作者 anyv
1 个管道 的构建 通过 耗费 0 秒

78

... ... @@ -44,6 +44,23 @@ class GoodsdetailsController extends WeChatBaseController{
}
/**
* 点击收藏
*/
public function goods_collection(){
$goods_id = $_POST['goods_id'];
$uid = cmf_get_current_user_id();
$arr['goods_id'] = $goods_id;
$arr['uid'] = $uid;
$data = Db::name('collect') -> insert($arr);
if($data){
return true;
}else{
return false;
}
}
... ...
... ... @@ -141,9 +141,13 @@
*点击收藏
*/
function goods_collection(id){
alert(id);
$.post("{:url('Goodsdetails/goods_collection')}",{goods_id:id},function(data){
if(data){
alert('收藏成功');
}else{
alert('收藏失败');
}
});
}
</script>
</body>
... ...