Skip to content

Commit

Permalink
fix(cmfx/modules/member): 注册用户时 inviter 可以为空
Browse files Browse the repository at this point in the history
  • Loading branch information
caixw committed Jan 8, 2025
1 parent 41f2820 commit 1932c47
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmfx/modules/member/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func Install(mod *cmfx.Module, o *Config, up *upload.Module, adminL *admin.Modul

_, err := m.Add(user.StateNormal, &RegisterInfo{
Username: "m1",
Password: "",
Password: "123",
Birthday: time.Now(),
Sex: types.SexFemale,
Nickname: "nickname",
Expand Down
4 changes: 2 additions & 2 deletions cmfx/modules/member/route_member.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,14 @@ func (mem *memberInfoTO) Filter(v *web.FilterContext) {

v.Add(filters.NotEmpty("username", &mem.Username)).
Add(filters.NotEmpty("password", &mem.Password)).
Add(filter.NewBuilder(filter.V(func(no string) bool {
Add(filter.NewBuilder(filter.V(validator.ZeroOr(func(no string) bool {
u, err := mem.m.UserModule().GetUserByNO(no)
if err != nil {
return false
}
mem.inviterID = u.ID
return true
}, locales.InvalidValue))("inviter", &mem.Inviter))
}), locales.InvalidValue))("inviter", &mem.Inviter))
}

func (mem *memberInfoTO) toInfo() *RegisterInfo {
Expand Down

0 comments on commit 1932c47

Please sign in to comment.