This commit is contained in:
wenxu12345 2022-04-25 21:13:32 +08:00
parent bd7266653f
commit ab706f4076
3 changed files with 18 additions and 18 deletions

View File

@ -174,7 +174,7 @@ func main() {
} }
go apiThird.MinioInit() go apiThird.MinioInit()
ginPort := flag.Int("port", 10000, "get ginServerPort from cmd,default 10000 as port") ginPort := flag.Int("port", 10002, "get ginServerPort from cmd,default 10000 as port")
flag.Parse() flag.Parse()
fmt.Println("start api server, port: ", *ginPort) fmt.Println("start api server, port: ", *ginPort)
err := r.Run(":" + strconv.Itoa(*ginPort)) err := r.Run(":" + strconv.Itoa(*ginPort))

View File

@ -14,7 +14,7 @@ func main() {
gin.SetMode(gin.ReleaseMode) gin.SetMode(gin.ReleaseMode)
router := cms_api.NewGinRouter() router := cms_api.NewGinRouter()
router.Use(utils.CorsHandler()) router.Use(utils.CorsHandler())
ginPort := flag.Int("port", 8000, "get ginServerPort from cmd,default 8000 as port") ginPort := flag.Int("port", 10006, "get ginServerPort from cmd,default 8000 as port")
flag.Parse() flag.Parse()
fmt.Println("start cms api server, port: ", ginPort) fmt.Println("start cms api server, port: ", ginPort)
router.Run(":" + strconv.Itoa(*ginPort)) router.Run(":" + strconv.Itoa(*ginPort))

View File

@ -205,22 +205,22 @@ func GetSelfUserInfo(c *gin.Context) {
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), updateUserInfoReq.String()) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), updateUserInfoReq.String())
etcdConnCache := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName) etcdConnCache := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName)
cacheClient := cache.NewCacheClient(etcdConnCache) cacheClient := cache.NewCacheClient(etcdConnCache)
cacheResp, err := cacheClient.UpdateUserInfo(context.Background(), updateUserInfoReq) := cacheClient.UpdateUserInfo(context.Background(), updateUserInfoReq)
if err != nil { //if err != nil {
log.NewError(req.OperationID, "UpdateUserInfo cache failed ", err.Error(), req.String()) // log.NewError(req.OperationID, "UpdateUserInfo cache failed ", err.Error(), req.String())
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call rpc server failed: " + err.Error()}) // c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call rpc server failed: " + err.Error()})
return // return
} //}
if cacheResp.CommonResp.ErrCode != 0 { //if cacheResp.CommonResp.ErrCode != 0 {
log.NewError(req.OperationID, utils.GetSelfFuncName(), cacheResp.CommonResp.String()) // log.NewError(req.OperationID, utils.GetSelfFuncName(), cacheResp.CommonResp.String())
resp := api.UpdateUserInfoResp{CommResp: api.CommResp{ErrCode: cacheResp.CommonResp.ErrCode, ErrMsg: cacheResp.CommonResp.ErrMsg}} // resp := api.UpdateUserInfoResp{CommResp: api.CommResp{ErrCode: cacheResp.CommonResp.ErrCode, ErrMsg: cacheResp.CommonResp.ErrMsg}}
c.JSON(http.StatusOK, resp) // c.JSON(http.StatusOK, resp)
return // return
} //}
resp := api.GetSelfUserInfoResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, UserInfo: RpcResp.UserInfoList[0]} //resp := api.GetSelfUserInfoResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, UserInfo: RpcResp.UserInfoList[0]}
resp.Data = jsonData.JsonDataOne(resp.UserInfo) //resp.Data = jsonData.JsonDataOne(resp.UserInfo)
log.NewInfo(req.OperationID, "GetUserInfo api return ", resp) //log.NewInfo(req.OperationID, "GetUserInfo api return ", resp)
c.JSON(http.StatusOK, resp) //c.JSON(http.StatusOK, resp)
} else { } else {
resp := api.GetSelfUserInfoResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} resp := api.GetSelfUserInfoResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}}
log.NewInfo(req.OperationID, "GetUserInfo api return ", resp) log.NewInfo(req.OperationID, "GetUserInfo api return ", resp)