|
@@ -142,6 +142,30 @@ class ActivityController extends Controller
|
|
|
}
|
|
}
|
|
|
$UserID=$user->UserID;
|
|
$UserID=$user->UserID;
|
|
|
$res=DB::connection('sqlsrv')->select("exec QPAccountsDB.dbo.GSP_GP_QueryProtect $UserID");
|
|
$res=DB::connection('sqlsrv')->select("exec QPAccountsDB.dbo.GSP_GP_QueryProtect $UserID");
|
|
|
|
|
+ $cooldownSeconds = 2 * 60 * 60;
|
|
|
|
|
+ $lastRecvTime = DB::connection('sqlsrv')
|
|
|
|
|
+ ->table('QPAccountsDB.dbo.RecordProtectList')
|
|
|
|
|
+ ->where('UserID', $UserID)
|
|
|
|
|
+ ->value('UpdateDate');
|
|
|
|
|
+
|
|
|
|
|
+ $cooldownLeftSeconds = 0;
|
|
|
|
|
+ $cooldownEndTime = null;
|
|
|
|
|
+ if (!empty($lastRecvTime)) {
|
|
|
|
|
+ $end = Carbon::parse($lastRecvTime)->addSeconds($cooldownSeconds);
|
|
|
|
|
+ $now = now();
|
|
|
|
|
+ if ($now->lt($end)) {
|
|
|
|
|
+ $cooldownLeftSeconds = $now->diffInSeconds($end);
|
|
|
|
|
+ $cooldownEndTime = $end->toDateTimeString();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 查询接口返回倒计时信息
|
|
|
|
|
+ if (!empty($res) && isset($res[0])) {
|
|
|
|
|
+ $res[0]->cooldown_seconds = $cooldownSeconds;
|
|
|
|
|
+ $res[0]->cooldown_left_seconds = $cooldownLeftSeconds;
|
|
|
|
|
+ $res[0]->cooldown_end_time = $cooldownEndTime;
|
|
|
|
|
+ $res[0]->can_receive = $cooldownLeftSeconds <= 0 ? 1 : 0;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
return apiReturnSuc($res);
|
|
return apiReturnSuc($res);
|
|
|
}
|
|
}
|
|
@@ -155,6 +179,27 @@ class ActivityController extends Controller
|
|
|
//欧洲暂时封闭
|
|
//欧洲暂时封闭
|
|
|
return apiReturnSuc();
|
|
return apiReturnSuc();
|
|
|
}
|
|
}
|
|
|
|
|
+ // 领取低保增加 2 小时 CD
|
|
|
|
|
+ $cooldownSeconds = 2 * 60 * 60;
|
|
|
|
|
+ $lastRecvTime = DB::connection('sqlsrv')
|
|
|
|
|
+ ->table('QPAccountsDB.dbo.RecordProtectList')
|
|
|
|
|
+ ->where('UserID', $UserID)
|
|
|
|
|
+ ->value('UpdateDate');
|
|
|
|
|
+ if (!empty($lastRecvTime)) {
|
|
|
|
|
+ $end = Carbon::parse($lastRecvTime)->addSeconds($cooldownSeconds);
|
|
|
|
|
+ $now = now();
|
|
|
|
|
+ if ($now->lt($end)) {
|
|
|
|
|
+ $left = $now->diffInSeconds($end);
|
|
|
|
|
+ return apiReturnFail(
|
|
|
|
|
+ ['web.protect.cooldown', 'Please claim again after cooldown'],
|
|
|
|
|
+ [
|
|
|
|
|
+ 'cooldown_seconds' => $cooldownSeconds,
|
|
|
|
|
+ 'cooldown_left_seconds' => $left,
|
|
|
|
|
+ 'cooldown_end_time' => $end->toDateTimeString(),
|
|
|
|
|
+ ]
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
$dbh = DB::connection()->getPdo();
|
|
$dbh = DB::connection()->getPdo();
|
|
|
|
|
|
|
|
$sql="
|
|
$sql="
|