cxfoot/modules/api/controllers/FeedbackController.php
2023-10-24 14:54:18 +08:00

93 lines
3.2 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* @author Any
* @description KISS
* @date 2021年6月30日
* @version 1.0.0
*
* _____LOG_____
*
*/
namespace app\modules\api\controllers;
use app\modules\api\behaviors\LoginBehavior;
use app\components\SiteHelper;
use app\components\SysConst;
use app\models\common\CommonFeedbackListForm;
use app\models\common\CommonFeedbackSubmitForm;
use app\models\Feedback;
class FeedbackController extends Controller
{
public function behaviors() {
return array_merge(parent::behaviors(),[
'login' => [
'class' => LoginBehavior::className(),
'ignore' => [
]
]
]);
}
/**
* hidedoc
* @catalog 帮助反馈/反馈列表
* @title 反馈列表
* @description 本接口提供反馈列表
* @method get
* @url /api/feedback/index
* @param keywords 非必选 string 关键词
* @param page 必选 int 页码
* @param limit 非必选 int 每页记录数
* @return {"code":0,"msg":"ok","data":[{"nickname":"admin","avatar_url":"http://app.tpl.dev.1nww.com/statics/images/avatar.jpg","cat_name":"界面问题","id":"3","cat_id":"4","contact":"18889895656","content":"反馈内容","pic_list":["http://app.tpl.dev.1nww.com/statics/images/uploader.jpg"],"created_at":"1625044828","review_user_id":"0","review_status":"0","review_time":"0","review_comment":"","created_at_cn":"2021-06-30 17:20:28","review_time_cn":"1970-01-01 08:00:00","review_status_cn":"待处理","review_user_nickname":"匿名"}],"count":"1","page_size":20,"page_count":1,"page_no":1,"end_flag":false}
* @return_param count int 记录条数
* @return_param page_size int 每页记录数
* @return_param page_count int 总页数
* @return_param page_no int 当前页码
* @return_param end_flag bool 是否加载结束
* @remark
*/
public function actionIndex()
{
$form = new CommonFeedbackListForm();
$form->attributes = \Yii::$app->request->get();
$form->cx_mch_id = $this->cx_mch_id;
$form->user_id = \Yii::$app->user->identity->id;
$data = $form->search();
return $this->responseHandler($data);
}
/**
* hidedoc
* @catalog 帮助反馈/反馈列表
* @title 提交反馈
* @description 本接口提供提交反馈
* @method post
* @url /api/feedback/submit
* @param cat_id 必选 int 反馈类型无分类为0
* @param contact 必选 string 联系方式QQ或手机号
* @param content 必选 string 反馈内容
* @param pic_list 必选 string 反馈图片[url,url]JSON数据格式
* @return
* @return_param param param_type param_desc
* @remark
*/
public function actionSubmit()
{
$form = new CommonFeedbackSubmitForm();
if(\Yii::$app->request->isPost){
$form->scenario = 'submit';
$form->attributes = \Yii::$app->request->post();
$form->cx_mch_id = $this->cx_mch_id;
$form->user_id = \Yii::$app->user->identity->id;
$data = $form->save();
return $this->responseHandler($data);
}
$form->cx_mch_id = $this->cx_mch_id;
$data = $form->search();
return $this->responseHandler($data);
}
}