package authsrv import ( "Cold_Logistic/internal/pkg/common/constant" validation "github.com/go-ozzo/ozzo-validation/v4" "gogs.baozhida.cn/Cold_Logistic_libs/pkg/contrib/errors" ) type LoginReqVo struct { LoginType int `json:"loginType"` // 登录类型:1-内部人员 2-普通用户 Openid string `json:"openid"` NickName string `json:"nickName"` TokenKey string `json:"tokenKey"` } func (r *LoginReqVo) Validate() error { switch r.LoginType { case constant.AccountPlatform: return validation.ValidateStruct(r, validation.Field(&r.TokenKey, validation.Required), ) case constant.AccountApplet: return validation.ValidateStruct(r, validation.Field(&r.Openid, validation.Required.Error("请在小程序登录")), //validation.Field(&r.Phone, validation.Required, validation.RuneLength(1, 11)), ) default: return errors.New("无法识别登录类型") } } type LoginRespVo struct { TokenType string `json:"tokenType"` AccessToken string `json:"accessToken"` ExpiresIn int64 `json:"expiresIn"` IsFirst int `json:"isFirst"` // 是否首次登录:1-是 2-否 }