no message
This commit is contained in:
parent
ae61c98079
commit
776ed4a2b8
@ -976,7 +976,7 @@ final class Cron
|
||||
{
|
||||
self::_helper_log("pending到activation - 开始");
|
||||
$oPlanQueueList = PlanQueue::whereNull("status")->get();
|
||||
// exit;
|
||||
|
||||
foreach ($oPlanQueueList as $oPlanQueue) {
|
||||
|
||||
// $oPlanPending = PlanPending::where("user_id", $oPlanQueue->user_id)->where("status", "!=", "fail")->orderBy("id", "ASC")->first(); // * 待激活表
|
||||
@ -986,8 +986,6 @@ final class Cron
|
||||
->orderBy("id", "ASC")
|
||||
->first();
|
||||
|
||||
// tomd($oPlanPending, 1);
|
||||
|
||||
try {
|
||||
|
||||
// 没有待激活套餐时,跳过。否则都必然$oPlanQueue->_delete();
|
||||
@ -1123,7 +1121,6 @@ final class Cron
|
||||
$oUser->save();
|
||||
|
||||
// todo 发站内信
|
||||
|
||||
DB::commit();
|
||||
continue;
|
||||
}
|
||||
@ -1206,71 +1203,64 @@ final class Cron
|
||||
foreach ($oPlanExpireQueueList as $oPlanExpireQueue)
|
||||
{
|
||||
|
||||
// try {
|
||||
try {
|
||||
|
||||
// DB::beginTransaction();
|
||||
DB::beginTransaction();
|
||||
|
||||
tomd($oPlanExpireQueue->user_id);
|
||||
$oUser = User::where("id", $oPlanExpireQueue->user_id)->first();
|
||||
// tomd($oUser->toArray(), 1);
|
||||
$oUser->class = $iToClass;
|
||||
$oUser->class_expire = $iToExpire;
|
||||
$oUser->transfer_enable = $iToEnable;
|
||||
$oUser->u = 0;
|
||||
$oUser->d = 0;
|
||||
$oUser->transfer_today = 0;
|
||||
$r = $oUser->save();
|
||||
|
||||
tomd($r);
|
||||
$oUser->save();
|
||||
|
||||
//// activated转移到expired
|
||||
// $oPlanActivated = PlanActivated::where("user_id", $oPlanExpireQueue->user_id)->first(); // 必然有,没有自然报错,user唯一
|
||||
// $oPlanActivated = Order::where("user_id", $oPlanExpireQueue->user_id)->where("status", "activated")->first();
|
||||
//
|
||||
// if ($oPlanActivated) {
|
||||
// $oPlanActivated->status = "expired";
|
||||
// $oPlanActivated->_save();
|
||||
//// self::plan_activatedToExpired($oPlanActivated);
|
||||
// }
|
||||
// //// end
|
||||
//
|
||||
// //// 通知
|
||||
// if ($reset_traffic >= 0) { // 如果设置了那个,付费用户过期转成体验用户。没设置就直接转普通用户。
|
||||
// $iToEnable = Tools::toGB($reset_traffic);
|
||||
// $iToExpire = date('Y-m-d H:i:s', strtotime("+$reset_day days"));
|
||||
// $iToClass = $iFreeClass;
|
||||
// $text .= '已转为免费体验帐户,赠送' . $reset_traffic . 'GB体验流量,'.$reset_day.'天体验时长。';
|
||||
// }
|
||||
//
|
||||
// try {
|
||||
// Notification::notifyUser($oUser, $_ENV['appName'] . '-您的套餐已经过期', $text);
|
||||
// } catch (GuzzleException|ClientExceptionInterface|TelegramSDKException $e) {
|
||||
// echo $e->getMessage() . PHP_EOL;
|
||||
// }
|
||||
// //// end
|
||||
//
|
||||
// $r = $oPlanExpireQueue->delete();
|
||||
//
|
||||
// tomd($r);
|
||||
//
|
||||
//// DB::commit();
|
||||
//
|
||||
// self::_helper_log("用户".$oUser->id."彻底过期");
|
||||
$oPlanActivated = PlanActivated::where("user_id", $oPlanExpireQueue->user_id)->first(); // 必然有,没有自然报错,user唯一
|
||||
$oPlanActivated = Order::where("user_id", $oPlanExpireQueue->user_id)->where("status", "activated")->first();
|
||||
|
||||
// } catch (\Exception $e) {
|
||||
//
|
||||
// tomd(22222222);
|
||||
// DB::rollBack();
|
||||
//
|
||||
// $sMsg = self::_helper_toJson($e->getMessage());
|
||||
//
|
||||
// self::_helper_log($sMsg, self::_eToArr($e, $sMsg));
|
||||
//
|
||||
// $oPlanExpireQueue->status = "fail:planQueue_expireDone";
|
||||
// $oPlanExpireQueue->type .= "_fail_".rand(1, 9999);
|
||||
// $oPlanExpireQueue->_save();
|
||||
//
|
||||
// }
|
||||
if ($oPlanActivated) {
|
||||
$oPlanActivated->status = "expired";
|
||||
$oPlanActivated->_save();
|
||||
// self::plan_activatedToExpired($oPlanActivated);
|
||||
}
|
||||
//// end
|
||||
|
||||
//// 通知
|
||||
if ($reset_traffic >= 0) { // 如果设置了那个,付费用户过期转成体验用户。没设置就直接转普通用户。
|
||||
$iToEnable = Tools::toGB($reset_traffic);
|
||||
$iToExpire = date('Y-m-d H:i:s', strtotime("+$reset_day days"));
|
||||
$iToClass = $iFreeClass;
|
||||
$text .= '已转为免费体验帐户,赠送' . $reset_traffic . 'GB体验流量,'.$reset_day.'天体验时长。';
|
||||
}
|
||||
|
||||
try {
|
||||
Notification::notifyUser($oUser, $_ENV['appName'] . '-您的套餐已经过期', $text);
|
||||
} catch (GuzzleException|ClientExceptionInterface|TelegramSDKException $e) {
|
||||
echo $e->getMessage() . PHP_EOL;
|
||||
}
|
||||
//// end
|
||||
|
||||
$r = $oPlanExpireQueue->delete();
|
||||
|
||||
DB::commit();
|
||||
|
||||
self::_helper_log("用户".$oUser->id."彻底过期");
|
||||
|
||||
} catch (\Exception $e) {
|
||||
|
||||
DB::rollBack();
|
||||
|
||||
$sMsg = self::_helper_toJson($e->getMessage());
|
||||
|
||||
self::_helper_log($sMsg, self::_eToArr($e, $sMsg));
|
||||
|
||||
$oPlanExpireQueue->status = "fail:planQueue_expireDone";
|
||||
$oPlanExpireQueue->type .= "_fail_".rand(1, 9999);
|
||||
$oPlanExpireQueue->_save();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user