fix(log): insert reset traffic log during subscription activation

This commit is contained in:
Chang lue Tsen 2025-08-21 10:53:12 -04:00
parent fcdb9f72ef
commit ec4e95451b

View File

@ -590,6 +590,23 @@ func (l *ActivateOrderLogic) ResetTraffic(ctx context.Context, orderInfo *order.
// Clear cache
l.clearServerCache(ctx, sub)
// insert reset traffic log
resetLog := &log.ResetSubscribe{
Type: log.ResetSubscribeTypePaid,
OrderNo: orderInfo.OrderNo,
ResetAt: time.Now().UnixMilli(),
}
content, _ := resetLog.Marshal()
if err = l.svc.LogModel.Insert(ctx, &log.SystemLog{
Type: log.TypeResetSubscribe.Uint8(),
Date: time.Now().Format(time.DateOnly),
ObjectID: userSub.Id,
Content: string(content),
}); err != nil {
logger.WithContext(ctx).Error("[Order Queue]Insert reset subscribe log failed", logger.Field("error", err.Error()))
}
// Send notifications
l.sendNotifications(ctx, orderInfo, userInfo, sub, userSub, telegram.ResetTrafficNotify)