feat(api): add referral percentage and only first purchase fields to user model and requests

This commit is contained in:
Chang lue Tsen
2025-09-01 09:03:39 -04:00
parent 4438b05272
commit aea20ffd5e
10 changed files with 96 additions and 61 deletions
@@ -41,20 +41,20 @@ func (l *GetUserListLogic) GetUserList(req *types.GetUserListRequest) (*types.Ge
userRespList := make([]types.User, 0, len(list))
for _, item := range list {
var user types.User
tool.DeepCopy(&user, item)
var u types.User
tool.DeepCopy(&u, item)
// 处理 AuthMethods
authMethods := make([]types.UserAuthMethod, len(user.AuthMethods)) // 直接创建目标 slice
for i, method := range user.AuthMethods {
authMethods := make([]types.UserAuthMethod, len(u.AuthMethods)) // 直接创建目标 slice
for i, method := range u.AuthMethods {
tool.DeepCopy(&authMethods[i], method)
if method.AuthType == "mobile" {
authMethods[i].AuthIdentifier = phone.FormatToInternational(method.AuthIdentifier)
}
}
user.AuthMethods = authMethods
u.AuthMethods = authMethods
userRespList = append(userRespList, user)
userRespList = append(userRespList, u)
}
return &types.GetUserListResponse{