Explorar o código

APP小程序-浏览记录-(beta)商品浏览记录保存
后台-用户操作记录-查询返回

xupuyuan hai 11 meses
pai
achega
2e9d2ea89b

+ 11 - 0
app/controller/admin/user/User.php

@@ -1979,4 +1979,15 @@ class User extends BaseController
1979 1979
             ->toArray();
1980 1980
         return app('json')->success('查询成功', $userData);
1981 1981
     }
1982
+    /**
1983
+     * 获取用户操作记录
1984
+     */
1985
+    public function getUseropeatingrecord(){
1986
+        $records = Db::name('user_operating_record')
1987
+            ->order('create_time DESC') // 按创建时间倒序,可根据需求改
1988
+            ->select()
1989
+            ->toArray();
1990
+        return app('json')->success($records, '获取成功');
1991
+    }
1992
+
1982 1993
 }

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

@@ -227,6 +227,8 @@ class Jd extends BaseController
227 227
             $formatList[] = $json;
228 228
         }
229 229
         shuffle($formatList);
230
+        $uid = $uid ?? 0;
231
+        app('app\controller\api\User')->sproductkeywordHistory($uid, $keyword, 2);
230 232
         return app("json")->success($formatList);
231 233
     }
232 234
 

+ 2 - 0
app/controller/api/store/product/Su.php

@@ -285,6 +285,8 @@ class Su extends BaseController
285 285
 
286 286
             }
287 287
         }
288
+        $uid = $uid ?? 0;
289
+        app('app\controller\api\User')->sproductkeywordHistory($uid, $keyword, 3);
288 290
         return app('json')->success('获取苏宁商品列表成功', $goodslist);
289 291
     }
290 292
 

+ 2 - 0
app/controller/api/store/product/TaoKe.php

@@ -278,6 +278,8 @@ class TaoKe extends BaseController
278 278
         }
279 279
         
280 280
         shuffle($goodsList);
281
+        $uid = $uid ?? 0;
282
+        app('app\controller\api\User')->sproductkeywordHistory($uid, $keyword, 3);
281 283
         return app('json')->success('获取拼多多商品列表成功', $goodsList);
282 284
     }
283 285
 

+ 2 - 0
app/controller/api/store/product/Vip.php

@@ -340,6 +340,8 @@ class Vip extends BaseController
340 340
                 $goodslist[] = $json;
341 341
             }
342 342
         }
343
+        $uid = $uid ?? 0;
344
+        app('app\controller\api\User')->sproductkeywordHistory($uid, $keyword, 3);
343 345
         return app('json')->success('获取唯品会商品列表成功', $goodslist);
344 346
     }
345 347
 

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

@@ -877,6 +877,20 @@ class User extends BaseController
877 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
      * 签到  获取积分

+ 2 - 0
route/admin.php

@@ -403,6 +403,8 @@ Route::group(config('admin.api_admin_prefix') . '/', function () {
403 403
             Route::post('getImAdmin', '/getImAdmin')->name('getImAdmin');
404 404
 
405 405
             Route::get('enterpriseUserScoreApi', '/enterpriseUserScoreApi')->name('enterpriseUserScoreApi');
406
+            //获取用户操作记录
407
+            Route::get('admin/user/records', 'admin.User/getUserOperatingRecords')->name('getUserOperatingRecords');
406 408
 
407 409
 
408 410