|
|
@@ -5,7 +5,7 @@
|
|
5
|
5
|
* @author xaboy<xaboy2005@qq.com>
|
|
6
|
6
|
* @day 2020/5/28
|
|
7
|
7
|
*
|
|
8
|
|
- *
|
|
|
8
|
+ *
|
|
9
|
9
|
*/
|
|
10
|
10
|
|
|
11
|
11
|
namespace app\controller\api\user;
|
|
|
@@ -15,13 +15,13 @@ use app\common\repositories\user\FeedbackRepository;
|
|
15
|
15
|
use app\validate\api\FeedbackValidate;
|
|
16
|
16
|
use think\App;
|
|
17
|
17
|
|
|
18
|
|
-class Feedback extends BaseController
|
|
|
18
|
+class Feedback
|
|
19
|
19
|
{
|
|
20
|
20
|
protected $repository;
|
|
21
|
21
|
|
|
22
|
22
|
public function __construct(App $app, FeedbackRepository $repository)
|
|
23
|
23
|
{
|
|
24
|
|
- parent::__construct($app);
|
|
|
24
|
+ // parent::__construct($app);
|
|
25
|
25
|
$this->repository = $repository;
|
|
26
|
26
|
}
|
|
27
|
27
|
|
|
|
@@ -34,13 +34,13 @@ class Feedback extends BaseController
|
|
34
|
34
|
*/
|
|
35
|
35
|
public function feedback(FeedbackValidate $validate)
|
|
36
|
36
|
{
|
|
37
|
|
- $data = $this->request->params(['type', 'content', 'images', 'realname', 'contact']);
|
|
38
|
|
- if (!is_array($data["images"])){
|
|
39
|
|
- $data["images"]=explode(",", $data["images"]);
|
|
|
37
|
+ $data = request()->params(['type', 'content', 'images', 'realname', 'contact']);
|
|
|
38
|
+ if (!is_array($data["images"])) {
|
|
|
39
|
+ $data["images"] = explode(",", $data["images"]);
|
|
40
|
40
|
|
|
41
|
41
|
}
|
|
42
|
42
|
$validate->check($data);
|
|
43
|
|
- $data['uid'] = $this->request->uid();
|
|
|
43
|
+ $data['uid'] = request()->uid();
|
|
44
|
44
|
$this->repository->create($data);
|
|
45
|
45
|
return app('json')->success('反馈成功');
|
|
46
|
46
|
}
|
|
|
@@ -53,14 +53,35 @@ class Feedback extends BaseController
|
|
53
|
53
|
public function feedbackList()
|
|
54
|
54
|
{
|
|
55
|
55
|
[$page, $limit] = $this->getPage();
|
|
56
|
|
- return app('json')->success($this->repository->getList(['uid' => $this->request->uid(),'is_del' => 0], $page, $limit));
|
|
|
56
|
+ return app('json')->success($this->repository->getList(['uid' => request()->uid(), 'is_del' => 0], $page, $limit));
|
|
57
|
57
|
}
|
|
58
|
58
|
|
|
59
|
59
|
public function detail($id)
|
|
60
|
60
|
{
|
|
61
|
|
- if (!$this->repository->uidExists($id, $this->request->uid()))
|
|
|
61
|
+ if (!$this->repository->uidExists($id, request()->uid()))
|
|
62
|
62
|
return app('json')->fail('数据不存在');
|
|
63
|
63
|
$feedback = $this->repository->get($id);
|
|
64
|
64
|
return app('json')->success($feedback);
|
|
65
|
65
|
}
|
|
|
66
|
+
|
|
|
67
|
+ /**
|
|
|
68
|
+ * @return void
|
|
|
69
|
+ * @author 史晨
|
|
|
70
|
+ * @date 2026/3/17 14:07
|
|
|
71
|
+ * 用户回复反馈
|
|
|
72
|
+ */
|
|
|
73
|
+ public function reply()
|
|
|
74
|
+ {
|
|
|
75
|
+ $data = request()->params(['feedback_id', 'content']);
|
|
|
76
|
+ if (empty($data['feedback_id']) || empty($data['content'])) {
|
|
|
77
|
+ return app('json')->fail('参数错误');
|
|
|
78
|
+ }
|
|
|
79
|
+
|
|
|
80
|
+ $res = $this->repository->reply($data['feedback_id'], request()->uid(), $data['content']);
|
|
|
81
|
+
|
|
|
82
|
+ if (!$res) {
|
|
|
83
|
+ return app('json')->fail('回复失败');
|
|
|
84
|
+ }
|
|
|
85
|
+ return app('json')->success('回复成功');
|
|
|
86
|
+ }
|
|
66
|
87
|
}
|