作者 潘浩文
1 个管道 的构建 通过 耗费 0 秒

1

... ... @@ -157,9 +157,10 @@ class BrandController extends WeChatBaseController
}
//点赞ajax接口
public function like(){
$re=$this->checkUser();
$param=$this->request->param();
$like=new LikeService();
return $like->like($param['id'],1,session('wechat_user')['users_id']);
return $like->like($param['id'],1,$re['id']);
}
... ...
... ... @@ -343,10 +343,27 @@
})
//点赞
$(".discuss").click(function(){
window.event.stopPropagation();
var num=$(".commentnum").html();
num++;
$(".commentnum").html(num)
$.ajax({
url: "{:url('portal/brand/like')}",
type: "post",
data: {
id:"{$list.id}",
},
success: function (data) {
if (data==1){
window.event.stopPropagation();
var num=$(".commentnum").html();
num++;
$(".commentnum").html(num)
}
else if (data==2){
window.event.stopPropagation();
var num=$(".commentnum").html();
num--;
$(".commentnum").html(num)
}
}
})
})
</script>
</body>
... ...