Commit d106e732 authored by shajiaiming's avatar shajiaiming

发币脚本

parent 5a390ac1
<?php
namespace console\controllers;
use common\models\psources\CoinIssueCoin;
use Yii;
use yii\console\Controller;
class IssueCoinController extends Controller
{
public function actionAutoIssue()
{
$manual_review = Yii::$app->redis->get('issue_chain_manual_review');
if (false == $manual_review || 'open' == $manual_review) {
return 0;
}
$issue_coin_model = CoinIssueCoin::find()
->select('name, symbol, introduction, total, charge, category, owner')
->where(['status' => CoinIssueCoin::UN_AUDIT])->asArray()->all();
echo json_encode($issue_coin_model);exit;
if (false == $issue_coin_model) {
echo date('Y-m-d H:i:s') . '暂无需要发行任务' . PHP_EOL;
return 0;
}
foreach ($issue_coin_model as $key => $issue_coin) {
go(function () use ($issue_coin) {
\Co::sleep(0.5);
});
}
return 0;
}
}
\ No newline at end of file
......@@ -44,4 +44,23 @@ class IssueChainController extends BaseController
}
public function actionManageReview()
{
$data = null;
$platform_id = Yii::$app->request->getPlatformId();
$manual_review = \Yii::$app->request->post('manual_review', '');
if (!in_array($manual_review, ['open', 'close'])) {
$msg = '参数错误';
$code = -1;
goto doEnd;
}
Yii::$app->redis->set('issue_chain_manual_review', $manual_review);
$code = 0;
$msg = 'success';
doEnd :
return ['code' => $code, 'msg' => $msg];
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment