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