Commit 33e4ace6 authored by shajiaiming's avatar shajiaiming

fix

parent cda4552e
......@@ -52,8 +52,6 @@ class AirDropController extends BaseController
$apply_record_model->update_time = $val;
$apply_record_model->save() && $apply_record_model->id = 0;;
}
$transaction->commit();
} catch (Exception $e) {
$transaction->rollback();
......@@ -65,6 +63,9 @@ class AirDropController extends BaseController
if (empty($this->msg)) {
$this->msg = 'Validation failed.';
}
$redis = Yii::$app->redis_app;
$redis->hmset('airdrop:' . $data['identifier'], 'draw_success', 0, 'income', 0, 'reach_time', 0);
goto doEnd;
}
......
......@@ -13,6 +13,38 @@ use common\models\psources\AirDropApplyTransferRecord;
class AirDropController extends Controller
{
/**
* 统计每个树莓派达标次数,已领取,未领取
* @return
*/
public function actionStatistics()
{
$expiry_date = date("Y-m-d 00:00:00", strtotime("+1 day"));
$apply = AirDrop::find()->select('id, identifier, finish_time')->where(['<', 'create_time', $expiry_date])->asArray()->all();
if (empty($apply) || empty($apply->record)) {
return 0;
}
foreach ($apply as $val) {
$reach = AirDropApplyRecord::find()
->where(['apply_id' => $val['id'], 'reach' => AirDropApplyRecord::REACH_YES])
->sum('reach');
$reach = empty($reach) ? 0 : $reach;
$draw = AirDropApplyRecord::find()
->where(['apply_id' => $val['id'], 'draw_status' => AirDropApplyRecord::STATUS_DRAW_SUEEESS])
->sum('reach');
$draw = empty($draw) ? 0 : $draw;
$reach = AirDropApplyRecord::find()
->where(['apply_id' => $val['id'], 'reach' => AirDropApplyRecord::REACH_YES])
->sum('reach');
$reach = empty($reach) ? 0 : $reach;
}
return 0;
}
/**
* 获取矿工地址的对应的冷钱包地址
* @return
*/
......
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