feat(server): implement server management handlers and database schema
This commit is contained in:
@@ -20,7 +20,7 @@ type GetSubscribeLogLogic struct {
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// Get Subscribe Log
|
||||
// NewGetSubscribeLogLogic Get Subscribe Log
|
||||
func NewGetSubscribeLogLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetSubscribeLogLogic {
|
||||
return &GetSubscribeLogLogic{
|
||||
Logger: logger.WithContext(ctx),
|
||||
@@ -39,7 +39,7 @@ func (l *GetSubscribeLogLogic) GetSubscribeLog(req *types.GetSubscribeLogRequest
|
||||
Page: req.Page,
|
||||
Size: req.Size,
|
||||
Type: log.TypeSubscribe.Uint8(),
|
||||
ObjectID: u.Id,
|
||||
ObjectID: u.Id, // filter by current user id
|
||||
})
|
||||
if err != nil {
|
||||
l.Errorw("[GetUserSubscribeLogs] Get User Subscribe Logs Error:", logger.Field("err", err.Error()))
|
||||
@@ -56,7 +56,7 @@ func (l *GetSubscribeLogLogic) GetSubscribeLog(req *types.GetSubscribeLogRequest
|
||||
list = append(list, types.UserSubscribeLog{
|
||||
Id: item.Id,
|
||||
UserId: item.ObjectID,
|
||||
UserSubscribeId: content.SubscribeId,
|
||||
UserSubscribeId: content.UserSubscribeId,
|
||||
Token: content.Token,
|
||||
IP: content.ClientIP,
|
||||
UserAgent: content.UserAgent,
|
||||
|
||||
@@ -20,7 +20,7 @@ type QueryUserBalanceLogLogic struct {
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// Query User Balance Log
|
||||
// NewQueryUserBalanceLogLogic Query User Balance Log
|
||||
func NewQueryUserBalanceLogLogic(ctx context.Context, svcCtx *svc.ServiceContext) *QueryUserBalanceLogLogic {
|
||||
return &QueryUserBalanceLogLogic{
|
||||
Logger: logger.WithContext(ctx),
|
||||
@@ -51,21 +51,20 @@ func (l *QueryUserBalanceLogLogic) QueryUserBalanceLog() (resp *types.QueryUserB
|
||||
Total: total,
|
||||
}
|
||||
|
||||
list := make([]types.UserBalanceLog, 0)
|
||||
list := make([]types.BalanceLog, 0)
|
||||
for _, datum := range data {
|
||||
var content log.Balance
|
||||
if err = content.Unmarshal([]byte(datum.Content)); err != nil {
|
||||
l.Errorf("[QueryUserBalanceLog] unmarshal balance log content failed: %v", err.Error())
|
||||
continue
|
||||
}
|
||||
list = append(list, types.UserBalanceLog{
|
||||
Id: datum.Id,
|
||||
list = append(list, types.BalanceLog{
|
||||
UserId: datum.ObjectID,
|
||||
Amount: content.Amount,
|
||||
Type: content.Type,
|
||||
OrderId: content.OrderId,
|
||||
Balance: content.Balance,
|
||||
CreatedAt: datum.CreatedAt.UnixMilli(),
|
||||
Timestamp: content.Timestamp,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -54,10 +54,10 @@ func (l *QueryUserCommissionLogLogic) QueryUserCommissionLog(req *types.QueryUse
|
||||
continue
|
||||
}
|
||||
list = append(list, types.CommissionLog{
|
||||
Id: datum.Id,
|
||||
UserId: datum.ObjectID,
|
||||
OrderNo: content.OrderNo,
|
||||
Type: content.Type,
|
||||
Amount: content.Amount,
|
||||
OrderNo: content.OrderNo,
|
||||
CreatedAt: content.CreatedAt,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user