diff --git a/app/api/controller/Square.php b/app/api/controller/Square.php index a7e0b896..fc16048e 100644 --- a/app/api/controller/Square.php +++ b/app/api/controller/Square.php @@ -97,18 +97,21 @@ class Square extends Controller $model = new squarelikeModel; $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']; + //$data = $this->postData(); + + $data1 = []; + $data1['merchant_id'] = $this->merchantId; + $data1['user_name'] = $useInfo['user_id']; + $data1['square_id'] = $id; + $data1['real_name'] = $useInfo['nick_name']; if (empty($detail)) { - if ($model->add($data)) { + if ($model->add($data1)) { $this->dynamicLikeNum($id); return $this->renderSuccess('操作成功'); } } else { $data['squarelike_id'] = $detail['squarelike_id']; - if ($detail->delete($data)) { + if ($model->delete($data1)) { $this->dynamicLikeNum($id); return $this->renderSuccess('操作成功'); } @@ -121,9 +124,8 @@ class Square extends Controller $count = squarelikeModel::getCount($id); $arr = [ 'likeNum' => $count, - 'square_id' => $id + //'square_id' => $id ]; - //print_r($arr); $detail->edit($arr); return $this->renderSuccess('操作成功'); } diff --git a/app/api/model/Square.php b/app/api/model/Square.php index 48103018..57c8ae06 100644 --- a/app/api/model/Square.php +++ b/app/api/model/Square.php @@ -27,7 +27,7 @@ class Square extends \app\common\model\Square public function edit(array $data): bool { // 是否删除图片 - !isset($data['logo_image_id']) && $data['logo_image_id'] = 0; + //!isset($data['logo_image_id']) && $data['logo_image_id'] = 0; return $this->save($data) !== false; }