package dto import ( "cold-delivery/app/admin/model" dto2 "cold-delivery/common/dto" model2 "cold-delivery/common/model" ) type CustomerGetPageReq struct { dto2.Pagination `search:"-"` Username string `form:"username" search:"type:contains;column:username;table:sys_user" comment:"用户名"` Name string `form:"name" search:"type:contains;column:nick_name;table:sys_user" comment:"昵称"` Type int `form:"type" search:"type:exact;column:type;table:sys_user" comment:"累心"` CustomerOrder } type CustomerOrder struct { //UserIdOrder string `search:"type:order;column:id;table:sys_user" form:"userIdOrder"` //UsernameOrder string `search:"type:order;column:username;table:sys_user" form:"usernameOrder"` //StatusOrder string `search:"type:order;column:status;table:sys_user" form:"statusOrder"` CreatedAtOrder string `search:"type:order;column:created_at;table:sys_user" form:"createdAtOrder" default:"desc"` } func (m *CustomerGetPageReq) GetNeedSearch() interface{} { return *m } type ResetCustomerPwdReq struct { Id int `json:"id" example:"1" vd:"$>0"` // 用户ID Password string `json:"password" example:"123456" vd:"len($)>0"` // 密码 model2.ControlBy `swaggerignore:"true"` } func (s *ResetCustomerPwdReq) GetId() interface{} { return s.Id } func (s *ResetCustomerPwdReq) Generate(userModel *model.SysUser) { if s.Id != 0 { userModel.Id = s.Id } userModel.Password = s.Password if s.ControlBy.UpdateBy != 0 { userModel.UpdateBy = s.UpdateBy } if s.ControlBy.CreateBy != 0 { userModel.CreateBy = s.CreateBy } } type UpdateCustomerStatusReq struct { Id int `json:"id" example:"1" vd:"$>0"` // 用户ID Status string `json:"status" example:"2" vd:"len($)>0"` // 状态 1-停用 2-正常 model2.ControlBy `swaggerignore:"true"` } func (s *UpdateCustomerStatusReq) GetId() interface{} { return s.Id } func (s *UpdateCustomerStatusReq) Generate(userModel *model.SysUser) { if s.Id != 0 { userModel.Id = s.Id } userModel.Status = s.Status if s.ControlBy.UpdateBy != 0 { userModel.UpdateBy = s.UpdateBy } if s.ControlBy.CreateBy != 0 { userModel.CreateBy = s.CreateBy } } type CustomerInsertReq struct { Id int `json:"id" swaggerignore:"true" comment:"用户ID"` // 用户ID Username string `json:"username" example:"username" vd:"@:len($)>0;msg:'用户名不能为空'"` // 用户名 Password string `json:"password" example:"123456" vd:"@:len($)>5;msg:'密码格式不正确'"` // 密码 Name string `json:"name" vd:"@:len($)>0;msg:'姓名不能为空'"` // 姓名 Phone string `json:"phone"` // 手机号 RoleId int `json:"roleId" example:"1" swaggerignore:"true"` // 角色id DeptId int `json:"deptId" example:"1"` // 机构id Status string `json:"status" example:"2" swaggerignore:"true"` // 状态 // 货车司机绑定《道路运输从业人员从业资格证》信息 Type int `json:"type" example:"2"` // 管理员1 仓管2 司机3 model2.ControlBy `swaggerignore:"true"` } // SetCreateBy 设置创建人id func (e *CustomerInsertReq) SetDeptId(deptId int) { e.DeptId = deptId } func (s *CustomerInsertReq) Generate(userModel *model.SysUser) { if s.Id != 0 { userModel.Id = s.Id } userModel.Username = s.Username userModel.Password = s.Password userModel.NickName = s.Name userModel.Phone = s.Phone userModel.DeptId = s.DeptId userModel.Status = "2" userModel.Type = 0 userModel.UserType = model.UserTypeCustomer if s.ControlBy.UpdateBy != 0 { userModel.UpdateBy = s.UpdateBy } if s.ControlBy.CreateBy != 0 { userModel.CreateBy = s.CreateBy } } func (s *CustomerInsertReq) GetId() interface{} { return s.Id } type CustomerUpdateReq struct { Id int `json:"id" comment:"用户ID"` // 用户ID Name string `json:"name" vd:"@:len($)>0;msg:'姓名不能为空'"` // 姓名 Phone string `json:"phone" swaggerignore:"true"` // 手机号 model2.ControlBy `swaggerignore:"true"` } func (s *CustomerUpdateReq) Generate(userModel *model.SysUser) { if s.Id != 0 { userModel.Id = s.Id } userModel.NickName = s.Name userModel.Phone = s.Phone if s.ControlBy.UpdateBy != 0 { userModel.UpdateBy = s.UpdateBy } if s.ControlBy.CreateBy != 0 { userModel.CreateBy = s.CreateBy } } func (s *CustomerUpdateReq) GetId() interface{} { return s.Id } type CustomerGetReq struct { Id int `uri:"id"` } func (s *CustomerGetReq) GetId() interface{} { return s.Id } type CustomerDeleteReq struct { Id int `json:"id"` model2.ControlBy `swaggerignore:"true"` } func (s *CustomerDeleteReq) GetId() interface{} { return s.Id } type CustomerById struct { dto2.ObjectById model2.ControlBy `swaggerignore:"true"` } func (s *CustomerById) GetIds() interface{} { return s.Ids } func (s *CustomerById) GetId() interface{} { if len(s.Ids) > 0 { s.Ids = append(s.Ids, s.Id) return s.Ids } return s.Id } func (s *CustomerById) GenerateM() (model2.ActiveRecord, error) { return &model.SysUser{}, nil } // PassWord 密码 type CustomerPassWord struct { NewPassword string `json:"newPassword" example:"123456" vd:"len($)>0"` // 新密码 OldPassword string `json:"oldPassword" example:"12345678" vd:"len($)>0"` // 旧密码 } type CustomerGetSMSVerifyCodeReq struct { Phone string `form:"phone" example:"13912345678"` //手机号 } type CustomerWxLoginReq struct { Phone string `json:"phone"` // 手机号 Code string `json:"code"` // 密码 }