|
@@ -981,6 +981,45 @@ class ActivityController extends Controller
|
|
|
if (!isset($taskData['sign_in_count'])) {
|
|
if (!isset($taskData['sign_in_count'])) {
|
|
|
$taskData['sign_in_count'] = 0;
|
|
$taskData['sign_in_count'] = 0;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ // 如存在未充值前的签到标记,且在同一天内完成充值,则补记签到
|
|
|
|
|
+ $pendingKey = "vip_withdraw_sign_pending_{$userId}";
|
|
|
|
|
+ $pendingSign = Redis::get($pendingKey);
|
|
|
|
|
+ if ($pendingSign && $pendingSign == date('Ymd')) {
|
|
|
|
|
+ $userRecharge = DB::table(TableName::QPAccountsDB() . 'YN_VIPAccount')
|
|
|
|
|
+ ->where('UserID', $userId)
|
|
|
|
|
+ ->value('Recharge') ?: 0;
|
|
|
|
|
+ if ($userRecharge > 0) {
|
|
|
|
|
+ if (($taskData['sign_in_count'] ?? 0) < 1) {
|
|
|
|
|
+ $taskData['sign_in_count'] = 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ \Log::info('VIP提现任务-签到补记成功(同日充值)', [
|
|
|
|
|
+ 'user_id' => $userId,
|
|
|
|
|
+ 'sign_in_count' => $taskData['sign_in_count']
|
|
|
|
|
+ ]);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($pendingSign) {
|
|
|
|
|
+ Redis::del($pendingKey);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 如存在“未充值前的签到标记”,且用户已完成充值,则补记签到次数
|
|
|
|
|
+ $pendingKey = "vip_withdraw_sign_pending_{$userId}";
|
|
|
|
|
+ if (Redis::exists($pendingKey)) {
|
|
|
|
|
+ $userRecharge = DB::table(TableName::QPAccountsDB() . 'YN_VIPAccount')
|
|
|
|
|
+ ->where('UserID', $userId)
|
|
|
|
|
+ ->value('Recharge') ?: 0;
|
|
|
|
|
+ if ($userRecharge > 0) {
|
|
|
|
|
+ if (($taskData['sign_in_count'] ?? 0) < 1) {
|
|
|
|
|
+ $taskData['sign_in_count'] = 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ Redis::del($pendingKey);
|
|
|
|
|
+ \Log::info('VIP提现任务-签到补记成功', [
|
|
|
|
|
+ 'user_id' => $userId,
|
|
|
|
|
+ 'sign_in_count' => $taskData['sign_in_count']
|
|
|
|
|
+ ]);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// 阶段3累计下注:基于总下注的增量进行累加(非时间周期)
|
|
// 阶段3累计下注:基于总下注的增量进行累加(非时间周期)
|
|
|
if (!isset($taskData['stage3_current_bet'])) {
|
|
if (!isset($taskData['stage3_current_bet'])) {
|
|
@@ -1079,18 +1118,62 @@ class ActivityController extends Controller
|
|
|
*/
|
|
*/
|
|
|
public function triggerSignIn($userId)
|
|
public function triggerSignIn($userId)
|
|
|
{
|
|
{
|
|
|
- // 检查用户是否已充值
|
|
|
|
|
|
|
+ // 检查用户是否已充值(仅用于记录日志,不再阻断签到进度)
|
|
|
$user_recharge = DB::table(TableName::QPAccountsDB() . 'YN_VIPAccount')
|
|
$user_recharge = DB::table(TableName::QPAccountsDB() . 'YN_VIPAccount')
|
|
|
->where('UserID', $userId)
|
|
->where('UserID', $userId)
|
|
|
->value('Recharge') ?: 0;
|
|
->value('Recharge') ?: 0;
|
|
|
|
|
+ $hasRecharge = $user_recharge > 0;
|
|
|
|
|
|
|
|
- if ($user_recharge <= 0) {
|
|
|
|
|
- \Log::info('VIP提现任务-签到触发失败', [
|
|
|
|
|
|
|
+ $pendingKey = "vip_withdraw_sign_pending_{$userId}";
|
|
|
|
|
+
|
|
|
|
|
+ if (!$hasRecharge) {
|
|
|
|
|
+ // 未充值用户,先把签到标记在Redis中,等待充值后结算(仅限同一天)
|
|
|
|
|
+ Redis::setex($pendingKey, 86400, date('Ymd')); // 标记签到日期
|
|
|
|
|
+
|
|
|
|
|
+ \Log::info('VIP提现任务-签到记录(待充值)', [
|
|
|
'user_id' => $userId,
|
|
'user_id' => $userId,
|
|
|
- 'reason' => '用户未充值'
|
|
|
|
|
|
|
+ 'note' => '用户尚未充值,签到标记已暂存Redis',
|
|
|
|
|
+ 'redis_key' => $pendingKey
|
|
|
|
|
+ ]);
|
|
|
|
|
+
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 用户已充值,如存在待结算签到标记,检查是否为同一天
|
|
|
|
|
+ $pendingSign = Redis::get($pendingKey);
|
|
|
|
|
+ if ($pendingSign && $pendingSign == date('Ymd')) {
|
|
|
|
|
+ // 同一天内补记签到次数(若尚未计数)
|
|
|
|
|
+ $redisKey = "vip_withdraw_task_{$userId}";
|
|
|
|
|
+ $data = Redis::get($redisKey);
|
|
|
|
|
+
|
|
|
|
|
+ if ($data) {
|
|
|
|
|
+ $taskData = json_decode($data, true);
|
|
|
|
|
+ if (($taskData['sign_in_count'] ?? 0) < 1) {
|
|
|
|
|
+ $taskData['sign_in_count'] = 1;
|
|
|
|
|
+ $this->saveUserTaskData($userId, $taskData);
|
|
|
|
|
+ Redis::setex($redisKey, 86400, json_encode($taskData));
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $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);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (($taskData['sign_in_count'] ?? 0) < 1) {
|
|
|
|
|
+ $taskData['sign_in_count'] = 1;
|
|
|
|
|
+ $this->saveUserTaskData($userId, $taskData);
|
|
|
|
|
+ }
|
|
|
|
|
+ Redis::setex($redisKey, 86400, json_encode($taskData));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ \Log::info('VIP提现任务-签到补记成功(同日充值)', [
|
|
|
|
|
+ 'user_id' => $userId
|
|
|
]);
|
|
]);
|
|
|
- return false;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+ Redis::del($pendingKey);
|
|
|
|
|
|
|
|
$redisKey = "vip_withdraw_task_{$userId}";
|
|
$redisKey = "vip_withdraw_task_{$userId}";
|
|
|
$data = Redis::get($redisKey);
|
|
$data = Redis::get($redisKey);
|