处理过期红包

This commit is contained in:
2025-10-14 11:35:59 +08:00
parent 2db084b7bd
commit 5b26b8c57f

View File

@@ -240,14 +240,9 @@ class PerformPerSecond
*/
public function processExpiredRedpackets()
{
$now = time();
$redpacketModel = new Redpacket();
// 查找已结束但未退款的红包
$expiredRedpackets = Db::name('redpacket')
// ->where('status', Redpacket::STATUS_ACTIVE)
->where('end_time', '<', $now)
// ->where('left_count', '>', 0)
->where(['end_time' => ['<',time()]])
->select();
foreach ($expiredRedpackets as $redpacket) {
@@ -285,8 +280,8 @@ class PerformPerSecond
Db::name('redpacket')
->where('id', $redpacket['id'])
->update([
'status' => Redpacket::STATUS_REFUNDED,
'updatetime' => $now
'status' => 3,
'updatetime' => time()
]);
// 清理Redis缓存