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']) {