package exchcodeser import ( "91porn-server/common/stderr" "91porn-server/models/commod" "91porn-server/models/l/exchlogmod" "go.mongodb.org/mongo-driver/bson/primitive" ) type ObjectID = primitive.ObjectID // 获取兑换码日志列表 func GetExchangeTypeList(param exchlogmod.ListReqParam) (code stderr.Code, data interface{}, err error) { var filterParam = exchlogmod.FilterDoc{ Code: param.Code, UserID: param.UserID, Channel: param.Channel, Authority: param.Authority, } total, tList, err := exchlogmod.GetExchangeLogList(filterParam, param.Page) if err != nil { code = stderr.Failure return } list := make([]exchlogmod.ListResp, len(tList)) for i, v := range tList { // 兼容之前的数据 if v.RewardCount == 0 { v.RewardCount = 1 } list[i] = exchlogmod.ListResp{ Code: v.Code, UserID: v.UserID, Channel: v.Channel, Authority: v.Authority, Reward: v.Reward, RewardCount: v.RewardCount, CreatedAt: v.CreatedAt, } } if tList == nil { data = commod.ListResp{Total: 0, List: []exchlogmod.ExchangeLog{}} } else { data = commod.ListResp{Total: total, List: list} } code = stderr.Success return }