feat(server): implement server management handlers and database schema
This commit is contained in:
@@ -376,7 +376,7 @@ func (l *ActivateOrderLogic) handleCommission(ctx context.Context, userInfo *use
|
||||
return err
|
||||
}
|
||||
|
||||
var commissionType uint8
|
||||
var commissionType uint16
|
||||
switch orderInfo.Type {
|
||||
case OrderTypeSubscribe:
|
||||
commissionType = log.CommissionTypePurchase
|
||||
@@ -593,6 +593,7 @@ func (l *ActivateOrderLogic) ResetTraffic(ctx context.Context, orderInfo *order.
|
||||
// insert reset traffic log
|
||||
resetLog := &log.ResetSubscribe{
|
||||
Type: log.ResetSubscribeTypePaid,
|
||||
UserId: userInfo.Id,
|
||||
OrderNo: orderInfo.OrderNo,
|
||||
ResetAt: time.Now().UnixMilli(),
|
||||
}
|
||||
|
||||
@@ -594,19 +594,20 @@ func (l *ResetTrafficLogic) clearCache(ctx context.Context, list []*user.Subscri
|
||||
}
|
||||
}
|
||||
// Insert traffic reset log
|
||||
l.insertLog(ctx, sub.Id)
|
||||
l.insertLog(ctx, sub.Id, sub.UserId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// insertLog inserts a reset traffic log entry
|
||||
func (l *ResetTrafficLogic) insertLog(ctx context.Context, subId int64) {
|
||||
func (l *ResetTrafficLogic) insertLog(ctx context.Context, subId, userId int64) {
|
||||
trafficLog := log.ResetSubscribe{
|
||||
Type: log.ResetSubscribeTypeAuto,
|
||||
UserId: userId,
|
||||
ResetAt: time.Now().UnixMilli(),
|
||||
}
|
||||
content, _ := trafficLog.Marshal()
|
||||
if err := l.svc.DB.Model(&log.SystemLog{}).Create(&log.SystemLog{
|
||||
if err := l.svc.DB.WithContext(ctx).Model(&log.SystemLog{}).Create(&log.SystemLog{
|
||||
Type: log.TypeResetSubscribe.Uint8(),
|
||||
ObjectID: subId,
|
||||
Date: time.Now().Format(time.DateOnly),
|
||||
|
||||
Reference in New Issue
Block a user