Files
rootandClaude Opus 5 8679200f41 Initial commit
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-15 13:57:10 +08:00

50 lines
1.2 KiB
Go

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
}