| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?php
- namespace app\api\controller;
- use app\api\logic\IssueWorkLogic;
- use app\api\validate\IssueWorkValidate;
- use app\common\model\dict\DictData;
- /**
- *
- * Class IssueWorkController
- * @package app\api\controller
- */
- class IssueWorkController extends BaseApiController
- {
- /**
- * @notes 投诉列表
- * @return \think\response\Json
- * @author likeadmin
- * @date 2024/07/10 15:06
- */
- public function lists()
- {
- $params['user_id'] = $this->userId;
- $result = IssueWorkLogic::lists($params);
- return $this->data($result);
- }
- /**
- * 获取投诉分类
- * @return \think\response\Json
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- public function getIssueWorkType()
- {
- $list = DictData::where(['type_value'=>'complaint_type','status'=>1])->field('value,name')->select()->toArray();
- return $this->data($list);
- }
- /**
- * 新增投诉
- * @return \think\response\Json
- */
- public function complaint()
- {
- $params = (new IssueWorkValidate())->post()->goCheck('add', [
- 'user_id' => $this->userId,
- 'user_info' => $this->userInfo
- ]);
- $result = IssueWorkLogic::add($params);
- if (false === $result) {
- return $this->fail(IssueWorkLogic::getError());
- }
- return $this->success('投诉成功', ['id'=>$result], 1, 1);
- }
- public function complaintInfo()
- {
- $params = (new IssueWorkValidate())->goCheck('detail', [
- 'user_id' => $this->userId,
- ]);
- $result = IssueWorkLogic::detail($params);
- return $this->data($result);
- }
- }
|