feat: 释放回库存的 Token 优先分配

This commit is contained in:
2026-11-09 18:30:28 +08:00
parent 08884270b7
commit eba3af2054
9 changed files with 361 additions and 3 deletions
+3 -1
View File
@@ -224,6 +224,7 @@ func (s *RockService) ReleaseUnboundUsingToken(ctx context.Context, tokenID uint
return fmt.Errorf("仅扫码使用中的链接可以释放回库存")
}
orderNo = token.AssignedOrderNo
now := time.Now()
if err := tx.Model(&token).Updates(map[string]interface{}{
"status": model.RockStatusAvailable,
"assigned_order_no": "",
@@ -238,7 +239,8 @@ func (s *RockService) ReleaseUnboundUsingToken(ctx context.Context, tokenID uint
"using_at": nil,
"redeemed_at": nil,
"upstream_fulfill_id": 0,
"updated_at": time.Now(),
"restocked_at": now, // 人工释放回库存:下次分配优先使用
"updated_at": now,
}).Error; err != nil {
return err
}