Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
token
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wallet
token
Commits
0a94b8e7
Commit
0a94b8e7
authored
Jul 10, 2020
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
处理退回矿机空投数据
parent
d0aa41b8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
0 deletions
+76
-0
AirDropRefund.php
common/models/psources/AirDropRefund.php
+24
-0
AirDropController.php
wallet/controllers/AirDropController.php
+52
-0
No files found.
common/models/psources/AirDropRefund.php
0 → 100644
View file @
0a94b8e7
<?php
namespace
common\models\psources
;
use
Yii
;
use
yii\db\Expression
;
class
AirDropRefund
extends
CommonActiveRecord
{
//定义场景
const
SCENARIOS_CREATE
=
'create'
;
const
SCENARIOS_UPDATE
=
'update'
;
public
static
function
getDb
()
{
return
Yii
::
$app
->
get
(
'p_sources'
);
}
public
static
function
tableName
()
{
return
'{{%wallet_airdrop_refund}}'
;
}
}
\ No newline at end of file
wallet/controllers/AirDropController.php
View file @
0a94b8e7
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
namespace
wallet\controllers
;
namespace
wallet\controllers
;
use
common\models\psources\AirDropApplyRecord
;
use
common\models\psources\AirDropApplyRecord
;
use
common\models\psources\AirDropRefund
;
use
common\models\psources\AirDropRulePool
;
use
common\service\chain33\Chain33Service
;
use
common\service\chain33\Chain33Service
;
use
Yii
;
use
Yii
;
use
wallet\base\BaseController
;
use
wallet\base\BaseController
;
...
@@ -145,4 +147,53 @@ class AirDropController extends BaseController
...
@@ -145,4 +147,53 @@ class AirDropController extends BaseController
return
[
'code'
=>
$this
->
code
,
'msg'
=>
$this
->
msg
,
'data'
=>
$this
->
data
];
return
[
'code'
=>
$this
->
code
,
'msg'
=>
$this
->
msg
,
'data'
=>
$this
->
data
];
}
}
public
function
actionStop
()
{
$redis
=
Yii
::
$app
->
redis_app
;
$redis
->
del
(
'airdrop:1000000000000000'
);
exit
;
var_dump
(
$redis
->
hget
(
'airdrop'
,
1000000000000000
));
exit
;
var_dump
(
$redis
->
hdel
(
'airdrop:'
,
1000000000000000
));
exit
;
if
(
!
Yii
::
$app
->
request
->
isPost
)
{
$this
->
code
=
-
1
;
$this
->
msg
=
'错误的请求方式.'
;
goto
doEnd
;
}
$data
=
Yii
::
$app
->
request
->
post
();
$identifier
=
$data
[
'identifier'
]
??
null
;
if
(
empty
(
$identifier
))
{
goto
doEnd
;
}
$identifier
=
array_unique
(
$identifier
);
$model
=
AirDrop
::
find
()
->
select
(
'id,identifier,wallet_address,miner_address'
)
->
where
([
'in'
,
'identifier'
,
$identifier
])
->
asArray
()
->
all
();
if
(
empty
(
$model
))
{
goto
doEnd
;
}
$redis
=
Yii
::
$app
->
redis_app
;
$refund
=
new
AirDropRefund
();
foreach
(
$model
as
$val
)
{
$sum
=
AirDropApplyRecord
::
find
()
->
where
([
'apply_id'
=>
$val
[
'id'
]])
->
andWhere
([
'reach'
=>
AirDropApplyRecord
::
REACH_YES
])
->
andWhere
([
'draw_status'
=>
AirDropApplyRecord
::
STATUS_DRAW_SUEEESS
])
->
sum
(
'amount'
);
$refund
->
setIsNewRecord
(
true
);
$refund
->
identifier
=
$val
[
'identifier'
];
$refund
->
wallet_address
=
$val
[
'wallet_address'
];
$refund
->
miner_address
=
$val
[
'miner_address'
];
$refund
->
draw_amount
=
$sum
;
$refund
->
save
()
&&
$refund
->
id
=
0
;
AirDropRulePool
::
deleteAll
(
'identifier = :identifier'
,
[
':identifier'
=>
$val
[
'identifier'
]]);
AirDropApplyRecord
::
deleteAll
(
'apply_id = :apply_id'
,
[
':apply_id'
=>
$val
[
'id'
]]);
AirDrop
::
findOne
(
$val
[
'id'
])
->
delete
();
$redis
->
del
(
$val
[
'identifier'
]);
$redis
->
del
(
'airdrop:'
.
$val
[
'identifier'
]);
}
doEnd
:
return
[
'code'
=>
$this
->
code
,
'msg'
=>
$this
->
msg
,
'data'
=>
$this
->
data
];
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment