...
|
...
|
@@ -8,6 +8,8 @@ import ( |
|
|
"oppmg/protocol"
|
|
|
)
|
|
|
|
|
|
// 请求统一用户中心的接口
|
|
|
|
|
|
//RequestUCenterLogin 调用用户中心进行账号密码登录
|
|
|
func RequestUCenterLogin(account, password string) (*ResponseLogin, error) {
|
|
|
var uclientReturn ResponseLogin
|
...
|
...
|
@@ -19,7 +21,7 @@ func RequestUCenterLogin(account, password string) (*ResponseLogin, error) { |
|
|
uclient := NewUCenterClient()
|
|
|
btBody, err := uclient.Call(param)
|
|
|
if err != nil {
|
|
|
log.Error("统一用户中心请求失败 err:%s", err)
|
|
|
log.Error("向统一用户中心发送请求失败 err:%s", err)
|
|
|
return nil, protocol.NewErrWithMessage("1")
|
|
|
}
|
|
|
err = json.Unmarshal(btBody, &uclientReturn)
|
...
|
...
|
@@ -27,7 +29,7 @@ func RequestUCenterLogin(account, password string) (*ResponseLogin, error) { |
|
|
log.Error("解析统一用户中心响应失败 err:%s", err)
|
|
|
return nil, protocol.NewErrWithMessage("1")
|
|
|
}
|
|
|
if !(uclientReturn.Code == ResponseCode0) {
|
|
|
if !(uclientReturn.Code == ResponseCodeOk) {
|
|
|
return nil, protocol.NewErrWithMessage("10052")
|
|
|
}
|
|
|
return &uclientReturn, nil
|
...
|
...
|
@@ -44,7 +46,7 @@ func RequestUCenterLoginBySecret(secret string) (*ResponseLogin, error) { |
|
|
uclient := NewUCenterClient()
|
|
|
btBody, err := uclient.Call(param)
|
|
|
if err != nil {
|
|
|
log.Error("统一用户中心请求失败 err:%s", err)
|
|
|
log.Error("向统一用户中心发送请求失败 err:%s", err)
|
|
|
return nil, protocol.NewErrWithMessage("1")
|
|
|
}
|
|
|
err = json.Unmarshal(btBody, &uclientReturn)
|
...
|
...
|
@@ -52,7 +54,7 @@ func RequestUCenterLoginBySecret(secret string) (*ResponseLogin, error) { |
|
|
log.Error("解析统一用户中心响应失败 err:%s", err)
|
|
|
return nil, protocol.NewErrWithMessage("1")
|
|
|
}
|
|
|
if !(uclientReturn.Code == ResponseCode0) {
|
|
|
if !(uclientReturn.Code == ResponseCodeOk) {
|
|
|
return &uclientReturn, protocol.NewErrWithMessage("1")
|
|
|
}
|
|
|
return &uclientReturn, nil
|
...
|
...
|
@@ -75,7 +77,7 @@ func RequestUCenterAddUser(phone string, nickname string, avatar string) (*Respo |
|
|
uclient := NewUCenterClient()
|
|
|
btBody, err := uclient.Call(param)
|
|
|
if err != nil {
|
|
|
log.Error("统一用户中心请求失败 err:%s", err)
|
|
|
log.Error("向统一用户中心发送请求失败 err:%s", err)
|
|
|
return nil, protocol.NewErrWithMessage("1")
|
|
|
}
|
|
|
err = json.Unmarshal(btBody, &ucenterReturn)
|
...
|
...
|
@@ -83,7 +85,7 @@ func RequestUCenterAddUser(phone string, nickname string, avatar string) (*Respo |
|
|
log.Error("解析统一用户中心响应失败 err:%s", err)
|
|
|
return nil, protocol.NewErrWithMessage("1")
|
|
|
}
|
|
|
if !(ucenterReturn.Code == ResponseCode0) {
|
|
|
if !(ucenterReturn.Code == ResponseCodeOk) {
|
|
|
return nil, protocol.NewErrWithMessage("10052")
|
|
|
}
|
|
|
return &ucenterReturn, nil
|
...
|
...
|
@@ -100,7 +102,7 @@ func RequestUCenterSmsCode(phone string) error { |
|
|
uclient := NewUCenterClient()
|
|
|
btBody, err := uclient.Call(param)
|
|
|
if err != nil {
|
|
|
log.Error("统一用户中心请求失败 err:%s", err)
|
|
|
log.Error("向统一用户中心发送请求失败 err:%s", err)
|
|
|
return protocol.NewErrWithMessage("1")
|
|
|
}
|
|
|
var ucenterReturn CommResponse
|
...
|
...
|
@@ -109,7 +111,7 @@ func RequestUCenterSmsCode(phone string) error { |
|
|
log.Error("解析统一用户中心响应失败 err:%s", err)
|
|
|
return protocol.NewErrWithMessage("1")
|
|
|
}
|
|
|
if !(ucenterReturn.Code == ResponseCode0) {
|
|
|
if !(ucenterReturn.Code == ResponseCodeOk) {
|
|
|
return protocol.NewErrWithMessage("10052")
|
|
|
}
|
|
|
return nil
|
...
|
...
|
@@ -125,7 +127,7 @@ func RequestUCenterLoginSms(phone string, captcha string) (*ResponseLoginSms, er |
|
|
uclient := NewUCenterClient()
|
|
|
btBody, err := uclient.Call(param)
|
|
|
if err != nil {
|
|
|
log.Error("统一用户中心请求失败 err:%s", err)
|
|
|
log.Error("向统一用户中心发送请求失败 err:%s", err)
|
|
|
return nil, protocol.NewErrWithMessage("1")
|
|
|
}
|
|
|
var ucenterReturn ResponseLoginSms
|
...
|
...
|
@@ -134,7 +136,7 @@ func RequestUCenterLoginSms(phone string, captcha string) (*ResponseLoginSms, er |
|
|
log.Error("解析统一用户中心响应失败 err:%s", err)
|
|
|
return nil, protocol.NewErrWithMessage("1")
|
|
|
}
|
|
|
if !(ucenterReturn.Code == ResponseCode0) {
|
|
|
if !(ucenterReturn.Code == ResponseCodeOk) {
|
|
|
return &ucenterReturn, protocol.NewErrWithMessage("10052")
|
|
|
}
|
|
|
return &ucenterReturn, nil
|
...
|
...
|
@@ -148,7 +150,7 @@ func RequestUCenterSmsCodeCheck(phone string, captcha string) (*ResponseSmsCodeC |
|
|
uclient := NewUCenterClient()
|
|
|
btBody, err := uclient.Call(param)
|
|
|
if err != nil {
|
|
|
log.Error("统一用户中心请求失败 err:%s", err)
|
|
|
log.Error("向统一用户中心发送请求失败 err:%s", err)
|
|
|
return nil, protocol.NewErrWithMessage("1")
|
|
|
}
|
|
|
var ucenterReturn ResponseSmsCodeCheck
|
...
|
...
|
@@ -157,7 +159,7 @@ func RequestUCenterSmsCodeCheck(phone string, captcha string) (*ResponseSmsCodeC |
|
|
log.Error("解析统一用户中心响应失败 err:%s", err)
|
|
|
return nil, protocol.NewErrWithMessage("1")
|
|
|
}
|
|
|
if !(ucenterReturn.Code == ResponseCode0) {
|
|
|
if !(ucenterReturn.Code == ResponseCodeOk) {
|
|
|
return &ucenterReturn, protocol.NewErrWithMessage("10026")
|
|
|
}
|
|
|
return &ucenterReturn, nil
|
...
|
...
|
@@ -173,7 +175,7 @@ func RequestUCenterRestPassword(phone, newPwd, confirmPwd, certificate string) e |
|
|
uclient := NewUCenterClient()
|
|
|
btBody, err := uclient.Call(param)
|
|
|
if err != nil {
|
|
|
log.Error("统一用户中心请求失败 err:%s", err)
|
|
|
log.Error("向统一用户中心发送请求失败 err:%s", err)
|
|
|
return protocol.NewErrWithMessage("1")
|
|
|
}
|
|
|
var ucenterReturn CommResponse
|
...
|
...
|
@@ -182,7 +184,7 @@ func RequestUCenterRestPassword(phone, newPwd, confirmPwd, certificate string) e |
|
|
log.Error("解析统一用户中心响应失败 err:%s", err)
|
|
|
return protocol.NewErrWithMessage("1")
|
|
|
}
|
|
|
if !(ucenterReturn.Code == ResponseCode0) {
|
|
|
if !(ucenterReturn.Code == ResponseCodeOk) {
|
|
|
return protocol.NewErrWithMessage("10052")
|
|
|
}
|
|
|
|
...
|
...
|
|