feature/main20240421
guojia 9 months ago
parent 753a1a1728
commit 0b1acccc32
  1. 15
      app/api/controller/Square.php

@ -35,11 +35,7 @@ class Square 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) {
@ -52,6 +48,8 @@ class Square extends Controller
$data = $this->postForm();
$data['merchant_id'] = $this->merchantId;
$data['user_name'] = $useInfo['user_id'];
$data['real_name'] = $useInfo['nick_name'];
if ((new squareModel)->add($data)) {
return $this->renderSuccess('添加成功');
}
@ -79,13 +77,10 @@ class Square extends Controller
public function dynamicLike(int $id): Json
{
if (!UserService::isStore()) {
throwError("无权限", 403);
}
$useInfo = UserService::getCurrentLoginUser(true);
$useInfo = UserService::getCurrentLoginUser(true)->toArray();
$model = new squarelikeModel;
$detail = squarelikeModel::detail($id, $useInfo['data']['user_name']);
$detail = squarelikeModel::detail($id, $useInfo['user_name']);
$data = $this->postForm();
if (empty($detail)) {
if ($model->add($data)) {

Loading…
Cancel
Save