From 0d9998edbab893735fe243b51b87a3d54896c08a Mon Sep 17 00:00:00 2001 From: guojia <445241500@qq.com> Date: Wed, 8 May 2024 23:19:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=84=8F=E8=A7=81=E5=8F=8D=E9=A6=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/Feedback.php | 15 ++++++++------- app/api/controller/Square.php | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/api/controller/Feedback.php b/app/api/controller/Feedback.php index 17399938..dae7cecb 100644 --- a/app/api/controller/Feedback.php +++ b/app/api/controller/Feedback.php @@ -34,11 +34,7 @@ class Feedback extends Controller */ public function add(): Json { - if (!UserService::isStore()) { - throwError("无权限", 403); - } - - $useInfo = UserService::getCurrentLoginUser(true); + $useInfo = UserService::getCurrentLoginUser(true)->toArray(); $content = $this->request->post('content'); if (!$content) { @@ -49,9 +45,11 @@ class Feedback extends Controller return $this->renderError('分类不能为空'); } - $data = $this->postForm(); + $data = $this->postData(); $data['merchant_id'] = $this->merchantId; - if ((new squareModel)->add($data)) { + $data['user_name'] = $useInfo['user_id']; + $data['real_name'] = $useInfo['nick_name']; + if ((new feedbackModel)->add($data)) { return $this->renderSuccess('添加成功'); } return $this->renderError('添加失败'); @@ -62,9 +60,12 @@ class Feedback extends Controller * 列表 */ public function list(): Json { + $useInfo = UserService::getCurrentLoginUser(true)->toArray(); + $model = new feedbackModel; $params = $this->request->param(); + $params['userName'] = $useInfo['user_id']; $list = $model->getList($params)->toArray(); foreach ($list['data'] as $kr => $r) { diff --git a/app/api/controller/Square.php b/app/api/controller/Square.php index a59bce96..5866ca70 100644 --- a/app/api/controller/Square.php +++ b/app/api/controller/Square.php @@ -70,7 +70,7 @@ class Square extends Controller foreach ($list['data'] as $kr => $r) { $model = new UserModel(); - $user = $model->where(['user_id' => $r['user_name']])->get()->toArray(); + $user = $model->where(['user_id' => $r['user_name']])->find()->toArray(); $res[$kr]['imgs'] = []; $res[$kr]['avatar_url'] = []; if ($r['imgs']) {