|
|
|
@ -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('操作成功'); |
|
|
|
|
} |
|
|
|
|