Browse Source

all route access log

zhangdehua 9 months ago
parent
commit
23d26025f8

+ 0 - 17
app/index/controller/Captcha.php

@@ -64,14 +64,6 @@ class Captcha extends Controller
     {
         $data = $this->postForm();
         $email = $data['mobile'] ?? '';
-        UserAccessLog::doSave([
-            'user_id' => 0,
-            'path' => $this->request->action(),
-            'remark' => $email,
-            'ip' => $this->request->ip(),
-            'store_id' => $this->getStoreId(),
-            'create_time' => time()
-        ]);
 
         if (empty($email) || !is_email($email)) {
             return $this->renderError('Invalid email address.');
@@ -130,15 +122,6 @@ class Captcha extends Controller
             return $this->renderError('Invalid email address.');
         }
 
-        UserAccessLog::doSave([
-            'user_id' => 0,
-            'path' => $this->request->action(),
-            'remark' => $email,
-            'ip' => $this->request->ip(),
-            'store_id' => $this->getStoreId(),
-            'create_time' => time()
-        ]);
-
         $smtp = new MailCaptchaService();
         $flag = $smtp->sendCaptcha($email);
         if ($flag) {

+ 20 - 0
app/index/controller/Controller.php

@@ -12,6 +12,7 @@ declare (strict_types=1);
 
 namespace app\index\controller;
 
+use app\index\model\user\UserAccessLog;
 use think\facade\Log;
 use think\facade\Session;
 use think\response\Json;
@@ -44,6 +45,25 @@ class Controller extends BaseController
         // 验证当前客户端状态
         $this->checkClient();
         $contrName =  $this->request->controller();
+        $actionName = $this->request->action();
+        $remark = '';
+        if ($actionName == 'productDetails'){
+            $remark = json_encode($this->request->param());
+        }
+
+        if ($actionName == 'sendEmailCaptcha'){
+            $remark = json_encode($this->postForm());
+        }
+
+        UserAccessLog::doSave([
+            'user_id' => 0,
+            'path' => $actionName,
+            'remark' => $remark,
+            'ip' => $this->request->ip(),
+            'store_id' => $this->getStoreId(),
+            'create_time' => time()
+        ]);
+
        if (strtolower($contrName) == 'cart'){
            $userId = Session::get('user_id');
            if (empty($userId)){

+ 0 - 17
app/index/controller/Index.php

@@ -24,15 +24,6 @@ class Index extends Controller
 {
     public function index()
     {
-        //Log::notice($this->request->ip());
-        UserAccessLog::doSave([
-            'user_id' => 0,
-            'path' => $this->request->action(),
-            'remark' => '',
-            'ip' => $this->request->ip(),
-            'store_id' => $this->getStoreId(),
-            'create_time' => time()
-        ]);
         //banner位
         $newArrivalCache = Cache::get('index_newArrival');
         $bestsellerCache = Cache::get('index_bestseller');
@@ -192,14 +183,6 @@ class Index extends Controller
 
     public function vapePoints(): View
     {
-        UserAccessLog::doSave([
-            'user_id' => 0,
-            'path' => $this->request->action(),
-            'remark' => '',
-            'ip' => $this->request->ip(),
-            'store_id' => $this->getStoreId(),
-            'create_time' => time()
-        ]);
         return view('vapePoints');
     }
 

+ 0 - 18
app/index/controller/Passport.php

@@ -39,15 +39,6 @@ class Passport extends Controller
     public function login()
     {
         if ($this->request->method() == 'GET') {
-            UserAccessLog::doSave([
-                'user_id' => 0,
-                'path' => $this->request->action(),
-                'remark' => '',
-                'ip' => $this->request->ip(),
-                'store_id' => $this->getStoreId(),
-                'create_time' => time()
-            ]);
-
             $userId = UserService::getCurrentLoginUserId();
             if ($userId){
                 return redirect('/index/index/index.html#goodsPosition');
@@ -78,15 +69,6 @@ class Passport extends Controller
     public function register()
     {
         $form = $this->postForm();
-        UserAccessLog::doSave([
-            'user_id' => 0,
-            'path' => $this->request->action(),
-            'remark' => json_encode($form),
-            'ip' => $this->request->ip(),
-            'store_id' => $this->getStoreId(),
-            'create_time' => time()
-        ]);
-
         // 执行登录
         $LoginService = new LoginService;
         if (!$LoginService->toRegister($form)) {

+ 1 - 1
app/index/view/passport/logIn.html

@@ -262,7 +262,7 @@
             const dp = {
                 form: {
                     mobile: email,
-                    smsCode: "hjhjhj",
+                    smsCode: "",
                     isParty: false,
                     partyData: []
                 }