...
|
...
|
@@ -30,3 +30,30 @@ func RequestUCenterLogin(account, password string) (*ResponseLogin, error) { |
|
|
}
|
|
|
return uclientReturn, nil
|
|
|
}
|
|
|
|
|
|
func RequestUCenterAddUser(phone string, nickname string, avatar string) (*ResponseAddUser, error) {
|
|
|
var ucenterReturn *ResponseAddUser
|
|
|
param := RequestAddUser{
|
|
|
Phone: phone,
|
|
|
Nickname: nickname,
|
|
|
Avatar: avatar,
|
|
|
Password: "9d1f5048afd96b39a3dae71a99f2c77a30112d29", //默认密码:fmt.Sprintf("%x", sha1.Sum([]byte("mmm1234554321")))
|
|
|
RegIm: 1,
|
|
|
}
|
|
|
uclient := NewUCenterClient()
|
|
|
btBody, err := uclient.Call(param)
|
|
|
if err != nil {
|
|
|
log.Error("统一用户中心请求失败 err:%s", err)
|
|
|
return nil, protocol.NewErrWithMessage("1")
|
|
|
}
|
|
|
err = json.Unmarshal(btBody, &ucenterReturn)
|
|
|
if err != nil {
|
|
|
log.Error("解析统一用户中心响应失败 err:%s", err)
|
|
|
return nil, protocol.NewErrWithMessage("1")
|
|
|
}
|
|
|
if !(ucenterReturn.Code == ResponseCode0 &&
|
|
|
ucenterReturn.Msg == ResponseMsgOk) {
|
|
|
return nil, protocol.NewErrWithMessage("10021")
|
|
|
}
|
|
|
return ucenterReturn, nil
|
|
|
} |
...
|
...
|
|