feature/main20240421
郭嘉 7 months ago
parent 264fd4c2bf
commit e0d9d1daf0
  1. 12
      app/api/controller/Square.php

@ -76,7 +76,7 @@ class Square extends Controller
$like = $modelLike->where(['user_name' => $r['user_name']])->where(['square_id' => $r['square_id']])->find()->toArray();
$res[$kr]['imgs'] = [];
$res[$kr]['isLike'] = !empty($like) ? true : false;
$list['data'][$kr]['isLike'] = !empty($like) ? true : false;
$res[$kr]['avatar_url'] = [];
if ($r['imgs']) {
$img_ids = explode(",", $r['imgs']);
@ -96,8 +96,11 @@ class Square extends Controller
$useInfo = UserService::getCurrentLoginUser(true)->toArray();
$model = new squarelikeModel;
$detail = squarelikeModel::detail($id, $useInfo['user_id']);
$data = $this->postForm();
$detail = squarelikeModel::detail($id, (String)$useInfo['user_id']);
$data = $this->postData();
$data['merchant_id'] = $this->merchantId;
$data['user_name'] = $useInfo['user_id'];
$data['real_name'] = $useInfo['nick_name'];
if (empty($detail)) {
if ($model->add($data)) {
$this->dynamicLikeNum($id);
@ -120,8 +123,9 @@ class Square extends Controller
'likeNum' => $count,
'square_id' => $id
];
//print_r($arr);
$detail->edit($arr);
return $this->renderSuccess('操作成功');
}
}

Loading…
Cancel
Save