1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- namespace api\modules\v1\controllers;
- use common\models\Feedback;
- use yii\rest\ActiveController;
- use common\library\Apireturn;
- use yii\helpers\ArrayHelper;
- use yii\filters\auth\QueryParamAuth;
- use yii;
- class AdviceController extends ActiveController
- {
- const DISPLAY = 15;//显示条数
- public $modelClass = 'common\models';
- public function behaviors()
- {
- return ArrayHelper::merge(parent::behaviors(), [
- 'authenticator' => [
- 'class' => QueryParamAuth::className(),
- 'tokenParam' => "token",//access-token修改为token
- 'optional' => [//不需要认证方法名 array
- ],
- ]
- ]);
- }
- /**
- * 反馈意见
- * @return array
- */
- public function actionAdvice(){
- $advice =new Feedback();
- if( $advice->load(Yii::$app->request->post(),'') && $advice->save()){
- return Apireturn::sent(0,'意见保存成功',200);
- }
- return Apireturn::sent(1,'意见保存失败',200);
- }
- }
|