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
5d0a1df3
Commit
5d0a1df3
authored
May 18, 2020
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
领取情况
parent
f32fa687
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
4 deletions
+46
-4
AirDropController.php
api/controllers/AirDropController.php
+36
-2
AirDropController.php
console/controllers/AirDropController.php
+10
-2
No files found.
api/controllers/AirDropController.php
View file @
5d0a1df3
...
...
@@ -66,8 +66,6 @@ class AirDropController extends BaseController
goto
doEnd
;
}
$model
=
AirDrop
::
find
()
->
select
(
'id'
)
->
where
([
'identifier'
=>
$identifier
,
'miner_address'
=>
$miner_address
])
->
one
();
$total
=
0
;
$items
=
[];
if
(
empty
(
$model
)
||
empty
(
$model
->
record
))
{
goto
doEnd
;
}
...
...
@@ -125,6 +123,42 @@ class AirDropController extends BaseController
return
[
'code'
=>
$this
->
code
,
'msg'
=>
$this
->
msg
,
'data'
=>
(
int
)
$this
->
data
];
}
/**
* 空投领取情况
* @param identifier 树莓派编号
* @param miner_address 矿工地址
* @return array
*/
public
function
actionInfo
()
{
if
(
Yii
::
$app
->
request
->
isPost
)
{
$this
->
code
=
-
1
;
$this
->
msg
=
'请求方式错误!'
;
goto
doEnd
;
}
$data
=
Yii
::
$app
->
request
->
get
();
$identifier
=
$data
[
'identifier'
]
??
null
;
if
(
false
==
$identifier
)
{
$this
->
code
=
-
1
;
$this
->
msg
=
'Validation failed.'
;
goto
doEnd
;
}
$redis
=
Yii
::
$app
->
redis_app
;
list
(
$reach
,
$reached_times
,
$draw_success
,
$income
,
$un_draw
)
=
$redis
->
hmget
(
'airdrop:'
.
$identifier
,
'reach'
,
'reached_times'
,
'draw_success'
,
'income'
,
'un_draw'
);
$this
->
data
=
[
'reach'
=>
empty
(
$reach
)
?
0
:
(
int
)
$reach
,
'reached_times'
=>
empty
(
$reached_times
)
?
0
:
(
int
)
$reached_times
,
'draw_success'
=>
empty
(
$draw_success
)
?
0
:
(
int
)
$draw_success
,
'income'
=>
empty
(
$income
)
?
0
:
(
int
)
$reach
,
'un_draw'
=>
empty
(
$un_draw
)
?
0
:
(
int
)
$un_draw
,
];
doEnd
:
return
[
'code'
=>
$this
->
code
,
'msg'
=>
$this
->
msg
,
'data'
=>
$this
->
data
];
}
public
function
actionBatchDraw
()
{
$this
->
code
=
-
1
;
...
...
console/controllers/AirDropController.php
View file @
5d0a1df3
...
...
@@ -32,6 +32,7 @@ class AirDropController extends Controller
go
(
function
()
use
(
$val
,
$redis
,
$expiry_date
)
{
\Co
::
sleep
(
0.5
);
if
(
!
empty
(
$val
->
record
))
{
//达标次数
$reach
=
AirDropApplyRecord
::
find
()
->
where
([
'apply_id'
=>
$val
[
'id'
],
'reach'
=>
AirDropApplyRecord
::
REACH_YES
])
...
...
@@ -39,7 +40,14 @@ class AirDropController extends Controller
->
sum
(
'reach'
);
$reach
=
empty
(
$reach
)
?
0
:
(
int
)
$reach
;
//已领取
//已领取次数
$reached_times
=
AirDropApplyRecord
::
find
()
->
where
([
'apply_id'
=>
$val
[
'id'
],
'draw_status'
=>
AirDropApplyRecord
::
STATUS_DRAW_SUEEESS
])
->
andWhere
([
'<'
,
'create_time'
,
$expiry_date
])
->
count
();
$reached_times
=
empty
(
$reached_times
)
?
0
:
(
int
)
$reached_times
;
//已领取空投总量
$draw_success
=
AirDropApplyRecord
::
find
()
->
where
([
'apply_id'
=>
$val
[
'id'
],
'draw_status'
=>
AirDropApplyRecord
::
STATUS_DRAW_SUEEESS
])
->
andWhere
([
'<'
,
'create_time'
,
$expiry_date
])
...
...
@@ -56,7 +64,7 @@ class AirDropController extends Controller
//未领取
$un_draw
=
$income
-
$draw_success
;
$redis
->
hmset
(
'airdrop:'
.
$val
->
identifier
,
'reach'
,
$reach
,
'draw_success'
,
$draw_success
,
'income'
,
$income
,
'un_draw'
,
$un_draw
);
$redis
->
hmset
(
'airdrop:'
.
$val
->
identifier
,
'reach'
,
$reach
,
'
reached_times'
,
$reached_times
,
'
draw_success'
,
$draw_success
,
'income'
,
$income
,
'un_draw'
,
$un_draw
);
}
});
}
...
...
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