Commit 044b73a5 authored by shajiaiming's avatar shajiaiming

Merge branch 'feature/airdrop' into develop

parents 3921d6da 06d400ff
......@@ -80,7 +80,7 @@ class AirDropController extends BaseController
$apply_id_arr = explode(',', $apply_ids);
$query->andWhere(['in', 'id', $apply_id_arr]);
}
$expiry_date = date("Y-m-d", strtotime("+1 day"));
$expiry_date = date("Y-m-d");
$query->andWhere(['<', 'create_time', $expiry_date]);
$items = $query->offset(($page - 1) * $size)->orderBy('id desc')->limit($size)->all();
......@@ -207,6 +207,49 @@ class AirDropController extends BaseController
return ['code' => $this->code, 'msg' => $this->msg, 'data' => $this->data];
}
public function actionRule()
{
$data = Yii::$app->request->get();
$identifier = $data['identifier'] ?? null;
$miner_address = $data['miner_address'] ?? null;
if (false == $identifier || false == $miner_address) {
$this->code = -1;
$this->msg = 'Validation failed.';
goto doEnd;
}
$exist = AirDropRulePool::find()->where(['identifier' => $identifier])->one();
if (false == $exist || false == $exist->rule) {
$this->code = -1;
$this->msg = 'Validation failed.';
goto doEnd;
}
$token = $exist->rule->token;
$amount = $exist->rule->amount;
$apply = AirDrop::find()->select('id')->where(['identifier' => $identifier, 'miner_address' => $miner_address])->asArray()->one();
if (empty($apply)) {
$this->code = -1;
$this->msg = 'Validation failed.';
goto doEnd;
}
$record = AirDropApplyRecord::find()->select('create_time')->where(['apply_id' => $apply['id']])->orderBy('id')->asArray()->all();
if (empty($record)) {
$begin_time = '?';
$over_time = '?';
} else {
$create_time_arr = array_column($record, 'create_time');
$begin_time = current($create_time_arr);
$over_time = end($create_time_arr);
}
$this->data = [
'token' => $token,
'amount' => $amount,
'begin_time' => $begin_time,
'over_time' => $over_time
];
doEnd :
return ['code' => $this->code, 'msg' => $this->msg, 'data' => $this->data];
}
public function actionGameTrade()
{
$coins_address = Yii::$app->request->post('coins_address', '');
......
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