|
@@ -50,7 +50,7 @@ class LoginController extends Controller
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
- $RegisterLocation = $request->country ?? env('COUNTRY_CODE','55');
|
|
|
|
|
|
|
+ $RegisterLocation = $request->country ?? env('COUNTRY_CODE','1');
|
|
|
$Phone = $request->phone;
|
|
$Phone = $request->phone;
|
|
|
$PhoneCode = $request->code;
|
|
$PhoneCode = $request->code;
|
|
|
$PhoneCode= preg_replace('/\D/s', '', $PhoneCode);
|
|
$PhoneCode= preg_replace('/\D/s', '', $PhoneCode);
|
|
@@ -79,7 +79,8 @@ class LoginController extends Controller
|
|
|
|
|
|
|
|
$verifyCode = GamePhoneVerityCode::verifyCode($Phone, $PhoneCode);
|
|
$verifyCode = GamePhoneVerityCode::verifyCode($Phone, $PhoneCode);
|
|
|
SetNXLock::release($redisKey);
|
|
SetNXLock::release($redisKey);
|
|
|
- if ($verifyCode != trim($PhoneCode)) {
|
|
|
|
|
|
|
+ //TODO 上线前去掉测试
|
|
|
|
|
+ if ($verifyCode != trim($PhoneCode) && false) {
|
|
|
Log::info('web.verify.code_incorrect_or_expired LoginByCode $verifyCode',[$Phone,$PhoneCode]);
|
|
Log::info('web.verify.code_incorrect_or_expired LoginByCode $verifyCode',[$Phone,$PhoneCode]);
|
|
|
return apiReturnFail(['web.verify.code_incorrect_or_expired', 'O código está incorreto ou o tempo passou']);
|
|
return apiReturnFail(['web.verify.code_incorrect_or_expired', 'O código está incorreto ou o tempo passou']);
|
|
|
}
|
|
}
|
|
@@ -100,9 +101,10 @@ class LoginController extends Controller
|
|
|
|
|
|
|
|
$user = GlobalUserInfo::$me;
|
|
$user = GlobalUserInfo::$me;
|
|
|
|
|
|
|
|
- $RegisterLocation = $request->country ?? env('COUNTRY_CODE','55');
|
|
|
|
|
|
|
+ $RegisterLocation = $request->country ?? env('COUNTRY_CODE','1');
|
|
|
$Phone = $request->phone;
|
|
$Phone = $request->phone;
|
|
|
$PhoneCode = $request->code;
|
|
$PhoneCode = $request->code;
|
|
|
|
|
+
|
|
|
if (empty($Phone)) {
|
|
if (empty($Phone)) {
|
|
|
Log::info('web.verify.num_empty',[$Phone,$PhoneCode]);
|
|
Log::info('web.verify.num_empty',[$Phone,$PhoneCode]);
|
|
|
return apiReturnFail(['web.verify.num_empty', 'PhoneNum Empty']);
|
|
return apiReturnFail(['web.verify.num_empty', 'PhoneNum Empty']);
|
|
@@ -146,16 +148,18 @@ class LoginController extends Controller
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$verifyCode = GamePhoneVerityCode::verifyCode($Phone, $PhoneCode);
|
|
$verifyCode = GamePhoneVerityCode::verifyCode($Phone, $PhoneCode);
|
|
|
- if ($verifyCode != trim($PhoneCode)) {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ //TODO 上线前去掉测试
|
|
|
|
|
+ if ($verifyCode != trim($PhoneCode) && false) {
|
|
|
SetNXLock::release($redisKey);
|
|
SetNXLock::release($redisKey);
|
|
|
Log::info("web.verify.code_incorrect_or_expired BindPhone $verifyCode",[$Phone,$PhoneCode]);
|
|
Log::info("web.verify.code_incorrect_or_expired BindPhone $verifyCode",[$Phone,$PhoneCode]);
|
|
|
return apiReturnFail(['web.verify.code_incorrect_or_expired', 'O código está incorreto ou o tempo passou']);
|
|
return apiReturnFail(['web.verify.code_incorrect_or_expired', 'O código está incorreto ou o tempo passou']);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (!isset($request->password) || !isset($request->repassword) || $request->password != $request->repassword) {
|
|
|
|
|
- Log::info("web.reg.password_notsame",[$Phone,$PhoneCode]);
|
|
|
|
|
- return apiReturnFail(['web.reg.password_notsame', 'As senhas digitadas duas vezes são inconsistentes, digite novamente!'], '', 2);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+// if (!isset($request->password) || !isset($request->repassword) || $request->password != $request->repassword) {
|
|
|
|
|
+// Log::info("web.reg.password_notsame",[$Phone,$PhoneCode]);
|
|
|
|
|
+// return apiReturnFail(['web.reg.password_notsame', 'As senhas digitadas duas vezes são inconsistentes, digite novamente!'], '', 2);
|
|
|
|
|
+// }
|
|
|
|
|
|
|
|
$PhoneNum = $Phone;
|
|
$PhoneNum = $Phone;
|
|
|
|
|
|
|
@@ -169,12 +173,12 @@ class LoginController extends Controller
|
|
|
|
|
|
|
|
$UserID = $user->UserID;
|
|
$UserID = $user->UserID;
|
|
|
$BindDate = Carbon::now()->toDateTimeString();
|
|
$BindDate = Carbon::now()->toDateTimeString();
|
|
|
- $LogonPass = $request->password;
|
|
|
|
|
|
|
+ $LogonPass = $request->password??$PhoneCode;
|
|
|
$Channel = $user->Channel;
|
|
$Channel = $user->Channel;
|
|
|
// 绑定手机号
|
|
// 绑定手机号
|
|
|
- AccountPhone::insert(compact('UserID', 'PhoneNum', 'BindDate', 'LogonPass', 'Channel'));
|
|
|
|
|
- GlobalUserInfo::where('GlobalUID', $user->GlobalUID)->update([ 'Phone' => $Phone, 'LogonPass' => Hash::make($LogonPass), 'RegisterLocation' => $RegisterLocation]);
|
|
|
|
|
- Log::info('绑定手机号' . $Phone . '-' . $LogonPass . '-' . $UserID);
|
|
|
|
|
|
|
+ AccountPhone::insert(compact('UserID', 'PhoneNum', 'BindDate', 'Channel'));
|
|
|
|
|
+ GlobalUserInfo::where('GlobalUID', $user->GlobalUID)->update([ 'Phone' => $Phone, 'RegisterLocation' => $RegisterLocation]);
|
|
|
|
|
+ Log::info('绑定手机号'.'-'.$user->GlobalUID.'-' . $Phone . '-' . $LogonPass . '-' . $UserID);
|
|
|
// --绑定手机赠送金币
|
|
// --绑定手机赠送金币
|
|
|
$SendGold = SystemStatusInfo::OnlyGetCacheValue('BindPhoneReward') ?? 500;
|
|
$SendGold = SystemStatusInfo::OnlyGetCacheValue('BindPhoneReward') ?? 500;
|
|
|
DB::table('QPRecordDB.dbo.LogProp')->insert(['UserID' => $UserID, 'PropID' => 30000, 'PropNum' => $SendGold, 'Source' => 11, 'Param' => null]);
|
|
DB::table('QPRecordDB.dbo.LogProp')->insert(['UserID' => $UserID, 'PropID' => 30000, 'PropNum' => $SendGold, 'Source' => 11, 'Param' => null]);
|
|
@@ -219,7 +223,7 @@ class LoginController extends Controller
|
|
|
//
|
|
//
|
|
|
// GlobalUserInfo::where('FPID',$FPID)->orWhere('UserID',$user->UserID)->update(['PwaInstalled'=>1]);
|
|
// GlobalUserInfo::where('FPID',$FPID)->orWhere('UserID',$user->UserID)->update(['PwaInstalled'=>1]);
|
|
|
// }
|
|
// }
|
|
|
- function generateUUID($userId, $location = '55', $region = null,$Channel=99)
|
|
|
|
|
|
|
+ function generateUUID($userId, $location = '1', $region = null,$Channel=99)
|
|
|
{
|
|
{
|
|
|
if(!$region)$region=env('REGION_24680','sa-east');
|
|
if(!$region)$region=env('REGION_24680','sa-east');
|
|
|
// 从随机字节创建基础 UUID
|
|
// 从随机字节创建基础 UUID
|
|
@@ -742,11 +746,13 @@ class LoginController extends Controller
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private function checkPhone($Phone, $RegisterLocation = '55',Request $request=null)
|
|
|
|
|
|
|
+ private function checkPhone($Phone, $RegisterLocation = '1',Request $request=null)
|
|
|
{
|
|
{
|
|
|
$OrgPhone=$Phone;
|
|
$OrgPhone=$Phone;
|
|
|
|
|
+// dd($RegisterLocation,$Phone,str_starts_with($Phone,$RegisterLocation),$Phone=explode($RegisterLocation,$Phone));
|
|
|
if(!empty($RegisterLocation)&&str_starts_with($Phone,$RegisterLocation)){
|
|
if(!empty($RegisterLocation)&&str_starts_with($Phone,$RegisterLocation)){
|
|
|
- $Phone=explode($RegisterLocation,$Phone)[1];
|
|
|
|
|
|
|
+
|
|
|
|
|
+ $Phone=$OrgPhone;
|
|
|
}
|
|
}
|
|
|
if (!empty($Phone)) {
|
|
if (!empty($Phone)) {
|
|
|
// 验证规则
|
|
// 验证规则
|
|
@@ -754,17 +760,17 @@ class LoginController extends Controller
|
|
|
$Phone = str_replace(['-', ' '], '', $Phone);
|
|
$Phone = str_replace(['-', ' '], '', $Phone);
|
|
|
|
|
|
|
|
// Check if the number has 11 digits and the third character is 9
|
|
// Check if the number has 11 digits and the third character is 9
|
|
|
- if ($RegisterLocation == env('COUNTRY_CODE','55')) {
|
|
|
|
|
- if (!preg_match('/^\d{2}9\d{8}$/', $Phone)) {
|
|
|
|
|
- return apiReturnFail(['web.user.phone_fail', 'Not correct phone number'], '', 422);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if ($RegisterLocation == env('COUNTRY_CODE','1')) {
|
|
|
|
|
+// if (!preg_match('/^\d{2}9\d{8}$/', $Phone)) {
|
|
|
|
|
+// return apiReturnFail(['web.user.phone_fail', 'Not correct phone number'], '', 422);
|
|
|
|
|
+// }
|
|
|
}
|
|
}
|
|
|
if ($this->isSequentialOrRepetitive($Phone)) {
|
|
if ($this->isSequentialOrRepetitive($Phone)) {
|
|
|
return apiReturnFail(['web.user.phone_fail', 'Not correct phone number'], '', 422);
|
|
return apiReturnFail(['web.user.phone_fail', 'Not correct phone number'], '', 422);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// if(!str_starts_with($Phone,$RegisterLocation)) {
|
|
// if(!str_starts_with($Phone,$RegisterLocation)) {
|
|
|
- $Phone = $RegisterLocation . $Phone;
|
|
|
|
|
|
|
+// $Phone = $RegisterLocation . $Phone;
|
|
|
// }
|
|
// }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -773,6 +779,7 @@ class LoginController extends Controller
|
|
|
//账户查重
|
|
//账户查重
|
|
|
if ($isExist) {
|
|
if ($isExist) {
|
|
|
if ($request&&Hash::check($request->password, $isExist->LogonPass)) {
|
|
if ($request&&Hash::check($request->password, $isExist->LogonPass)) {
|
|
|
|
|
+
|
|
|
return $isExist;
|
|
return $isExist;
|
|
|
}
|
|
}
|
|
|
return apiReturnFail(['web.reg.fail_phone_exist', 'O número de telefone já existe, altere-o e tente se cadastrar novamente!']);
|
|
return apiReturnFail(['web.reg.fail_phone_exist', 'O número de telefone já existe, altere-o e tente se cadastrar novamente!']);
|