WithDrawInfoController.php 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163
  1. <?php
  2. namespace App\Http\Controllers\Game;
  3. use App\Facade\TableName;
  4. use App\Game\GlobalUserInfo;
  5. use App\Http\helper\NumConfig;
  6. use App\Models\Account\UserBlacklist;
  7. use App\Models\AccountsInfo;
  8. use App\Models\Treasure\GameScoreLocker;
  9. use App\Notification\TelegramBot;
  10. use App\Util;
  11. use App\Utility\SetNXLock;
  12. use GuzzleHttp\Client;
  13. use GuzzleHttp\Exception\RequestException;
  14. use Illuminate\Http\Request;
  15. use Illuminate\Support\Facades\DB;
  16. use Illuminate\Support\Facades\Hash;
  17. use Illuminate\Support\Facades\Log;
  18. use Illuminate\Support\Facades\Redis;
  19. use Illuminate\Support\Facades\Validator;
  20. class WithDrawInfoController
  21. {
  22. public function FreeWithDrawInfo(Request $request)
  23. {
  24. $user = $request->user();
  25. $userScoreData = GlobalUserInfo::getScoreDataByUserID($user->UserID);
  26. if(!$userScoreData['Recharge']){
  27. $totalWithdraw = max($userScoreData['InsureScore'],40);
  28. if($userScoreData['InsureScore']<40){
  29. //第一种状态,我免费领了10块钱,但是金额不足40,点进去页面填信息后点击提现,提示我去玩游戏
  30. return apiReturnSuc(['state' => 1, 'total' => $totalWithdraw,'InsureScore' => $userScoreData['InsureScore']]);
  31. }else{
  32. //第二种状态,我免费金额足够40,提现按钮会点亮,告知用户点击进去
  33. return apiReturnSuc(['state' => 2, 'total' => $totalWithdraw,'InsureScore' => $userScoreData['InsureScore']]);
  34. }
  35. }else{
  36. //第四种状态,VIP状态下,金额不足了,进度条颜色红色,按钮灰色(不可点击),次日整个消失
  37. if($userScoreData['InsureScore']<10){
  38. return apiReturnSuc(['state' => 4, 'total' => max($userScoreData['InsureScore'],40),'InsureScore' => max($userScoreData['InsureScore'],40)]);
  39. }else{
  40. //第三种状态,进去完成了充值未提现,提现按钮会高光,引导用户完成提现
  41. return apiReturnSuc(['state' => 3, 'total' => max($userScoreData['InsureScore'],40),'InsureScore' => max($userScoreData['InsureScore'],40)]);
  42. }
  43. }
  44. }
  45. public function WithDrawRecord(Request $request)
  46. {
  47. $user = $request->user();
  48. $UserID=$user->UserID;
  49. // $paypass = $request->input('paypass');
  50. // if (!empty($user->InsurePass)&&!Hash::check($paypass,$user->InsurePass)) {
  51. // return apiReturnFail(['web.user.paypass_fail', 'A senha original está errada, digite-a novamente.'], '', 2);
  52. // }
  53. $scoreType = intval($request->input('score_type', -1));
  54. if (!in_array($scoreType, [-1, 0, 1], true)) {
  55. return apiReturnFail(['web.withdraw.params_error', 'score_type must be -1, 0 or 1'], [], 422);
  56. }
  57. $sort = strtolower($request->input('sort', 'desc'));
  58. $sort = in_array($sort, ['asc', 'desc']) ? $sort : 'desc';
  59. $sortBy = strtolower($request->input('sort_by', 'createdate'));
  60. $pageSize = intval($request->input('page_size', 10));
  61. if ($pageSize <= 0) {
  62. $pageSize = 100;
  63. }
  64. $query = DB::table('QPAccountsDB.dbo.OrderWithDraw')
  65. ->where('UserID', $UserID);
  66. if ($scoreType !== -1) {
  67. $query->where('score_type', $scoreType);
  68. }
  69. $allowedSortColumns = [
  70. 'withdraw' => 'WithDraw',
  71. 'createdate' => 'CreateDate',
  72. ];
  73. $sortColumn = $allowedSortColumns[$sortBy] ?? 'CreateDate';
  74. $list = $query
  75. ->selectRaw("CreateDate,OrderId,[State],WithDraw,ServiceFee,PixType,score_type")
  76. ->where('CreateDate', '>=', date('Y-m-d', strtotime('-30 day')))
  77. ->orderBy($sortColumn, $sort)
  78. ->paginate($pageSize);
  79. return apiReturnSuc($list);
  80. }
  81. public function GetWithDrawBaseInfo(Request $request)
  82. {
  83. $user = $request->user();
  84. $UserID=$user->UserID;
  85. // $paypass = $request->input('paypass');
  86. //
  87. // if (empty($user->InsurePass)||!Hash::check($paypass,$user->InsurePass)) {
  88. // return apiReturnFail(['web.user.paypass_fail', 'A senha original está errada, digite-a novamente.'], '', 2);
  89. // }
  90. $dbh = DB::connection()->getPdo();
  91. $sql="DECLARE @return_value int
  92. set nocount on use QPAccountsDB
  93. EXEC @return_value = GSP_GR_GetWithDrawBaseInfo '$UserID'
  94. SELECT 'ReturnValue' = @return_value";
  95. // echo $sql;die;
  96. $stmt = $dbh->prepare($sql);
  97. $stmt->execute();
  98. $retval = $stmt->fetch(\PDO::FETCH_ASSOC);
  99. $retval['srate']=env('CONFIG_24680_RATE',1);
  100. // 获取绑定手机号
  101. $phone = DB::table(TableName::QPAccountsDB() . 'AccountPhone')->where('UserID', $UserID)->value('PhoneNum');
  102. $phone = trim($phone);
  103. // 去掉国家号前缀
  104. $countryCode = (string) env('COUNTRY_CODE', '1');
  105. if ($countryCode !== '' && strpos($phone, $countryCode) === 0) {
  106. $phone = substr($phone, mb_strlen($countryCode));
  107. }
  108. $retval['bind_phone'] = $phone;
  109. $hasSuccessWithdraw = DB::table('QPAccountsDB.dbo.OrderWithDraw')
  110. ->lock('WITH(NOLOCK)')
  111. ->where('UserID', $UserID)
  112. ->where('State', 2)
  113. ->exists();
  114. $retval['has_success_withdraw'] = $hasSuccessWithdraw;
  115. if (Redis::exists('withdraw_info_time_' . $UserID)) {
  116. $lastTime = Redis::get('withdraw_info_time_' . $UserID);
  117. $retval['withdraw_info_update_by_phone'] = true;
  118. $retval['withdraw_info_update_time_pass'] = time() - $lastTime;
  119. } else {
  120. $retval['withdraw_info_update_by_phone'] = false;
  121. $retval['withdraw_info_update_time_pass'] = 0;
  122. }
  123. return apiReturnSuc($retval);
  124. }
  125. public function GoWithDraw(Request $request)
  126. {
  127. $user = $request->user();
  128. $UserID=$user->UserID;
  129. // $paypass = $request->input('paypass');
  130. //
  131. // if (empty($user->InsurePass)||!Hash::check($paypass,$user->InsurePass)) {
  132. // return apiReturnFail(['web.user.paypass_fail', 'A senha original está errada, digite-a novamente.'], '', 2);
  133. // }
  134. $exists = UserBlacklist::where('UserID', $UserID)->first();
  135. if ($exists){
  136. return apiReturnFail(['web.withdraw.try_again_later','User In Control']);
  137. }
  138. $score=$request->input('score',0);
  139. if(!$score||is_float($score)||$score<=0){
  140. return apiReturnFail(['web.withdraw.score_fail', 'Amount must be an integer value.']);
  141. }
  142. $redisKey = 'withdraw_'.$UserID;
  143. if (!SetNXLock::getExclusiveLock($redisKey)) {
  144. return apiReturnFail(['web.withdraw.try_again_later','Tente novamente mais tarde']);
  145. }
  146. GameScoreLocker::where('UserID',$UserID)->delete();
  147. $dbh = DB::connection()->getPdo();
  148. // $score=$score*NumConfig::NUM_VALUE;
  149. $sql="DECLARE @return_value int
  150. set nocount on use QPAccountsDB
  151. EXEC @return_value = GSP_GR_GetWithDraw20260312 '$UserID','$score'
  152. SELECT 'ReturnValue' = @return_value";
  153. // echo $sql;die;
  154. $stmt = $dbh->prepare($sql);
  155. $stmt->execute();
  156. SetNXLock::release($redisKey);
  157. $retval = $stmt->fetch(\PDO::FETCH_ASSOC);
  158. try {
  159. // set @ret = 1 --可提额度不足
  160. // set @ret = 2 --低于最低可提现金额
  161. // set @ret = 3 --高于最高可提现金额
  162. // set @ret = 4 --超过每天提现次数上限
  163. // set @ret = 5 --身上钱不够
  164. // set @ret = 6 --开在游戏里面
  165. // set @ret = 7 --未充值的用户TX额度
  166. if (isset($retval['ReturnValue'])) {
  167. $ReturnValue = $retval['ReturnValue'];
  168. // set @ret = 1 -- Insufficient withdrawal amount
  169. // set @ret = 2 -- Lower than the minimum withdrawal amount
  170. // set @ret = 3 -- Higher than the maximum withdrawal amount
  171. // set @ret = 4 -- Exceeded the daily withdrawal limit
  172. // set @ret = 5 -- Not enough money on hand
  173. // set @ret = 6 -- Opened in the game
  174. // set @ret = 7 -- Undeposited user TX amount
  175. $errors = [
  176. [],
  177. ['web.withdraw.no_withdraw_value', "The withdrawable amount is not enough"],
  178. ['web.withdraw.too_low', 'Lower than the minimum withdrawal amount'],
  179. ['web.withdraw.too_high', 'Higher than the maximum withdrawal amount'],
  180. ['web.withdraw.day_max', 'Exceeded the daily withdrawal limit'],
  181. ['web.withdraw.no_enouth_score', 'Not enough money on hand'],
  182. ['web.withdraw.in_game', 'Sorry, You\'re in game for now'],
  183. ['web.withdraw.no_deposit', ' You need deposit first!'],
  184. ];
  185. return apiReturnFail($errors[$ReturnValue], [], $ReturnValue == 7 ? 777 : 301);
  186. }else{
  187. return apiReturnSuc($retval);
  188. }
  189. }catch (\Exception $e){
  190. TelegramBot::getDefault()->sendProgramNotify("WithDraw Error:", var_export($retval,true).':'.$e->getTraceAsString());
  191. return apiReturnSuc($retval);
  192. }
  193. }
  194. public function saveCpf(Request $request)
  195. {
  196. // $user = $request->user();
  197. // $UserID=$user->UserID;
  198. //
  199. // $account = $request->Account ?: '';
  200. // $phone = $request->Phone ?: '';
  201. // $email = $request->Email ?: '';
  202. // $PixNum = $request->PixNum ?: '';
  203. //
  204. // if(!Util::validateCpf($PixNum)){
  205. // return apiReturnFail(['withdraw.account.tip.cpf_error','Cpf error format']);
  206. // }
  207. //
  208. // $redisKey = 'Api_updateAccountsPayInfo_'.$UserID;
  209. // $lock = SetNXLock::getExclusiveLock($redisKey);
  210. // if (!$lock) {
  211. // return apiReturnFail(['web.withdraw.try_again_later','Tente novamente mais tarde']);
  212. // }
  213. // $exist = DB::table(TableName::QPAccountsDB() . 'AccountWithDrawInfo')->where('UserID', $UserID)->first();
  214. //
  215. // if ($exist) {
  216. // DB::table(TableName::QPAccountsDB() . 'AccountWithDrawInfo')->where('UserID', $UserID)->update(['PixNum' => $PixNum]);
  217. // } else {
  218. //
  219. // $data = ['BankUserName' => $account, 'PhoneNumber' => $phone, 'EmailAddress' => $email, 'UserID' => $UserID, 'PixNum' => $PixNum, 'Achieves' => '', 'HistoryWithDraw' => 0];
  220. // DB::table(TableName::QPAccountsDB() . 'AccountWithDrawInfo')
  221. // ->insert($data);
  222. // }
  223. // SetNXLock::release($redisKey);
  224. return apiReturnSuc();
  225. }
  226. public function MexWithDrawInfo(Request $request)
  227. {
  228. $user = $request->user();
  229. $UserID=$user->UserID;
  230. $paypass = $request->input('paypass');
  231. $PixType = $request->input('cbPixType');;
  232. $BankNO = $request->input('account');
  233. $AccountsBank = $request->input('account');
  234. $BankUserName = $request->input('userName');
  235. $PhoneNumber = $request->input('phone');
  236. $EmailAddress = $request->input('email');
  237. $IFSCNumber = $request->input('IFSCNumber');
  238. // $PANNumber = $request->input('PAN');
  239. // $AdhaarNumber = $request->input('adhaar');
  240. // $BranchBank = $request->input('branceBank');
  241. $BranchBank = $request->input('bank');//银行编号
  242. $PixNum = $request->input('account');
  243. Util::WriteLog("mexwithdraw",$request->all());
  244. if(isset($EmailAddress)&&!empty($EmailAddress)){
  245. $validator = Validator::make(
  246. ['email' => $EmailAddress],
  247. ['email' => 'required|email']
  248. );
  249. if ($validator->fails()) {
  250. return apiReturnFail(['web.user.email_fail','Wrong email format']);
  251. }
  252. }
  253. if (!$AccountsBank || $AccountsBank == 'undefined') {
  254. return apiReturnFail(['web.bank.account_empty', 'The bank account cannot be empty']);
  255. }
  256. if (!(strlen($AccountsBank) == 16 || strlen($AccountsBank) == 18)) {
  257. return apiReturnFail(['web.bank.account_invalid_length', 'The bank number must have 16 or 18 digits']);
  258. }
  259. if (!(strlen($IFSCNumber) == 18 && $IFSCNumber)) {
  260. return apiReturnFail(['web.bank.clabe_invalid_length', 'The Clabe number must have 18 digits']);
  261. }
  262. if (!$BankUserName || $BankUserName == 'undefined') {
  263. return apiReturnFail(['web.bank.username_empty', 'The name cannot be empty']);
  264. }
  265. if (!$BranchBank || $BranchBank == 'undefined') {
  266. return apiReturnFail(['web.bank.branch_empty', 'The branch code cannot be empty']);
  267. }
  268. if (strlen($AccountsBank) == 16) {
  269. $PixType = 2;
  270. }
  271. if (strlen($AccountsBank) == 18) {
  272. $PixType = 1;
  273. }
  274. $redisKey = 'withDrawInfo_withDrawInfo_' . $UserID;
  275. if (!SetNXLock::getExclusiveLock($redisKey)) {
  276. return apiReturnFail(['web.bank.try_again_later', 'Please try again later']);
  277. }
  278. if (!$UserID) {
  279. Log::info('miss UserID', $request->all());
  280. SetNXLock::release($redisKey);
  281. return apiReturnFail(['web.bank.missing_userid', 'params error']);
  282. }
  283. if (empty($PixType)) {
  284. SetNXLock::release($redisKey);
  285. return apiReturnFail(['web.bank.pix_type_missing', 'The PIX type is missing']);
  286. }
  287. // 验证PixNum绑定次数
  288. if (!empty($PixNum)) {
  289. $BindCount = DB::table(TableName::QPRecordDB() . 'RecordBankCardBind')
  290. ->where('BankCard', $PixNum)
  291. ->lock('WITH(NOLOCK)')
  292. ->count();
  293. if ($BindCount >= 3) {
  294. SetNXLock::release($redisKey);
  295. return apiReturnFail(['web.bank.cpf_used_multiple_times', 'The CPF number has been used multiple times and cannot be saved'], [], 302);
  296. }
  297. }
  298. // 验证玩家信息
  299. if (!empty($user->InsurePass)&&!Hash::check($paypass,$user->InsurePass)) {
  300. return apiReturnFail(['web.user.paypass_fail', 'A senha original está errada, digite-a novamente.'], '', 2);
  301. }
  302. if ($PixType < 10 && false) {
  303. $data = compact('PixType', 'BankUserName', 'PhoneNumber', 'EmailAddress', 'PixNum');
  304. } else {
  305. $data = compact('PixType', 'BankUserName','IFSCNumber', 'PhoneNumber', 'EmailAddress','BankNO', 'AccountsBank','BranchBank','PixNum');
  306. $PixNum = $BankNO;
  307. }
  308. foreach ($data as $key => &$val) {
  309. $data[$key] = trim($val);
  310. }
  311. unset($val);
  312. $AccountWithDrawInfo = DB::table(TableName::QPAccountsDB() . 'AccountWithDrawInfo')
  313. ->lock('WITH(NOLOCK)')
  314. ->where('UserID', $UserID)
  315. ->first();
  316. if (!$AccountWithDrawInfo) {
  317. $data['UserID'] = $UserID;
  318. $data['Achieves'] = 0;
  319. $data['HistoryWithDraw'] = 0;
  320. try {
  321. DB::table(TableName::QPAccountsDB() . 'AccountWithDrawInfo')
  322. ->where('UserID', $UserID)
  323. ->insert($data);
  324. } catch (\Exception $e) {
  325. Log::error('insert AccountWithDrawInfo failed', ['data' => $data]);
  326. }
  327. } else {
  328. DB::table(TableName::QPAccountsDB() . 'AccountWithDrawInfo')
  329. ->where('UserID', $UserID)
  330. ->update($data);
  331. }
  332. // 添加绑定记录
  333. if (empty($AccountWithDrawInfo->PixNum) || $AccountWithDrawInfo->PixNum != $PixNum) {
  334. try {
  335. DB::table(TableName::QPRecordDB() . 'RecordBankCardBind')
  336. ->insert([
  337. 'UserID' => $UserID,
  338. 'BankCard' => $PixNum ?: '',
  339. 'BindDate' => now()
  340. ]);
  341. } catch (\Exception $e) {
  342. Log::error('insert RecordBankCardBind failed', ['data' => $data]);
  343. }
  344. }
  345. SetNXLock::release($redisKey);
  346. return apiReturnSuc();
  347. }
  348. public function RuWithDrawInfo(Request $request)
  349. {
  350. $user = $request->user();
  351. $UserID=$user->UserID;
  352. $paypass = $request->input('paypass');
  353. $PixType = $request->input('PixType');;
  354. $BankNO = $request->input('account');
  355. $BankUserName = $request->input('userName');
  356. $PhoneNumber = $request->input('phone');
  357. // $EmailAddress = $request->input('email');
  358. // $IFSCNumber = $request->input('IFSCNumber');
  359. // $PANNumber = $request->input('PAN');
  360. // $AdhaarNumber = $request->input('adhaar');
  361. // $BranchBank = $request->input('branceBank');
  362. $BranchBank = $request->input('bank');//银行编号
  363. $PixNum = $BankNO;
  364. $AccountsBank = $BankNO;
  365. Util::WriteLog("ruwithdraw",$request->all());
  366. if (!$BankUserName || $BankUserName == 'undefined') {
  367. return apiReturnFail(['web.bank.username_empty', 'The name cannot be empty']);
  368. }
  369. if($PixType==1) {
  370. if (!$AccountsBank || $AccountsBank == 'undefined') {
  371. return apiReturnFail(['web.bank.account_empty', 'The bank account cannot be empty']);
  372. }
  373. if (!(strlen($AccountsBank) == 16 )) {
  374. return apiReturnFail(['web.bank.account_invalid_length', 'The bank number must have 16 digits']);
  375. }
  376. // if (!(strlen($IFSCNumber) == 11 && $IFSCNumber)) {
  377. // return apiReturnFail(['web.bank.clabe_invalid_length', 'The Clabe number must have 18 digits']);
  378. // }
  379. }else{
  380. if(!$PhoneNumber||strlen($PhoneNumber)!=11){
  381. return apiReturnFail(['withdraw.account.tip.phone_error', 'The phone number is error']);
  382. }
  383. if (!$BranchBank || $BranchBank == 'undefined') {
  384. return apiReturnFail(['web.bank.branch_empty', 'The branch code cannot be empty']);
  385. }
  386. }
  387. $redisKey = 'withDrawInfo_withDrawInfo_' . $UserID;
  388. if (!SetNXLock::getExclusiveLock($redisKey)) {
  389. return apiReturnFail(['web.bank.try_again_later', 'Please try again later']);
  390. }
  391. if (!$UserID) {
  392. Log::info('miss UserID', $request->all());
  393. SetNXLock::release($redisKey);
  394. return apiReturnFail(['web.bank.missing_userid', 'params error']);
  395. }
  396. if (empty($PixType)) {
  397. SetNXLock::release($redisKey);
  398. return apiReturnFail(['web.bank.pix_type_missing', 'The PIX type is missing']);
  399. }
  400. // 验证PixNum绑定次数
  401. if (!empty($PixNum)) {
  402. $BindCount = DB::table(TableName::QPRecordDB() . 'RecordBankCardBind')
  403. ->where('BankCard', $PixNum)
  404. ->lock('WITH(NOLOCK)')
  405. ->count();
  406. if ($BindCount >= 3) {
  407. SetNXLock::release($redisKey);
  408. return apiReturnFail(['web.bank.cpf_used_multiple_times', 'The CPF number has been used multiple times and cannot be saved'], [], 302);
  409. }
  410. }
  411. // 验证玩家信息
  412. if (!empty($user->InsurePass)&&!Hash::check($paypass,$user->InsurePass)) {
  413. return apiReturnFail(['web.user.paypass_fail', 'A senha original está errada, digite-a novamente.'], '', 2);
  414. }
  415. $data = compact('PixType', 'BankUserName', 'PhoneNumber','BankNO', 'AccountsBank','BranchBank','PixNum');
  416. $PixNum = $BankNO;
  417. foreach ($data as $key => &$val) {
  418. $data[$key] = trim($val);
  419. }
  420. unset($val);
  421. $AccountWithDrawInfo = DB::table(TableName::QPAccountsDB() . 'AccountWithDrawInfo')
  422. ->lock('WITH(NOLOCK)')
  423. ->where('UserID', $UserID)
  424. ->first();
  425. if (!$AccountWithDrawInfo) {
  426. $data['UserID'] = $UserID;
  427. $data['Achieves'] = 0;
  428. $data['HistoryWithDraw'] = 0;
  429. try {
  430. DB::table(TableName::QPAccountsDB() . 'AccountWithDrawInfo')
  431. ->where('UserID', $UserID)
  432. ->insert($data);
  433. } catch (\Exception $e) {
  434. Log::error('insert AccountWithDrawInfo failed', ['data' => $data]);
  435. }
  436. } else {
  437. DB::table(TableName::QPAccountsDB() . 'AccountWithDrawInfo')
  438. ->where('UserID', $UserID)
  439. ->update($data);
  440. }
  441. // 添加绑定记录
  442. if (empty($AccountWithDrawInfo->PixNum) || $AccountWithDrawInfo->PixNum != $PixNum) {
  443. try {
  444. DB::table(TableName::QPRecordDB() . 'RecordBankCardBind')
  445. ->insert([
  446. 'UserID' => $UserID,
  447. 'BankCard' => $PixNum ?: '',
  448. 'BindDate' => now()
  449. ]);
  450. } catch (\Exception $e) {
  451. Log::error('insert RecordBankCardBind failed', ['data' => $data]);
  452. }
  453. }
  454. SetNXLock::release($redisKey);
  455. return apiReturnSuc();
  456. }
  457. public function withDrawInfo(Request $request)
  458. {
  459. // return apiReturnFail('params error');
  460. $user = $request->user();
  461. $UserID=$user->UserID;
  462. // 检查是否有成功的提现记录 (State = 2 表示成功)
  463. $hasSuccessWithdraw = DB::table('QPAccountsDB.dbo.OrderWithDraw')
  464. ->lock('WITH(NOLOCK)')
  465. ->where('UserID', $UserID)
  466. ->where('State', 2)
  467. ->exists();
  468. $limitKey = 'last_withdraw_info_update_' . $UserID;
  469. if ($hasSuccessWithdraw) {
  470. if (Redis::exists($limitKey)) {
  471. return apiReturnFail(['web.withdraw.update_limit', 'You can only update your information once every 24 hours.']);
  472. }
  473. $code = $request->input('code');
  474. if (empty($code)) {
  475. return apiReturnFail(['web.verify.code_empty', 'Verification code cannot be empty']);
  476. }
  477. $phone = DB::table(TableName::QPAccountsDB() . 'AccountPhone')->where('UserID', $UserID)->value('PhoneNum');
  478. if (empty($phone)) {
  479. return apiReturnFail(['web.verify.phone_not_bound', 'Phone number not bound']);
  480. }
  481. $verifyStatus = \App\Models\GamePhoneVerityCode::verifyCode($phone, $code);
  482. if ($verifyStatus == 1) {
  483. return apiReturnFail(['web.verify.code_error', 'Invalid verification code']);
  484. }
  485. // 验证通过,清除验证码
  486. \App\Models\GamePhoneVerityCode::clearPhoneCode($phone);
  487. // 设置标识,下次修改时弹窗
  488. Redis::setex('withdraw_info_time_' . $UserID, 30 * 24 * 3600, time());
  489. } else {
  490. Redis::del('withdraw_info_time_' . $UserID);
  491. }
  492. // $UserID = (int)$request->globalUser->UserID;//$request->input('UserID');
  493. // $RequestDynamicPass = $request->input('DynamicPass');
  494. $PixType = $request->input('cbPixType');
  495. $BankUserName = urldecode($request->input('userName'));
  496. $EmailAddress = $request->input('email');
  497. $PixNum = $request->input('PixNum');
  498. if(!empty($EmailAddress))$EmailAddress=Util::cleanEmptyString($EmailAddress);
  499. if(!empty($PixNum))$PixNum=Util::cleanEmptyString($PixNum);
  500. if (!empty($EmailAddress)&&!Util::validateEmail($EmailAddress)) {
  501. return apiReturnFail(['web.user.email_fail','Wrong email format']);
  502. }
  503. $redisKey = 'withDrawInfo_withDrawInfo_'.$UserID;
  504. if (!SetNXLock::getExclusiveLock($redisKey)) {
  505. Util::WriteLog("withdrawInfo",[1, $request->all()]);
  506. return apiReturnFail(['web.withdraw.try_again_later','Tente novamente mais tarde']);
  507. }
  508. if (!$UserID) {
  509. Util::WriteLog("withdrawInfo",[2, $request->all()]);
  510. Log::info('miss UserID', $request->all());
  511. SetNXLock::release($redisKey);
  512. return apiReturnFail(['web.withdraw.params_error','params error']);
  513. }
  514. if (empty($PixType)) {
  515. Util::WriteLog("withdrawInfo",[3, $request->all()]);
  516. SetNXLock::release($redisKey);
  517. return apiReturnFail(["web.withdraw.pix_type_missing",'O tipo PIX está ausente']);
  518. }
  519. // 验证PixNum绑定次数
  520. // if (!empty($PixNum)) {
  521. // $BindCount = DB::table(TableName::QPRecordDB() . 'RecordBankCardBind')
  522. // ->where('BankCard', $PixNum)
  523. // ->lock('WITH(NOLOCK)')
  524. // ->count();
  525. // if ($BindCount >= 6) {
  526. // Util::WriteLog("withdrawInfo",[4, $request->all()]);
  527. // SetNXLock::release($redisKey);
  528. // return apiReturnFail(['web.withdraw.cpf_number_used','O número do CPF foi usado várias vezes e não pode ser salvo'], [], 302);
  529. // }
  530. // }
  531. if ($PixType==1) {
  532. // 验证 cashapp
  533. if (!empty($PixNum)) {
  534. // 如果 PixNum 第一个字符不是 "$",则在前面添加 "$"
  535. if (substr($PixNum, 0, 1) !== '$') {
  536. $PixNum = '$' . $PixNum;
  537. }
  538. // 构建 cash.app URL
  539. $cashAppUrl = 'https://cash.app/' . $PixNum;
  540. try {
  541. // 使用 stream context 来获取 HTTP 响应头
  542. $context = stream_context_create([
  543. 'http' => [
  544. 'method' => 'GET',
  545. 'header' => "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36\r\n",
  546. 'ignore_errors' => true
  547. ]
  548. ]);
  549. $htmlContent = @file_get_contents($cashAppUrl, false, $context);
  550. // 检查 HTTP 响应头中的状态码
  551. if ($htmlContent === false || (isset($http_response_header) && preg_match('/HTTP\/\d\.\d\s+404/', implode("\n", $http_response_header)))) {
  552. Util::WriteLog("withdrawInfo", [5, $request->all(), 'Invalid cashapp: ' . $PixNum]);
  553. SetNXLock::release($redisKey);
  554. return apiReturnFail(['web.withdraw.invalid_cashapp', 'Invalid CashApp account']);
  555. }
  556. if ($htmlContent !== false) {
  557. // 去除空格换行,转换成一行字符串
  558. $htmlContent = preg_replace('/\s+/', '', $htmlContent);
  559. Util::WriteLog("withdrawInfo", [5, $request->all(), 'CashApp verification response: ' . $htmlContent]);
  560. // 检查响应内容中是否包含 "404 Not Found"
  561. if (stripos($htmlContent, '404NotFound') !== false) {
  562. Util::WriteLog("withdrawInfo", [5, $request->all(), 'Invalid cashapp: ' . $PixNum]);
  563. SetNXLock::release($redisKey);
  564. return apiReturnFail(['web.withdraw.invalid_cashapp', 'Invalid CashApp account']);
  565. }
  566. }
  567. } catch (\Exception $e) {
  568. // 其他异常也记录日志但不阻止流程
  569. Util::WriteLog("withdrawInfo", [5, $request->all(), 'CashApp verification error: ' . $e->getMessage()]);
  570. }
  571. }
  572. $data = compact('PixType', 'BankUserName', 'PixNum');
  573. } else {
  574. $data = compact('PixType', 'EmailAddress');
  575. }
  576. foreach ($data as $key => &$val) {
  577. $data[$key] = trim($val);
  578. }
  579. unset($val);
  580. $AccountWithDrawInfo = DB::table(TableName::QPAccountsDB() . 'AccountWithDrawInfo')
  581. ->lock('WITH(NOLOCK)')
  582. ->where('UserID', $UserID)
  583. ->first();
  584. if (!$AccountWithDrawInfo) {
  585. $data['UserID'] = $UserID;
  586. $data['Achieves'] = 0;
  587. $data['HistoryWithDraw'] = 0;
  588. try {
  589. DB::table(TableName::QPAccountsDB() . 'AccountWithDrawInfo')
  590. ->where('UserID', $UserID)
  591. ->insert($data);
  592. } catch (\Exception $e) {
  593. Log::error('insert AccountWithDrawInfo failed', ['data' => $data]);
  594. Util::WriteLog("withdrawInfo",[6, $request->all(),$data]);
  595. }
  596. } else {
  597. DB::table(TableName::QPAccountsDB() . 'AccountWithDrawInfo')
  598. ->where('UserID', $UserID)
  599. ->update($data);
  600. }
  601. // 记录修改时间,限制24小时
  602. Redis::setex($limitKey, 86400, time());
  603. SetNXLock::release($redisKey);
  604. return apiReturnSuc();
  605. }
  606. public function withDrawInfoSA(Request $request)
  607. {
  608. // return apiReturnFail('params error');
  609. $UserID = $request->input('UserID');
  610. $RequestDynamicPass = $request->input('DynamicPass');
  611. $PixType = $request->input('cbPixType');
  612. $BankNO = $request->input('bank');
  613. $AccountsBank = urldecode($request->input('account'));
  614. $BankUserName = urldecode($request->input('userName'));
  615. // 原始代码
  616. $BankUserName = Util::filterNickName($BankUserName);
  617. // 新增处理:在大写字母前加空格
  618. $BankUserName = preg_replace('/(?<!^)([A-Z])/', ' $1', $BankUserName);
  619. $PhoneNumber = $request->input('phone');
  620. $EmailAddress = $request->input('email');
  621. $IFSCNumber = $request->input('IFSC');
  622. $PANNumber = $request->input('PAN');
  623. $AdhaarNumber = $request->input('adhaar');
  624. $BranchBank = $request->input('branceBank');
  625. $PixNum = $request->input('PixNum');
  626. $redisKey = 'withDrawInfo_withDrawInfo_'.$UserID;
  627. if (!SetNXLock::getExclusiveLock($redisKey)) {
  628. Util::WriteLog("withdrawInfo",[1, $request->all()]);
  629. return apiReturnFail('Tente novamente mais tarde');
  630. }
  631. if (!$UserID) {
  632. Util::WriteLog("withdrawInfo",[2, $request->all()]);
  633. Log::info('miss UserID', $request->all());
  634. SetNXLock::release($redisKey);
  635. return apiReturnFail('params error');
  636. }
  637. if (empty($PixType)) {
  638. Util::WriteLog("withdrawInfo",[3, $request->all()]);
  639. SetNXLock::release($redisKey);
  640. return apiReturnFail('O tipo PIX está ausente');
  641. }
  642. // Util::validateSouthAmericanPhone('',)
  643. // 验证PixNum绑定次数
  644. if (!empty($PixNum)) {
  645. $BindCount = DB::table(TableName::QPRecordDB() . 'RecordBankCardBind')
  646. ->where('BankCard', $PixNum)
  647. ->lock('WITH(NOLOCK)')
  648. ->count();
  649. if ($BindCount >= 8) {
  650. Util::WriteLog("withdrawInfo",[4, $request->all()]);
  651. SetNXLock::release($redisKey);
  652. return apiReturnFail(['web.withdraw.cpf_number_used','The CPF number has been used several times and cannot be saved'], [], 302);
  653. }
  654. }
  655. // if(!is_numeric($PixNum)){
  656. // return apiReturnFail(['web.withdraw.pix_failed','The CPF number has been used several times and cannot be saved'], [], 302);
  657. // }
  658. // 验证玩家信息
  659. $DynamicPass = DB::table(TableName::QPAccountsDB() . 'AccountsInfo')
  660. ->where('UserID', $UserID)
  661. ->lock('WITH(NOLOCK)')
  662. ->value('DynamicPass');
  663. if ($DynamicPass != $RequestDynamicPass || empty($DynamicPass)) {
  664. SetNXLock::release($redisKey);
  665. Util::WriteLog("withdrawInfo",[5, $request->all()]);
  666. return apiReturnFail('As informações do jogador são inconsistentes');
  667. }
  668. $data = compact('PixType', 'BankUserName', 'PhoneNumber', 'EmailAddress', 'PixNum','BankNO', 'AccountsBank', 'IFSCNumber', 'PANNumber', 'AdhaarNumber', 'BranchBank');
  669. foreach ($data as $key => &$val) {
  670. $data[$key] = trim($val);
  671. }
  672. unset($val);
  673. $AccountWithDrawInfo = DB::table(TableName::QPAccountsDB() . 'AccountWithDrawInfo')
  674. ->lock('WITH(NOLOCK)')
  675. ->where('UserID', $UserID)
  676. ->first();
  677. if (!$AccountWithDrawInfo) {
  678. $data['UserID'] = $UserID;
  679. $data['Achieves'] = 0;
  680. $data['HistoryWithDraw'] = 0;
  681. try {
  682. DB::table(TableName::QPAccountsDB() . 'AccountWithDrawInfo')
  683. ->where('UserID', $UserID)
  684. ->insert($data);
  685. } catch (\Exception $e) {
  686. Log::error('insert AccountWithDrawInfo failed', ['data' => $data]);
  687. Util::WriteLog("withdrawInfo",[6, $request->all(),$data]);
  688. }
  689. } else {
  690. $data = array_filter($data, function ($value) {
  691. return !is_null($value) && $value !== '';
  692. });
  693. DB::table(TableName::QPAccountsDB() . 'AccountWithDrawInfo')
  694. ->where('UserID', $UserID)
  695. ->update($data);
  696. }
  697. // 添加绑定记录
  698. if (empty($AccountWithDrawInfo->PixNum) || $AccountWithDrawInfo->PixNum != $PixNum) {
  699. try {
  700. if(!DB::table(TableName::QPRecordDB() . 'RecordBankCardBind')->where('UserID', $UserID)->exists()&&is_numeric($PixNum)) {
  701. DB::table(TableName::QPRecordDB() . 'RecordBankCardBind')
  702. ->insert([
  703. 'UserID' => $UserID,
  704. 'BankCard' => $PixNum ?? '',
  705. 'BindDate' => now()
  706. ]);
  707. Util::WriteLog('update_pix', [
  708. 'UserID' => $UserID,
  709. 'BankCard' => $PixNum ?? '',
  710. 'BindDate' => now()
  711. ]);
  712. }
  713. } catch (\Exception $e) {
  714. Log::error('insert RecordBankCardBind failed', ['data' => $data]);
  715. Util::WriteLog("withdrawInfo",[7, $request->all(),$data]);
  716. }
  717. }
  718. SetNXLock::release($redisKey);
  719. return apiReturnSuc();
  720. }
  721. public function kycSimpleEU(Request $request)
  722. {
  723. // return apiReturnFail('params error');
  724. $user = $request->user();
  725. $UserID=$user->UserID;
  726. $firstName = Util::filterNickName(urldecode($request->input('firstName')));
  727. $lastName = Util::filterNickName(urldecode($request->input('lastName')));
  728. // 原始代码
  729. $BankUserName = $firstName.'|'.$lastName;
  730. $PhoneNumber = $request->input('phone');
  731. $EmailAddress = $request->input('email');
  732. Util::WriteLog("kyc_eu",$request->all());
  733. if(isset($EmailAddress)&&!empty($EmailAddress)){
  734. $validator = Validator::make(
  735. ['email' => $EmailAddress],
  736. ['email' => 'required|email']
  737. );
  738. if ($validator->fails()) {
  739. return apiReturnFail(['web.user.email_fail','Wrong email format']);
  740. }
  741. }
  742. if (!$BankUserName || $BankUserName == 'undefined') {
  743. return apiReturnFail(['web.bank.username_empty', 'The name cannot be empty']);
  744. }
  745. $redisKey = 'withDrawInfo_withDrawInfo_' . $UserID;
  746. if (!SetNXLock::getExclusiveLock($redisKey)) {
  747. return apiReturnFail(['web.bank.try_again_later', 'Please try again later']);
  748. }
  749. if (!$UserID) {
  750. Log::info('miss UserID', $request->all());
  751. SetNXLock::release($redisKey);
  752. return apiReturnFail(['web.bank.missing_userid', 'params error']);
  753. }
  754. $data = compact('BankUserName', 'PhoneNumber', 'EmailAddress');
  755. foreach ($data as $key => &$val) {
  756. $data[$key] = trim($val);
  757. if(empty($val))unset($data[$key]);
  758. }
  759. unset($val);
  760. $AccountWithDrawInfo = DB::table(TableName::QPAccountsDB() . 'AccountWithDrawInfo')
  761. ->lock('WITH(NOLOCK)')
  762. ->where('UserID', $UserID)
  763. ->first();
  764. if (!$AccountWithDrawInfo) {
  765. $data['UserID'] = $UserID;
  766. $data['Achieves'] = 0;
  767. $data['HistoryWithDraw'] = 0;
  768. try {
  769. DB::table(TableName::QPAccountsDB() . 'AccountWithDrawInfo')
  770. ->where('UserID', $UserID)
  771. ->insert($data);
  772. } catch (\Exception $e) {
  773. Log::error('insert AccountWithDrawInfo failed', ['data' => $data]);
  774. }
  775. } else {
  776. DB::table(TableName::QPAccountsDB() . 'AccountWithDrawInfo')
  777. ->where('UserID', $UserID)
  778. ->update($data);
  779. }
  780. SetNXLock::release($redisKey);
  781. return apiReturnSuc();
  782. }
  783. public function withDrawInfoEU(Request $request)
  784. {
  785. // return apiReturnFail('params error');
  786. $user = $request->user();
  787. $UserID=$user->UserID;
  788. // $UserID = $request->input('UserID');
  789. // $RequestDynamicPass = $request->input('DynamicPass');
  790. $PixType = $request->input('cbPixType');
  791. $firstName = Util::filterNickName(urldecode($request->input('firstName')));
  792. $lastName = Util::filterNickName(urldecode($request->input('lastName')));
  793. // 原始代码
  794. $BankUserName = $firstName.'|'.$lastName;
  795. $BankNO = $request->input('account');
  796. $AccountsBank = $request->input('account');
  797. $PhoneNumber = $request->input('phone');
  798. $EmailAddress = $request->input('email');
  799. $IFSCNumber = $request->input('IFSCNumber');
  800. $BranchBank = $request->input('bank');//银行编号
  801. $PixNum = $request->input('account');
  802. Util::WriteLog("euwithdraw",$request->all());
  803. if(isset($EmailAddress)&&!empty($EmailAddress)){
  804. $validator = Validator::make(
  805. ['email' => $EmailAddress],
  806. ['email' => 'required|email']
  807. );
  808. if ($validator->fails()) {
  809. return apiReturnFail(['web.user.email_fail','Wrong email format']);
  810. }
  811. }
  812. if (!$AccountsBank || $AccountsBank == 'undefined') {
  813. return apiReturnFail(['web.bank.account_empty', 'The bank account cannot be empty']);
  814. }
  815. if (!(strlen($AccountsBank) == 16 || strlen($AccountsBank) == 18)) {
  816. return apiReturnFail(['web.bank.account_invalid_length', 'The bank number must have 16 or 18 digits']);
  817. }
  818. if (!(strlen($IFSCNumber) == 18 && $IFSCNumber)) {
  819. return apiReturnFail(['web.bank.clabe_invalid_length', 'The Clabe number must have 18 digits']);
  820. }
  821. if (!$BankUserName || $BankUserName == 'undefined') {
  822. return apiReturnFail(['web.bank.username_empty', 'The name cannot be empty']);
  823. }
  824. if (!$BranchBank || $BranchBank == 'undefined') {
  825. return apiReturnFail(['web.bank.branch_empty', 'The branch code cannot be empty']);
  826. }
  827. if (strlen($AccountsBank) == 16) {
  828. $PixType = 2;
  829. }
  830. if (strlen($AccountsBank) == 18) {
  831. $PixType = 1;
  832. }
  833. $redisKey = 'withDrawInfo_withDrawInfo_' . $UserID;
  834. if (!SetNXLock::getExclusiveLock($redisKey)) {
  835. return apiReturnFail(['web.bank.try_again_later', 'Please try again later']);
  836. }
  837. if (!$UserID) {
  838. Log::info('miss UserID', $request->all());
  839. SetNXLock::release($redisKey);
  840. return apiReturnFail(['web.bank.missing_userid', 'params error']);
  841. }
  842. if (empty($PixType)) {
  843. SetNXLock::release($redisKey);
  844. return apiReturnFail(['web.bank.pix_type_missing', 'The PIX type is missing']);
  845. }
  846. // 验证PixNum绑定次数
  847. if (!empty($PixNum)) {
  848. $BindCount = DB::table(TableName::QPRecordDB() . 'RecordBankCardBind')
  849. ->where('BankCard', $PixNum)
  850. ->lock('WITH(NOLOCK)')
  851. ->count();
  852. if ($BindCount >= 3) {
  853. SetNXLock::release($redisKey);
  854. return apiReturnFail(['web.bank.cpf_used_multiple_times', 'The CPF number has been used multiple times and cannot be saved'], [], 302);
  855. }
  856. }
  857. // 验证玩家信息
  858. if (!empty($user->InsurePass)&&!Hash::check($paypass,$user->InsurePass)) {
  859. return apiReturnFail(['web.user.paypass_fail', 'A senha original está errada, digite-a novamente.'], '', 2);
  860. }
  861. if ($PixType < 10 && false) {
  862. $data = compact('PixType', 'BankUserName', 'PhoneNumber', 'EmailAddress', 'PixNum');
  863. } else {
  864. $data = compact('PixType', 'BankUserName','IFSCNumber', 'PhoneNumber', 'EmailAddress','BankNO', 'AccountsBank','BranchBank','PixNum');
  865. $PixNum = $BankNO;
  866. }
  867. foreach ($data as $key => &$val) {
  868. $data[$key] = trim($val);
  869. }
  870. unset($val);
  871. $AccountWithDrawInfo = DB::table(TableName::QPAccountsDB() . 'AccountWithDrawInfo')
  872. ->lock('WITH(NOLOCK)')
  873. ->where('UserID', $UserID)
  874. ->first();
  875. if (!$AccountWithDrawInfo) {
  876. $data['UserID'] = $UserID;
  877. $data['Achieves'] = 0;
  878. $data['HistoryWithDraw'] = 0;
  879. try {
  880. DB::table(TableName::QPAccountsDB() . 'AccountWithDrawInfo')
  881. ->where('UserID', $UserID)
  882. ->insert($data);
  883. } catch (\Exception $e) {
  884. Log::error('insert AccountWithDrawInfo failed', ['data' => $data]);
  885. }
  886. } else {
  887. DB::table(TableName::QPAccountsDB() . 'AccountWithDrawInfo')
  888. ->where('UserID', $UserID)
  889. ->update($data);
  890. }
  891. // 添加绑定记录
  892. if (empty($AccountWithDrawInfo->PixNum) || $AccountWithDrawInfo->PixNum != $PixNum) {
  893. try {
  894. DB::table(TableName::QPRecordDB() . 'RecordBankCardBind')
  895. ->insert([
  896. 'UserID' => $UserID,
  897. 'BankCard' => $PixNum ?: '',
  898. 'BindDate' => now()
  899. ]);
  900. } catch (\Exception $e) {
  901. Log::error('insert RecordBankCardBind failed', ['data' => $data]);
  902. }
  903. }
  904. SetNXLock::release($redisKey);
  905. return apiReturnSuc();
  906. }
  907. // 获取提现信息
  908. public function getWithDrawInfo(Request $request)
  909. {
  910. // $UserID = (int)$request->globalUser->UserID;//$request->input('UserID');
  911. $user = $request->user();
  912. $UserID=$user->UserID;
  913. // $paypass = $request->input('paypass');
  914. // if (!empty($user->InsurePass)&&!Hash::check($paypass,$user->InsurePass)) {
  915. // return apiReturnFail(['web.user.paypass_fail', 'A senha original está errada, digite-a novamente.'], '', 2);
  916. // }
  917. $info = DB::table(TableName::QPAccountsDB() . 'AccountWithDrawInfo')
  918. ->where('UserID', $UserID)
  919. ->lock('WITH(NOLOCK)')
  920. ->first();
  921. if (!$info) { // 赋值 -- 避免客户端报错
  922. $info = [
  923. // 'BankNO' => '',
  924. // 'AccountsBank' => '',
  925. 'BankUserName' => '',
  926. // 'PhoneNumber' => '',
  927. // 'IFSCNumber' => '',
  928. 'EmailAddress' => '',
  929. // 'Achieves' => '',
  930. // 'PANNumber' => '',
  931. // 'AdhaarNumber' => '',
  932. // 'BranchBank' => '',
  933. 'PixNum' => '',
  934. 'PixType' => '',
  935. ];
  936. }
  937. $info = json_decode(json_encode($info),true);
  938. if(env('REGION_24680')=='na-mexico') {
  939. $info['bank_list'] = config('games.mex_bank_list');
  940. }else if(env('REGION_24680')=='eu-russian') {
  941. $info['bank_list'] = config('games.ru_bank_list');
  942. }
  943. // 获取绑定手机号
  944. $phone = DB::table(TableName::QPAccountsDB() . 'AccountPhone')->where('UserID', $UserID)->value('PhoneNum');
  945. if ($phone) {
  946. // 简单脱敏处理,例如:5511******88
  947. $info['bind_phone'] = substr($phone, 0, 4) . '****' . substr($phone, -2);
  948. } else {
  949. $info['bind_phone'] = '';
  950. }
  951. $AccountsInfoModel = new AccountsInfo();
  952. $total = $AccountsInfoModel->accountTotalStatistics([$UserID]);
  953. $totalRecharge= @$total[0]->Recharge ?? 0;
  954. $info['total_recharge'] = intval($totalRecharge);
  955. $info['withdraw_level'] = env('MIN_RECHARGE',20);
  956. $hasSuccessWithdraw = DB::table('QPAccountsDB.dbo.OrderWithDraw')
  957. ->lock('WITH(NOLOCK)')
  958. ->where('UserID', $UserID)
  959. ->where('State', 2)
  960. ->exists();
  961. $info['has_success_withdraw'] = $hasSuccessWithdraw;
  962. return apiReturnSuc(compact('info'));
  963. }
  964. }