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
9c88496b
Commit
9c88496b
authored
Dec 25, 2018
by
ZhuChunYang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改解冻BUG
parent
4316ab75
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
5 deletions
+14
-5
CoinReleaseMemberController.php
backend/controllers/CoinReleaseMemberController.php
+4
-2
FreezeJob.php
backend/jobs/FreezeJob.php
+9
-2
DevController.php
console/controllers/DevController.php
+1
-1
No files found.
backend/controllers/CoinReleaseMemberController.php
View file @
9c88496b
...
...
@@ -59,8 +59,8 @@ class CoinReleaseMemberController extends BaseController
$post
[
'rule_id'
]
=
$rule_id
;
$coin_publish_rule
=
CoinPublishRule
::
findOne
(
$rule_id
);
if
(
$coin_publish_rule
)
{
$post
[
'release'
]
=
1e8
*
$post
[
'amount'
]
*
(
100
-
$coin_publish_rule
->
lock
)
/
100
;
$post
[
'freeze'
]
=
1e8
*
$post
[
'amount'
]
*
$coin_publish_rule
->
lock
/
100
;
$post
[
'release'
]
=
$post
[
'amount'
]
*
(
100
-
$coin_publish_rule
->
lock
)
/
100
;
$post
[
'freeze'
]
=
$post
[
'amount'
]
*
$coin_publish_rule
->
lock
/
100
;
$post
[
'company_name'
]
=
$coin_publish_rule
->
company_name
;
}
else
{
return
[
'code'
=>
-
1
,
'msg'
=>
'规则不存在'
];
...
...
@@ -77,6 +77,8 @@ class CoinReleaseMemberController extends BaseController
}
if
(
$model
->
load
(
$post
)
&&
$model
->
validate
())
{
$model
->
amount
=
$model
->
amount
*
1e8
;
$model
->
freeze
=
$model
->
freeze
*
1e8
;
$model
->
release
=
$model
->
release
*
1e8
;
if
(
$model
->
save
(
false
))
{
return
[
'code'
=>
0
,
'msg'
=>
'添加成功'
];
}
...
...
backend/jobs/FreezeJob.php
View file @
9c88496b
...
...
@@ -8,6 +8,7 @@
namespace
backend\jobs
;
use
common\base\Exception
;
use
common\models\psources\CoinPublish
;
use
common\models\psources\CoinPublishRule
;
use
common\models\psources\CoinReleaseList
;
...
...
@@ -40,6 +41,7 @@ class FreezeJob extends BaseObject implements JobInterface
$coin_publish_rule
=
CoinPublishRule
::
findOne
(
$this
->
id
);
if
(
!
$coin_publish_rule
)
{
// 计划任务已经被删除
echo
$this
->
id
.
'计划任务已删除'
.
PHP_EOL
;
return
0
;
}
$coin_publish
=
CoinPublish
::
findOne
(
$coin_publish_rule
->
pid
);
...
...
@@ -59,8 +61,8 @@ class FreezeJob extends BaseObject implements JobInterface
$value
[
'change'
]
=
$change
;
}
unset
(
$key
,
$value
);
foreach
(
$members
as
$key
=>
$value
)
{
try
{
$trans
=
CoinPublish
::
getDb
()
->
beginTransaction
();
$models
=
CoinReleaseMember
::
findOne
(
$value
[
'id'
]);
$models
->
release
=
$value
[
'release'
];
...
...
@@ -74,11 +76,16 @@ class FreezeJob extends BaseObject implements JobInterface
$list
->
status
=
1
;
$list
->
from
=
$address
;
$list
->
mid
=
$value
[
'id'
];
if
(
$models
->
save
()
&&
$list
->
save
(
))
{
if
(
$models
->
save
(
false
)
&&
$list
->
save
(
false
))
{
$trans
->
commit
();
}
echo
date
(
'Y-m-d H:i:s'
)
.
': 释放币成功 [Coin_release_member_id]: '
.
$value
[
'id'
]
.
PHP_EOL
;
}
catch
(
\Exception
$e
){
$trans
->
rollBack
();
Yii
::
info
(
'释放币失败, [Coin_release_member_id]: '
.
$value
[
'id'
],
__CLASS__
);
echo
date
(
'Y-m-d H:i:s'
)
.
': 释放币失败:'
.
$e
->
getMessage
()
.
PHP_EOL
;
}
}
// 执行下一次任务
...
...
console/controllers/DevController.php
View file @
9c88496b
...
...
@@ -35,7 +35,7 @@ class DevController extends Controller
*/
public
function
actionFreeze1
()
{
$qid
=
Yii
::
$app
->
queue
->
push
(
new
FreezeJob
([
'id'
=>
45
]));
$qid
=
Yii
::
$app
->
queue
->
push
(
new
FreezeJob
([
'id'
=>
67
]));
var_dump
(
$qid
);
}
...
...
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