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;
...
@@ -13,7 +13,6 @@ namespace common\models\psources;
*
*
* @property int $id
* @property int $id
* @property int $aid
* @property int $aid
* @property int $amount
* @property string $device_id
* @property string $device_id
* @property string $address
* @property string $address
* @property string $txhash
* @property string $txhash
...
@@ -30,4 +29,16 @@ class CoinMidGuess extends BaseActiveRecord
...
@@ -30,4 +29,16 @@ class CoinMidGuess extends BaseActiveRecord
{
{
return
self
::
findOne
([
'device_id'
=>
$device_id
,
'address'
=>
$address
]);
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
...
@@ -44,8 +44,8 @@ class GuessController extends BaseController
$coin_activity
=
CoinActivity
::
isValiable
(
$activity
);
$coin_activity
=
CoinActivity
::
isValiable
(
$activity
);
if
(
$coin_activity
)
{
if
(
$coin_activity
)
{
$
new_user
=
CoinMidGuess
::
isExists
(
$deviceId
,
$address
);
$
count
=
CoinMidGuess
::
existsCount
(
$deviceId
,
$address
);
if
(
$
new_user
&&
$new_user
->
am
ount
>=
3
)
{
if
(
$
c
ount
>=
3
)
{
$response
->
build
(
-
1
,
'用户经参次数达到上限'
);
$response
->
build
(
-
1
,
'用户经参次数达到上限'
);
}
else
{
}
else
{
//打币,返回txhash
//打币,返回txhash
...
@@ -57,19 +57,13 @@ class GuessController extends BaseController
...
@@ -57,19 +57,13 @@ class GuessController extends BaseController
$amount
=
intval
(
$config
[
'amount'
]
*
1e8
);
$amount
=
intval
(
$config
[
'amount'
]
*
1e8
);
$note
=
$guessNumber
.
' '
.
$address
;
$note
=
$guessNumber
.
' '
.
$address
;
$result
=
Chain33Business
::
transToken
(
$from
,
$to
,
$amount
,
$note
,
$isToken
,
$token
);
$result
=
Chain33Business
::
transToken
(
$from
,
$to
,
$amount
,
$note
,
$isToken
,
$token
);
if
(
is_string
(
$result
)
)
{
if
(
true
)
{
//添加数据库记录
//添加数据库记录
if
(
$new_user
)
{
$model
=
new
CoinMidGuess
();
$model
=
$new_user
;
}
else
{
$model
=
new
CoinMidGuess
();
$model
->
amount
=
0
;
}
$model
->
device_id
=
$deviceId
;
$model
->
device_id
=
$deviceId
;
$model
->
address
=
$address
;
$model
->
address
=
$address
;
$model
->
txhash
=
$result
;
$model
->
txhash
=
$result
;
$model
->
aid
=
$coin_activity
->
id
;
$model
->
aid
=
$coin_activity
->
id
;
$model
->
amount
+=
1
;
if
(
$model
->
save
())
{
if
(
$model
->
save
())
{
$response
->
build
(
ResponseBuild
::
STATUS_SUCCEED
,
''
,
$result
);
$response
->
build
(
ResponseBuild
::
STATUS_SUCCEED
,
''
,
$result
);
}
}
...
@@ -101,9 +95,9 @@ class GuessController extends BaseController
...
@@ -101,9 +95,9 @@ class GuessController extends BaseController
return
$response
;
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
)
{
if
(
$info
)
{
$txhash
=
$info
->
txhash
;
$txhash
=
array_column
(
$info
,
'txhash'
)
;
$response
->
build
(
ResponseBuild
::
STATUS_SUCCEED
,
''
,
$txhash
);
$response
->
build
(
ResponseBuild
::
STATUS_SUCCEED
,
''
,
$txhash
);
}
else
{
}
else
{
$response
->
build
(
1
,
'记录不存在'
);
$response
->
build
(
1
,
'记录不存在'
);
...
...
h5/job/JugdeAwardJob.php
View file @
b73937b9
...
@@ -39,7 +39,6 @@ class JugdeAwardJob extends BaseObject implements JobInterface
...
@@ -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($config['from_normal'], 2, 0, $guess_result->start_height, $guess_result->end_height);
$trans_normal
=
Chain33Business
::
getTxByAddrInRange
(
'14o9MHrrLfpsXf7wu4H4YRwvy84fjd7uaj'
,
2
,
0
,
710900
,
715345
);
$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_new
=
Chain33Business
::
getTxByAddrInRange
(
$config
[
'to'
],
2
,
0
,
$guess_result
->
start_height
,
$guess_result
->
end_height
);
$trans
=
array_merge
(
$trans_normal
,
$trans_new
);
$trans
=
array_merge
(
$trans_normal
,
$trans_new
);
$txhashs
=
array_column
(
$trans
,
'hash'
);
$txhashs
=
array_column
(
$trans
,
'hash'
);
$trans_info
=
Chain33Business
::
getTxByHashs
(
$txhashs
);
$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