5 测试测试

最佳答案 2017-11-15 10:00



public function addFollow(){
$follow_obj = D('Follow');
if(empty($_POST['m_id']) || empty($_POST['g_id'])){
apiResponse('error','您未登录或商品ID为空!');
}
$where['m_id'] = I('post.m_id');
$where['g_id'] = I('post.g_id');
//判断是否关注过
$follow = $follow_obj->findFollow($where);
if($follow){
apiResponse('error','您已经关注过该商品!');
}else{
$data['m_id'] = I('post.m_id');
$data['g_id'] = I('post.g_id');
$data['ctime'] = time();
if($data){
//商品关注量加一
$this->good_obj->where(array('g_id'=>I('post.g_id')))->setInc('follow_volume');
$add_res = $follow_obj->addFollow($data);
if($add_res){
apiResponse('success','关注成功!');
}else{
apiResponse('error','关注失败!');
}
}
}
}
请先 登录 后评论

其它 0 个回答

  • 1 关注
  • 0 收藏,3187 浏览
  • 测试测试 提出于 2017-11-07 10:49

相似问题