fix(subscribe): improve query logic and handle status filtering

This commit is contained in:
Chang lue Tsen
2025-04-28 18:59:06 +09:00
parent 105ee9cc46
commit 2aaf4cf618
3 changed files with 8 additions and 6 deletions
+3 -4
View File
@@ -369,15 +369,14 @@ func (l *ActivateOrderLogic) Renewal(ctx context.Context, orderInfo *order.Order
userSub.Status = 1
}
//fix bug:FinishedAt causes the update subscription to fail
if now.AddDate(-30, 0, 0).After(*userSub.FinishedAt) {
userSub.FinishedAt = &now
}
// Check whether traffic reset on renewal is enabled
if !*sub.RenewalReset {
userSub.Download = 0
userSub.Upload = 0
}
if userSub.FinishedAt != nil {
userSub.FinishedAt = nil
}
userSub.ExpireTime = tool.AddTime(sub.UnitTime, orderInfo.Quantity, userSub.ExpireTime)
// update user subscribe