DefaultController.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. namespace addons\ShortVideo\api\modules\v1\controllers;
  3. use addons\ShortVideo\common\models\ShortVideo;
  4. use addons\ShortVideo\common\models\ShortVideoConfig;
  5. class DefaultController extends BaseController
  6. {
  7. public $modelClass = '';
  8. /**
  9. * 不用进行登录验证的方法
  10. *
  11. * 例如: ['index', 'update', 'create', 'view', 'delete']
  12. * 默认全部需要验证
  13. *
  14. * @var array
  15. */
  16. protected $authOptional = ['index'];
  17. /**
  18. * 首页
  19. *
  20. * @return string
  21. */
  22. public function actionIndex()
  23. {
  24. return 'Hello world';
  25. }
  26. public function actionGetConfig()
  27. {
  28. if (!\Yii::$app->request->isGet) {
  29. return $this->error('请求方式错误');
  30. }
  31. $configs = ShortVideoConfig::getConfig($this->mall_id);
  32. // dd($configs);
  33. return $this->success('success', $configs);
  34. }
  35. /**
  36. * @name:
  37. * @msg: 当前会员是否可以发布视频
  38. * @param {*}
  39. * @return {*}
  40. */
  41. public function actionIsCanPublish()
  42. {
  43. if (!\Yii::$app->request->isGet) {
  44. return $this->error('请求方式错误');
  45. }
  46. $res = ShortVideo::userCanPush($this->mall_id, $this->user_id);
  47. return $this->success('success', $res);
  48. }
  49. }