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