feat(api): standardize timestamp field across log structures
This commit is contained in:
parent
88cbfbb7d6
commit
82fd674ae4
@ -41,7 +41,7 @@ type (
|
||||
UserAgent string `json:"user_agent"`
|
||||
ClientIP string `json:"client_ip"`
|
||||
UserSubscribeId int64 `json:"user_subscribe_id"`
|
||||
SubscribedAt int64 `json:"subscribed_at"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
}
|
||||
FilterSubscribeLogRequest {
|
||||
FilterLogParams
|
||||
@ -57,7 +57,7 @@ type (
|
||||
LoginIP string `json:"login_ip"`
|
||||
UserAgent string `json:"user_agent"`
|
||||
Success bool `json:"success"`
|
||||
LoginTime int64 `json:"login_time"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
}
|
||||
FilterLoginLogRequest {
|
||||
FilterLogParams
|
||||
@ -73,7 +73,7 @@ type (
|
||||
Identifier string `json:"identifier"`
|
||||
RegisterIP string `json:"register_ip"`
|
||||
UserAgent string `json:"user_agent"`
|
||||
RegisterTime int64 `json:"register_time"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
}
|
||||
FilterRegisterLogRequest {
|
||||
FilterLogParams
|
||||
@ -88,7 +88,7 @@ type (
|
||||
UserId int64 `json:"user_id"`
|
||||
UserSubscribeId int64 `json:"user_subscribe_id"`
|
||||
OrderNo string `json:"order_no,omitempty"`
|
||||
ResetAt int64 `json:"reset_at"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
}
|
||||
FilterResetSubscribeLogRequest {
|
||||
FilterLogParams
|
||||
@ -156,7 +156,7 @@ type (
|
||||
Amount int64 `json:"amount"`
|
||||
Balance int64 `json:"balance"`
|
||||
Remark string `json:"remark,omitempty"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
}
|
||||
FilterGiftLogRequest {
|
||||
FilterLogParams
|
||||
|
||||
@ -515,7 +515,7 @@ type (
|
||||
Token string `json:"token"`
|
||||
IP string `json:"ip"`
|
||||
UserAgent string `json:"user_agent"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
}
|
||||
UserLoginLog {
|
||||
Id int64 `json:"id"`
|
||||
@ -523,7 +523,7 @@ type (
|
||||
LoginIP string `json:"login_ip"`
|
||||
UserAgent string `json:"user_agent"`
|
||||
Success bool `json:"success"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
}
|
||||
MessageLog {
|
||||
Id int64 `json:"id"`
|
||||
@ -750,7 +750,7 @@ type (
|
||||
Type uint16 `json:"type"`
|
||||
UserSubscribeId int64 `json:"user_subscribe_id"`
|
||||
OrderNo string `json:"order_no,omitempty"`
|
||||
ResetAt int64 `json:"reset_at"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
}
|
||||
BalanceLog {
|
||||
Type uint16 `json:"type"`
|
||||
@ -765,7 +765,7 @@ type (
|
||||
UserId int64 `json:"user_id"`
|
||||
Amount int64 `json:"amount"`
|
||||
OrderNo string `json:"order_no"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@ func (l *FilterCommissionLogLogic) FilterCommissionLog(req *types.FilterCommissi
|
||||
Type: content.Type,
|
||||
Amount: content.Amount,
|
||||
OrderNo: content.OrderNo,
|
||||
CreatedAt: content.CreatedAt,
|
||||
Timestamp: content.Timestamp,
|
||||
})
|
||||
}
|
||||
return &types.FilterCommissionLogResponse{
|
||||
|
||||
@ -57,7 +57,7 @@ func (l *FilterGiftLogLogic) FilterGiftLog(req *types.FilterGiftLogRequest) (res
|
||||
Amount: content.Amount,
|
||||
Balance: content.Balance,
|
||||
Remark: content.Remark,
|
||||
CreatedAt: content.CreatedAt,
|
||||
Timestamp: content.Timestamp,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -54,7 +54,7 @@ func (l *FilterLoginLogLogic) FilterLoginLog(req *types.FilterLoginLogRequest) (
|
||||
LoginIP: item.LoginIP,
|
||||
UserAgent: item.UserAgent,
|
||||
Success: item.Success,
|
||||
LoginTime: item.LoginTime,
|
||||
Timestamp: item.Timestamp,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -55,7 +55,7 @@ func (l *FilterRegisterLogLogic) FilterRegisterLog(req *types.FilterRegisterLogR
|
||||
Identifier: item.Identifier,
|
||||
RegisterIP: item.RegisterIP,
|
||||
UserAgent: item.UserAgent,
|
||||
RegisterTime: item.RegisterTime,
|
||||
Timestamp: item.Timestamp,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -55,7 +55,7 @@ func (l *FilterResetSubscribeLogLogic) FilterResetSubscribeLog(req *types.Filter
|
||||
UserId: content.UserId,
|
||||
UserSubscribeId: item.ObjectID,
|
||||
OrderNo: content.OrderNo,
|
||||
ResetAt: content.ResetAt,
|
||||
Timestamp: content.Timestamp,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@ func (l *FilterSubscribeLogLogic) FilterSubscribeLog(req *types.FilterSubscribeL
|
||||
UserAgent: content.UserAgent,
|
||||
ClientIP: content.ClientIP,
|
||||
UserSubscribeId: content.UserSubscribeId,
|
||||
SubscribedAt: datum.CreatedAt.UnixMilli(),
|
||||
Timestamp: datum.CreatedAt.UnixMilli(),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@ func (l *GetUserLoginLogsLogic) GetUserLoginLogs(req *types.GetUserLoginLogsRequ
|
||||
LoginIP: content.LoginIP,
|
||||
UserAgent: content.UserAgent,
|
||||
Success: content.Success,
|
||||
CreatedAt: datum.CreatedAt.UnixMilli(),
|
||||
Timestamp: datum.CreatedAt.UnixMilli(),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ func (l *GetUserSubscribeResetTrafficLogsLogic) GetUserSubscribeResetTrafficLogs
|
||||
Id: item.Id,
|
||||
Type: content.Type,
|
||||
OrderNo: content.OrderNo,
|
||||
ResetAt: content.ResetAt,
|
||||
Timestamp: content.Timestamp,
|
||||
UserSubscribeId: item.ObjectID,
|
||||
})
|
||||
}
|
||||
|
||||
@ -185,7 +185,7 @@ func (l *TelephoneUserRegisterLogic) TelephoneUserRegister(req *types.TelephoneR
|
||||
Identifier: phoneNumber,
|
||||
RegisterIP: req.IP,
|
||||
UserAgent: req.UserAgent,
|
||||
RegisterTime: time.Now().UnixMilli(),
|
||||
Timestamp: time.Now().UnixMilli(),
|
||||
}
|
||||
content, _ = registerLog.Marshal()
|
||||
if err := l.svcCtx.LogModel.Insert(l.ctx, &log.SystemLog{
|
||||
|
||||
@ -173,7 +173,7 @@ func (l *UserRegisterLogic) UserRegister(req *types.UserRegisterRequest) (resp *
|
||||
Identifier: req.Email,
|
||||
RegisterIP: req.IP,
|
||||
UserAgent: req.UserAgent,
|
||||
RegisterTime: time.Now().UnixMilli(),
|
||||
Timestamp: time.Now().UnixMilli(),
|
||||
}
|
||||
content, _ = registerLog.Marshal()
|
||||
if err = l.svcCtx.LogModel.Insert(l.ctx, &log.SystemLog{
|
||||
|
||||
@ -102,7 +102,7 @@ func (l *CloseOrderLogic) CloseOrder(req *types.CloseOrderRequest) error {
|
||||
Amount: orderInfo.GiftAmount,
|
||||
Balance: deduction,
|
||||
Remark: "Order cancellation refund",
|
||||
CreatedAt: time.Now().UnixMilli(),
|
||||
Timestamp: time.Now().UnixMilli(),
|
||||
}
|
||||
content, _ := giftLog.Marshal()
|
||||
|
||||
|
||||
@ -204,7 +204,7 @@ func (l *PurchaseLogic) Purchase(req *types.PurchaseOrderRequest) (resp *types.P
|
||||
Amount: orderInfo.GiftAmount,
|
||||
Balance: u.GiftAmount,
|
||||
Remark: "Purchase order deduction",
|
||||
CreatedAt: time.Now().UnixMilli(),
|
||||
Timestamp: time.Now().UnixMilli(),
|
||||
}
|
||||
content, _ := giftLog.Marshal()
|
||||
|
||||
|
||||
@ -171,7 +171,7 @@ func (l *RenewalLogic) Renewal(req *types.RenewalOrderRequest) (resp *types.Rene
|
||||
Amount: orderInfo.GiftAmount,
|
||||
Balance: u.GiftAmount,
|
||||
Remark: "Renewal order deduction",
|
||||
CreatedAt: time.Now().UnixMilli(),
|
||||
Timestamp: time.Now().UnixMilli(),
|
||||
}
|
||||
content, _ := giftLog.Marshal()
|
||||
|
||||
|
||||
@ -112,7 +112,7 @@ func (l *ResetTrafficLogic) ResetTraffic(req *types.ResetTrafficOrderRequest) (r
|
||||
Amount: orderInfo.GiftAmount,
|
||||
Balance: u.GiftAmount,
|
||||
Remark: "Renewal order deduction",
|
||||
CreatedAt: time.Now().UnixMilli(),
|
||||
Timestamp: time.Now().UnixMilli(),
|
||||
}
|
||||
content, _ := giftLog.Marshal()
|
||||
|
||||
|
||||
@ -59,7 +59,7 @@ func (l *GetLoginLogLogic) GetLoginLog(req *types.GetLoginLogRequest) (resp *typ
|
||||
LoginIP: content.LoginIP,
|
||||
UserAgent: content.UserAgent,
|
||||
Success: content.Success,
|
||||
CreatedAt: datum.CreatedAt.UnixMilli(),
|
||||
Timestamp: datum.CreatedAt.UnixMilli(),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -60,7 +60,7 @@ func (l *GetSubscribeLogLogic) GetSubscribeLog(req *types.GetSubscribeLogRequest
|
||||
Token: content.Token,
|
||||
IP: content.ClientIP,
|
||||
UserAgent: content.UserAgent,
|
||||
CreatedAt: item.CreatedAt.UnixMilli(),
|
||||
Timestamp: item.CreatedAt.UnixMilli(),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -58,7 +58,7 @@ func (l *QueryUserCommissionLogLogic) QueryUserCommissionLog(req *types.QueryUse
|
||||
Type: content.Type,
|
||||
Amount: content.Amount,
|
||||
OrderNo: content.OrderNo,
|
||||
CreatedAt: content.CreatedAt,
|
||||
Timestamp: content.Timestamp,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -123,7 +123,7 @@ type Login struct {
|
||||
LoginIP string `json:"login_ip"`
|
||||
UserAgent string `json:"user_agent"`
|
||||
Success bool `json:"success"`
|
||||
LoginTime int64 `json:"login_time"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
}
|
||||
|
||||
// Marshal implements the json.Marshaler interface for Login.
|
||||
@ -149,7 +149,7 @@ type Register struct {
|
||||
Identifier string `json:"identifier"`
|
||||
RegisterIP string `json:"register_ip"`
|
||||
UserAgent string `json:"user_agent"`
|
||||
RegisterTime int64 `json:"register_time"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
}
|
||||
|
||||
// Marshal implements the json.Marshaler interface for Register.
|
||||
@ -200,7 +200,7 @@ type ResetSubscribe struct {
|
||||
Type uint16 `json:"type"`
|
||||
UserId int64 `json:"user_id"`
|
||||
OrderNo string `json:"order_no,omitempty"`
|
||||
ResetAt int64 `json:"reset_at"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
}
|
||||
|
||||
// Marshal implements the json.Marshaler interface for ResetSubscribe.
|
||||
@ -251,7 +251,7 @@ type Commission struct {
|
||||
Type uint16 `json:"type"`
|
||||
Amount int64 `json:"amount"`
|
||||
OrderNo string `json:"order_no"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
}
|
||||
|
||||
// Marshal implements the json.Marshaler interface for Commission.
|
||||
@ -279,7 +279,7 @@ type Gift struct {
|
||||
Amount int64 `json:"amount"`
|
||||
Balance int64 `json:"balance"`
|
||||
Remark string `json:"remark,omitempty"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
}
|
||||
|
||||
// Marshal implements the json.Marshaler interface for Gift.
|
||||
|
||||
@ -235,7 +235,7 @@ type CommissionLog struct {
|
||||
UserId int64 `json:"user_id"`
|
||||
Amount int64 `json:"amount"`
|
||||
OrderNo string `json:"order_no"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
}
|
||||
|
||||
type Coupon struct {
|
||||
@ -1109,7 +1109,7 @@ type GiftLog struct {
|
||||
Amount int64 `json:"amount"`
|
||||
Balance int64 `json:"balance"`
|
||||
Remark string `json:"remark,omitempty"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
}
|
||||
|
||||
type GoogleLoginCallbackRequest struct {
|
||||
@ -1149,7 +1149,7 @@ type LoginLog struct {
|
||||
LoginIP string `json:"login_ip"`
|
||||
UserAgent string `json:"user_agent"`
|
||||
Success bool `json:"success"`
|
||||
LoginTime int64 `json:"login_time"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
}
|
||||
|
||||
type LoginResponse struct {
|
||||
@ -1576,7 +1576,7 @@ type RegisterLog struct {
|
||||
Identifier string `json:"identifier"`
|
||||
RegisterIP string `json:"register_ip"`
|
||||
UserAgent string `json:"user_agent"`
|
||||
RegisterTime int64 `json:"register_time"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
}
|
||||
|
||||
type RenewalOrderRequest struct {
|
||||
@ -1604,7 +1604,7 @@ type ResetSubscribeLog struct {
|
||||
UserId int64 `json:"user_id"`
|
||||
UserSubscribeId int64 `json:"user_subscribe_id"`
|
||||
OrderNo string `json:"order_no,omitempty"`
|
||||
ResetAt int64 `json:"reset_at"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
}
|
||||
|
||||
type ResetSubscribeTrafficLog struct {
|
||||
@ -1612,7 +1612,7 @@ type ResetSubscribeTrafficLog struct {
|
||||
Type uint16 `json:"type"`
|
||||
UserSubscribeId int64 `json:"user_subscribe_id"`
|
||||
OrderNo string `json:"order_no,omitempty"`
|
||||
ResetAt int64 `json:"reset_at"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
}
|
||||
|
||||
type ResetTrafficOrderRequest struct {
|
||||
@ -1906,7 +1906,7 @@ type SubscribeLog struct {
|
||||
UserAgent string `json:"user_agent"`
|
||||
ClientIP string `json:"client_ip"`
|
||||
UserSubscribeId int64 `json:"user_subscribe_id"`
|
||||
SubscribedAt int64 `json:"subscribed_at"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
}
|
||||
|
||||
type SubscribeSortRequest struct {
|
||||
@ -2327,7 +2327,7 @@ type UserLoginLog struct {
|
||||
LoginIP string `json:"login_ip"`
|
||||
UserAgent string `json:"user_agent"`
|
||||
Success bool `json:"success"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
}
|
||||
|
||||
type UserLoginRequest struct {
|
||||
@ -2407,7 +2407,7 @@ type UserSubscribeLog struct {
|
||||
Token string `json:"token"`
|
||||
IP string `json:"ip"`
|
||||
UserAgent string `json:"user_agent"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
}
|
||||
|
||||
type UserSubscribeTrafficLog struct {
|
||||
|
||||
@ -389,7 +389,7 @@ func (l *ActivateOrderLogic) handleCommission(ctx context.Context, userInfo *use
|
||||
Type: commissionType,
|
||||
Amount: amount,
|
||||
OrderNo: orderInfo.OrderNo,
|
||||
CreatedAt: orderInfo.CreatedAt.UnixMilli(),
|
||||
Timestamp: orderInfo.CreatedAt.UnixMilli(),
|
||||
}
|
||||
|
||||
content, _ := commissionLog.Marshal()
|
||||
@ -580,7 +580,7 @@ func (l *ActivateOrderLogic) ResetTraffic(ctx context.Context, orderInfo *order.
|
||||
Type: log.ResetSubscribeTypePaid,
|
||||
UserId: userInfo.Id,
|
||||
OrderNo: orderInfo.OrderNo,
|
||||
ResetAt: time.Now().UnixMilli(),
|
||||
Timestamp: time.Now().UnixMilli(),
|
||||
}
|
||||
|
||||
content, _ := resetLog.Marshal()
|
||||
|
||||
@ -604,7 +604,7 @@ func (l *ResetTrafficLogic) insertLog(ctx context.Context, subId, userId int64)
|
||||
trafficLog := log.ResetSubscribe{
|
||||
Type: log.ResetSubscribeTypeAuto,
|
||||
UserId: userId,
|
||||
ResetAt: time.Now().UnixMilli(),
|
||||
Timestamp: time.Now().UnixMilli(),
|
||||
}
|
||||
content, _ := trafficLog.Marshal()
|
||||
if err := l.svc.DB.WithContext(ctx).Model(&log.SystemLog{}).Create(&log.SystemLog{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user