67 lines
2.4 KiB
Go
67 lines
2.4 KiB
Go
package sysin
|
|
|
|
import (
|
|
"context"
|
|
"regexp"
|
|
"strings"
|
|
|
|
"github.com/gogf/gf/v2/errors/gerror"
|
|
)
|
|
|
|
type AppMemberRegisterInp struct {
|
|
Username string `json:"username" v:"required|length:3,64#用户名不能为空|用户名长度为3到64个字符"`
|
|
Mobile string `json:"mobile" v:"required|phone-loose#手机号不能为空|手机号格式不正确"`
|
|
Password string `json:"password" v:"required|length:6,64#密码不能为空|密码长度为6到64个字符"`
|
|
InviteCode string `json:"inviteCode" v:"required#请输入邀请码"`
|
|
RegisterOrigin string `json:"registerOrigin" v:"max-length:512#注册来源不能超过512个字符"`
|
|
RegisterHost string `json:"registerHost" v:"max-length:255#注册域名不能超过255个字符"`
|
|
}
|
|
|
|
func (in *AppMemberRegisterInp) Filter(ctx context.Context) error {
|
|
in.Username = strings.TrimSpace(in.Username)
|
|
in.Mobile = strings.TrimSpace(in.Mobile)
|
|
in.InviteCode = strings.TrimSpace(in.InviteCode)
|
|
if !regexp.MustCompile(`^[0-9]{6}$`).MatchString(in.InviteCode) {
|
|
return gerror.New("邀请码必须为6位数字")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type AppMemberRegisterModel struct {
|
|
MemberId uint64 `json:"memberId"`
|
|
MemberNo string `json:"memberNo"`
|
|
Bound bool `json:"bound"`
|
|
Domain string `json:"domain"`
|
|
}
|
|
|
|
type AppMemberAccountLoginInp struct {
|
|
Account string `json:"account" v:"required|max-length:64#登录账号不能为空|登录账号不能超过64个字符"`
|
|
Password string `json:"password" v:"required|max-length:64#登录密码不能为空|登录密码不能超过64个字符"`
|
|
LoginHost string `json:"loginHost" v:"max-length:255#登录域名不能超过255个字符"`
|
|
}
|
|
|
|
func (in *AppMemberAccountLoginInp) Filter(ctx context.Context) error {
|
|
in.Account = strings.TrimSpace(in.Account)
|
|
return nil
|
|
}
|
|
|
|
type AppMemberMobileLoginInp struct {
|
|
Mobile string `json:"mobile" v:"required|phone-loose#手机号不能为空|手机号格式不正确"`
|
|
Code string `json:"code" v:"required|length:4,8#验证码不能为空|验证码格式不正确"`
|
|
LoginHost string `json:"loginHost" v:"max-length:255#登录域名不能超过255个字符"`
|
|
}
|
|
|
|
func (in *AppMemberMobileLoginInp) Filter(ctx context.Context) error {
|
|
in.Mobile = strings.TrimSpace(in.Mobile)
|
|
return nil
|
|
}
|
|
|
|
type AppMemberLoginModel struct {
|
|
Id uint64 `json:"id"`
|
|
MemberNo string `json:"memberNo"`
|
|
Username string `json:"username"`
|
|
Mobile string `json:"mobile"`
|
|
Token string `json:"token"`
|
|
Expires int64 `json:"expires"`
|
|
}
|