chuweiqiang 1 anno fa
parent
commit
676b06051b
2 ha cambiato i file con 18 aggiunte e 3 eliminazioni
  1. 3 2
      .idea/workspace.xml
  2. 15 1
      application/api/controller/Mall.php

+ 3 - 2
.idea/workspace.xml

@@ -2,7 +2,8 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="1a36929e-c054-4875-a943-593a74e55fa4" name="Default Changelist" comment="">
-      <change beforePath="$PROJECT_DIR$/application/api/controller/Datum.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/api/controller/Datum.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/application/api/controller/Mall.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/api/controller/Mall.php" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -579,7 +580,7 @@
       <workItem from="1711672177712" duration="21603000" />
       <workItem from="1711758657673" duration="11105000" />
       <workItem from="1711935199010" duration="23200000" />
-      <workItem from="1712104344631" duration="1704000" />
+      <workItem from="1712104344631" duration="2236000" />
     </task>
     <servers />
   </component>

+ 15 - 1
application/api/controller/Mall.php

@@ -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]);
     }