pull/103/head
Gordon 3 years ago
parent ea5e69e26d
commit 0daa840eaa

@ -26,7 +26,7 @@ type paramsAddFriend struct {
// //
func ImportFriend(c *gin.Context) { func ImportFriend(c *gin.Context) {
log.Info("", "", "ImportFriend init ....") log.Info("", "", "ImportFriend init ....")
log.NewDebug("", "api importFriend start")
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
client := pbFriend.NewFriendClient(etcdConn) client := pbFriend.NewFriendClient(etcdConn)
@ -41,16 +41,15 @@ func ImportFriend(c *gin.Context) {
OwnerUid: params.OwnerUid, OwnerUid: params.OwnerUid,
Token: c.Request.Header.Get("token"), Token: c.Request.Header.Get("token"),
} }
log.NewDebug(req.OperationID, "args is ", req.String())
RpcResp, err := client.ImportFriend(context.Background(), req) RpcResp, err := client.ImportFriend(context.Background(), req)
if err != nil { if err != nil {
log.Error(req.Token, req.OperationID, "err=%s,ImportFriend failed", err) log.NewError(req.OperationID, "rpc importFriend failed", err.Error())
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "cImportFriend failed" + err.Error()}) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "cImportFriend failed" + err.Error()})
return return
} }
log.InfoByArgs("ImportFriend success,args=%s", RpcResp.String()) log.NewDebug(req.OperationID, "rpc importFriend success", RpcResp.CommonResp.ErrorMsg, RpcResp.CommonResp.ErrorCode, RpcResp.FailedUidList)
resp := gin.H{"errCode": RpcResp.CommonResp.ErrorCode, "errMsg": RpcResp.CommonResp.ErrorMsg, "failedUidList": RpcResp.FailedUidList} c.JSON(http.StatusOK, gin.H{"errCode": RpcResp.CommonResp.ErrorCode, "errMsg": RpcResp.CommonResp.ErrorMsg, "failedUidList": RpcResp.FailedUidList})
c.JSON(http.StatusOK, resp)
log.InfoByArgs("ImportFriend success return,get args=%s,return args=%s", req.String(), RpcResp.String())
} }
func AddFriend(c *gin.Context) { func AddFriend(c *gin.Context) {
@ -78,7 +77,8 @@ func AddFriend(c *gin.Context) {
return return
} }
log.InfoByArgs("call add friend rpc server success,args=%s", RpcResp.String()) log.InfoByArgs("call add friend rpc server success,args=%s", RpcResp.String())
resp := gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg} c.JSON(http.StatusOK, gin.H{
c.JSON(http.StatusOK, resp) "errCode": RpcResp.ErrorCode,
log.InfoByArgs("api add friend success return,get args=%s,return args=%s", req.String(), RpcResp.String()) "errMsg": RpcResp.ErrorMsg,
})
} }

@ -127,6 +127,7 @@ func (s *friendServer) ImportFriend(ctx context.Context, req *pbFriend.ImportFri
} }
} }
log.NewDebug(req.OperationID, "rpc come end", resp.CommonResp.ErrorCode, resp.CommonResp.ErrorMsg, resp.FailedUidList)
return &resp, nil return &resp, nil
} }

Loading…
Cancel
Save