| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <?php
- namespace addons\Scratch\api\modules\v1\controllers;
- use addons\Scratch\api\modules\v1\services\DefaultService;
- use addons\Scratch\common\models\ScratchModel;
- use addons\Distribution\common\enums\DistributionEnum;
- use common\enums\StatusEnum;
- use common\models\common\CapitalLog;
- use common\models\order\OrderDetail;
- use Yii;
- use api\controllers\OnAuthController;
- /**
- * 默认控制器
- *
- * Class DefaultController
- * @package addons\Scratch\api\modules\v1\controllers
- */
- class DefaultController extends OnAuthController
- {
- public $modelClass = '';
- public $from_type = ['Scratch'];
- /**
- * 不用进行登录验证的方法
- *
- * 例如: ['index', 'update', 'create', 'view', 'delete']
- * 默认全部需要验证
- *
- * @var array
- */
- protected $authOptional = ['index'];
- /**
- * 首页
- *
- * @return string
- */
- public function actionIndex()
- {
- return 'Scratch,Hello world!!!!!';
- }
- /**
- * @return mixed|void
- */
- public function actionInfo()
- {
- try {
- if(!\Yii::$app->request->isGet){
- throw new \ErrorException('NOT IS GET!');
- }
- $this->success('ok', DefaultService::getInfo(
- $this->mall_id,
- $this->user
- ));
- }catch (\ErrorException $errorException){
- $this->error($errorException->getMessage());
- }catch (\Exception $exception){
- $this->error($exception->getMessage());
- }
- }
- /**
- *
- */
- public function actionLogList()
- {
- try {
- if(!\Yii::$app->request->isGet){
- throw new \ErrorException('NOT IS GET!');
- }
- $page = \Yii::$app->request->get('page', 1);
- $limit = \Yii::$app->request->get('limit', 10);
- $capitalType = \Yii::$app->request->get('capital_type', '');
- $this->success('ok', DefaultService::getLogList(
- $this->mall_id,
- $this->user,
- $this->from_type,
- $capitalType,
- $page,
- $limit
- ));
- }catch (\ErrorException $errorException){
- $this->error($errorException->getMessage());
- }catch (\Exception $exception){
- $this->error($exception->getMessage());
- }
- }
- }
|