Commit ce6d3276 authored by shajiaiming's avatar shajiaiming

fix

parent 5464fec7
...@@ -63,6 +63,8 @@ class AirDropController extends BaseController ...@@ -63,6 +63,8 @@ class AirDropController extends BaseController
$apply_id_arr = explode(',', $apply_ids); $apply_id_arr = explode(',', $apply_ids);
$query->andWhere(['in', 'id', $apply_id_arr]); $query->andWhere(['in', 'id', $apply_id_arr]);
} }
$expiry_date = date("Y-m-d", time()) . " 00:00:00";
$query->andWhere(['<', 'create_time', $expiry_date]);
$items = $query->offset(($page - 1) * $size)->orderBy('id desc')->limit($size)->all(); $items = $query->offset(($page - 1) * $size)->orderBy('id desc')->limit($size)->all();
$countQuery = clone $query; $countQuery = clone $query;
...@@ -71,7 +73,6 @@ class AirDropController extends BaseController ...@@ -71,7 +73,6 @@ class AirDropController extends BaseController
$this->data = [ $this->data = [
'items' => $items, 'items' => $items,
'total' => $total, 'total' => $total,
'income' => 134
]; ];
} }
...@@ -79,6 +80,34 @@ class AirDropController extends BaseController ...@@ -79,6 +80,34 @@ class AirDropController extends BaseController
return ['code' => $this->code, 'msg' => $this->msg, 'data' => $this->data]; return ['code' => $this->code, 'msg' => $this->msg, 'data' => $this->data];
} }
public function actionIncome()
{
$this->data = 0;
$data = Yii::$app->request->get();
$identifier = $data['identifier'] ?? '';
$miner_address = $data['miner_address'] ?? '';
if (false == $identifier || false == $miner_address) {
$this->code = -1;
$this->msg = 'Validation failed.';
goto doEnd;
}
$model = AirDrop::find()->select('id')->where(['identifier' => $identifier, 'miner_address' => $miner_address])->one();
if (empty($model) || empty($model->record)) {
goto doEnd;
}
$this->data = AirDropApplyRecord::find()
->where(['apply_id' => $model['id'], 'reach' => AirDropApplyRecord::REACH_YES])
->sum('bonus_token');
if (empty($this->data)) {
$this->data = 0;
goto doEnd;
}
doEnd :
return ['code' => $this->code, 'msg' => $this->msg, 'data' => $this->data];
}
public function actionBatchDraw() public function actionBatchDraw()
{ {
if (!Yii::$app->request->isPost) { if (!Yii::$app->request->isPost) {
......
...@@ -60,7 +60,7 @@ class AirDropController extends Controller ...@@ -60,7 +60,7 @@ class AirDropController extends Controller
if (empty($record)) return 0; if (empty($record)) return 0;
$service = new Chain33Service(); $service = new Chain33Service();
$execer = 'coins'; $execer = 'ticket';
foreach ($record as $val) { foreach ($record as $val) {
go(function () use ($val, $service, $execer) { go(function () use ($val, $service, $execer) {
\Co::sleep(0.5); \Co::sleep(0.5);
......
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