Commit a263c55c authored by hujun's avatar hujun

取消点赞数

parent bd35380f
...@@ -68,6 +68,25 @@ class Feed extends Basic ...@@ -68,6 +68,25 @@ class Feed extends Basic
return $this->response(200, ""); return $this->response(200, "");
} }
/**
* 取消点赞数
*
* @return \think\Response
* @throws \think\Exception
*/
public function editDecFeedClick() {
header('Access-Control-Allow-Origin:*');
$push = new PushFeed();
if (empty($this->params['id'])) {
return $this->$this->response(101, 'Id is null');
}
$push->editNum($this->params['id'], 'click_num', 2);
return $this->response(200, "");
}
/** /**
* feed 详情 * feed 详情
* *
......
...@@ -47,7 +47,8 @@ class Basic extends Controller ...@@ -47,7 +47,8 @@ class Basic extends Controller
'broker/forgetPwd', 'broker/forgetPwd',
'broker/getFeedInfo', 'broker/getFeedInfo',
'broker/feedList', 'broker/feedList',
'broker/editFeedClick' 'broker/editFeedClick',
'broker/editDecFeedClick'
); );
......
...@@ -22,8 +22,9 @@ class PushFeed extends BaseModel ...@@ -22,8 +22,9 @@ class PushFeed extends BaseModel
* @throws \think\Exception * @throws \think\Exception
*/ */
public function editNum($id, $field, $way = 1, $step = 1) { public function editNum($id, $field, $way = 1, $step = 1) {
$this->where('id',$id); $this->where('id',$id);
if ($way) { if ($way == 1) {
$result = $this->setInc($field, $step); $result = $this->setInc($field, $step);
} else { } else {
$result = $this->setDec($field, $step); $result = $this->setDec($field, $step);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment