| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- namespace addons\HiGo\backend\controllers;
- use addons\HiGo\common\models\HigoHibeiLog;
- use addons\HiGo\common\models\HigoMall;
- use addons\HiGo\common\models\HigoWallet;
- use common\enums\StatusEnum;
- use Yii;
- /**
- * 默认控制器
- *
- * Class DataOverviewController
- * @package addons\HiGo\backend\controllers
- */
- class DataOverviewController extends BaseController
- {
- /**
- * 首页
- *
- * @return string
- */
- public function actionIndex()
- {
- if (Yii::$app->request->isAjax) {
- if (Yii::$app->request->isGet) {
- $hi_bei_data = HigoWallet::find()
- ->where(['mall_id' => $this->mall_id, 'status' => StatusEnum::ENABLED])
- ->andWhere(['>', 'hi_bei', 0])
- ->select('user_id, hi_bei')
- ->with([
- 'user' => function ($query) {
- $query->select('id,nickname,avatar_url');
- }
- ])
- ->limit(10)
- ->orderBy('hi_bei DESC')
- ->asArray()
- ->all();
- $hi_value_data = HigoWallet::find()
- ->where(['mall_id' => $this->mall_id, 'status' => StatusEnum::ENABLED])
- ->andWhere(['>', 'hi_value', 0])
- ->select('user_id, hi_value')
- ->with([
- 'user' => function ($query) {
- $query->select('id,nickname,avatar_url');
- }
- ])
- ->limit(10)
- ->orderBy('hi_value DESC')
- ->asArray()
- ->all();
- //嗨呗
- $total = HigoMall::getOne([['mall_id' => $this->mall_id], ['status' => StatusEnum::ENABLED]],true);
- $log = HigoHibeiLog::find()->where(['mall_id' => $this->mall_id,'from_type' => HigoHibeiLog::FROM_TYPE_AIRDROP,'status' => StatusEnum::ENABLED])->andWhere(['>','created_at',strtotime(date('Y-m-d'))])->one();
- $total['airdrops_today'] = $log['change_num'] ?? 0;
- $update_time = date('Y-m-d H:i:s');
- return $this->success('success', compact('hi_bei_data', 'hi_value_data','total', 'update_time'));
- }
- }
- return $this->render('index', []);
- }
- }
|