|
|
@ -97,18 +97,21 @@ class Square extends Controller |
|
|
|
|
|
|
|
|
|
|
|
$model = new squarelikeModel; |
|
|
|
$model = new squarelikeModel; |
|
|
|
$detail = squarelikeModel::detail($id, (String)$useInfo['user_id']); |
|
|
|
$detail = squarelikeModel::detail($id, (String)$useInfo['user_id']); |
|
|
|
$data = $this->postData(); |
|
|
|
//$data = $this->postData(); |
|
|
|
$data['merchant_id'] = $this->merchantId; |
|
|
|
|
|
|
|
$data['user_name'] = $useInfo['user_id']; |
|
|
|
$data1 = []; |
|
|
|
$data['real_name'] = $useInfo['nick_name']; |
|
|
|
$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 (empty($detail)) { |
|
|
|
if ($model->add($data)) { |
|
|
|
if ($model->add($data1)) { |
|
|
|
$this->dynamicLikeNum($id); |
|
|
|
$this->dynamicLikeNum($id); |
|
|
|
return $this->renderSuccess('操作成功'); |
|
|
|
return $this->renderSuccess('操作成功'); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$data['squarelike_id'] = $detail['squarelike_id']; |
|
|
|
$data['squarelike_id'] = $detail['squarelike_id']; |
|
|
|
if ($detail->delete($data)) { |
|
|
|
if ($model->delete($data1)) { |
|
|
|
$this->dynamicLikeNum($id); |
|
|
|
$this->dynamicLikeNum($id); |
|
|
|
return $this->renderSuccess('操作成功'); |
|
|
|
return $this->renderSuccess('操作成功'); |
|
|
|
} |
|
|
|
} |
|
|
@ -121,9 +124,8 @@ class Square extends Controller |
|
|
|
$count = squarelikeModel::getCount($id); |
|
|
|
$count = squarelikeModel::getCount($id); |
|
|
|
$arr = [ |
|
|
|
$arr = [ |
|
|
|
'likeNum' => $count, |
|
|
|
'likeNum' => $count, |
|
|
|
'square_id' => $id |
|
|
|
//'square_id' => $id |
|
|
|
]; |
|
|
|
]; |
|
|
|
//print_r($arr); |
|
|
|
|
|
|
|
$detail->edit($arr); |
|
|
|
$detail->edit($arr); |
|
|
|
return $this->renderSuccess('操作成功'); |
|
|
|
return $this->renderSuccess('操作成功'); |
|
|
|
} |
|
|
|
} |
|
|
|