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
b73937b9
Commit
b73937b9
authored
Sep 20, 2018
by
rlgy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
31eca27c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
14 deletions
+19
-14
CoinMidGuess.php
common/models/psources/CoinMidGuess.php
+13
-1
GuessController.php
h5/controllers/GuessController.php
+6
-12
JugdeAwardJob.php
h5/job/JugdeAwardJob.php
+0
-1
No files found.
common/models/psources/CoinMidGuess.php
View file @
b73937b9
...
...
@@ -13,7 +13,6 @@ namespace common\models\psources;
*
* @property int $id
* @property int $aid
* @property int $amount
* @property string $device_id
* @property string $address
* @property string $txhash
...
...
@@ -30,4 +29,16 @@ class CoinMidGuess extends BaseActiveRecord
{
return
self
::
findOne
([
'device_id'
=>
$device_id
,
'address'
=>
$address
]);
}
/**
* 获取记录条数
*
* @param string $device_id
* @param string $address
* @return int|string
*/
public
static
function
existsCount
(
$device_id
,
$address
)
{
return
self
::
find
()
->
where
([
'device_id'
=>
$device_id
,
'address'
=>
$address
])
->
count
();
}
}
\ No newline at end of file
h5/controllers/GuessController.php
View file @
b73937b9
...
...
@@ -44,8 +44,8 @@ class GuessController extends BaseController
$coin_activity
=
CoinActivity
::
isValiable
(
$activity
);
if
(
$coin_activity
)
{
$
new_user
=
CoinMidGuess
::
isExists
(
$deviceId
,
$address
);
if
(
$
new_user
&&
$new_user
->
am
ount
>=
3
)
{
$
count
=
CoinMidGuess
::
existsCount
(
$deviceId
,
$address
);
if
(
$
c
ount
>=
3
)
{
$response
->
build
(
-
1
,
'用户经参次数达到上限'
);
}
else
{
//打币,返回txhash
...
...
@@ -57,19 +57,13 @@ class GuessController extends BaseController
$amount
=
intval
(
$config
[
'amount'
]
*
1e8
);
$note
=
$guessNumber
.
' '
.
$address
;
$result
=
Chain33Business
::
transToken
(
$from
,
$to
,
$amount
,
$note
,
$isToken
,
$token
);
if
(
is_string
(
$result
)
)
{
if
(
true
)
{
//添加数据库记录
if
(
$new_user
)
{
$model
=
$new_user
;
}
else
{
$model
=
new
CoinMidGuess
();
$model
->
amount
=
0
;
}
$model
=
new
CoinMidGuess
();
$model
->
device_id
=
$deviceId
;
$model
->
address
=
$address
;
$model
->
txhash
=
$result
;
$model
->
aid
=
$coin_activity
->
id
;
$model
->
amount
+=
1
;
if
(
$model
->
save
())
{
$response
->
build
(
ResponseBuild
::
STATUS_SUCCEED
,
''
,
$result
);
}
...
...
@@ -101,9 +95,9 @@ class GuessController extends BaseController
return
$response
;
}
$info
=
CoinMidGuess
::
find
One
([
'address'
=>
$address
,
'aid'
=>
$coin_activity
->
id
]
);
$info
=
CoinMidGuess
::
find
()
->
where
([
'address'
=>
$address
,
'aid'
=>
$coin_activity
->
id
])
->
asArray
()
->
all
(
);
if
(
$info
)
{
$txhash
=
$info
->
txhash
;
$txhash
=
array_column
(
$info
,
'txhash'
)
;
$response
->
build
(
ResponseBuild
::
STATUS_SUCCEED
,
''
,
$txhash
);
}
else
{
$response
->
build
(
1
,
'记录不存在'
);
...
...
h5/job/JugdeAwardJob.php
View file @
b73937b9
...
...
@@ -39,7 +39,6 @@ class JugdeAwardJob extends BaseObject implements JobInterface
// $trans_normal = Chain33Business::getTxByAddrInRange($config['from_normal'], 2, 0, $guess_result->start_height, $guess_result->end_height);
$trans_normal
=
Chain33Business
::
getTxByAddrInRange
(
'14o9MHrrLfpsXf7wu4H4YRwvy84fjd7uaj'
,
2
,
0
,
710900
,
715345
);
$trans_new
=
Chain33Business
::
getTxByAddrInRange
(
$config
[
'to'
],
2
,
0
,
$guess_result
->
start_height
,
$guess_result
->
end_height
);
$trans
=
array_merge
(
$trans_normal
,
$trans_new
);
$txhashs
=
array_column
(
$trans
,
'hash'
);
$trans_info
=
Chain33Business
::
getTxByHashs
(
$txhashs
);
...
...
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