GrantLogController.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace addons\UserGift\backend\controllers;
  3. use addons\UserGift\common\enums\GiftEnum;
  4. use addons\UserGift\common\models\UserGiftGrantLog;
  5. use common\enums\AddonsEnum;
  6. use common\logic\common\Gift;
  7. use Yii;
  8. use common\controllers\AddonsController;
  9. /**
  10. * 发送明细控制器
  11. *
  12. * Class StatisticsController
  13. * @package addons\UserGift\backend\controllers
  14. */
  15. class GrantLogController extends AddonsController
  16. {
  17. /**
  18. * @var string
  19. */
  20. // public $layout = "@addons/UserGift/backend/views/layouts/main";
  21. public $enableCsrfValidation = false;
  22. /**
  23. * 发送列表
  24. * @Author: lun
  25. * @DateTime: 2021/12/20 0020 10:15
  26. * @Copyright: copyright (c) 2021 广东七件事集团
  27. * @return mixed|string|void
  28. */
  29. public function actionIndex()
  30. {
  31. if (Yii::$app->request->isAjax) {
  32. if (Yii::$app->request->isGet) {
  33. $params = Yii::$app->request->get();
  34. // 检查提交的参数
  35. $res = Yii::$app->services->validate->validate($params,[
  36. [['page', 'limit'], 'safe'],
  37. [['gift_type', 'title'], 'string'],
  38. [['user_id'], 'integer'],
  39. ]);
  40. if($res === false) return $this->error(Yii::$app->services->validate->getErrorMessage());
  41. $data = Gift::getGrantLogList($this->mall_id,AddonsEnum::ADDONS_NAME_USERGIFT, (new UserGiftGrantLog()), (new GiftEnum()), $params);
  42. $this->success('获取成功', $data);
  43. }
  44. } else {
  45. return $this->render($this->action->id);
  46. }
  47. }
  48. }