package req import ( "errors" "servicebase/pkg/datasource/fields" ) // 登录请求对象 type SignInRequest struct { Email string `json:"email"` Password string `json:"password"` } func (req *SignInRequest) CheckParameter() (err error) { if len(req.Email) == 0 || len(req.Password) == 0 { err = errors.New("邮箱和密码不能为空") return } return nil } // 注册请求对象 type SignUpRequest struct { UserType string `json:"userType"` Truename string `json:"truename"` Nickname string `json:"nickname"` Password string `json:"password"` Phone string `json:"phone"` Email string `json:"email"` BirthYear string `json:"birthYear"` BirthMonth string `json:"birthMonth"` BirthDay string `json:"birthday"` Gender string `json:"gender"` Position string `json:"position"` PostCode string `json:"postCode"` Prefecture string `json:"prefecture"` Address string `json:"address"` Building string `json:"building"` InvoiceType string `json:"invoiceType"` InvoiceNo string `json:"invoiceNo"` } func (req *SignUpRequest) CheckParameter() (err error) { if len(req.UserType) == 0 { err = errors.New("用户类型不能为空") return } if req.UserType == "P" { if len(req.InvoiceType) == 0 { err = errors.New("开发票类型不能为空") return } } if len(req.Truename) == 0 { err = errors.New("真实姓名不能为空") return } if len(req.Nickname) == 0 { err = errors.New("昵称不能为空") return } if len(req.Password) == 0 { err = errors.New("密码不能为空") return } if len(req.Phone) == 0 { err = errors.New("手机号不能为空") return } if len(req.Email) == 0 { err = errors.New("邮箱不能为空") return } if len(req.BirthYear) == 0 { err = errors.New("出生年不能为空") return } if len(req.BirthMonth) == 0 { err = errors.New("出生月不能为空") return } if len(req.BirthDay) == 0 { err = errors.New("出生日不能为空") return } if len(req.Gender) == 0 { err = errors.New("性别不能为空") return } if len(req.Position) == 0 { err = errors.New("职位不能为空") return } if len(req.PostCode) == 0 { err = errors.New("邮编不能为空") return } if len(req.Prefecture) == 0 { err = errors.New("省不能为空") return } if len(req.Address) == 0 { err = errors.New("地址不能为空") return } return nil } type ReportAllReq struct { Date fields.Date `json:"date" form:"date" uri:"date"` } // 登录请求对象 type UserInfoUpdateReq struct { // UserType string `gorm:"column:user_type;type:char(1);not null;comment:P=person C= crop" json:"user_type"` Truename string `gorm:"column:truename;type:varchar(60);not null" json:"truename"` Nickname string `gorm:"column:nickname;type:varchar(60);not null" json:"nickname"` Phone string `gorm:"column:phone;type:varchar(20);not null" json:"phone"` Email string `gorm:"column:email;type:varchar(100);not null;uniqueIndex:EMAIL_idx,priority:1" json:"email"` Birthday string `gorm:"column:birthday;type:varchar(20);not null" json:"birthday"` Gender string `gorm:"column:gender;type:char(1);not null" json:"gender"` Position string `gorm:"column:position;type:varchar(100);not null" json:"position"` PostCode string `gorm:"column:post_code;type:varchar(20);not null" json:"post_code"` Prefecture string `gorm:"column:prefecture;type:varchar(100);not null" json:"prefecture"` Address string `gorm:"column:address;type:varchar(255);not null" json:"address"` Building string `gorm:"column:building;type:varchar(100);not null" json:"building"` InvoiceType string `gorm:"column:invoice_type;type:char(1);not null;comment:发票类型 1=可开 2=不可开" json:"invoice_type"` InvoiceNo string `gorm:"column:invoice_no;type:varchar(50);not null;comment:发票编号" json:"invoice_no"` AccountBank string `gorm:"column:account_bank;type:varchar(255);not null;comment:开户银行" json:"account_bank"` AccountBranch string `gorm:"column:account_branch;type:varchar(255);not null;comment:开户支行" json:"account_branch"` AccountType string `gorm:"column:account_type;type:char(1);not null;comment:账户类型 1= 普通預金 2=当座預金" json:"account_type"` AccountNo string `gorm:"column:account_no;type:varchar(100);not null;comment:银行账号" json:"account_no"` AccountName string `gorm:"column:account_name;type:varchar(100);not null;comment:开户人姓名" json:"account_name"` PersonalDocType string `gorm:"column:personal_doc_type;type:char(1);not null;comment:1=居民票的复印件2=驾驶证3=护照4=保险证5=在留卡" json:"personal_doc_type"` PersonalImage string `gorm:"column:personal_image;type:varchar(255);not null;comment:身份证照片" json:"personal_image"` PersonalEndDate string `gorm:"column:personal_end_date;type:varchar(255);not null;comment:身份证有效期" json:"personal_end_date"` PersonalImage2 string `gorm:"column:personal_image_2;type:varchar(255);not null;comment:身份证照片" json:"personal_image_2"` } func (req *UserInfoUpdateReq) Check() (err error) { if len(req.Email) == 0 { err = errors.New("邮箱不能为空") return } return nil } type UserPwdUpdateReq struct { PrePassowrd string `json:"pre_password"` NewPassowrd string `json:"new_password"` } func (req *UserPwdUpdateReq) Check() (err error) { if len(req.NewPassowrd) == 0 { err = errors.New("新密码不能为空") return } return nil } type UserLogOffReq struct { Passowrd string `json:"password"` } func (req *UserLogOffReq) Check() (err error) { if len(req.Passowrd) == 0 { err = errors.New("密码不能为空") return } return nil } type UserPwdResetReq struct { Email string `json:"email"` } func (req *UserPwdResetReq) Check() (err error) { if len(req.Email) == 0 { err = errors.New("邮箱不能为空") return } return nil } type UserPwdResetCommitReq struct { Code string `json:"code"` // 邮件中url的代码 NewPassword string `json:"new_password"` // 新密码 } func (req *UserPwdResetCommitReq) Check() (err error) { if len(req.NewPassword) == 0 { err = errors.New("新密码不能为空") return } return nil } type UserActiveReq struct { UserId string `json:"userId" uri:"userId"` // 邮件中url的代码 } func (req *UserActiveReq) Check() (err error) { if len(req.UserId) == 0 { err = errors.New("不能为空") return } return nil } type AppUserAddApplyList struct { Page ClanIDBody Direct string `json:"direct"` // send 发出的申请 receive 收到的申请 } func (req *AppUserAddApplyList) Check() (err error) { req.Page.check() // if err = req.ClanIDBody.Check(); err != nil { // return // } return nil }