礼物墙
This commit is contained in:
@@ -297,7 +297,7 @@ class PerformPerSecond
|
||||
->where('end_time', '<', $now)
|
||||
->where('left_count', '>', 0)
|
||||
->select();
|
||||
|
||||
$processedCounts = 0;
|
||||
foreach ($expiredRedpackets as $redpacket) {
|
||||
Db::startTrans();
|
||||
try {
|
||||
@@ -320,28 +320,29 @@ class PerformPerSecond
|
||||
}
|
||||
}
|
||||
|
||||
// 更新红包状态为已结束
|
||||
// 更新红包状态为已退款
|
||||
Db::name('redpacket')
|
||||
->where('id', $redpacket['id'])
|
||||
->update([
|
||||
'status' => Redpacket::STATUS_FINISHED,
|
||||
'status' => Redpacket::STATUS_REFUNDED,
|
||||
'updatetime' => $now
|
||||
]);
|
||||
|
||||
// 更新Redis缓存
|
||||
// 清理Redis缓存
|
||||
$redis = Cache::store('redis')->handler();
|
||||
$redisKey = "redpacket:{$redpacket['id']}";
|
||||
$redis->hSet($redisKey, 'status', Redpacket::STATUS_FINISHED);
|
||||
$redis->del($redisKey);
|
||||
|
||||
Db::commit();
|
||||
$processedCount++;
|
||||
$processedCounts++;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
// 记录日志
|
||||
\think\Log::error("红包退款失败: {$redpacket['id']}, 错误: " . $e->getMessage());
|
||||
}
|
||||
}
|
||||
echo "处理过期红包-共". $processedCount . "条数据\n";
|
||||
echo "处理过期红包-共". $processedCounts . "条数据\n";
|
||||
echo "处理未开始红包-共". $processedCount . "条数据\n";
|
||||
}
|
||||
|
||||
//签约房时间结束处理和签约到期处理
|
||||
|
||||
Reference in New Issue
Block a user