|
@@ -272,7 +272,21 @@ class Mall extends Base
|
|
|
* @param name:status type:int default:0 desc:收藏状态(0取消收藏【未收藏】,1收藏)
|
|
|
*/
|
|
|
public function goodsCollect(){
|
|
|
- $coll_status = UserCollect::plateCollect($this->user_id,6,input('post.id',0));
|
|
|
+ $data = input();
|
|
|
+ if($data['status'] == 0){
|
|
|
+ UserCollect::where('user_id',$this->user_id)->where('coll_type',6)->where('coll_id',$data['id'])->delete();
|
|
|
+ $coll_status = 0;
|
|
|
+ }else{
|
|
|
+ Data::save('UserCollect', [
|
|
|
+ 'user_id'=>$this->user_id,
|
|
|
+ 'coll_type'=>6,
|
|
|
+ 'coll_id'=>$data['id'],
|
|
|
+ 'children_id'=>0,
|
|
|
+ 'create_int'=>time()],'user_id',['user_id'=>$this->user_id,'coll_type'=>6, 'coll_id'=>$data['id'],'children_id'=>0]);
|
|
|
+ $coll_status = 1;
|
|
|
+ }
|
|
|
+
|
|
|
+// $coll_status = UserCollect::plateCollect($this->user_id,6,input('post.id',0));
|
|
|
$coll_status ? $this->success('收藏成功',['status'=>1]) : $this->success('取消收藏成功',['status'=>0]);
|
|
|
}
|
|
|
|