Преглед изворни кода

AP小程序-浏览记录-(未完成)浏览记录保存

xupuyuan пре 11 месеци
родитељ
комит
2e90f501e6

+ 14 - 0
app/common/repositories/user/UserRepository.php

@@ -4493,5 +4493,19 @@ class UserRepository extends BaseRepository
4493
             'operation_time' => date('Y-m-d H:i:s')
4493
             'operation_time' => date('Y-m-d H:i:s')
4494
         ]);
4494
         ]);
4495
     }
4495
     }
4496
+    /**
4497
+     * 保存用户搜索商品关键字
4498
+     * @param $uid
4499
+     * @param $keyword
4500
+     * @param $type
4501
+     * @return void
4502
+     */
4503
+    public function sproductkeywordHistory($uid, $keyword, $type){
4504
+        Db::name('third_history')->insert([
4505
+            'uid' => $uid,
4506
+            'keyword' => $keyword,
4507
+            'type' => $type,
4508
+        ]);
4509
+    }
4496
 
4510
 
4497
 }
4511
 }

+ 3 - 2
app/controller/api/store/product/Jd.php

@@ -13,6 +13,7 @@ use think\Exception;
13
 use think\exception\ValidateException;
13
 use think\exception\ValidateException;
14
 use think\facade\Db;
14
 use think\facade\Db;
15
 use think\facade\Log;
15
 use think\facade\Log;
16
+use app\common\repositories\user\UserRepository;
16
 
17
 
17
 class Jd extends BaseController
18
 class Jd extends BaseController
18
 {
19
 {
@@ -155,7 +156,7 @@ class Jd extends BaseController
155
     }
156
     }
156
 
157
 
157
     /*京粉精选商品查询接口*/
158
     /*京粉精选商品查询接口*/
158
-    public function jdList()
159
+    public function jdList(UserRepository $repository)
159
     {
160
     {
160
         $keyword = request()->param('keyword', '');
161
         $keyword = request()->param('keyword', '');
161
         $_cid = request()->param('cid', '');
162
         $_cid = request()->param('cid', '');
@@ -228,7 +229,7 @@ class Jd extends BaseController
228
         }
229
         }
229
         shuffle($formatList);
230
         shuffle($formatList);
230
         $uid = $uid ?? 0;
231
         $uid = $uid ?? 0;
231
-        app('app\controller\api\User')->sproductkeywordHistory($uid, $keyword, 2);
232
+        $repository->sproductkeywordHistory($uid, 1, 1, '用户同意用户协议记录');
232
         return app("json")->success($formatList);
233
         return app("json")->success($formatList);
233
     }
234
     }
234
 
235
 

+ 1 - 14
app/controller/api/user/User.php

@@ -877,20 +877,7 @@ class User extends BaseController
877
             return app('json')->fail('删除失败');
877
             return app('json')->fail('删除失败');
878
         }
878
         }
879
     }
879
     }
880
-    /**
881
-     * 保存用户搜索商品关键字
882
-     * @param $uid
883
-     * @param $keyword
884
-     * @param $type
885
-     * @return void
886
-     */
887
-    public function sproductkeywordHistory($uid, $keyword, $type){
888
-        Db::name('third_history')->insert([
889
-            'uid' => $uid,
890
-            'keyword' => $keyword,
891
-            'type' => $type,
892
-        ]);
893
-    }
880
+
894
 
881
 
895
     /**
882
     /**
896
      * 签到  获取积分
883
      * 签到  获取积分