PayRechargeController.php 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113
  1. <?php
  2. namespace App\Http\Controllers\Game;
  3. use App\Facade\TableName;
  4. use App\Game\GlobalUserInfo;
  5. use App\Game\Services\OuroGameService;
  6. use App\Http\Controllers\Controller;
  7. use App\Http\helper\NumConfig;
  8. use App\Models\Order;
  9. use App\Services\OrderServices;
  10. use App\Utility\SetNXLock;
  11. use App\Util;
  12. use Illuminate\Http\Request;
  13. use Illuminate\Support\Facades\App;
  14. use Illuminate\Support\Facades\DB;
  15. use Illuminate\Support\Facades\Redis;
  16. class PayRechargeController extends Controller
  17. {
  18. /**
  19. * 设置用户语言环境
  20. */
  21. private function setUserLocale($request)
  22. {
  23. $user = $request->user();
  24. if ($user) {
  25. $locale = GlobalUserInfo::getLocaleByUserID($user->UserID, 'en');
  26. App::setLocale($locale);
  27. }
  28. }
  29. // 充值记录
  30. public function orderList(Request $request)
  31. {
  32. $user_id = (int)$request->globalUser->UserID;//$request->get('user_id', 1);
  33. $page = $request->get('page', 1);
  34. $pageSize = $request->get('pageSize', 7);
  35. $redisKey = 'PayRecharge_orderList_'.$user_id;
  36. if (!SetNXLock::getExclusiveLock($redisKey)) {
  37. return apiReturnFail(['web.withdraw.try_again_later','Tente novamente mais tarde']);
  38. }
  39. $where[] = ['user_id', $user_id];
  40. $where[] = ['pay_status', 1];
  41. $cacheTime = 60 * rand(1, 2);
  42. // $list = cache()->remember($user_id . '_order_list', $cacheTime, function () use ($where, $pageSize) {
  43. //
  44. // return Order::where($where)
  45. // ->orderBy('finished_at', 'desc')
  46. // ->selectRaw('amount,payment_code,order_sn as payment_sn,finished_at,created_at,pay_status')
  47. // ->paginate(15,['*'],'page',1);
  48. // });
  49. $list = Order::query()->where($where)
  50. ->orderBy('finished_at', 'desc')
  51. ->selectRaw('amount,payment_code,order_sn as payment_sn,finished_at,created_at,pay_status,type')
  52. ->paginate($pageSize);
  53. // ->paginate(15,['*'],'page',1);
  54. foreach ($list as &$val) {
  55. $val->amount = number_format($val->amount, 2, '.', '');
  56. }
  57. SetNXLock::release($redisKey);
  58. return apiReturnSuc($list);
  59. }
  60. // 首充
  61. public function firstPay(Request $request)
  62. {
  63. $user = $request->user();
  64. $user_recharge = DB::table(TableName::QPAccountsDB() . 'YN_VIPAccount')
  65. ->where('UserID', $user->UserID)
  66. ->value('Recharge') ?: 0;
  67. if($user_recharge)return apiReturnSuc();
  68. $firstPayGift = DB::table('agent.dbo.recharge_gift')
  69. ->where('gift_id', 301)->first();
  70. if(!$firstPayGift) return apiReturnFail();
  71. $names = DB::table('agent.dbo.admin_configs')
  72. ->where([
  73. 'type' => 'pay_method',
  74. 'status' => 1,
  75. ])
  76. ->selectRaw('id, name, status, new_pay_type as type')
  77. ->orderByDesc('sort')->get()->toArray();
  78. $list = DB::table('agent.dbo.recharge_gear')
  79. ->select('id','money','favorable_price','give')
  80. ->orderBy('money', 'asc')->where('status', 1)->get();
  81. $gear = Util::filterGearByDevice(\GuzzleHttp\json_encode($names));
  82. foreach ($list as &$val) {
  83. $val->favorable_price = $val->favorable_price + $val->give;
  84. $val->gear = $gear;
  85. $val->recommend = 0;
  86. if($val->money == $firstPayGift->recommend){
  87. $val->recommend = 1;
  88. }
  89. }
  90. return apiReturnSuc(compact('list', 'firstPayGift'));
  91. }
  92. // 首充礼包(带倒计时逻辑)
  93. public function firstPayGift(Request $request)
  94. {
  95. $user = $request->user();
  96. $this->setUserLocale($request);
  97. // 获取礼包配置
  98. $giftConfig = DB::table('agent.dbo.recharge_gift')
  99. ->where('gift_id', 301)
  100. ->first();
  101. if (!$giftConfig) {
  102. return apiReturnFail(['web.gift.config_not_exists', __('web.gift.config_not_exists')]);
  103. }
  104. // 检查用户是否购买了首充礼包
  105. $giftRecord = DB::table('agent.dbo.first_pay_gift_records')
  106. ->where('user_id', $user->UserID)
  107. ->first();
  108. // ========== 未购买礼包:返回充值列表 + 礼包配置 + 倒计时 ==========
  109. if (!$giftRecord) {
  110. // 获取充值档位列表
  111. $list = DB::table('agent.dbo.recharge_gear')
  112. ->select('money', 'favorable_price', 'give', 'gear')
  113. ->orderBy('money', 'asc')
  114. ->where('status', 1)
  115. ->where('in_shop', 1)
  116. ->get();
  117. foreach ($list as &$val) {
  118. $val->favorable_price = $val->favorable_price + $val->give;
  119. $val->recommend = 0;
  120. if ($val->money == $giftConfig->recommend) {
  121. $val->recommend = 1;
  122. }
  123. if (!empty($val->gear)) {
  124. $val->gear = Util::filterGearByDevice($val->gear);
  125. }
  126. }
  127. // ========== 处理倒计时逻辑(仅未购买时) ==========
  128. $redisKey = "first_pay_gift_timer_{$user->UserID}";
  129. $currentTime = time();
  130. $timeLeft = 0;
  131. $timerData = Redis::get($redisKey);
  132. if ($timerData) {
  133. $timerData = json_decode($timerData, true);
  134. $firstRequestTime = $timerData['first_request_time'];
  135. $phase = $timerData['phase'];
  136. // 阶段1:valid_h倒计时
  137. if ($phase === 'first') {
  138. $expireTime = $firstRequestTime + ($giftConfig->valid_h * 3600);
  139. if ($currentTime >= $expireTime) {
  140. $expireDate = date('Y-m-d', $expireTime);
  141. $currentDate = date('Y-m-d', $currentTime);
  142. if ($expireDate !== $currentDate) {
  143. // 进入阶段2
  144. $nextDayStart = time();
  145. $newExpireTime = $nextDayStart + ($giftConfig->valid_h_2 * 3600);
  146. $newTimerData = [
  147. 'first_request_time' => $firstRequestTime,
  148. 'phase' => 'daily',
  149. 'current_cycle_start' => $nextDayStart,
  150. 'last_expire_time' => $newExpireTime
  151. ];
  152. Redis::set($redisKey, json_encode($newTimerData));
  153. $timeLeft = max(0, $newExpireTime - $currentTime);
  154. }
  155. } else {
  156. $timeLeft = $expireTime - $currentTime;
  157. }
  158. }
  159. // 阶段2:每日循环
  160. elseif ($phase === 'daily') {
  161. $currentCycleStart = $timerData['current_cycle_start'];
  162. $expireTime = $currentCycleStart + ($giftConfig->valid_h_2 * 3600);
  163. if ($currentTime >= $expireTime) {
  164. $expireDate = date('Y-m-d', $expireTime);
  165. $currentDate = date('Y-m-d', $currentTime);
  166. if ($expireDate !== $currentDate) {
  167. $todayStart = time();
  168. $newExpireTime = $todayStart + ($giftConfig->valid_h_2 * 3600);
  169. $newTimerData = [
  170. 'first_request_time' => $firstRequestTime,
  171. 'phase' => 'daily',
  172. 'current_cycle_start' => $todayStart,
  173. 'last_expire_time' => $newExpireTime
  174. ];
  175. Redis::set($redisKey, json_encode($newTimerData));
  176. $timeLeft = max(0, $newExpireTime - $currentTime);
  177. }
  178. } else {
  179. $timeLeft = $expireTime - $currentTime;
  180. }
  181. }
  182. } else {
  183. // 首次请求,初始化倒计时
  184. $expireTime = $currentTime + ($giftConfig->valid_h * 3600);
  185. $timerData = [
  186. 'first_request_time' => $currentTime,
  187. 'phase' => 'first',
  188. 'last_expire_time' => $expireTime
  189. ];
  190. Redis::set($redisKey, json_encode($timerData));
  191. $timeLeft = $giftConfig->valid_h * 3600;
  192. }
  193. return apiReturnSuc([
  194. 'has_purchased' => false, // 未购买标记
  195. 'list' => $list, // 充值档位列表
  196. 'gift_info' => [
  197. 'gift_id' => $giftConfig->gift_id,
  198. 'gift_name' => $giftConfig->gift_name,
  199. 'total_bonus' => $giftConfig->total_bonus,
  200. 'bonus_instantly' => $giftConfig->bonus_instantly,
  201. 'day_rewards' => $giftConfig->day_rewards ? json_decode($giftConfig->day_rewards) : null,
  202. 'betting_bonus' => $giftConfig->betting_bonus ? json_decode($giftConfig->betting_bonus) : null,
  203. 'betting_task' => $giftConfig->betting_task ? json_decode($giftConfig->betting_task) : null,
  204. ],
  205. 'time_left' => $timeLeft, // ✅ 倒计时(未购买时展示)
  206. 'expire_at' => time() + $timeLeft // ✅ 过期时间戳
  207. ]);
  208. }
  209. // ========== 已购买礼包:返回任务进度(无倒计时) ==========
  210. // 获取用户当前累计下注次数(从RecordUserGameCount表)
  211. $currentTotalBetCount = DB::table(TableName::QPRecordDB() . 'RecordUserGameCount')
  212. ->where('UserID', $user->UserID)
  213. ->sum('Cnt') ?? 0;
  214. // 获取用户当前累计下注金额(从统计表,用于下注任务)
  215. $userStats = DB::table('QPRecordDB.dbo.RecordUserTotalStatistics')
  216. ->where('UserID', $user->UserID)
  217. ->first();
  218. $currentTotalBetAmount = $userStats->TotalBet ?? 0;
  219. // 更新下注进度到礼包记录(betting_current_bet存储下注次数,用于下注奖励)
  220. DB::table('agent.dbo.first_pay_gift_records')
  221. ->where('user_id', $user->UserID)
  222. ->update([
  223. 'betting_current_bet' => $currentTotalBetCount,
  224. 'updated_at' => date('Y-m-d H:i:s')
  225. ]);
  226. // 重新获取最新记录
  227. $giftRecord = DB::table('agent.dbo.first_pay_gift_records')
  228. ->where('user_id', $user->UserID)
  229. ->first();
  230. // 解析任务数据
  231. $dayRewardsData = $giftRecord->day_rewards_data ? json_decode($giftRecord->day_rewards_data, true) : null;
  232. $bettingBonusData = $giftRecord->betting_bonus_data ? json_decode($giftRecord->betting_bonus_data, true) : null;
  233. $bettingTaskData = $giftRecord->betting_task_data ? json_decode($giftRecord->betting_task_data, true) : null;
  234. // 计算当前是购买后的第几天(所有任务都需要用到)
  235. $purchaseDate = date('Y-m-d', strtotime($giftRecord->created_at));
  236. $today = date('Y-m-d');
  237. $daysPassed = floor((strtotime($today) - strtotime($purchaseDate)) / 86400);
  238. // 构建返回数据
  239. $giftInfo = [
  240. 'gift_id' => $giftRecord->gift_id,
  241. 'gift_name' => $giftRecord->gift_name,
  242. 'total_bonus' => (float)$giftRecord->total_bonus,
  243. 'bonus_instantly' => (float)$giftRecord->bonus_instantly,
  244. 'pay_amount' => (float)$giftRecord->pay_amount,
  245. ];
  246. // 每日奖励进度
  247. if ($dayRewardsData) {
  248. $startDay = $dayRewardsData['start_day'] ?? 1;
  249. $bonusDay = $dayRewardsData['bonus_day'] ?? 0;
  250. $claimedDays = $giftRecord->day_rewards_claimed;
  251. // $startDay = $startDay-1;
  252. // 判断每日奖励状态
  253. // 0=不可领取, 1=可领取, 2=已领取, 3=过期
  254. $dayRewardStatus = 0; // 默认不可领取
  255. // 检查是否过期(购买后7天)
  256. if ($daysPassed >= 7) {
  257. $dayRewardStatus = 3; // 过期
  258. } elseif ($daysPassed >= $startDay-1) {
  259. // 计算今天是第几个奖励日(从起始天数开始)
  260. $rewardIndex = $daysPassed - ($startDay-1);
  261. if ($rewardIndex < $bonusDay) {
  262. // 在奖励期内
  263. if ($claimedDays > $rewardIndex) {
  264. $dayRewardStatus = 2; // 已领取
  265. } else {
  266. // 即便前几天漏领,后续奖励仍可继续领取(漏掉的视为作废)
  267. $dayRewardStatus = 1; // 可领取
  268. }
  269. } else {
  270. // 超过奖励天数
  271. $dayRewardStatus = 2; // 已领取完
  272. }
  273. }
  274. $giftInfo['day_rewards'] = [
  275. 'total_bonus' => (float)$giftRecord->day_rewards_total,
  276. 'bonus_day' => $bonusDay,
  277. 'start_day' => $startDay,
  278. 'bonus' => $dayRewardsData['bonus'] ?? [],
  279. 'claimed_days' => $claimedDays,
  280. 'progress' => $claimedDays . '/' . $bonusDay,
  281. 'status' => $dayRewardStatus, // 0=不可领取, 1=可领取, 2=已领取, 3=过期
  282. 'status_text' => ['不可领取', '可领取', '已领取', '过期'][$dayRewardStatus] ?? '未知'
  283. ];
  284. }
  285. // 下注奖励进度(使用下注次数)
  286. if ($bettingBonusData) {
  287. $perBet = $bettingBonusData['per_bet'] ?? 100; // 每次下注次数要求
  288. $perBetBonus = $bettingBonusData['per_bet_bonus'] ?? 2; // 每次奖励金额(不是百分比)
  289. $currentBetCount = $giftRecord->betting_current_bet; // 当前累计下注次数
  290. $totalBonusLimit = $giftRecord->betting_bonus_total; // 总奖励上限
  291. $claimedAmount = $giftRecord->betting_bonus_claimed; // 已领取金额
  292. $remainingBonus = $totalBonusLimit - $claimedAmount; // 剩余可领取金额
  293. // 每次可领取的金额(直接使用配置的值,不是百分比计算)
  294. $perReward = (float)$perBetBonus;
  295. // 根据当前下注次数计算已达成的次数
  296. $completedTimes = floor($currentBetCount / $perBet);
  297. // 已领取的次数
  298. $claimedTimes = $claimedAmount > 0 ? floor($claimedAmount / $perReward) : 0;
  299. // 当前可领取次数(但不能超过剩余总额)
  300. $canClaimTimes = $completedTimes - $claimedTimes;
  301. $maxCanClaimTimes = floor($remainingBonus / $perReward); // 剩余总额最多可领次数
  302. $canClaimTimes = min($canClaimTimes, $maxCanClaimTimes);
  303. // 当前可领取金额
  304. $canClaimAmount = min($canClaimTimes * $perReward, $remainingBonus);
  305. // 计算下次领取需要的下注次数
  306. $nextClaimBet = 0;
  307. if ($remainingBonus > 0 && $canClaimTimes == 0) {
  308. // 还有剩余奖励但当前不能领取,计算还需下注多少次
  309. $nextClaimBet = ($claimedTimes + 1) * $perBet - $currentBetCount;
  310. }
  311. // 判断下注奖励状态
  312. // 0=不可领取(可领取金额为0), 1=可领取, 2=已领取(所有奖励都领完), 3=过期
  313. $bettingBonusStatus = 0; // 默认不可领取
  314. // 检查是否过期(购买后7天)
  315. if ($daysPassed >= 7) {
  316. $bettingBonusStatus = 3; // 过期
  317. } elseif ($remainingBonus <= 0) {
  318. $bettingBonusStatus = 2; // 已领取完
  319. } elseif ($canClaimAmount > 0) {
  320. $bettingBonusStatus = 1; // 可领取
  321. } else {
  322. $bettingBonusStatus = 0; // 不可领取(下注次数不足)
  323. }
  324. $giftInfo['betting_bonus'] = [
  325. 'total_bonus' => (float)$totalBonusLimit, // 总奖励上限
  326. 'per_bet' => $perBet, // 每次下注次数要求
  327. 'per_bet_bonus' => $perReward, // 每次奖励金额(实际金额)
  328. // 'per_reward' => $perReward, // 每次奖励金额(保持兼容)
  329. 'current_bet' => (float)$currentBetCount, // 当前累计下注次数
  330. 'claimed_amount' => (float)$claimedAmount, // 已领取金额
  331. 'remaining_bonus' => (float)$remainingBonus, // 剩余可领金额
  332. 'can_claim_amount' => (float)$canClaimAmount, // 当前可领取金额
  333. 'can_claim_times' => max(0, $canClaimTimes), // 当前可领取次数
  334. 'next_claim_bet' => max(0, $nextClaimBet), // 下次领取还需下注次数
  335. 'progress' => round($currentBetCount, 0) . '/' . round($claimedTimes * $perBet + $perBet, 0), // 当前进度/下次领取目标(次数)
  336. 'status' => $bettingBonusStatus, // 0=不可领取, 1=可领取, 2=已领取, 3=过期
  337. 'status_text' => ['不可领取', '可领取', '已领取', '过期'][$bettingBonusStatus] ?? '未知'
  338. ];
  339. }
  340. // 下注任务进度(使用下注金额)
  341. if ($bettingTaskData) {
  342. $betPayTimes = $bettingTaskData['bet_pay_times'] ?? 60;
  343. $requiredBet = $giftRecord->pay_amount * $betPayTimes;
  344. $currentProgress = $currentTotalBetAmount / NumConfig::NUM_VALUE; // 使用下注金额,不是次数
  345. $taskCompleted = $currentProgress >= $requiredBet;
  346. $isClaimed = $giftRecord->betting_task_claimed == 1;
  347. // 判断下注任务状态
  348. // 0=不可领取, 1=可领取, 2=已领取, 3=过期
  349. $bettingTaskStatus = 0; // 默认不可领取
  350. // 检查是否过期(购买后7天)
  351. if ($daysPassed >= 7) {
  352. $bettingTaskStatus = 3; // 过期
  353. } elseif ($isClaimed) {
  354. $bettingTaskStatus = 2; // 已领取
  355. } elseif ($taskCompleted) {
  356. $bettingTaskStatus = 1; // 可领取(任务完成且未领取)
  357. } else {
  358. $bettingTaskStatus = 0; // 不可领取(任务未完成)
  359. }
  360. $giftInfo['betting_task'] = [
  361. 'total_bonus' => (float)$giftRecord->betting_task_total,
  362. 'bet_pay_times' => $betPayTimes,
  363. 'required_bet' => $requiredBet, // 需要下注的金额
  364. 'current_bet' => (float)$currentProgress, // 当前累计下注
  365. 'progress' => round($currentProgress, 2) . '/' . $requiredBet,
  366. 'status' => $bettingTaskStatus, // 0=不可领取, 1=可领取, 2=已领取, 3=过期
  367. 'status_text' => ['不可领取', '可领取', '已领取', '过期'][$bettingTaskStatus] ?? '未知'
  368. ];
  369. }
  370. $giftInfo['expired'] = strtotime($giftRecord->created_at)+86400*7;
  371. return apiReturnSuc([
  372. 'has_purchased' => true, // 已购买标记
  373. 'gift_info' => $giftInfo
  374. // ✅ 已购买用户不返回倒计时
  375. ]);
  376. }
  377. /**
  378. * 领取首充礼包奖励
  379. */
  380. public function claimFirstPayGiftReward(Request $request)
  381. {
  382. $user = $request->user();
  383. $userId = $user->UserID;
  384. $rewardType = $request->input('reward_type'); // 'day_reward', 'betting_bonus', 'betting_task'
  385. $this->setUserLocale($request);
  386. // 获取礼包记录
  387. $giftRecord = DB::table('agent.dbo.first_pay_gift_records')
  388. ->where('user_id', $userId)
  389. ->first();
  390. if (!$giftRecord) {
  391. return apiReturnFail(['web.gift.not_purchased', __('web.gift.not_purchased')]);
  392. }
  393. $rewardAmount = 0;
  394. try {
  395. // 每日奖励领取
  396. if ($rewardType === 'day_reward') {
  397. $dayRewardsData = json_decode($giftRecord->day_rewards_data, true);
  398. if (!$dayRewardsData) {
  399. return apiReturnFail(['web.gift.no_day_rewards_config', __('web.gift.no_day_rewards_config')]);
  400. }
  401. $bonusDay = $dayRewardsData['bonus_day'] ?? 0;
  402. $startDay = $dayRewardsData['start_day'] ?? 1;
  403. $bonusArray = $dayRewardsData['bonus'] ?? [];
  404. $claimedDays = $giftRecord->day_rewards_claimed;
  405. // 检查是否还有可领取的天数
  406. if ($claimedDays >= $bonusDay) {
  407. return apiReturnFail(['web.gift.day_rewards_all_claimed', __('web.gift.day_rewards_all_claimed')]);
  408. }
  409. // 计算当前是购买后的第几天
  410. $purchaseDate = date('Y-m-d', strtotime($giftRecord->created_at));
  411. $currentDate = date('Y-m-d');
  412. $daysPassed = floor((strtotime($currentDate) - strtotime($purchaseDate)) / 86400);
  413. // 检查是否到了可以领取的天数(从第start_day天开始)
  414. if ($daysPassed < $startDay-1) {
  415. return apiReturnFail(['web.gift.day_rewards_not_time', str_replace(':day', $startDay, __('web.gift.day_rewards_not_time'))]);
  416. }
  417. // 计算今天应该领取第几天的奖励
  418. // 例如:start_day=2,今天是第3天,应该领取第1个奖励(索引0)
  419. $todayRewardIndex = $daysPassed - ($startDay-1);
  420. // 检查是否超过奖励天数
  421. if ($todayRewardIndex >= $bonusDay) {
  422. return apiReturnFail(['web.gift.day_rewards_expired', __('web.gift.day_rewards_expired')]);
  423. }
  424. // 检查今天是否已领取
  425. $lastClaimDate = $giftRecord->day_last_claim_date;
  426. if ($lastClaimDate && $lastClaimDate === $currentDate) {
  427. return apiReturnFail(['web.gift.day_rewards_claimed_today', __('web.gift.day_rewards_claimed_today')]);
  428. }
  429. // 检查是否跳过了某些天(过期不补领)
  430. // 如果今天应该领第5天的奖励,但用户只领了3天,那就直接领第5天的
  431. if ($todayRewardIndex > $claimedDays) {
  432. // 跳过了一些天,更新已领取天数为今天的索引
  433. $claimedDays = $todayRewardIndex;
  434. }
  435. // 计算今天可领取的奖励(使用todayRewardIndex作为索引)
  436. $todayBonusPercent = $bonusArray[$todayRewardIndex] ?? 0;
  437. $rewardAmount = round($giftRecord->pay_amount * $todayBonusPercent / 100, 2);
  438. // 更新记录
  439. DB::table('agent.dbo.first_pay_gift_records')
  440. ->where('user_id', $userId)
  441. ->update([
  442. 'day_rewards_claimed' => $todayRewardIndex + 1, // 已领取到第几天(索引+1)
  443. 'day_last_claim_date' => $currentDate,
  444. 'updated_at' => date('Y-m-d H:i:s')
  445. ]);
  446. }
  447. // 下注奖励领取(使用下注次数)
  448. elseif ($rewardType === 'betting_bonus') {
  449. $bettingBonusData = json_decode($giftRecord->betting_bonus_data, true);
  450. if (!$bettingBonusData) {
  451. return apiReturnFail(['web.gift.no_betting_bonus_config', __('web.gift.no_betting_bonus_config')]);
  452. }
  453. // 检查是否过期(购买后7天)
  454. $purchaseDate = date('Y-m-d', strtotime($giftRecord->created_at));
  455. $currentDate = date('Y-m-d');
  456. $daysPassed = floor((strtotime($currentDate) - strtotime($purchaseDate)) / 86400);
  457. if ($daysPassed >= 7) {
  458. return apiReturnFail(['web.gift.betting_bonus_expired', __('web.gift.betting_bonus_expired')]);
  459. }
  460. // 获取最新的下注次数
  461. $currentBetCount = DB::table(TableName::QPRecordDB() . 'RecordUserGameCount')
  462. ->where('UserID', $userId)
  463. ->sum('Cnt') ?? 0;
  464. $perBet = $bettingBonusData['per_bet'] ?? 100; // 每次下注次数要求
  465. $perBetBonus = $bettingBonusData['per_bet_bonus'] ?? 2; // 每次奖励金额(不是百分比)
  466. $totalBonusLimit = $giftRecord->betting_bonus_total; // 总奖励上限
  467. $claimedAmount = $giftRecord->betting_bonus_claimed; // 已领取金额
  468. $remainingBonus = $totalBonusLimit - $claimedAmount; // 剩余可领金额
  469. // 检查是否还有剩余奖励
  470. if ($remainingBonus <= 0) {
  471. return apiReturnFail(['web.gift.betting_bonus_all_claimed', __('web.gift.betting_bonus_all_claimed')]);
  472. }
  473. // 每次可领取的金额(直接使用配置的值,不是百分比计算)
  474. $perReward = (float)$perBetBonus;
  475. // 根据当前下注次数计算已达成的次数
  476. $completedTimes = floor($currentBetCount / $perBet);
  477. // 已领取的次数
  478. $claimedTimes = $claimedAmount > 0 ? floor($claimedAmount / $perReward) : 0;
  479. // 可领取次数(下注达成的次数 - 已领取次数)
  480. $canClaimTimes = $completedTimes - $claimedTimes;
  481. // 检查是否可以领取
  482. if ($canClaimTimes <= 0) {
  483. $neededBets = (($claimedTimes + 1) * $perBet - $currentBetCount);
  484. return apiReturnFail(['web.gift.betting_bonus_insufficient', str_replace(':times', $neededBets, __('web.gift.betting_bonus_insufficient'))]);
  485. }
  486. // ✅ 一次性领取所有已达成的奖励(但不能超过剩余总额)
  487. $totalCanClaimAmount = $canClaimTimes * $perReward; // 理论可领取总额
  488. $rewardAmount = min($totalCanClaimAmount, $remainingBonus); // 实际领取金额(不超过剩余总额)
  489. $actualClaimTimes = floor($rewardAmount / $perReward); // 实际领取次数
  490. // 更新记录(同时更新下注次数)
  491. DB::table('agent.dbo.first_pay_gift_records')
  492. ->where('user_id', $userId)
  493. ->update([
  494. 'betting_bonus_claimed' => $giftRecord->betting_bonus_claimed + $rewardAmount,
  495. 'betting_current_bet' => $currentBetCount, // 更新最新下注次数
  496. 'updated_at' => date('Y-m-d H:i:s')
  497. ]);
  498. \Log::info('下注奖励领取', [
  499. 'user_id' => $userId,
  500. 'can_claim_times' => $canClaimTimes,
  501. 'actual_claim_times' => $actualClaimTimes,
  502. 'reward_amount' => $rewardAmount
  503. ]);
  504. }
  505. // 下注任务领取(使用下注金额)
  506. elseif ($rewardType === 'betting_task') {
  507. if ($giftRecord->betting_task_claimed == 1) {
  508. return apiReturnFail(['web.gift.betting_task_claimed', __('web.gift.betting_task_claimed')]);
  509. }
  510. $bettingTaskData = json_decode($giftRecord->betting_task_data, true);
  511. if (!$bettingTaskData) {
  512. return apiReturnFail(['web.gift.no_betting_task_config', __('web.gift.no_betting_task_config')]);
  513. }
  514. // 检查是否过期(购买后7天)
  515. $purchaseDate = date('Y-m-d', strtotime($giftRecord->created_at));
  516. $currentDate = date('Y-m-d');
  517. $daysPassed = floor((strtotime($currentDate) - strtotime($purchaseDate)) / 86400);
  518. if ($daysPassed >= 7) {
  519. return apiReturnFail(['web.gift.betting_task_expired', __('web.gift.betting_task_expired')]);
  520. }
  521. // 获取最新的下注金额
  522. $userStats = DB::table('QPRecordDB.dbo.RecordUserTotalStatistics')
  523. ->where('UserID', $userId)
  524. ->first();
  525. $currentBetAmount = ($userStats->TotalBet ?? 0) / NumConfig::NUM_VALUE;
  526. $betPayTimes = $bettingTaskData['bet_pay_times'] ?? 60;
  527. $requiredBet = $giftRecord->pay_amount * $betPayTimes;
  528. if ($currentBetAmount < $requiredBet) {
  529. return apiReturnFail(['web.gift.betting_task_insufficient', str_replace(':amount', $requiredBet, __('web.gift.betting_task_insufficient'))]);
  530. }
  531. $rewardAmount = $giftRecord->betting_task_total;
  532. // 更新记录
  533. DB::table('agent.dbo.first_pay_gift_records')
  534. ->where('user_id', $userId)
  535. ->update([
  536. 'betting_task_claimed' => 1,
  537. 'updated_at' => date('Y-m-d H:i:s')
  538. ]);
  539. }
  540. else {
  541. return apiReturnFail(['web.gift.invalid_reward_type', __('web.gift.invalid_reward_type')]);
  542. }
  543. // 添加奖励到用户账户
  544. if ($rewardAmount > 0) {
  545. OuroGameService::AddScore($userId, $rewardAmount * NumConfig::NUM_VALUE, 52, true); // 52=首充礼包奖励
  546. \Log::info('首充礼包奖励领取', [
  547. 'user_id' => $userId,
  548. 'reward_type' => $rewardType,
  549. 'amount' => $rewardAmount
  550. ]);
  551. }
  552. return apiReturnSuc([
  553. 'amount' => $rewardAmount,
  554. 'message' => str_replace(':amount', $rewardAmount, __('web.gift.claim_success'))
  555. ]);
  556. } catch (\Exception $e) {
  557. \Log::error('首充礼包奖励领取失败', [
  558. 'user_id' => $userId,
  559. 'error' => $e->getMessage()
  560. ]);
  561. return apiReturnFail(['web.gift.claim_failed', str_replace(':error', $e->getMessage(), __('web.gift.claim_failed'))]);
  562. }
  563. }
  564. /**
  565. * 获取首充礼包数据(包含充值档位列表)
  566. * @param $firstPayGift 礼包配置
  567. * @param $timeLeft 剩余秒数(已经是用户实际剩余时间)
  568. */
  569. private function getFirstPayGiftData($firstPayGift, $timeLeft)
  570. {
  571. // 获取支付方式
  572. // $names = DB::table('agent.dbo.admin_configs')
  573. // ->where([
  574. // 'type' => 'pay_method',
  575. // 'status' => 1,
  576. // ])
  577. // ->selectRaw('id, name, status, new_pay_type as type')
  578. // ->orderByDesc('sort')
  579. // ->get()
  580. // ->toArray();
  581. // 获取充值档位
  582. $list = DB::table('agent.dbo.recharge_gear')
  583. ->select('money', 'favorable_price', 'give','gear')
  584. ->orderBy('money', 'asc')
  585. ->where('status', 1)
  586. ->where('in_shop', 1)
  587. ->get();
  588. // $gear = \GuzzleHttp\json_encode($names);
  589. foreach ($list as &$val) {
  590. $val->favorable_price = $val->favorable_price + $val->give;
  591. // $val->gear = $gear;
  592. $val->recommend = 0;
  593. if ($val->money == $firstPayGift->recommend) {
  594. $val->recommend = 1;
  595. }
  596. if (!empty($val->gear)) {
  597. $val->gear = Util::filterGearByDevice($val->gear);
  598. }
  599. }
  600. return apiReturnSuc([
  601. 'list' => $list,
  602. 'gift_info' => [
  603. 'gift_id' => $firstPayGift->gift_id,
  604. 'gift_name' => $firstPayGift->gift_name,
  605. 'total_bonus' => $firstPayGift->total_bonus,
  606. 'bonus_instantly' => $firstPayGift->bonus_instantly,
  607. 'day_rewards' => $firstPayGift->day_rewards?json_decode($firstPayGift->day_rewards):'',
  608. 'betting_bonus' => $firstPayGift->betting_bonus?json_decode($firstPayGift->betting_bonus):'',
  609. 'betting_task' => $firstPayGift->betting_task?json_decode($firstPayGift->betting_task):'',
  610. ],
  611. 'time_left' => $timeLeft, // 剩余秒数
  612. 'expire_at' => time() + $timeLeft // 过期时间戳
  613. ]);
  614. }
  615. public function firstPayMulti(Request $request)
  616. {
  617. $user = LoginController::checkLogin($request);
  618. if($user){
  619. if(env('CONFIG_24680_NFTD_99',0)==0)if($user->Channel==99)return apiReturnFail();
  620. $fpkey='Firstpay_'.$user->UserID;
  621. if(Redis::exists($fpkey)){
  622. $data=Redis::get($fpkey);
  623. $data=json_decode($data,true);
  624. $data['timeleft']=86400-(time()-$data['buytime']);
  625. return apiReturnSuc(['leftitem'=>$data]);
  626. }
  627. $user_recharge = DB::table(TableName::QPAccountsDB() . 'YN_VIPAccount')
  628. ->where('UserID', $user->UserID)
  629. ->value('Recharge') ?: 0;
  630. if($user_recharge)return apiReturnFail();
  631. }
  632. $items=DB::table('agent.dbo.recharge_gear')
  633. ->where('status',1)
  634. ->where('second_give','>',0)
  635. ->where('first_pay','>=', 1)
  636. ->select('gift_id','money','give','favorable_price','second_give')->get()->each(function($item){
  637. $item->id=28;
  638. })->toArray();
  639. $default=count($items)-1;
  640. return apiReturnSuc(compact('items','default'));
  641. }
  642. // 破产礼包
  643. public function bankruptcyGift(Request $request)
  644. {
  645. $user = $request->user();
  646. $this->setUserLocale($request);
  647. // 判断用户是否充值
  648. $user_recharge = DB::table(TableName::QPAccountsDB() . 'YN_VIPAccount')
  649. ->where('UserID', $user->UserID)
  650. ->value('Recharge') ?: 0;
  651. if ($user_recharge <= 0) {
  652. return apiReturnFail(['web.gift.user_not_recharged', __('web.gift.user_not_recharged')]);
  653. }
  654. // 获取所有破产礼包配置 (gift_id=302)
  655. $bankruptcyGifts = DB::table('agent.dbo.recharge_gift')
  656. ->where('gift_id', 302)
  657. ->get();
  658. if ($bankruptcyGifts->isEmpty()) {
  659. return apiReturnFail(['web.gift.bankruptcy_gift_not_exists', __('web.gift.bankruptcy_gift_not_exists')]);
  660. }
  661. $result = [];
  662. // 遍历每条礼包配置,根据 recommend 关联 recharge_gear
  663. foreach ($bankruptcyGifts as $gift) {
  664. $gear = DB::table('agent.dbo.recharge_gear')
  665. ->select('money', 'favorable_price', 'gear')
  666. ->where('money', $gift->recommend)
  667. ->where('status', 1)
  668. ->first();
  669. if ($gear) {
  670. $gear->gift_id = $gift->gift_id;
  671. $gear->total_bonus = $gift->total_bonus;
  672. $gear->bonus = $gift->total_bonus - 100;
  673. if (!empty($gear->gear)) {
  674. $gear->gear = Util::filterGearByDevice($gear->gear);
  675. }
  676. $result[] = $gear;
  677. }
  678. }
  679. // 按 money 排序
  680. usort($result, function($a, $b) {
  681. return $a->money <=> $b->money;
  682. });
  683. return apiReturnSuc($result);
  684. }
  685. // 每日首充礼包
  686. public function dailyFirstRechargeGift(Request $request)
  687. {
  688. $user = $request->user();
  689. $this->setUserLocale($request);
  690. // 检查用户今日是否已充值(完成任意档位充值后入口消失)
  691. $todayStart = date('Y-m-d') . ' 00:00:00';
  692. $todayEnd = date('Y-m-d') . ' 23:59:59';
  693. $todayRecharge = DB::table('agent.dbo.order')
  694. ->where('user_id', $user->UserID)
  695. ->where('pay_status', 1)
  696. ->where('GiftsID', 303)
  697. ->where('pay_at', '>=', $todayStart)
  698. ->where('pay_at', '<=', $todayEnd)
  699. ->first();
  700. // 如果今日已充值,返回入口消失标记
  701. if ($todayRecharge) {
  702. return apiReturnSuc([
  703. 'has_recharged_today' => true,
  704. 'message' => __('web.gift.recharged_today')
  705. ]);
  706. }
  707. // 获取每日首充礼包配置 (gift_id=303)
  708. $dailyGifts = DB::table('agent.dbo.recharge_gift')
  709. ->where('gift_id', 303)
  710. ->get();
  711. if ($dailyGifts->isEmpty()) {
  712. return apiReturnFail(['web.gift.daily_first_recharge_not_exists', __('web.gift.daily_first_recharge_not_exists')]);
  713. }
  714. $result = [];
  715. // 遍历每条礼包配置,根据 recommend 关联 recharge_gear
  716. foreach ($dailyGifts as $gift) {
  717. $gear = DB::table('agent.dbo.recharge_gear')
  718. ->select('money', 'favorable_price', 'gear', 'give')
  719. ->where('money', $gift->recommend)
  720. ->where('status', 1)
  721. ->first();
  722. if ($gear) {
  723. $gear->gift_id = $gift->gift_id;
  724. $gear->total_bonus = $gift->total_bonus;
  725. $gear->bonus = $gift->total_bonus - 100;
  726. $gear->recommend = $gift->first_pay?1:0;
  727. if (!empty($gear->gear)) {
  728. $gear->gear = Util::filterGearByDevice($gear->gear);
  729. }
  730. $result[] = $gear;
  731. }
  732. }
  733. // 按 money 排序
  734. usort($result, function($a, $b) {
  735. return $a->money <=> $b->money;
  736. });
  737. return apiReturnSuc([
  738. 'has_recharged_today' => false,
  739. 'list' => $result
  740. ]);
  741. }
  742. // 每日礼包(三档充值)
  743. public function dailyGift(Request $request)
  744. {
  745. $user = $request->user();
  746. $this->setUserLocale($request);
  747. // 获取每日礼包配置 (gift_id=304),应该有3档
  748. $dailyGifts = DB::table('agent.dbo.recharge_gift')
  749. ->where('gift_id', 304)
  750. ->orderBy('recommend', 'asc')
  751. ->get();
  752. if ($dailyGifts->isEmpty()) {
  753. return apiReturnFail(['web.gift.daily_gift_not_exists', __('web.gift.daily_gift_not_exists')]);
  754. }
  755. if ($dailyGifts->count() > 3) {
  756. // 如果配置超过3档,只取前3档
  757. $dailyGifts = $dailyGifts->take(3);
  758. }
  759. // 检查用户今日每档的充值状态
  760. $todayStart = date('Y-m-d') . ' 00:00:00';
  761. $todayEnd = date('Y-m-d') . ' 23:59:59';
  762. $todayRecharges = DB::table('agent.dbo.order')
  763. ->where('user_id', $user->UserID)
  764. ->where('GiftsID', 304)
  765. ->where('pay_status', 1)
  766. ->where('pay_at', '>=', $todayStart)
  767. ->where('pay_at', '<=', $todayEnd)
  768. ->pluck('amount')
  769. ->toArray();
  770. $result = [];
  771. $completedCount = 0;
  772. // 遍历每档配置
  773. foreach ($dailyGifts as $index => $gift) {
  774. $gear = DB::table('agent.dbo.recharge_gear')
  775. ->select('money', 'favorable_price', 'gear', 'give')
  776. ->where('money', $gift->recommend)
  777. ->where('status', 1)
  778. ->first();
  779. if ($gear) {
  780. // 检查该档位今日是否已充值(使用浮点数比较,允许小数点精度差异)
  781. $isCompleted = false;
  782. foreach ($todayRecharges as $rechargeAmount) {
  783. if (abs($rechargeAmount/100 - $gift->recommend) < 0.01) {
  784. $isCompleted = true;
  785. break;
  786. }
  787. }
  788. if ($isCompleted) {
  789. $completedCount++;
  790. }
  791. $gear->gift_id = $gift->gift_id;
  792. $gear->total_bonus = $gift->total_bonus;
  793. $gear->bonus = $gift->total_bonus - 100;
  794. $gear->is_completed = $isCompleted; // 是否已完成
  795. $gear->gear_index = $index + 1; // 档位序号(1,2,3)
  796. $gear->recommend = $gift->first_pay?1:0;
  797. if (!empty($gear->gear)) {
  798. $gear->gear = Util::filterGearByDevice($gear->gear);
  799. }
  800. $result[] = $gear;
  801. }
  802. }
  803. // 获取额外奖励金额(从任意一档的 task_bonus 字段获取,task_bonus 是数字字段)
  804. $taskBonus = null;
  805. $firstGift = $dailyGifts->first();
  806. if ($firstGift && $firstGift->task_bonus !== null) {
  807. $taskBonus = round((float)$firstGift->task_bonus, 2);
  808. }
  809. // 检查是否可以领取额外奖励(三档都完成)
  810. $canClaimBonus = ($completedCount >= 3 && $taskBonus > 0);
  811. // 检查是否已领取过额外奖励
  812. $hasClaimedBonus = false;
  813. if ($canClaimBonus) {
  814. $redisKey = "daily_gift_bonus_claimed_{$user->UserID}_" . date('Y-m-d');
  815. $hasClaimedBonus = Redis::exists($redisKey);
  816. }
  817. return apiReturnSuc([
  818. 'list' => $result,
  819. 'completed_count' => $completedCount,
  820. 'total_count' => count($result),
  821. 'can_claim_bonus' => $canClaimBonus && !$hasClaimedBonus,
  822. 'has_claimed_bonus' => $hasClaimedBonus,
  823. 'task_bonus' => $taskBonus
  824. ]);
  825. }
  826. // 领取每日礼包三档完成后的额外奖励
  827. public function claimDailyGiftBonus(Request $request)
  828. {
  829. $user = $request->user();
  830. $userId = $user->UserID;
  831. $this->setUserLocale($request);
  832. // 检查三档是否都已完成
  833. $todayStart = date('Y-m-d') . ' 00:00:00';
  834. $todayEnd = date('Y-m-d') . ' 23:59:59';
  835. // 获取每日礼包配置
  836. $dailyGifts = DB::table('agent.dbo.recharge_gift')
  837. ->where('gift_id', 304)
  838. ->orderBy('recommend', 'asc')
  839. ->get()
  840. ->take(3);
  841. if ($dailyGifts->isEmpty()) {
  842. return apiReturnFail(['web.gift.daily_gift_not_exists', __('web.gift.daily_gift_not_exists')]);
  843. }
  844. // 检查每档今日是否都已充值
  845. $todayRecharges = DB::table('agent.dbo.order')
  846. ->where('user_id', $userId)
  847. ->where('GiftsID', 304)
  848. ->where('pay_status', 1)
  849. ->where('pay_at', '>=', $todayStart)
  850. ->where('pay_at', '<=', $todayEnd)
  851. ->pluck('amount')
  852. ->toArray();
  853. $completedCount = 0;
  854. foreach ($dailyGifts as $gift) {
  855. // 检查该档位是否已充值(使用浮点数比较)
  856. $isCompleted = false;
  857. foreach ($todayRecharges as $rechargeAmount) {
  858. if (abs($rechargeAmount/100 - $gift->recommend) < 0.01) {
  859. $isCompleted = true;
  860. break;
  861. }
  862. }
  863. if ($isCompleted) {
  864. $completedCount++;
  865. }
  866. }
  867. if ($completedCount < 3) {
  868. return apiReturnFail(['web.gift.three_tiers_not_completed', __('web.gift.three_tiers_not_completed')]);
  869. }
  870. // 检查是否已领取过
  871. $redisKey = "daily_gift_bonus_claimed_{$userId}_" . date('Y-m-d');
  872. if (Redis::exists($redisKey)) {
  873. return apiReturnFail(['web.gift.bonus_already_claimed_today', __('web.gift.bonus_already_claimed_today')]);
  874. }
  875. // 获取奖励金额(从任意一档的 task_bonus 获取,task_bonus 是数字字段)
  876. $firstGift = $dailyGifts->first();
  877. $rewardAmount = 0;
  878. if ($firstGift && $firstGift->task_bonus !== null) {
  879. $rewardAmount = round((float)$firstGift->task_bonus, 2);
  880. }
  881. if ($rewardAmount <= 0) {
  882. return apiReturnFail(['web.gift.bonus_config_not_exists', __('web.gift.bonus_config_not_exists')]);
  883. }
  884. try {
  885. // 发放奖励
  886. OuroGameService::AddScore($userId, $rewardAmount * NumConfig::NUM_VALUE, 52, true); // 52=礼包奖励
  887. // 标记已领取
  888. Redis::setex($redisKey, 86400, 1); // 24小时过期
  889. \Log::info('每日礼包额外奖励领取成功', [
  890. 'user_id' => $userId,
  891. 'reward_amount' => $rewardAmount
  892. ]);
  893. return apiReturnSuc([
  894. 'amount' => $rewardAmount,
  895. 'message' => str_replace(':amount', $rewardAmount, __('web.gift.claim_success'))
  896. ]);
  897. } catch (\Exception $e) {
  898. \Log::error('每日礼包额外奖励领取失败', [
  899. 'user_id' => $userId,
  900. 'error' => $e->getMessage()
  901. ]);
  902. return apiReturnFail(['web.gift.claim_failed', str_replace(':error', $e->getMessage(), __('web.gift.claim_failed'))]);
  903. }
  904. }
  905. public function getSecondGive(Request $request)
  906. {
  907. $user = $request->user();
  908. $fpkey='Firstpay_'.$user->UserID;
  909. if(Redis::exists($fpkey)){
  910. $data=Redis::get($fpkey);
  911. $data=json_decode($data,true);
  912. $data['timeleft']=86400-(time()-$data['buytime']);
  913. if($data['timeleft']<=0) {
  914. Redis::del($fpkey);
  915. //加钱
  916. if($data['second_give']){
  917. $czReason=$data['czReason'];
  918. $cjReason=$data['cjReason'];
  919. [$OrgScore,$NowScore]=OuroGameService::AddScore($user->UserID,$data['second_give']*NumConfig::NUM_VALUE,$cjReason);
  920. //更新二次领钱记录
  921. DB::table(TableName::agent() . 'guide_payment')->where('UserID',$user->UserID)->update([
  922. 'GetSecondTime' => now(),
  923. 'SecondScoreNum'=>$data['second_give']*NumConfig::NUM_VALUE
  924. ]);
  925. return apiReturnSuc(compact('OrgScore','NowScore'));
  926. }
  927. return apiReturnSuc();
  928. }
  929. }
  930. return apiReturnFail(['web.withdraw.try_again_later','Tente novamente mais tarde']);
  931. }
  932. }