no message

This commit is contained in:
hellcat 2025-10-13 17:33:57 +08:00
parent 4a770ff17f
commit 916839cb1e

View File

@ -963,7 +963,7 @@ final class Cron
DB::beginTransaction(); DB::beginTransaction();
$oUser->isPayClass = $oUser->class >= $iPayClass ? true : false; // $oUser->isPayClass = $oUser->class >= $iPayClass ? true : false;
if (strtotime($oUser->class_expire) < time()) { // 时间到期 if (strtotime($oUser->class_expire) < time()) { // 时间到期
self::_class_expire($oUser); self::_class_expire($oUser);
@ -1007,14 +1007,15 @@ final class Cron
->orderBy("id", "ASC") ->orderBy("id", "ASC")
->first(); ->first();
// 没有待激活套餐时,跳过。否则都必然$oPlanQueue->_delete();
if (!$oPlanPending) {
$oPlanQueue->type = "expire";
$oPlanQueue->save();
continue; // 没有待激活就直接桡过,而不是报错
}
try { try {
// 没有待激活套餐时,跳过。否则都必然$oPlanQueue->_delete();
if (!$oPlanPending) {
// throw new \Exception("没有待激活套餐");
continue; // 没有待激活就直接桡过,而不是报错
}
DB::beginTransaction(); DB::beginTransaction();
$oProduct = Product::where("code", $oPlanPending->product_code)->first(); // * 商品表 $oProduct = Product::where("code", $oPlanPending->product_code)->first(); // * 商品表
@ -1030,7 +1031,7 @@ final class Cron
$iUserMoneyOld = $oUser->money; $iUserMoneyOld = $oUser->money;
$iUserMoneyNew = $oUser->money + $oPlanPending->user_price; $iUserMoneyNew = $oUser->money + $oPlanPending->user_price;
$oUser->money = $oPlanPending->user_price; $oUser->money = $iUserMoneyNew;
$oUser->save(); $oUser->save();
(new UserMoneyLog())->add( (new UserMoneyLog())->add(
@ -1141,7 +1142,7 @@ final class Cron
$oUser->autorenew = 0; $oUser->autorenew = 0;
$oUser->save(); $oUser->save();
// todo 发站内信 // todo 发站内信 成功失败都发
DB::commit(); DB::commit();
continue; continue;
} }
@ -1187,7 +1188,7 @@ final class Cron
DB::commit(); DB::commit();
continue; // continue;
} catch (\Exception $e) { } catch (\Exception $e) {
@ -1230,20 +1231,13 @@ final class Cron
DB::beginTransaction(); DB::beginTransaction();
$oUser = User::where("id", $oPlanExpireQueue->user_id)->first(); $oUser = User::where("id", $oPlanExpireQueue->user_id)->first();
$oUser->class = $iToClass;
$oUser->class_expire = $iToExpire;
$oUser->transfer_enable = $iToEnable;
$oUser->u = 0;
$oUser->d = 0;
$oUser->transfer_today = 0;
$oUser->save();
//// activated转移到expired //// activated转移到expired
// $oPlanActivated = PlanActivated::where("user_id", $oPlanExpireQueue->user_id)->first(); // 必然有没有自然报错user唯一 // $oPlanActivated = PlanActivated::where("user_id", $oPlanExpireQueue->user_id)->first(); // 必然有没有自然报错user唯一
$oPlanActivated = Order::where("user_id", $oPlanExpireQueue->user_id)->where("status", "activated")->first(); $oPlanActivated = Order::where("user_id", $oPlanExpireQueue->user_id)->where("status", "activated")->first(); // 没有就不管,只过期用户
if ($oPlanActivated) { if ($oPlanActivated) {
$oPlanActivated->status = "expired"; $oPlanActivated->status = "expired";
$oPlanActivated->update_time = time();
$oPlanActivated->_save(); $oPlanActivated->_save();
// self::plan_activatedToExpired($oPlanActivated); // self::plan_activatedToExpired($oPlanActivated);
} }
@ -1257,6 +1251,14 @@ final class Cron
$text .= '已转为免费体验帐户,赠送' . $reset_traffic . 'GB体验流量'.$reset_day.'天体验时长。'; $text .= '已转为免费体验帐户,赠送' . $reset_traffic . 'GB体验流量'.$reset_day.'天体验时长。';
} }
$oUser->class = $iToClass;
$oUser->u = 0;
$oUser->d = 0;
$oUser->transfer_today = 0;
$oUser->transfer_enable = $iToEnable;
$oUser->class_expire = $iToExpire;
$oUser->save();
try { try {
Notification::notifyUser($oUser, $_ENV['appName'] . '-您的套餐已经过期', $text); Notification::notifyUser($oUser, $_ENV['appName'] . '-您的套餐已经过期', $text);
} catch (GuzzleException|ClientExceptionInterface|TelegramSDKException $e) { } catch (GuzzleException|ClientExceptionInterface|TelegramSDKException $e) {
@ -1264,12 +1266,12 @@ final class Cron
} }
//// end //// end
$r = $oPlanExpireQueue->delete(); $oPlanExpireQueue->delete();
DB::commit();
self::_helper_log("用户".$oUser->id."彻底过期"); self::_helper_log("用户".$oUser->id."彻底过期");
DB::commit();
} catch (\Exception $e) { } catch (\Exception $e) {
DB::rollBack(); DB::rollBack();