mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
方便测试导入数据 (#148)
This commit is contained in:
parent
ea6d472002
commit
a55582a018
@ -17,6 +17,7 @@ import (
|
|||||||
|
|
||||||
type ParamsSetPassword struct {
|
type ParamsSetPassword struct {
|
||||||
Email string `json:"email"`
|
Email string `json:"email"`
|
||||||
|
Name string `json:"name"`
|
||||||
PhoneNumber string `json:"phoneNumber"`
|
PhoneNumber string `json:"phoneNumber"`
|
||||||
Password string `json:"password"`
|
Password string `json:"password"`
|
||||||
VerificationCode string `json:"verificationCode"`
|
VerificationCode string `json:"verificationCode"`
|
||||||
@ -38,6 +39,9 @@ func SetPassword(c *gin.Context) {
|
|||||||
} else {
|
} else {
|
||||||
account = params.PhoneNumber
|
account = params.PhoneNumber
|
||||||
}
|
}
|
||||||
|
if params.Name == "" {
|
||||||
|
params.Name = account
|
||||||
|
}
|
||||||
if params.VerificationCode != config.Config.Demo.SuperCode {
|
if params.VerificationCode != config.Config.Demo.SuperCode {
|
||||||
accountKey := account + "_" + constant.VerificationCodeForRegisterSuffix
|
accountKey := account + "_" + constant.VerificationCodeForRegisterSuffix
|
||||||
v, err := db.DB.GetAccountCode(accountKey)
|
v, err := db.DB.GetAccountCode(accountKey)
|
||||||
@ -54,7 +58,7 @@ func SetPassword(c *gin.Context) {
|
|||||||
openIMRegisterReq.OperationID = params.OperationID
|
openIMRegisterReq.OperationID = params.OperationID
|
||||||
openIMRegisterReq.Platform = params.Platform
|
openIMRegisterReq.Platform = params.Platform
|
||||||
openIMRegisterReq.UserID = account
|
openIMRegisterReq.UserID = account
|
||||||
openIMRegisterReq.Nickname = account
|
openIMRegisterReq.Nickname = params.Name
|
||||||
openIMRegisterReq.Secret = config.Config.Secret
|
openIMRegisterReq.Secret = config.Config.Secret
|
||||||
openIMRegisterResp := api.UserRegisterResp{}
|
openIMRegisterResp := api.UserRegisterResp{}
|
||||||
bMsg, err := http2.Post(url, openIMRegisterReq, 2)
|
bMsg, err := http2.Post(url, openIMRegisterReq, 2)
|
||||||
@ -69,7 +73,7 @@ func SetPassword(c *gin.Context) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.NewError(params.OperationID, utils.GetSelfFuncName(), err.Error())
|
log.NewError(params.OperationID, utils.GetSelfFuncName(), err.Error())
|
||||||
}
|
}
|
||||||
c.JSON(http.StatusOK, gin.H{"errCode": constant.RegisterFailed, "errMsg": "register failed: "+openIMRegisterResp.ErrMsg})
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.RegisterFailed, "errMsg": "register failed: " + openIMRegisterResp.ErrMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Info(params.OperationID, "begin store mysql", account, params.Password)
|
log.Info(params.OperationID, "begin store mysql", account, params.Password)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user