DefaultController.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace addons\SignIn\api\modules\v1\controllers;
  3. use addons\SignIn\common\models\UserSignInAwardRecord;
  4. use common\enums\StatusEnum;
  5. use Yii;
  6. use api\controllers\OnAuthController;
  7. /**
  8. * 默认控制器
  9. *
  10. * Class DefaultController
  11. * @package addons\SignIn\api\modules\v1\controllers
  12. */
  13. class DefaultController extends OnAuthController
  14. {
  15. public $modelClass = '';
  16. /**
  17. * 不用进行登录验证的方法
  18. *
  19. * 例如: ['index', 'update', 'create', 'view', 'delete']
  20. * 默认全部需要验证
  21. *
  22. * @var array
  23. */
  24. protected $authOptional = ['index'];
  25. /**
  26. * 首页
  27. *
  28. * @return string
  29. */
  30. public function actionIndex()
  31. {
  32. return 'Hello world';
  33. }
  34. public function actionAwardLog()
  35. {
  36. if (Yii::$app->request->isGet) {
  37. $data = Yii::$app->request->get();
  38. $where[] = ['=','user_id',$this->user_id];
  39. $where[] = ['=','mall_id',$this->mall_id];
  40. $where[] = ['=','status',StatusEnum::ENABLED];
  41. $params['where'] = $where;
  42. $params['order'] = 'id desc';
  43. $params['limit'] = $data['limit'];
  44. //$params['with'] = ['user'];
  45. $list = UserSignInAwardRecord::listPage($params, false, true);
  46. }
  47. return $this->success('操作成功', $list);
  48. }
  49. }