|
|
@@ -481,259 +481,6 @@ class ActivityController extends Controller
|
|
|
|
|
|
|
|
|
}
|
|
|
- public function test(Request $request){
|
|
|
-// $this->repayFirst();
|
|
|
-
|
|
|
-// $config=RouteService::getChannelConfig($request);
|
|
|
-//
|
|
|
-// dd($config->toArray());
|
|
|
- dd(1);
|
|
|
- $countrys=['COL','PER','ARG','ECU','CHL'];
|
|
|
- $service = new SmartFastPay();
|
|
|
- $country=$request->input('country','');
|
|
|
-
|
|
|
- if(!empty($country)) {
|
|
|
-
|
|
|
- $json = $service->curlGet('https://api.smartfastpay.com/documents-type?country=' . $country);
|
|
|
-
|
|
|
-
|
|
|
- // 将 JSON 字符串转换为 PHP 数组
|
|
|
- $decodedJson = json_decode($json, true);
|
|
|
-
|
|
|
- // 获取 data 部分
|
|
|
- $data = $decodedJson['data'] ?? [];
|
|
|
-
|
|
|
-
|
|
|
- // 传递数据到视图
|
|
|
- return view('other.datatable', compact('data', 'country'));
|
|
|
- }else{
|
|
|
- $datas=[];
|
|
|
- foreach ($countrys as $country){
|
|
|
- $json = $service->curlGet('https://api.smartfastpay.com/documents-type?country=' . $country);
|
|
|
-
|
|
|
-
|
|
|
- // 将 JSON 字符串转换为 PHP 数组
|
|
|
- $decodedJson = json_decode($json, true);
|
|
|
-
|
|
|
- // 获取 data 部分
|
|
|
- $data = $decodedJson['data'] ?? [];
|
|
|
-
|
|
|
- $datas[$country]=$data;
|
|
|
- }
|
|
|
-// echo json_encode($datas);die;
|
|
|
- return view('other.datatables', compact('datas'));
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-// $user = GlobalUserInfo::getGameUserInfoToWeb('UserID',$user_id);
|
|
|
-// LoginController::CheckTimeBonus($user);
|
|
|
-// $datas = RePayConfig::CacheDatas();
|
|
|
-//
|
|
|
-// if (isset($datas) && is_array($datas) && count($datas)) {
|
|
|
-// $datas = array_filter($datas, function ($v) use ($user) {
|
|
|
-// return $user['Score'] < $v['LessThan'];
|
|
|
-// });
|
|
|
-// }
|
|
|
-// dd($user,$datas,date("Y-m-d H:i:s",$user['bonus_pack']['settime']));
|
|
|
-//
|
|
|
-
|
|
|
-
|
|
|
-// dd(Util::validateCpf('47285044171'));
|
|
|
-// $newid=AccountsInfo::whereBetween('UserID',[10000,100000])->max('UserID')??10000;
|
|
|
-// TelegramBot::getDefault()->sendMsgWithEnv('test123');
|
|
|
-// Log::error("test123");
|
|
|
-// AgentService::SetUserAgent("5ce7c4e17c-b53b-eb1a-0004581854",4581854,"fw9tdk");
|
|
|
-// AgentService::recordPerformance(4581854,100*NumConfig::NUM_VALUE);
|
|
|
-// OuroGameService::notifyWebHall(4478930,"",'pay_finish',["Golds"=>1000,"PayNum"=>10]);
|
|
|
-
|
|
|
-// $key='ingame_state_'.$request->input('uid');
|
|
|
-// $exist=Redis::exists($key);
|
|
|
-// $ingame_state=Redis::get($key)??-1;
|
|
|
-//
|
|
|
-// exit(json_encode(compact('exist','ingame_state')));
|
|
|
-
|
|
|
-// DB::connection('write')->select("SET NOCOUNT ON use QPRecordDB exec GSP_GP_AddUserLogin $UserID");
|
|
|
- /*try {
|
|
|
- $str='N4IgRgZgDiBcIAYD2A5KATFAbAqgWQEEBnARgBcAnLAJQBUBRAdQEcQAaEIgSwHMA7OCACmATwBSGLgEkAbFIDWZABJ4AVugDCKVVgAidMQDEAyo0MAWAIoAvABZ50ANQDuAN0byxAIQAKtBFwAMhpiAEwAmowAHiQAWsayUlixAMaB1igajqHoPimq1F4AhnxYtCm0UuaxhjS01mJI6ADM1HyMSmJKjoYojLGhjq4AGhoAnM7UAOJQac2GEQC26OFCWFgkAPJTZEQ4Lq4oSoYIxoaOKEX0bbHD1JdTWGTGfFA+YDhYAKwDKQg4dz4KXkUGajkY6BEsWsCDGUi4zi4YDMqikqiQXBQ1nkX3CixwCG0OBIKFoOJQoXo1jw+JEeGxzk2DGa4R0qk2uhwGX6XCZPAyunoUMW4QQsUWsVU4qkzXF2nC1h4zlZ6ExoRw5lJlmaKC4YjG7BAKUEX1ChoA+uhBIsLWRBCQAOyhBAIB1jZqu0IyL7m8wkULmsYkL6GgCuRUEeCQ1i46yKAHovgA6BAAAgAFIEuHxQ1EANypgh8dAUDHoVMkZoF4x4AC0UzGAA4SF4AJSFqBQLBCRhCMAAaS4ZETzQdSeaMgz/aUtDwgTYqawXHkQlTUyEwKQ7Y0tlLiyE8ZIJBkKdPaajYFjq+MRQgRQoXBHY4nIAAvkA===';
|
|
|
- $destr=LZ::decompressFromBase64($str);
|
|
|
-// dd($destr);
|
|
|
- }catch (\Exception $exception){
|
|
|
- TelegramBot::getDefault()->sendProgramNotify("Game LZ decrypt:", $exception->getMessage().$exception->getTraceAsString());
|
|
|
- $destr=$str;
|
|
|
- }
|
|
|
- return $destr;*/
|
|
|
-
|
|
|
-// $pass='$2y$10$THuv5qMoBlCi2uIZLiR7k.7j/ixywIgZ/th49pJKxtkQjBz4mBtlm';
|
|
|
-// return json_encode(['res'=>Hash::check('',$pass)]);
|
|
|
-
|
|
|
- /* $users=GlobalUserInfo::where("RegisterDate",'>','2024-06-18')->get();
|
|
|
- foreach ($users as $user){
|
|
|
- $UserID=$user->UserID;
|
|
|
- $startDate=Carbon::parse($user->RegisterDate)->format('Ymd');
|
|
|
- $endDate=Carbon::parse($user->LastLogonDate)->format('Ymd');
|
|
|
- for($i=$startDate;$i<=$endDate;$i++){
|
|
|
-
|
|
|
-// DB::table('QPRecordDB.dbo.RecordUserLogin')->insert(['UserID'=>$UserID,'DateID'=>$i,'Cnt'=>1]);
|
|
|
- }
|
|
|
-
|
|
|
- }*/
|
|
|
-
|
|
|
- }
|
|
|
- public function tes11t()
|
|
|
- {
|
|
|
-
|
|
|
-
|
|
|
- $dbh = DB::connection()->getPdo();
|
|
|
-
|
|
|
-
|
|
|
- $sql="SELECT ID,UserID,ChangeScore
|
|
|
- FROM QPRecordDB.dbo.RecordUserScoreChange t
|
|
|
- WHERE UpdateTime>'2024-06-05 03:53:12' and UpdateTime<'2024-06-05 09:57:19' and ChangeScore>=1000 and Reason=1 order by UpdateTime";
|
|
|
-
|
|
|
-// echo $sql;die;
|
|
|
- $stmt = $dbh->prepare($sql);
|
|
|
-
|
|
|
- $stmt->execute();
|
|
|
-
|
|
|
- $addmoneys = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
|
|
-
|
|
|
- $asorts=[];
|
|
|
- foreach ($addmoneys as $addmoney) {
|
|
|
- if(!isset($asorts[$addmoney['UserID']]))$asorts[$addmoney['UserID']]=[];
|
|
|
- $asorts[$addmoney['UserID']][]=$addmoney;
|
|
|
- }
|
|
|
-
|
|
|
- $orders=Order::whereRaw('id>9978316 and id<9979949 and pay_status=1 and payment_sn is null')->get();
|
|
|
- $osorts=[];
|
|
|
- foreach ($orders as $order){
|
|
|
- if(!isset($osorts[$order->UserID]))$osorts[$order->UserID]=[];
|
|
|
- $osorts[$order->UserID][]=(array)$order;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- $channels=[];
|
|
|
- foreach ($osorts as $UserID=>$osort) {
|
|
|
-
|
|
|
- if(isset($asorts[$UserID])){
|
|
|
- $asort=$asorts[$UserID];
|
|
|
- if(count($asort)>count($osort)){
|
|
|
- $ChangeScore=0;
|
|
|
- foreach ($asort as $k=>$v){
|
|
|
- $ChangeScore+=$v['ChangeScore'];
|
|
|
- }
|
|
|
- $pay=0;
|
|
|
- foreach ($osort as $k=>$v){
|
|
|
- $pay+=$order['amount'];
|
|
|
- }
|
|
|
- $Channel = DB::connection('write')->table(TableName::QPAccountsDB() . 'AccountsInfo')
|
|
|
- ->where('UserID', $UserID)->select('Channel', 'RegisterDate')->first();
|
|
|
-
|
|
|
- echo json_encode([$UserID,count($asort),$ChangeScore,count($osort),$pay,($ChangeScore-$pay)/100,$Channel])."\r\n";
|
|
|
-
|
|
|
- if(!isset($channels[$Channel->Channel]))$channels[$Channel->Channel]=['NewPayPeple'=>0,'OldUserPayCount'=>0,'PayPeple'=>0,'PayCount'=>0,'PayTotal'=>0,'OldUserPayBi'=>0,'OldUserPaySum'=>0,'NewPayPepleBi'=>0,'NewPayTotal'=>0];
|
|
|
-
|
|
|
- if(date('Ymd',strtotime($Channel->RegisterDate))!='20240605'){
|
|
|
- $channels[$Channel->Channel]['OldUserPayCount']+=count($asort)-1;
|
|
|
- }else{
|
|
|
- $channels[$Channel->Channel]['NewPayPeple']+=count($asort)-count($osort);
|
|
|
- }
|
|
|
- $channels[$Channel->Channel]['PayPeple']+=count($asort)-1;
|
|
|
-
|
|
|
-// if(date('Ymd',strtotime($Channel->RegisterDate))!='20240605'){
|
|
|
-// $channels[$Channel->Channel]['OldUserPayBi']+=count($asort)-count($osort);
|
|
|
-// $channels[$Channel->Channel]['OldUserPaySum']+=($ChangeScore-$pay);
|
|
|
-// }else{
|
|
|
-// $channels[$Channel->Channel]['NewPayPepleBi']+=count($asort)-count($osort);
|
|
|
-// $channels[$Channel->Channel]['NewPayTotal']+=($ChangeScore-$pay);
|
|
|
-// }
|
|
|
-
|
|
|
-// $channels[$Channel->Channel]['PayCount']+=count($asort)-count($osort);
|
|
|
-// $channels[$Channel->Channel]['PayTotal']+=($ChangeScore-$pay);
|
|
|
-
|
|
|
-// $callback = DB::table(TableName::agent() . 'UserCallBack')->where('UserID', $UserID)->first();
|
|
|
-// if($callback)DB::table(TableName::agent() . 'UserCallBack')->where('UserID', $UserID)->decrement('recharge',($ChangeScore-$pay));
|
|
|
-
|
|
|
-// DB::table('QPRecordDB.dbo.RecordUserTotalStatistics')->where('UserID',$UserID)->increment('Recharge',($ChangeScore-$pay)/100);
|
|
|
-//
|
|
|
-// DB::connection('write')->table('QPRecordDB.dbo.RecordUserScoreStatisticsNew')->where('ScoreType', 1)
|
|
|
-// ->where('UserID', $UserID)
|
|
|
-// ->where('DateID', 20240605)
|
|
|
-// ->decrement('ScoreCount',count($asort)-count($osort));
|
|
|
-// DB::connection('write')->table('QPRecordDB.dbo.RecordUserScoreStatisticsNew')->where('ScoreType', 1)
|
|
|
-// ->where('UserID', $UserID)
|
|
|
-// ->where('DateID', 20240605)
|
|
|
-// ->decrement('Score',($ChangeScore-$pay));
|
|
|
-
|
|
|
- $total=$ChangeScore-$pay;
|
|
|
- while($total>0){
|
|
|
- $arr=array_shift($asort);
|
|
|
- $ID=$arr['ID'];
|
|
|
- $ChangeScore=$arr['ChangeScore'];
|
|
|
- echo $ID."|".$ChangeScore."\r\n";
|
|
|
- $total-=$ChangeScore;
|
|
|
-// DB::table('QPRecordDB.dbo.RecordUserScoreChange')->where('ID',$ID)->delete();
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-// print_r($channels);
|
|
|
-// ->updateOrInsert(['Channel' => -1, 'DateID' => $dateID], ['OldUserPayCount' => DB::raw("OldUserPayCount+$addPayPeple"), 'OldUserPayBi' => DB::raw('OldUserPayBi+1'), 'OldUserPaySum' => DB::raw("OldUserPaySum+$money")]);
|
|
|
-// ->updateOrInsert(['Channel' => -1, 'DateID' => $dateID], ['NewPayPeple' => DB::raw("NewPayPeple+$addPayPeple"), 'NewPayPepleBi' => DB::raw('NewPayPepleBi+1'), 'NewPayTotal' => DB::raw("NewPayTotal+$money")]);
|
|
|
-// print_r($channels);
|
|
|
-// foreach ($channels as $Channel=>$ChannelData){
|
|
|
-// DB::connection('write')->table(TableName::QPRecordDB() . 'RecordPlatformData')
|
|
|
-// ->where('DateID', '20240605')
|
|
|
-// ->where('Channel', -1)->update([
|
|
|
-// 'OldUserPayBi'=>DB::raw("OldUserPayBi-$ChannelData[OldUserPayBi]"),
|
|
|
-// 'OldUserPaySum'=>DB::raw("OldUserPaySum-$ChannelData[OldUserPaySum]"),
|
|
|
-// 'NewPayPepleBi'=>DB::raw("NewPayPepleBi-$ChannelData[NewPayPepleBi]"),
|
|
|
-// 'NewPayTotal'=>DB::raw("NewPayTotal-$ChannelData[NewPayTotal]")
|
|
|
-// ]);
|
|
|
-// DB::connection('write')->table(TableName::QPRecordDB() . 'RecordPlatformData')
|
|
|
-// ->where('DateID', '20240605')
|
|
|
-// ->where('Channel', $Channel)->update([
|
|
|
-// 'OldUserPayBi'=>DB::raw("OldUserPayBi-$ChannelData[OldUserPayBi]"),
|
|
|
-// 'OldUserPaySum'=>DB::raw("OldUserPaySum-$ChannelData[OldUserPaySum]"),
|
|
|
-// 'NewPayPepleBi'=>DB::raw("NewPayPepleBi-$ChannelData[NewPayPepleBi]"),
|
|
|
-// 'NewPayTotal'=>DB::raw("NewPayTotal-$ChannelData[NewPayTotal]")
|
|
|
-// ]);
|
|
|
-//
|
|
|
-// }
|
|
|
- foreach ($channels as $Channel=>$ChannelData){
|
|
|
-// DB::connection('write')->table(TableName::QPRecordDB() . 'RecordPlatformData')
|
|
|
-// ->where('DateID', '20240605')
|
|
|
-// ->where('Channel', -1)->update([
|
|
|
-// 'NewPayPeple'=>DB::raw("NewPayPeple-$ChannelData[NewPayPeple]"),
|
|
|
-// 'OldUserPayCount'=>DB::raw("OldUserPayCount-$ChannelData[OldUserPayCount]"),
|
|
|
-// 'PayPeple'=>DB::raw("PayPeple-$ChannelData[PayPeple]"),
|
|
|
-// ]);
|
|
|
-// DB::connection('write')->table(TableName::QPRecordDB() . 'RecordPlatformData')
|
|
|
-// ->where('DateID', '20240605')
|
|
|
-// ->where('Channel', $Channel)->update([
|
|
|
-// 'NewPayPeple'=>DB::raw("NewPayPeple-$ChannelData[NewPayPeple]"),
|
|
|
-// 'OldUserPayCount'=>DB::raw("OldUserPayCount-$ChannelData[OldUserPayCount]"),
|
|
|
-// 'PayPeple'=>DB::raw("PayPeple-$ChannelData[PayPeple]"),
|
|
|
-// ]);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-// UPDATE RecordPlatformData SET PayTotal=PayTotal+@Cnt,PayPeple=PayPeple+@PayPeple,PayCount=PayCount+1 WHERE DateID=@DateID AND Channel=-1
|
|
|
-//
|
|
|
-//
|
|
|
-// UPDATE RecordPlatformData SET PayTotal=PayTotal+@Cnt,PayPeple=PayPeple+@PayPeple,PayCount=PayCount+1 WHERE DateID=@DateID AND Channel=@Channel
|
|
|
- die;
|
|
|
- }
|
|
|
|
|
|
// ==================== VIP提现诱导功能 ====================
|
|
|
|
|
|
@@ -777,10 +524,10 @@ class ActivityController extends Controller
|
|
|
$stage3_task2_status = 0; // 不能领取
|
|
|
if ($taskData['stage2_completed']) { // 阶段3需要阶段2完成才能解锁
|
|
|
// 循环任务:基于累计下注判断是否可领取(不使用已领取状态)
|
|
|
- if (($taskData['stage3_current_bet'] ?? 0) >= 600) {
|
|
|
+ if (($taskData['stage3_current_bet'] ?? 0) >= 6000) {
|
|
|
$stage3_task1_status = 1; // 待领取
|
|
|
}
|
|
|
- if (($taskData['stage3_current_bet'] ?? 0) >= 1200) {
|
|
|
+ if (($taskData['stage3_current_bet'] ?? 0) >= 12000) {
|
|
|
$stage3_task2_status = 1; // 待领取
|
|
|
}
|
|
|
}
|
|
|
@@ -923,21 +670,21 @@ class ActivityController extends Controller
|
|
|
elseif ($stage === 3) {
|
|
|
if ($taskId === 'stage3_task1') {
|
|
|
// 每满600可领取20,领取后扣除600下注进度
|
|
|
- if (($taskData['stage3_current_bet'] ?? 0) < 600) {
|
|
|
+ if (($taskData['stage3_current_bet'] ?? 0) < 6000) {
|
|
|
Redis::del($redisLockKey);
|
|
|
return apiReturnFail('任务未完成');
|
|
|
}
|
|
|
$rewardAmount = 20;
|
|
|
- $this->updateTaskProgress($userId, 'stage3_current_bet', max(0, ($taskData['stage3_current_bet'] - 600)));
|
|
|
+ $this->updateTaskProgress($userId, 'stage3_current_bet', max(0, ($taskData['stage3_current_bet'] - 6000)));
|
|
|
}
|
|
|
elseif ($taskId === 'stage3_task2') {
|
|
|
// 每满1200可领取40,领取后扣除1200下注进度
|
|
|
- if (($taskData['stage3_current_bet'] ?? 0) < 1200) {
|
|
|
+ if (($taskData['stage3_current_bet'] ?? 0) < 12000) {
|
|
|
Redis::del($redisLockKey);
|
|
|
return apiReturnFail('任务未完成');
|
|
|
}
|
|
|
$rewardAmount = 40;
|
|
|
- $this->updateTaskProgress($userId, 'stage3_current_bet', max(0, ($taskData['stage3_current_bet'] - 1200)));
|
|
|
+ $this->updateTaskProgress($userId, 'stage3_current_bet', max(0, ($taskData['stage3_current_bet'] - 12000)));
|
|
|
}
|
|
|
} else {
|
|
|
Redis::del($redisLockKey);
|
|
|
@@ -984,8 +731,17 @@ class ActivityController extends Controller
|
|
|
if ($data) {
|
|
|
$taskData = json_decode($data, true);
|
|
|
} else {
|
|
|
- // 从数据库初始化任务数据
|
|
|
- $taskData = $this->initUserTaskData($userId);
|
|
|
+ // 从数据库加载任务数据
|
|
|
+ $dbData = DB::table('agent.dbo.vip_withdraw_tasks')
|
|
|
+ ->where('user_id', $userId)
|
|
|
+ ->first();
|
|
|
+
|
|
|
+ if ($dbData) {
|
|
|
+ $taskData = json_decode($dbData->task_data, true);
|
|
|
+ } else {
|
|
|
+ // 初始化任务数据
|
|
|
+ $taskData = $this->initUserTaskData($userId);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 实时更新统计数据
|
|
|
@@ -994,12 +750,36 @@ class ActivityController extends Controller
|
|
|
// 检查任务完成状态
|
|
|
$this->checkTaskCompletion($taskData);
|
|
|
|
|
|
- // 保存到Redis(缓存1小时)
|
|
|
- Redis::setex($redisKey, 3600, json_encode($taskData));
|
|
|
+ // 保存到数据库(持久化)
|
|
|
+ $this->saveUserTaskData($userId, $taskData);
|
|
|
+
|
|
|
+ // 保存到Redis(缓存24小时)
|
|
|
+ Redis::setex($redisKey, 86400, json_encode($taskData));
|
|
|
|
|
|
return $taskData;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 保存用户任务数据到数据库
|
|
|
+ */
|
|
|
+ private function saveUserTaskData($userId, $taskData)
|
|
|
+ {
|
|
|
+ try {
|
|
|
+ DB::table('agent.dbo.vip_withdraw_tasks')->updateOrInsert(
|
|
|
+ ['user_id' => $userId],
|
|
|
+ [
|
|
|
+ 'task_data' => json_encode($taskData, JSON_UNESCAPED_UNICODE),
|
|
|
+ 'updated_at' => date('Y-m-d H:i:s')
|
|
|
+ ]
|
|
|
+ );
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ \Log::error('VIP提现任务数据保存失败', [
|
|
|
+ 'user_id' => $userId,
|
|
|
+ 'error' => $e->getMessage()
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获取任务配置
|
|
|
*/
|
|
|
@@ -1062,17 +842,17 @@ class ActivityController extends Controller
|
|
|
'tasks' => [
|
|
|
[
|
|
|
'id' => 'stage3_task1',
|
|
|
- 'title' => '下注金额达到600',
|
|
|
+ 'title' => '下注金额达到6000',
|
|
|
'type' => 'bet_amount',
|
|
|
- 'target' => 600,
|
|
|
+ 'target' => 6000,
|
|
|
'reward' => 20,
|
|
|
'progress_key' => 'stage3_current_bet'
|
|
|
],
|
|
|
[
|
|
|
'id' => 'stage3_task2',
|
|
|
- 'title' => '下注金额达到1200',
|
|
|
+ 'title' => '下注金额达到12000',
|
|
|
'type' => 'bet_amount',
|
|
|
- 'target' => 1200,
|
|
|
+ 'target' => 12000,
|
|
|
'reward' => 40,
|
|
|
'progress_key' => 'stage3_current_bet'
|
|
|
]
|
|
|
@@ -1194,8 +974,8 @@ class ActivityController extends Controller
|
|
|
|
|
|
// 阶段3任务检查(循环):基于累计下注,不使用时间周期
|
|
|
if ($taskData['stage2_completed']) {
|
|
|
- $taskData['stage3_task1'] = ($taskData['stage3_current_bet'] ?? 0) >= 600;
|
|
|
- $taskData['stage3_task2'] = ($taskData['stage3_current_bet'] ?? 0) >= 1200;
|
|
|
+ $taskData['stage3_task1'] = ($taskData['stage3_current_bet'] ?? 0) >= 6000;
|
|
|
+ $taskData['stage3_task2'] = ($taskData['stage3_current_bet'] ?? 0) >= 12000;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1210,7 +990,12 @@ class ActivityController extends Controller
|
|
|
if ($data) {
|
|
|
$taskData = json_decode($data, true);
|
|
|
$taskData[$key] = $value;
|
|
|
- Redis::setex($redisKey, 3600, json_encode($taskData));
|
|
|
+
|
|
|
+ // ✅ 保存到数据库(持久化)
|
|
|
+ $this->saveUserTaskData($userId, $taskData);
|
|
|
+
|
|
|
+ // ✅ 更新Redis缓存(24小时)
|
|
|
+ Redis::setex($redisKey, 86400, json_encode($taskData));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1231,7 +1016,12 @@ class ActivityController extends Controller
|
|
|
$taskData['stage3_current_bet'] = 0;
|
|
|
$taskData['stage3_cycle_start'] = (int)date('Ymd');
|
|
|
$taskData['stage3_loop_count'] = ($taskData['stage3_loop_count'] ?? 0) + 1;
|
|
|
- Redis::setex($redisKey, 3600, json_encode($taskData));
|
|
|
+
|
|
|
+ // ✅ 保存到数据库(持久化)
|
|
|
+ $this->saveUserTaskData($userId, $taskData);
|
|
|
+
|
|
|
+ // ✅ 更新Redis缓存(24小时)
|
|
|
+ Redis::setex($redisKey, 86400, json_encode($taskData));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1260,7 +1050,12 @@ class ActivityController extends Controller
|
|
|
if ($data) {
|
|
|
$taskData = json_decode($data, true);
|
|
|
$taskData['sign_in_count'] = ($taskData['sign_in_count'] ?? 0) + 1;
|
|
|
- Redis::setex($redisKey, 3600, json_encode($taskData));
|
|
|
+
|
|
|
+ // ✅ 保存到数据库(持久化)
|
|
|
+ $this->saveUserTaskData($userId, $taskData);
|
|
|
+
|
|
|
+ // ✅ 更新Redis缓存(24小时)
|
|
|
+ Redis::setex($redisKey, 86400, json_encode($taskData));
|
|
|
|
|
|
\Log::info('VIP提现任务-签到触发成功', [
|
|
|
'user_id' => $userId,
|
|
|
@@ -1269,10 +1064,24 @@ class ActivityController extends Controller
|
|
|
|
|
|
return true;
|
|
|
} else {
|
|
|
- // 如果Redis没有数据,初始化
|
|
|
- $taskData = $this->initUserTaskData($userId);
|
|
|
- $taskData['sign_in_count'] = 1;
|
|
|
- Redis::setex($redisKey, 3600, json_encode($taskData));
|
|
|
+ // 如果Redis没有数据,从数据库加载或初始化
|
|
|
+ $dbData = DB::table('agent.dbo.vip_withdraw_tasks')
|
|
|
+ ->where('user_id', $userId)
|
|
|
+ ->first();
|
|
|
+
|
|
|
+ if ($dbData) {
|
|
|
+ $taskData = json_decode($dbData->task_data, true);
|
|
|
+ } else {
|
|
|
+ $taskData = $this->initUserTaskData($userId);
|
|
|
+ }
|
|
|
+
|
|
|
+ $taskData['sign_in_count'] = ($taskData['sign_in_count'] ?? 0) + 1;
|
|
|
+
|
|
|
+ // ✅ 保存到数据库(持久化)
|
|
|
+ $this->saveUserTaskData($userId, $taskData);
|
|
|
+
|
|
|
+ // ✅ 更新Redis缓存(24小时)
|
|
|
+ Redis::setex($redisKey, 86400, json_encode($taskData));
|
|
|
|
|
|
\Log::info('VIP提现任务-签到触发成功(首次)', [
|
|
|
'user_id' => $userId,
|
|
|
@@ -1321,7 +1130,12 @@ class ActivityController extends Controller
|
|
|
|
|
|
// 阶段1已完成,增加邀请计数
|
|
|
$taskData['invite_count'] = ($taskData['invite_count'] ?? 0) + 1;
|
|
|
- Redis::setex($redisKey, 3600, json_encode($taskData));
|
|
|
+
|
|
|
+ // ✅ 保存到数据库(持久化)
|
|
|
+ $this->saveUserTaskData($userId, $taskData);
|
|
|
+
|
|
|
+ // ✅ 更新Redis缓存(24小时)
|
|
|
+ Redis::setex($redisKey, 86400, json_encode($taskData));
|
|
|
|
|
|
\Log::info('VIP提现任务-邀请触发成功', [
|
|
|
'user_id' => $userId,
|
|
|
@@ -1330,13 +1144,46 @@ class ActivityController extends Controller
|
|
|
|
|
|
return true;
|
|
|
} else {
|
|
|
- // 如果Redis没有数据但用户已充值且阶段1可能已完成,初始化
|
|
|
- // 但邀请需要阶段1完成,此时阶段1可能未完成,所以不计数
|
|
|
- \Log::info('VIP提现任务-邀请触发失败', [
|
|
|
- 'user_id' => $userId,
|
|
|
- 'reason' => 'Redis数据不存在或阶段1未完成'
|
|
|
- ]);
|
|
|
- return false;
|
|
|
+ // 如果Redis没有数据,从数据库加载
|
|
|
+ $dbData = DB::table('agent.dbo.vip_withdraw_tasks')
|
|
|
+ ->where('user_id', $userId)
|
|
|
+ ->first();
|
|
|
+
|
|
|
+ if ($dbData) {
|
|
|
+ $taskData = json_decode($dbData->task_data, true);
|
|
|
+
|
|
|
+ // 检查阶段1是否完成
|
|
|
+ if (!isset($taskData['stage1_completed']) || !$taskData['stage1_completed']) {
|
|
|
+ \Log::info('VIP提现任务-邀请触发失败', [
|
|
|
+ 'user_id' => $userId,
|
|
|
+ 'reason' => '阶段1未完成'
|
|
|
+ ]);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 增加邀请计数
|
|
|
+ $taskData['invite_count'] = ($taskData['invite_count'] ?? 0) + 1;
|
|
|
+
|
|
|
+ // ✅ 保存到数据库(持久化)
|
|
|
+ $this->saveUserTaskData($userId, $taskData);
|
|
|
+
|
|
|
+ // ✅ 更新Redis缓存(24小时)
|
|
|
+ Redis::setex($redisKey, 86400, json_encode($taskData));
|
|
|
+
|
|
|
+ \Log::info('VIP提现任务-邀请触发成功(从数据库加载)', [
|
|
|
+ 'user_id' => $userId,
|
|
|
+ 'invite_count' => $taskData['invite_count']
|
|
|
+ ]);
|
|
|
+
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ // 用户数据不存在或阶段1未完成
|
|
|
+ \Log::info('VIP提现任务-邀请触发失败', [
|
|
|
+ 'user_id' => $userId,
|
|
|
+ 'reason' => '用户数据不存在或阶段1未完成'
|
|
|
+ ]);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|