From e2f8156a4dd37bc7097bc8ecb347fdc6a8a25e71 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Tue, 17 May 2022 20:18:12 +0800 Subject: [PATCH] organization --- deploy_k8s/script/build_push_all_images.sh | 11 +++++-- internal/api/office/tag.go | 4 +-- internal/rpc/office/office.go | 37 +++++++++++++++++++++- 3 files changed, 47 insertions(+), 5 deletions(-) diff --git a/deploy_k8s/script/build_push_all_images.sh b/deploy_k8s/script/build_push_all_images.sh index 5efab73e9..f5a03edfc 100644 --- a/deploy_k8s/script/build_push_all_images.sh +++ b/deploy_k8s/script/build_push_all_images.sh @@ -23,6 +23,13 @@ # ../cmd/open_im_demo/ #) # -dockerfile_list=pwd +dockerfile_list=$(ls ../dockerfiles/) +echo ${dockerfile_list} +for dockerfile in $dockerfile_list +do + echo "start to build images" $dockerfile + docker build -t $image . -f ${dockerfile} + echo "build ${dockerfile} ok" +done +echo ${#dockerfile_list[*]} -docker build -t $image . -f deploy.Dockerfile diff --git a/internal/api/office/tag.go b/internal/api/office/tag.go index 630517593..c187ecef5 100644 --- a/internal/api/office/tag.go +++ b/internal/api/office/tag.go @@ -262,8 +262,8 @@ func GetTagSendLogs(c *gin.Context) { client := pbOffice.NewOfficeServiceClient(etcdConn) respPb, err := client.GetTagSendLogs(context.Background(), &reqPb) if err != nil { - log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetUserTags failed", err.Error()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "CreateTag rpc server failed" + err.Error()}) + log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetTagSendLogs failed", err.Error()) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetTagSendLogs rpc server failed" + err.Error()}) return } if err := utils.CopyStructFields(&resp.CommResp, respPb.CommonResp); err != nil { diff --git a/internal/rpc/office/office.go b/internal/rpc/office/office.go index 1e76fa2b6..10d09c938 100644 --- a/internal/rpc/office/office.go +++ b/internal/rpc/office/office.go @@ -56,7 +56,13 @@ func (s *officeServer) Run() { log.NewInfo("0", "listen network success, ", address, listener) defer listener.Close() //grpc server - srv := grpc.NewServer() + recvSize := 1024 * 1024 * 30 + sendSize := 1024 * 1024 * 30 + var options = []grpc.ServerOption{ + grpc.MaxRecvMsgSize(recvSize), + grpc.MaxSendMsgSize(sendSize), + } + srv := grpc.NewServer(options...) defer srv.GracefulStop() //Service registers with etcd pbOffice.RegisterOfficeServiceServer(srv, s) @@ -548,9 +554,18 @@ func (s *officeServer) GetWorkMomentByID(_ context.Context, req *pbOffice.GetWor if !canSee { log.NewError(req.OperationID, utils.GetSelfFuncName(), "workMoments not access to user", canSee, workMoment, req.OpUserID) } + if err := utils.CopyStructFields(resp.WorkMoment, workMoment); err != nil { log.NewError(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields", err.Error()) } + user, err := imdb.GetUserByUserID(workMoment.UserID) + if err != nil { + log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetUserByUserID failed", err.Error()) + } + if user != nil { + resp.WorkMoment.FaceURL = user.FaceURL + resp.WorkMoment.UserName = user.Nickname + } log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String()) return resp, nil } @@ -573,6 +588,16 @@ func (s *officeServer) GetUserWorkMoments(_ context.Context, req *pbOffice.GetUs if err := utils.CopyStructFields(&resp.WorkMoments, workMoments); err != nil { log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error()) } + for _, v := range resp.WorkMoments { + user, err := imdb.GetUserByUserID(v.UserID) + if err != nil { + log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error()) + } + if user != nil { + v.UserName = user.Nickname + v.FaceURL = user.FaceURL + } + } log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String()) return resp, nil } @@ -590,6 +615,16 @@ func (s *officeServer) GetUserFriendWorkMoments(_ context.Context, req *pbOffice if err := utils.CopyStructFields(&resp.WorkMoments, workMoments); err != nil { log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error()) } + for _, v := range resp.WorkMoments { + user, err := imdb.GetUserByUserID(v.UserID) + if err != nil { + log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error()) + } + if user != nil { + v.UserName = user.Nickname + v.FaceURL = user.FaceURL + } + } log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String()) return resp, nil }