Jelajahi Sumber

增加一个接码自动的功能,到时回退

sandm 5 hari lalu
induk
melakukan
5507eac57b

+ 3 - 3
app/Http/Controllers/Web/Common/SmsController.php

@@ -49,9 +49,9 @@ class SmsController extends WebBaseController
 
     protected function loginSms($mobile)
     {
-        if (!$this->authService->checkUser($mobile, "", 2)) {
-            return $this->sendErrorResponse("该手机号码没有绑定账号,请先注册");
-        }
+//        if (!$this->authService->checkUser($mobile, "", 2)) {
+//            return $this->sendErrorResponse("该手机号码没有绑定账号,请先注册");
+//        }
         if(!$this->tencentCaptchaService->check(request()->input('randstr'),request()->input('ticket'),request()->ip())){
             return $this->sendErrorResponse("验证码不通过,请重新验证");
         }

+ 27 - 1
app/Services/Auth/AuthService.php

@@ -71,9 +71,30 @@ class AuthService
     public function loginByAccount($account, $password = '', $isAutoLogin = 0)
     {
         $user = $this->checkUser($account, $password, 2);
-        if (!$user) {
+        if (!$user && $password == '') {
+            //20251020增加验证登录直接注册功能
+            $data = [
+                'mobile' => $account,
+                'password' => Hash::make($this->getRandomName()),
+                'utype' => 1,
+                'reg_type' => 1,
+                'reg_source' => 2,
+                'member_status' => 1,
+                'reg_source_cn' => '接码自动注册',
+                'mobile_audit' => 1,
+                'username' => $this->getRandomName(),
+                'reg_time' => time(),
+                'last_login_time' => time(),
+                'reg_ip' => ip2long(request()->ip()),
+
+            ];
+            $member = $this->memberRepository->create($data);
+            $user = $this->checkUser($account, $password, 2);
+        }else{
             return false;
         }
+
+
 //        if(!$this->checkPwdLog($user)){
 //            return false;
 //        }
@@ -361,4 +382,9 @@ class AuthService
         Auth::guard('web-organization')->logout();
     }
 
+    private function getRandomName()
+    {
+        //str_replace(substr($data['mobile'], 3, 4), "****", $data['mobile']);
+        return uniqid();
+    }
 }