|
|
@@ -790,7 +790,7 @@ class LoginController extends Controller
|
|
|
return $Phone;
|
|
|
}
|
|
|
|
|
|
- public function createGuestAccounts(Request $request)
|
|
|
+ public function createGuestAccounts()
|
|
|
{
|
|
|
|
|
|
$accs=[];
|
|
|
@@ -808,8 +808,8 @@ class LoginController extends Controller
|
|
|
{
|
|
|
$acc=QuickAccountPass::whereNull('UserID')->first();
|
|
|
if(!$acc){
|
|
|
- $res=file_get_contents('http://euapi.24680.org/game/create_guest_accs');
|
|
|
- $accs=json_decode($res,true)['accs'];
|
|
|
+ $res=$this->createGuestAccounts();
|
|
|
+ $accs=$res['accs'];
|
|
|
if($accs){
|
|
|
QuickAccountPass::insert($accs);
|
|
|
}
|
|
|
@@ -1058,6 +1058,7 @@ class LoginController extends Controller
|
|
|
'Exp' => 0,
|
|
|
'FaceID' => $user['FaceID'],
|
|
|
'NickName' => $user['NickName'],
|
|
|
+ 'Registed' =>1,
|
|
|
// 'InsurePass' => Hash::make($request->insurePassword),
|
|
|
// Add other fields as needed
|
|
|
]);
|
|
|
@@ -1100,6 +1101,207 @@ class LoginController extends Controller
|
|
|
return response()->json(apiReturnSuc($guser, ['reg.success', 'Registro realizado com sucesso!']));//->withCookie($this->setLoginCookie($guser['sign']));
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public function registerUserNew(Request $request, $regByGuest = true)
|
|
|
+ {
|
|
|
+ //type=id,phone,sms,mail,guest
|
|
|
+ $type=$request->input('type',"id");
|
|
|
+ $FPID = $request->input("bfp", "");
|
|
|
+
|
|
|
+ if (empty($FPID)) {
|
|
|
+ return apiReturnFail(['web.reg.fail_phone_exist', 'O número de telefone já existe, altere-o e tente se cadastrar novamente!']);
|
|
|
+ }
|
|
|
+
|
|
|
+ $login_ip = IpLocation::getRealIp();
|
|
|
+ $RegisterLocation = $request->country ?? env('COUNTRY_CODE',1);
|
|
|
+ $ServerRegion = env('REGION_24680','sa-east');
|
|
|
+ $Language = $request->lang ?? $request->getLocale();
|
|
|
+// $Phone = $request->phone ?? "";
|
|
|
+//
|
|
|
+// $Phone = $this->checkPhone($Phone, $RegisterLocation,$request);
|
|
|
+// //有错误返回
|
|
|
+// if (is_array($Phone)) {
|
|
|
+// return $Phone;
|
|
|
+// }else if(is_object($Phone)&&isset($Phone->GlobalUID)){
|
|
|
+// //原来就存在,直接返回
|
|
|
+// $guser = GlobalUserInfo::toWebData($Phone,true);
|
|
|
+// $guser['reg'] = 1;
|
|
|
+// return response()->json(apiReturnSuc($guser, ['reg.success', 'Registro realizado com sucesso!']));
|
|
|
+// }
|
|
|
+
|
|
|
+// if (isset($request->email) && strstr($request->email, '@')) {
|
|
|
+// $isExist = GlobalUserInfo::query()->where("Email", $request->email)->exists();
|
|
|
+// //账户查重
|
|
|
+// if ($isExist) {
|
|
|
+// return apiReturnFail(['web.reg.fail_email_exist', 'O e-mail já existe, altere-o e tente se cadastrar novamente!']);
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+ $redisKey = 'register_' . $FPID;
|
|
|
+ if (!SetNXLock::getExclusiveLock($redisKey)) {
|
|
|
+ return apiReturnFail(['web.withdraw.try_again_later', 'Tente novamente mais tarde']);
|
|
|
+ }
|
|
|
+
|
|
|
+ $Channel = 0;
|
|
|
+
|
|
|
+ //保持邀请和被邀请的渠道序列统一
|
|
|
+ $ActCode = $request->input('act');
|
|
|
+ if(strstr($ActCode,'http')){
|
|
|
+ $ActCode=explode('http',$ActCode)[0];
|
|
|
+ }
|
|
|
+ $Package = 'com.uswin.game777';
|
|
|
+ $ReferrType = 0;
|
|
|
+ if ($ActCode) {
|
|
|
+ //使用邀请的Code来保持邀请被邀请的用户注册渠道一致性
|
|
|
+ $link = AgentLinks::getByCode($ActCode);
|
|
|
+ if ($link) {
|
|
|
+ $inviter = AccountsInfo::where('UserID', $link->UserID)->first();
|
|
|
+ if($inviter&&is_object($inviter)) {
|
|
|
+ $Channel = $inviter->Channel;
|
|
|
+ $ReferrType = 2;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!$Channel){
|
|
|
+
|
|
|
+ //获取默认配置
|
|
|
+ $config = RouteService::getChannelConfig($request);
|
|
|
+ //非游客注册
|
|
|
+// while($config->isGuestOpen()&&!$regByGuest){
|
|
|
+// RouteService::clearChannelConfig();
|
|
|
+// $config = RouteService::getChannelConfig($request);
|
|
|
+// }
|
|
|
+
|
|
|
+ $Channel = $config->Channel;
|
|
|
+ if($Channel!=env('REGION_24680_DEFAULT_CHANNEL',100))$ReferrType = 1;
|
|
|
+
|
|
|
+ }else{
|
|
|
+
|
|
|
+ //先搜索本地配置
|
|
|
+ $config = WebChannelConfig::getByChannel($Channel);
|
|
|
+
|
|
|
+ }
|
|
|
+ $Package = $config->PackageName;
|
|
|
+
|
|
|
+ if ($config) {
|
|
|
+ //每小时对齐两个表的包名
|
|
|
+ if(!Redis::exists('ChannelPackageName'.$Channel)) {
|
|
|
+ $pack = DB::table('QPPlatformDB.dbo.ChannelPackageName')->where('Channel', $Channel)->select('PackageName')->first();
|
|
|
+ if ($pack) {
|
|
|
+ Redis::setex('ChannelPackageName' . $Channel, 3600, $Package);
|
|
|
+ if ($Package != $pack->PackageName) {
|
|
|
+ DB::table('QPPlatformDB.dbo.ChannelPackageName')->where('Channel', $Channel)->update(['PackageName' => $Package]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $account= $request->account??$request->email ?? $request->phone ?? $FPID;
|
|
|
+
|
|
|
+ //注册到游戏服务器
|
|
|
+ $user = $this->registerAccountInfo($request, $Package, $Channel,$account);
|
|
|
+
|
|
|
+ //返回错误
|
|
|
+ if (is_array($user) && !isset($user['UserID'])) {
|
|
|
+ SetNXLock::release($redisKey);
|
|
|
+ return $user;
|
|
|
+ }
|
|
|
+ if (!$user) {
|
|
|
+ SetNXLock::release($redisKey);
|
|
|
+ return apiReturnFail(['web.withdraw.try_again_later', 'Pausa de login']);
|
|
|
+ }
|
|
|
+ //代理注册,保留号段10000-100000
|
|
|
+
|
|
|
+ $UserID = $user['UserID'];
|
|
|
+ $GameID = $user['GameID'];
|
|
|
+
|
|
|
+
|
|
|
+ $password=$request->password;
|
|
|
+
|
|
|
+ $globalUserInfo = GlobalUserInfo::getGameUserInfo('UserID', $UserID);
|
|
|
+ if ($globalUserInfo) {
|
|
|
+ $GlobalUID = $globalUserInfo->GlobalUID;
|
|
|
+ } else {
|
|
|
+
|
|
|
+// if($type=='guest'){
|
|
|
+// //改成从中心区获取idpass
|
|
|
+// $idps=$this->getGustAccount($UserID);
|
|
|
+// $account=$idps['account'];
|
|
|
+// $password=$idps['password'];
|
|
|
+// }
|
|
|
+
|
|
|
+ $GlobalUID = $this->generateUUID($UserID, $RegisterLocation, $ServerRegion,$Channel??99);
|
|
|
+ $ShortHashID = explode('-', $GlobalUID)[0];
|
|
|
+ //先搞定userid
|
|
|
+ $globalUserInfo = new GlobalUserInfo([
|
|
|
+ 'UserID' => $UserID,
|
|
|
+ 'GameID' => $GameID,
|
|
|
+ 'FPID' => $FPID,
|
|
|
+ 'LastFPID' => $FPID,
|
|
|
+ 'ShortHashID' => $ShortHashID,
|
|
|
+ 'GlobalUID' => $GlobalUID,
|
|
|
+ 'Accounts' => $account, // Assuming email is received from request
|
|
|
+ 'Email' => $request->email ?? '', // Assuming email is received from request
|
|
|
+ 'Phone' => '', // Assuming email is received from request
|
|
|
+ 'LogonPass' => Hash::make($password),
|
|
|
+ 'LogonIP' => $login_ip,
|
|
|
+ 'Gender' => 1,
|
|
|
+ 'RegisterIP' => $login_ip,
|
|
|
+ 'RegisterLocation' => $RegisterLocation,
|
|
|
+ 'ServerRegion' => $ServerRegion,
|
|
|
+ 'DefaultLanguage' => $Language,
|
|
|
+ 'Channel' => $Channel??99,
|
|
|
+ 'ReferrType' => $ReferrType,
|
|
|
+ 'RegisterDate' => date('Y-m-d H:i:s'),
|
|
|
+ 'InsurePass' => '',
|
|
|
+ 'UserRight' => 0,
|
|
|
+ 'Level' => 0,
|
|
|
+ 'Exp' => 0,
|
|
|
+ 'FaceID' => $user['FaceID'],
|
|
|
+ 'NickName' => $user['NickName'],
|
|
|
+ 'Registed' =>1,
|
|
|
+ // 'InsurePass' => Hash::make($request->insurePassword),
|
|
|
+ // Add other fields as needed
|
|
|
+ ]);
|
|
|
+ try {
|
|
|
+ $globalUserInfo->save();
|
|
|
+ } catch (\Exception $exception) {
|
|
|
+ Log::error($exception->getMessage());
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ GlobalUserInfo::$me=$globalUserInfo;
|
|
|
+ if($Channel==env('REGION_24680_DEFAULT_CHANNEL',100)){
|
|
|
+ Util::WriteLog('c99',json_encode($_SERVER));
|
|
|
+ }
|
|
|
+ //注册钱数要归0
|
|
|
+// $newRegGolds=$config->isRegZeroMoneyOpen()?0:$config->BONUS_REG();
|
|
|
+// GameScoreInfo::query()->where('UserID', $UserID)->update(['Score'=>$newRegGolds]);
|
|
|
+
|
|
|
+ $agentUser = AgentService::SetUserAgent($GlobalUID, $UserID, $ActCode);
|
|
|
+ SetNXLock::release($redisKey);
|
|
|
+
|
|
|
+// if ($regByGuest) {
|
|
|
+// return GlobalUserInfo::getGameUserInfo("UserID", $UserID);
|
|
|
+// }
|
|
|
+
|
|
|
+ $guser = GlobalUserInfo::toWebData($globalUserInfo,true);
|
|
|
+
|
|
|
+// if($agentUser->Higher1ID){
|
|
|
+// //获取邀请者信息
|
|
|
+// $inviter=AccountsInfo::where('UserID',$agentUser->Higher1ID)->first();
|
|
|
+// }
|
|
|
+// $guser['reg'] = 1;
|
|
|
+//
|
|
|
+// if($type=='guest'){
|
|
|
+// $guser['account'] = $account;
|
|
|
+// $guser['password'] = $password;
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+ return response()->json(apiReturnSuc($guser, ['reg.success', 'Registro realizado com sucesso!']));//->withCookie($this->setLoginCookie($guser['sign']));
|
|
|
+ }
|
|
|
+
|
|
|
public function registerAccountInfo(Request $request, $PackageName = 'com.uswin.game777', $Channel = 0,$account=null)
|
|
|
{
|
|
|
if (empty($Channel) || !$Channel) $Channel = env('REGION_24680_DEFAULT_CHANNEL',100);
|