|
|
|
@ -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) { |
|
|
|
|