| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- namespace addons\UserGift\backend\controllers;
- use addons\UserGift\common\enums\GiftEnum;
- use addons\UserGift\common\models\UserGiftRule;
- use addons\UserGift\common\models\UserGiftStatistics;
- use common\enums\AddonsEnum;
- use common\enums\StatusEnum;
- use common\logic\common\Gift;
- use Yii;
- use common\controllers\AddonsController;
- /**
- * 规则统计控制器
- *
- * Class StatisticsController
- * @package addons\UserGift\backend\controllers
- */
- class StatisticsController extends AddonsController
- {
- /**
- * @var string
- */
- // public $layout = "@addons/UserGift/backend/views/layouts/main";
- public $enableCsrfValidation = false;
- /**
- * 统计列表
- * @Author: lun
- * @DateTime: 2021/12/20 0020 10:15
- * @Copyright: copyright (c) 2021 广东七件事集团
- * @return mixed|string|void
- */
- public function actionIndex()
- {
- if (Yii::$app->request->isAjax) {
- if (Yii::$app->request->isGet) {
- $params = Yii::$app->request->get();
- // 检查提交的参数
- $res = Yii::$app->services->validate->validate($params,[
- [['page', 'limit'], 'safe'],
- [['gift_type', 'title'], 'string'],
- ]);
- if($res === false) return $this->error(Yii::$app->services->validate->getErrorMessage());
- $data = Gift::getStatisticsList($this->mall_id, AddonsEnum::ADDONS_NAME_USERGIFT, (new UserGiftStatistics()), (new GiftEnum()), $params);
- $this->success('获取成功', $data);
- }
- } else {
- return $this->render($this->action->id);
- }
- }
- }
|