Commit 16d5bf94 authored by zhuwei's avatar zhuwei

是否被收藏

parent 6890e293
......@@ -60,6 +60,10 @@ class CollectUser extends Basic
$insert["agents_id"] = $params['agents_id'];
$insert["user_id"] = $params['user_id'];
$insert["status"] = 1;
$is_saved = $this->aCollectUser->getCollectUser('id',$insert);
if($is_saved){
return $this->response("200", "成功");
}
$res = $this->aCollectUser->saveCollectUser($insert);
}else{
//取消收藏
......
......@@ -267,13 +267,12 @@ class UserLogService
public function userDetailIsCollect($user_id, $agent_id)
{
$is_collect = 2;
//先判断是否已经存在数据
$field = 'id,status';
$get_params['agents_id'] = $agent_id;
$get_params['user_id'] = $user_id;
$collect_house = new ACollectUser();
$res = $collect_house->getCollectUser($field, $get_params);
if ($res && ($res[0]['status'] == 1)) {//如果存在
$insert["agents_id"] = $agent_id;
$insert["user_id"] = $user_id;
$insert["status"] = 1;
$is_saved = $collect_house->getCollectUser('id',$insert);
if($is_saved){
$is_collect = 1;
}
return $is_collect;
......
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