ucenter.go 2.4 KB
package protocol

const (
	ModuleOportunity = "opportunity"
	ModuleQuestion   = "question"
)

const (
	MethodLogin       = "/auth/login"
	MethodGetUser     = "/users/"
	MethodPutUser     = "/users/"
	MethodUserExists  = "/users/isExist"
	MethodServerLogin = "/auth/serverLogin"
)

/*UCenterLogin */
type UCenterLoginRequest struct {
	Phone     string `json:"phone"`
	PassWord  string `json:"password"`
	Code      string `json:"code"`
	GrantType string `json:"grantType" valid:"Required"`
	//ClientId  string `json:"clientId" valid:"Required"`
	Type int   `json:"type"` //1为密码登录,管理后台登录,2为token登录,app登录
	Uid  int64 `json:"uid"`  // type2
	//CompanyId    int64 `json:"companyId"` // type2
}
type UCenterLoginResponse struct {
	Uid    int64               `json:"uid"` //统一用户中心用户编号,作为登录凭证
	Module []*ModulePermission `json:"module"`
}

//模块权限  (机会)opportunity  (问题)question
type ModulePermission struct {
	Name  string              `json:"name"` //模块名称  子菜单名称  `
	Menus []*ModulePermission `json:"-"`    //子模块权限
}

/*获取用户信息 UCenterGetUser */
type UCenterGetUserRequest struct {
}
type UCenterGetUserResponse struct {
	Id              int64  `json:"id"`
	Phone           string `json:"phone"`
	NickName        string `json:"nickname"`
	Avatar          string `json:"avatar"`
	ImToken         string `json:"imtoken"`
	Accid           int64  `json:"accid"`
	CustomerAccount int64  `json:"customerAccount"`
}

type UCenter_GetUserResponse struct {
	Id              int64  `json:"id"`
	Phone           string `json:"phone"`
	NickName        string `json:"nickname"`
	Avatar          string `json:"avatar"`
	ImToken         string `json:"imtoken"`
	Accid           string `json:"accid"`
	CustomerAccount string `json:"customerAccount"`
}

/*修改用户信息  UCenterPutUser */
type UCenterPutUserRequest struct {
	Phone    string `json:"phone,omitempty"`
	PassWord string `json:"password,omitempty"`
	NickName string `json:"nickname,omitempty"`
	Avatar   string `json:"avatar,omitempty"`
}
type UCenterPutUserResponse struct {
}

/*服务端登录*/
type UCenterServerLoginRequest struct {
	Token     string `json:"token"`
	Uid       int64  `json:"uid"`
	CompanyId int64  `json:"company_id"`
	Type      int    `json:"type"` //1为密码登录,管理后台登录,2为token登录,app登录
}

//type UCenterServerLoginResponse struct {
//}