mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
workMoments
This commit is contained in:
parent
3e5d9a394f
commit
071dd46a4c
@ -292,49 +292,6 @@ func GetUserFriendWorkMoments(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, resp)
|
c.JSON(http.StatusOK, resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetUserWorkMomentsCommentsMsg(c *gin.Context) {
|
|
||||||
var (
|
|
||||||
req apiStruct.GetUserWorkMomentsCommentsMsgReq
|
|
||||||
resp apiStruct.GetUserWorkMomentsCommentsMsgResp
|
|
||||||
reqPb pbOffice.GetUserWorkMomentsCommentsMsgReq
|
|
||||||
respPb *pbOffice.GetUserWorkMomentsCommentsMsgResp
|
|
||||||
)
|
|
||||||
if err := c.BindJSON(&req); err != nil {
|
|
||||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "bind json failed", err.Error())
|
|
||||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "bind json failed " + err.Error()})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
|
||||||
ok, userID := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
|
||||||
if !ok {
|
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
reqPb.OperationID = req.OperationID
|
|
||||||
reqPb.Pagination = &pbCommon.RequestPagination{
|
|
||||||
PageNumber: req.PageNumber,
|
|
||||||
ShowNumber: req.ShowNumber,
|
|
||||||
}
|
|
||||||
reqPb.UserID = userID
|
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName)
|
|
||||||
client := pbOffice.NewOfficeServiceClient(etcdConn)
|
|
||||||
respPb, err := client.GetUserWorkMomentsCommentsMsg(context.Background(), &reqPb)
|
|
||||||
if err != nil {
|
|
||||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetUserWorkMomentsCommentsMsg rpc failed", err.Error())
|
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserWorkMomentsCommentsMsg rpc server failed" + err.Error()})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := utils.CopyStructFields(&resp, respPb.CommonResp); err != nil {
|
|
||||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
|
||||||
}
|
|
||||||
resp.Data.CurrentPage = respPb.Pagination.CurrentPage
|
|
||||||
resp.Data.ShowNumber = respPb.Pagination.ShowNumber
|
|
||||||
resp.Data.CommentMsgs = respPb.CommentsMsgs
|
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
|
|
||||||
c.JSON(http.StatusOK, resp)
|
|
||||||
}
|
|
||||||
|
|
||||||
func SetUserWorkMomentsLevel(c *gin.Context) {
|
func SetUserWorkMomentsLevel(c *gin.Context) {
|
||||||
var (
|
var (
|
||||||
req apiStruct.SetUserWorkMomentsLevelReq
|
req apiStruct.SetUserWorkMomentsLevelReq
|
||||||
@ -372,39 +329,3 @@ func SetUserWorkMomentsLevel(c *gin.Context) {
|
|||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
|
||||||
c.JSON(http.StatusOK, resp)
|
c.JSON(http.StatusOK, resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
func ClearUserWorkMomentsCommentsMsg(c *gin.Context) {
|
|
||||||
var (
|
|
||||||
req apiStruct.ClearUserWorkMomentsCommentsMsgReq
|
|
||||||
resp apiStruct.ClearUserWorkMomentsCommentsMsgResp
|
|
||||||
reqPb pbOffice.ClearUserWorkMomentsCommentsMsgReq
|
|
||||||
respPb *pbOffice.ClearUserWorkMomentsCommentsMsgResp
|
|
||||||
)
|
|
||||||
if err := c.BindJSON(&req); err != nil {
|
|
||||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "bind json failed", err.Error())
|
|
||||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "bind json failed " + err.Error()})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
|
||||||
ok, userID := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
|
||||||
if !ok {
|
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
reqPb.UserID = userID
|
|
||||||
reqPb.OperationID = req.OperationID
|
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName)
|
|
||||||
client := pbOffice.NewOfficeServiceClient(etcdConn)
|
|
||||||
respPb, err := client.ClearUserWorkMomentsCommentsMsg(context.Background(), &reqPb)
|
|
||||||
if err != nil {
|
|
||||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "ClearUserWorkMomentsCommentsMsg rpc failed", err.Error())
|
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "ClearUserWorkMomentsCommentsMsg rpc server failed" + err.Error()})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := utils.CopyStructFields(&resp, respPb.CommonResp); err != nil {
|
|
||||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
|
||||||
}
|
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
|
|
||||||
c.JSON(http.StatusOK, resp)
|
|
||||||
}
|
|
||||||
|
@ -1,47 +1,31 @@
|
|||||||
package msg
|
package msg
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
|
||||||
"Open_IM/pkg/common/constant"
|
"Open_IM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/db"
|
|
||||||
"Open_IM/pkg/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
pbOffice "Open_IM/pkg/proto/office"
|
||||||
pbChat "Open_IM/pkg/proto/chat"
|
|
||||||
pbCommon "Open_IM/pkg/proto/sdk_ws"
|
|
||||||
"Open_IM/pkg/utils"
|
"Open_IM/pkg/utils"
|
||||||
"context"
|
"github.com/golang/protobuf/proto"
|
||||||
"encoding/json"
|
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func CommentOneWorkMomentNotification(operationID, recvID string, comment db.CommentMsg, user db.User) {
|
func WorkMomentSendNotification(operationID, sendID, recvID string, notificationMsg *pbOffice.WorkMomentNotificationMsg) {
|
||||||
log.NewInfo(operationID, utils.GetSelfFuncName(), "args: ", recvID, user, comment)
|
log.NewInfo(operationID, utils.GetSelfFuncName(), recvID)
|
||||||
var req pbChat.SendMsgReq
|
bytes, err := proto.Marshal(notificationMsg)
|
||||||
var msgData pbCommon.MsgData
|
|
||||||
msgData.SendID = user.UserID
|
|
||||||
msgData.RecvID = recvID
|
|
||||||
msgData.ContentType = constant.WorkMomentNewCommentNotification
|
|
||||||
msgData.SessionType = constant.SingleChatType
|
|
||||||
msgData.MsgFrom = constant.UserMsgType
|
|
||||||
bytes, err := json.Marshal(comment)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.NewError(operationID, utils.GetSelfFuncName(), "marshal failed", err.Error())
|
log.NewError(operationID, utils.GetSelfFuncName(), "proto marshal failed", err.Error())
|
||||||
}
|
|
||||||
msgData.Content = bytes
|
|
||||||
msgData.SenderFaceURL = user.FaceURL
|
|
||||||
msgData.SenderNickname = user.Nickname
|
|
||||||
msgData.CreateTime = utils.GetCurrentTimestampByMill()
|
|
||||||
msgData.ClientMsgID = utils.GetMsgID(user.UserID)
|
|
||||||
req.MsgData = &msgData
|
|
||||||
req.OperationID = operationID
|
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName)
|
|
||||||
client := pbChat.NewChatClient(etcdConn)
|
|
||||||
respPb, err := client.SendMsg(context.Background(), &req)
|
|
||||||
if err != nil {
|
|
||||||
log.NewError(operationID, utils.GetSelfFuncName(), "send msg failed", err.Error())
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if respPb.ErrCode != 0 {
|
|
||||||
log.NewError(operationID, utils.GetSelfFuncName(), "send tag msg failed ", respPb)
|
|
||||||
}
|
}
|
||||||
|
WorkMomentNotification(operationID, sendID, recvID, bytes)
|
||||||
|
}
|
||||||
|
|
||||||
|
func WorkMomentNotification(operationID, sendID, recvID string, content []byte) {
|
||||||
|
n := &NotificationMsg{
|
||||||
|
SendID: sendID,
|
||||||
|
RecvID: recvID,
|
||||||
|
Content: content,
|
||||||
|
MsgFrom: constant.UserMsgType,
|
||||||
|
ContentType: constant.WorkMomentNotification,
|
||||||
|
SessionType: constant.UserMsgType,
|
||||||
|
OperationID: operationID,
|
||||||
|
}
|
||||||
|
Notification(n)
|
||||||
}
|
}
|
||||||
|
@ -270,20 +270,73 @@ func (s *officeServer) GetUserTagByID(_ context.Context, req *pbOffice.GetUserTa
|
|||||||
func (s *officeServer) CreateOneWorkMoment(_ context.Context, req *pbOffice.CreateOneWorkMomentReq) (resp *pbOffice.CreateOneWorkMomentResp, err error) {
|
func (s *officeServer) CreateOneWorkMoment(_ context.Context, req *pbOffice.CreateOneWorkMomentReq) (resp *pbOffice.CreateOneWorkMomentResp, err error) {
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String())
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String())
|
||||||
resp = &pbOffice.CreateOneWorkMomentResp{CommonResp: &pbOffice.CommonResp{}}
|
resp = &pbOffice.CreateOneWorkMomentResp{CommonResp: &pbOffice.CommonResp{}}
|
||||||
workMoment := db.WorkMoment{Comments: []*db.Comment{}, LikeUsers: []*db.LikeUser{}}
|
workMoment := db.WorkMoment{
|
||||||
|
Comments: []*db.Comment{},
|
||||||
|
LikeUserList: []*db.LikeUser{},
|
||||||
|
}
|
||||||
|
createUser, err := imdb.GetUserByUserID(req.WorkMoment.UserID)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetUserByUserID", err.Error())
|
||||||
|
resp.CommonResp = &pbOffice.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}
|
||||||
|
return resp, nil
|
||||||
|
}
|
||||||
|
workMoment.UserName = createUser.Nickname
|
||||||
|
workMoment.FaceURL = createUser.FaceURL
|
||||||
if err := utils.CopyStructFields(&workMoment, req.WorkMoment); err != nil {
|
if err := utils.CopyStructFields(&workMoment, req.WorkMoment); err != nil {
|
||||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||||
}
|
}
|
||||||
|
workMoment.PermissionUserIDList = s.getPermissionUserIDList(req.OperationID, req.WorkMoment.PermissionGroupIDList, req.WorkMoment.PermissionUserIDList)
|
||||||
|
for _, userID := range req.WorkMoment.AtUserIDList {
|
||||||
|
userName, err := imdb.GetUserNameByUserID(userID)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetUserNameByUserID failed", userID, err.Error())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
workMoment.AtUserList = append(workMoment.AtUserList, &db.AtUser{
|
||||||
|
UserID: userID,
|
||||||
|
UserName: userName,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "workMoment to create", workMoment)
|
||||||
err = db.DB.CreateOneWorkMoment(&workMoment)
|
err = db.DB.CreateOneWorkMoment(&workMoment)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "CreateOneWorkMoment", err.Error())
|
log.NewError(req.OperationID, utils.GetSelfFuncName(), "CreateOneWorkMoment", err.Error())
|
||||||
resp.CommonResp = &pbOffice.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}
|
resp.CommonResp = &pbOffice.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// send notification to at users
|
||||||
|
for _, atUser := range req.WorkMoment.AtUserIDList {
|
||||||
|
workMomentNotificationMsg := &pbOffice.WorkMomentNotificationMsg{
|
||||||
|
NotificationMsgType: constant.WorkMomentAtUserNotification,
|
||||||
|
WorkMomentID: workMoment.WorkMomentID,
|
||||||
|
WorkMomentContent: workMoment.Content,
|
||||||
|
UserID: workMoment.UserID,
|
||||||
|
FaceURL: createUser.FaceURL,
|
||||||
|
UserName: createUser.Nickname,
|
||||||
|
}
|
||||||
|
msg.WorkMomentSendNotification(req.OperationID, workMoment.UserID, atUser, workMomentNotificationMsg)
|
||||||
|
}
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String())
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String())
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// count and distinct permission users
|
||||||
|
func (s *officeServer) getPermissionUserIDList(operationID string, groupIDList, userIDList []string) []string {
|
||||||
|
var permissionUserIDList []string
|
||||||
|
for _, groupID := range groupIDList {
|
||||||
|
GroupMemberIDList, err := imdb.GetGroupMemberIDListByGroupID(groupID)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(operationID, utils.GetSelfFuncName(), "GetGroupMemberIDListByGroupID failed", groupID, err.Error())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
permissionUserIDList = append(permissionUserIDList, GroupMemberIDList...)
|
||||||
|
}
|
||||||
|
permissionUserIDList = append(permissionUserIDList, userIDList...)
|
||||||
|
permissionUserIDList = utils.RemoveRepeatedStringInList(permissionUserIDList)
|
||||||
|
return permissionUserIDList
|
||||||
|
}
|
||||||
|
|
||||||
func (s *officeServer) DeleteOneWorkMoment(_ context.Context, req *pbOffice.DeleteOneWorkMomentReq) (resp *pbOffice.DeleteOneWorkMomentResp, err error) {
|
func (s *officeServer) DeleteOneWorkMoment(_ context.Context, req *pbOffice.DeleteOneWorkMomentReq) (resp *pbOffice.DeleteOneWorkMomentResp, err error) {
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String())
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String())
|
||||||
resp = &pbOffice.DeleteOneWorkMomentResp{CommonResp: &pbOffice.CommonResp{}}
|
resp = &pbOffice.DeleteOneWorkMomentResp{CommonResp: &pbOffice.CommonResp{}}
|
||||||
@ -295,7 +348,7 @@ func (s *officeServer) DeleteOneWorkMoment(_ context.Context, req *pbOffice.Dele
|
|||||||
}
|
}
|
||||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "workMoment", workMoment)
|
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "workMoment", workMoment)
|
||||||
if workMoment.UserID != req.UserID {
|
if workMoment.UserID != req.UserID {
|
||||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "workMoment.UserID != req.WorkMomentID ", workMoment, req.WorkMomentID)
|
log.NewError(req.OperationID, utils.GetSelfFuncName(), "workMoment.UserID != req.WorkMomentID, delete failed", workMoment, req.WorkMomentID)
|
||||||
resp.CommonResp = &pbOffice.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}
|
resp.CommonResp = &pbOffice.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
@ -311,15 +364,17 @@ func (s *officeServer) DeleteOneWorkMoment(_ context.Context, req *pbOffice.Dele
|
|||||||
|
|
||||||
func isUserCanSeeWorkMoment(userID string, workMoment db.WorkMoment) bool {
|
func isUserCanSeeWorkMoment(userID string, workMoment db.WorkMoment) bool {
|
||||||
if userID != workMoment.UserID {
|
if userID != workMoment.UserID {
|
||||||
if utils.IsContain(userID, workMoment.WhoCantSeeUserIDList) {
|
switch workMoment.Permission {
|
||||||
return false
|
case constant.WorkMomentPublic:
|
||||||
}
|
|
||||||
if utils.IsContain(userID, workMoment.WhoCanSeeUserIDList) {
|
|
||||||
return true
|
return true
|
||||||
}
|
case constant.WorkMomentPrivate:
|
||||||
if workMoment.IsPrivate {
|
|
||||||
return false
|
return false
|
||||||
|
case constant.WorkMomentPermissionCanSee:
|
||||||
|
return utils.IsContain(userID, workMoment.PermissionUserIDList)
|
||||||
|
case constant.WorkMomentPermissionCantSee:
|
||||||
|
return !utils.IsContain(userID, workMoment.PermissionUserIDList)
|
||||||
}
|
}
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@ -333,11 +388,20 @@ func (s *officeServer) LikeOneWorkMoment(_ context.Context, req *pbOffice.LikeOn
|
|||||||
resp.CommonResp = &pbOffice.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}
|
resp.CommonResp = &pbOffice.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
if err = db.DB.LikeOneWorkMoment(req.UserID, userName, req.WorkMomentID); err != nil {
|
workMoment, err := db.DB.LikeOneWorkMoment(req.UserID, userName, req.WorkMomentID)
|
||||||
|
if err != nil {
|
||||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "LikeOneWorkMoment failed ", err.Error())
|
log.NewError(req.OperationID, utils.GetSelfFuncName(), "LikeOneWorkMoment failed ", err.Error())
|
||||||
resp.CommonResp = &pbOffice.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}
|
resp.CommonResp = &pbOffice.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
workMomentNotificationMsg := &pbOffice.WorkMomentNotificationMsg{
|
||||||
|
NotificationMsgType: constant.WorkMomentLikeNotification,
|
||||||
|
WorkMomentID: workMoment.WorkMomentID,
|
||||||
|
WorkMomentContent: workMoment.Content,
|
||||||
|
UserID: workMoment.UserID,
|
||||||
|
}
|
||||||
|
// send notification
|
||||||
|
msg.WorkMomentSendNotification(req.OperationID, req.UserID, workMoment.UserID, workMomentNotificationMsg)
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String())
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String())
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
@ -360,7 +424,7 @@ func (s *officeServer) CommentOneWorkMoment(_ context.Context, req *pbOffice.Com
|
|||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
comment := db.Comment{
|
comment := &db.Comment{
|
||||||
UserID: req.UserID,
|
UserID: req.UserID,
|
||||||
UserName: commentUser.Nickname,
|
UserName: commentUser.Nickname,
|
||||||
ReplyUserID: req.ReplyUserID,
|
ReplyUserID: req.ReplyUserID,
|
||||||
@ -374,18 +438,25 @@ func (s *officeServer) CommentOneWorkMoment(_ context.Context, req *pbOffice.Com
|
|||||||
resp.CommonResp = &pbOffice.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}
|
resp.CommonResp = &pbOffice.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
commentMsg := db.CommentMsg{
|
workMomentNotificationMsg := &pbOffice.WorkMomentNotificationMsg{
|
||||||
Comment: comment,
|
NotificationMsgType: constant.WorkMomentCommentNotification,
|
||||||
UserID: workMoment.UserID,
|
WorkMomentID: workMoment.WorkMomentID,
|
||||||
WorkMomentID: workMoment.WorkMomentID,
|
WorkMomentContent: workMoment.Content,
|
||||||
WorkMomentContent: workMoment.Content,
|
UserID: workMoment.UserID,
|
||||||
|
Comment: &pbOffice.Comment{
|
||||||
|
UserID: comment.UserID,
|
||||||
|
UserName: comment.UserName,
|
||||||
|
FaceURL: commentUser.FaceURL,
|
||||||
|
ReplyUserID: comment.ReplyUserID,
|
||||||
|
ReplyUserName: comment.ReplyUserName,
|
||||||
|
ContentID: comment.ContentID,
|
||||||
|
Content: comment.Content,
|
||||||
|
CreateTime: comment.CreateTime,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
if err = db.DB.CreateUserWorkMomentsCommentsMsg(commentMsg); err != nil {
|
msg.WorkMomentSendNotification(req.OperationID, req.UserID, workMoment.UserID, workMomentNotificationMsg)
|
||||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error())
|
|
||||||
}
|
|
||||||
msg.CommentOneWorkMomentNotification(req.OperationID, workMoment.UserID, commentMsg, *commentUser)
|
|
||||||
if req.ReplyUserID != "" {
|
if req.ReplyUserID != "" {
|
||||||
msg.CommentOneWorkMomentNotification(req.OperationID, req.ReplyUserID, commentMsg, *commentUser)
|
msg.WorkMomentSendNotification(req.OperationID, req.UserID, req.ReplyUserID, workMomentNotificationMsg)
|
||||||
}
|
}
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String())
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String())
|
||||||
return resp, nil
|
return resp, nil
|
||||||
@ -405,6 +476,9 @@ func (s *officeServer) GetWorkMomentByID(_ context.Context, req *pbOffice.GetWor
|
|||||||
}
|
}
|
||||||
canSee := isUserCanSeeWorkMoment(req.OpUserID, *workMoment)
|
canSee := isUserCanSeeWorkMoment(req.OpUserID, *workMoment)
|
||||||
log.Debug(req.OperationID, utils.GetSelfFuncName(), canSee, req.OpUserID, *workMoment)
|
log.Debug(req.OperationID, utils.GetSelfFuncName(), canSee, req.OpUserID, *workMoment)
|
||||||
|
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 {
|
if err := utils.CopyStructFields(resp.WorkMoment, workMoment); err != nil {
|
||||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields", err.Error())
|
log.NewError(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields", err.Error())
|
||||||
}
|
}
|
||||||
@ -455,34 +529,6 @@ func (s *officeServer) GetUserFriendWorkMoments(_ context.Context, req *pbOffice
|
|||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *officeServer) GetUserWorkMomentsCommentsMsg(_ context.Context, req *pbOffice.GetUserWorkMomentsCommentsMsgReq) (resp *pbOffice.GetUserWorkMomentsCommentsMsgResp, err error) {
|
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String())
|
|
||||||
resp = &pbOffice.GetUserWorkMomentsCommentsMsgResp{CommonResp: &pbOffice.CommonResp{}}
|
|
||||||
resp.CommentsMsgs = make([]*pbOffice.CommentsMsg, 0)
|
|
||||||
workMomentsCommentMsgs, err := db.DB.GetUserWorkMomentsCommentsMsg(req.UserID, req.Pagination.ShowNumber, req.Pagination.PageNumber)
|
|
||||||
if err != nil {
|
|
||||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetUserWorkMomentsCommentsMsg", err.Error())
|
|
||||||
resp.CommonResp = &pbOffice.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}
|
|
||||||
return resp, nil
|
|
||||||
}
|
|
||||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "workMomentsCommentMsgs: ", workMomentsCommentMsgs)
|
|
||||||
for _, commentMsg := range workMomentsCommentMsgs {
|
|
||||||
comment := pbOffice.Comment{}
|
|
||||||
if err := utils.CopyStructFields(&comment, commentMsg); err != nil {
|
|
||||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), err.Error())
|
|
||||||
}
|
|
||||||
resp.CommentsMsgs = append(resp.CommentsMsgs, &pbOffice.CommentsMsg{
|
|
||||||
Comment: &comment,
|
|
||||||
WorkMomentID: commentMsg.WorkMomentID,
|
|
||||||
Content: commentMsg.WorkMomentContent,
|
|
||||||
UserID: req.UserID,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
resp.Pagination = &pbCommon.ResponsePagination{CurrentPage: req.Pagination.PageNumber, ShowNumber: req.Pagination.ShowNumber}
|
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String())
|
|
||||||
return resp, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *officeServer) SetUserWorkMomentsLevel(_ context.Context, req *pbOffice.SetUserWorkMomentsLevelReq) (resp *pbOffice.SetUserWorkMomentsLevelResp, err error) {
|
func (s *officeServer) SetUserWorkMomentsLevel(_ context.Context, req *pbOffice.SetUserWorkMomentsLevelReq) (resp *pbOffice.SetUserWorkMomentsLevelResp, err error) {
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String())
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String())
|
||||||
resp = &pbOffice.SetUserWorkMomentsLevelResp{CommonResp: &pbOffice.CommonResp{}}
|
resp = &pbOffice.SetUserWorkMomentsLevelResp{CommonResp: &pbOffice.CommonResp{}}
|
||||||
@ -495,14 +541,9 @@ func (s *officeServer) SetUserWorkMomentsLevel(_ context.Context, req *pbOffice.
|
|||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *officeServer) ClearUserWorkMomentsCommentsMsg(_ context.Context, req *pbOffice.ClearUserWorkMomentsCommentsMsgReq) (resp *pbOffice.ClearUserWorkMomentsCommentsMsgResp, err error) {
|
func (s *officeServer) ChangeWorkMomentPermission(_ context.Context, req *pbOffice.ChangeWorkMomentPermissionReq) (resp *pbOffice.ChangeWorkMomentPermissionResp, err error) {
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String())
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String())
|
||||||
resp = &pbOffice.ClearUserWorkMomentsCommentsMsgResp{CommonResp: &pbOffice.CommonResp{}}
|
resp = &pbOffice.ChangeWorkMomentPermissionResp{CommonResp: &pbOffice.CommonResp{}}
|
||||||
if err := db.DB.ClearUserWorkMomentsCommentsMsg(req.UserID); err != nil {
|
|
||||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "ClearUserWorkMomentsCommentsMsg", err.Error())
|
|
||||||
resp.CommonResp = &pbOffice.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}
|
|
||||||
return resp, nil
|
|
||||||
}
|
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String())
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String())
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
@ -44,10 +44,38 @@ type GetWorkMomentByIDReq struct {
|
|||||||
office.GetWorkMomentByIDReq
|
office.GetWorkMomentByIDReq
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type WorkMoment struct {
|
||||||
|
WorkMomentID string `json:"workMomentID"`
|
||||||
|
UserID string `json:"userID"`
|
||||||
|
Content string `json:"content"`
|
||||||
|
LikeUsers []*LikeUser `json:"likeUsers"`
|
||||||
|
Comments []*Comment `json:"comments"`
|
||||||
|
Permission int32 `json:"permission"`
|
||||||
|
PermissionUserIDList []string `json:"permissionUserIDList"`
|
||||||
|
PermissionGroupIDList []string `json:"permissionGroupIDList"`
|
||||||
|
AtUserIDList []string `json:"atUserIDList"`
|
||||||
|
CreateTime int32 `json:"createTime,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type LikeUser struct {
|
||||||
|
UserID string `json:"userID"`
|
||||||
|
UserName string `json:"userName"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Comment struct {
|
||||||
|
UserID string `json:"userID"`
|
||||||
|
UserName string `json:"userName"`
|
||||||
|
ReplyUserID string `json:"replyUserID"`
|
||||||
|
ReplyUserName string `json:"replyUserName"`
|
||||||
|
ContentID string `json:"contentID"`
|
||||||
|
Content string `json:"content"`
|
||||||
|
CreateTime int32 `json:"createTime"`
|
||||||
|
}
|
||||||
|
|
||||||
type GetWorkMomentByIDResp struct {
|
type GetWorkMomentByIDResp struct {
|
||||||
CommResp
|
CommResp
|
||||||
Data struct {
|
Data struct {
|
||||||
WorkMoment *office.WorkMoment `json:"workMoment"`
|
WorkMoment *WorkMoment `json:"workMoment"`
|
||||||
} `json:"data"`
|
} `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,9 +86,9 @@ type GetUserWorkMomentsReq struct {
|
|||||||
type GetUserWorkMomentsResp struct {
|
type GetUserWorkMomentsResp struct {
|
||||||
CommResp
|
CommResp
|
||||||
Data struct {
|
Data struct {
|
||||||
WorkMoments []*office.WorkMoment `json:"workMoments"`
|
WorkMoments []*WorkMoment `json:"workMoments"`
|
||||||
CurrentPage int32 `json:"currentPage"`
|
CurrentPage int32 `json:"currentPage"`
|
||||||
ShowNumber int32 `json:"showNumber"`
|
ShowNumber int32 `json:"showNumber"`
|
||||||
} `json:"data"`
|
} `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,22 +99,9 @@ type GetUserFriendWorkMomentsReq struct {
|
|||||||
type GetUserFriendWorkMomentsResp struct {
|
type GetUserFriendWorkMomentsResp struct {
|
||||||
CommResp
|
CommResp
|
||||||
Data struct {
|
Data struct {
|
||||||
WorkMoments []*office.WorkMoment `json:"workMoments"`
|
WorkMoments []*WorkMoment `json:"workMoments"`
|
||||||
CurrentPage int32 `json:"currentPage"`
|
CurrentPage int32 `json:"currentPage"`
|
||||||
ShowNumber int32 `json:"showNumber"`
|
ShowNumber int32 `json:"showNumber"`
|
||||||
} `json:"data"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type GetUserWorkMomentsCommentsMsgReq struct {
|
|
||||||
WorkMomentsUserCommonReq
|
|
||||||
}
|
|
||||||
|
|
||||||
type GetUserWorkMomentsCommentsMsgResp struct {
|
|
||||||
CommResp
|
|
||||||
Data struct {
|
|
||||||
CommentMsgs []*office.CommentsMsg `json:"comments"`
|
|
||||||
CurrentPage int32 `json:"currentPage"`
|
|
||||||
ShowNumber int32 `json:"showNumber"`
|
|
||||||
} `json:"data"`
|
} `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,11 +112,3 @@ type SetUserWorkMomentsLevelReq struct {
|
|||||||
type SetUserWorkMomentsLevelResp struct {
|
type SetUserWorkMomentsLevelResp struct {
|
||||||
CommResp
|
CommResp
|
||||||
}
|
}
|
||||||
|
|
||||||
type ClearUserWorkMomentsCommentsMsgReq struct {
|
|
||||||
office.ClearUserWorkMomentsCommentsMsgReq
|
|
||||||
}
|
|
||||||
|
|
||||||
type ClearUserWorkMomentsCommentsMsgResp struct {
|
|
||||||
CommResp
|
|
||||||
}
|
|
||||||
|
@ -91,8 +91,8 @@ const (
|
|||||||
|
|
||||||
OrganizationChangedNotification = 1801
|
OrganizationChangedNotification = 1801
|
||||||
|
|
||||||
WorkMomentNotificationStart = 1900
|
WorkMomentNotificationBegin = 1900
|
||||||
WorkMomentNewCommentNotification = 1901
|
WorkMomentNotification = 1901
|
||||||
|
|
||||||
NotificationEnd = 2000
|
NotificationEnd = 2000
|
||||||
|
|
||||||
@ -183,6 +183,17 @@ const (
|
|||||||
OtherType = 1
|
OtherType = 1
|
||||||
VideoType = 2
|
VideoType = 2
|
||||||
ImageType = 3
|
ImageType = 3
|
||||||
|
|
||||||
|
// workMoment permission
|
||||||
|
WorkMomentPublic = 0
|
||||||
|
WorkMomentPrivate = 1
|
||||||
|
WorkMomentPermissionCanSee = 2
|
||||||
|
WorkMomentPermissionCantSee = 3
|
||||||
|
|
||||||
|
// workMoment sdk notification type
|
||||||
|
WorkMomentCommentNotification = 0
|
||||||
|
WorkMomentLikeNotification = 1
|
||||||
|
WorkMomentAtUserNotification = 2
|
||||||
)
|
)
|
||||||
|
|
||||||
var ContentType2PushContent = map[int64]string{
|
var ContentType2PushContent = map[int64]string{
|
||||||
|
@ -568,15 +568,22 @@ func (d *DataBases) GetTagSendLogs(userID string, showNumber, pageNumber int32)
|
|||||||
type WorkMoment struct {
|
type WorkMoment struct {
|
||||||
WorkMomentID string `bson:"work_moment_id"`
|
WorkMomentID string `bson:"work_moment_id"`
|
||||||
UserID string `bson:"user_id"`
|
UserID string `bson:"user_id"`
|
||||||
|
UserName string `bson:"user_name"`
|
||||||
|
FaceURL string `bson:"face_url"`
|
||||||
Content string `bson:"content"`
|
Content string `bson:"content"`
|
||||||
LikeUsers []*LikeUser `bson:"like_users"`
|
LikeUserList []*LikeUser `bson:"like_user_list"`
|
||||||
|
AtUserList []*AtUser `bson:"at_user_list"`
|
||||||
Comments []*Comment `bson:"comments"`
|
Comments []*Comment `bson:"comments"`
|
||||||
WhoCanSeeUserIDList []string `bson:"who_can_see_user_id_list"`
|
PermissionUserIDList []string `bson:"permission_user_id_list"`
|
||||||
WhoCantSeeUserIDList []string `bson:"who_cant_see_user_id_list"`
|
Permission int32 `bson:"is_private"`
|
||||||
IsPrivate bool `bson:"is_private"`
|
|
||||||
CreateTime int32 `bson:"create_time"`
|
CreateTime int32 `bson:"create_time"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type AtUser struct {
|
||||||
|
UserID string `bson:"user_id"`
|
||||||
|
UserName string `bson:"user_name"`
|
||||||
|
}
|
||||||
|
|
||||||
type LikeUser struct {
|
type LikeUser struct {
|
||||||
UserID string `bson:"user_id"`
|
UserID string `bson:"user_id"`
|
||||||
UserName string `bson:"user_name"`
|
UserName string `bson:"user_name"`
|
||||||
@ -617,67 +624,33 @@ func (d *DataBases) GetWorkMomentByID(workMomentID string) (*WorkMoment, error)
|
|||||||
return workMoment, err
|
return workMoment, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *DataBases) LikeOneWorkMoment(likeUserID, userName, workMomentID string) error {
|
func (d *DataBases) LikeOneWorkMoment(likeUserID, userName, workMomentID string) (*WorkMoment, error) {
|
||||||
workMoment, err := d.GetWorkMomentByID(workMomentID)
|
workMoment, err := d.GetWorkMomentByID(workMomentID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return nil, err
|
||||||
}
|
}
|
||||||
var isAlreadyLike bool
|
var isAlreadyLike bool
|
||||||
for i, user := range workMoment.LikeUsers {
|
for i, user := range workMoment.LikeUserList {
|
||||||
if likeUserID == user.UserID {
|
if likeUserID == user.UserID {
|
||||||
isAlreadyLike = true
|
isAlreadyLike = true
|
||||||
workMoment.LikeUsers = append(workMoment.LikeUsers[0:i], workMoment.LikeUsers[i+1:]...)
|
workMoment.LikeUserList = append(workMoment.LikeUserList[0:i], workMoment.LikeUserList[i+1:]...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !isAlreadyLike {
|
if !isAlreadyLike {
|
||||||
workMoment.LikeUsers = append(workMoment.LikeUsers, &LikeUser{UserID: likeUserID, UserName: userName})
|
workMoment.LikeUserList = append(workMoment.LikeUserList, &LikeUser{UserID: likeUserID, UserName: userName})
|
||||||
}
|
}
|
||||||
log.Info("", utils.GetSelfFuncName(), workMoment)
|
log.NewDebug("", utils.GetSelfFuncName(), workMoment)
|
||||||
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
|
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
|
||||||
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cWorkMoment)
|
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cWorkMoment)
|
||||||
_, err = c.UpdateOne(ctx, bson.M{"work_moment_id": workMomentID}, bson.M{"$set": bson.M{"like_users": workMoment.LikeUsers}})
|
_, err = c.UpdateOne(ctx, bson.M{"work_moment_id": workMomentID}, bson.M{"$set": bson.M{"like_users": workMoment.LikeUserList}})
|
||||||
return err
|
return workMoment, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *DataBases) SetUserWorkMomentsLevel(userID string, level int32) error {
|
func (d *DataBases) SetUserWorkMomentsLevel(userID string, level int32) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *DataBases) CreateUserWorkMomentsCommentsMsg(msg CommentMsg) error {
|
func (d *DataBases) CommentOneWorkMoment(comment *Comment, workMomentID string) (WorkMoment, error) {
|
||||||
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
|
|
||||||
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cCommentMsg)
|
|
||||||
_, err := c.InsertOne(ctx, msg)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (d *DataBases) ClearUserWorkMomentsCommentsMsg(userID string) error {
|
|
||||||
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
|
|
||||||
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cCommentMsg)
|
|
||||||
_, err := c.DeleteOne(ctx, bson.M{"user_id": userID})
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
type CommentMsg struct {
|
|
||||||
WorkMomentID string `bson:"work_moment" json:"work_moment"`
|
|
||||||
WorkMomentContent string `bson:"work_moment_content" json:"work_moment_content"`
|
|
||||||
UserID string `bson:"user_id" json:"user_id"`
|
|
||||||
Comment
|
|
||||||
}
|
|
||||||
|
|
||||||
func (d *DataBases) GetUserWorkMomentsCommentsMsg(userID string, showNumber, pageNumber int32) ([]CommentMsg, error) {
|
|
||||||
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
|
|
||||||
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cCommentMsg)
|
|
||||||
var commentMsgList []CommentMsg
|
|
||||||
findOpts := options.Find().SetLimit(int64(showNumber)).SetSkip(int64(showNumber) * (int64(pageNumber) - 1)).SetSort(bson.M{"create_time": -1})
|
|
||||||
result, err := c.Find(ctx, bson.M{"user_id": userID}, findOpts)
|
|
||||||
if err != nil {
|
|
||||||
return commentMsgList, err
|
|
||||||
}
|
|
||||||
err = result.All(ctx, &commentMsgList)
|
|
||||||
return commentMsgList, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (d *DataBases) CommentOneWorkMoment(comment Comment, workMomentID string) (WorkMoment, error) {
|
|
||||||
comment.ContentID = generateWorkMomentCommentID(workMomentID)
|
comment.ContentID = generateWorkMomentCommentID(workMomentID)
|
||||||
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
|
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
|
||||||
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cWorkMoment)
|
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cWorkMoment)
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -113,26 +113,35 @@ message LikeUser {
|
|||||||
string userName = 2;
|
string userName = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message NotificationUser {
|
||||||
|
string userID = 1;
|
||||||
|
string userName = 2;
|
||||||
|
}
|
||||||
|
|
||||||
message Comment {
|
message Comment {
|
||||||
string userID = 1;
|
string userID = 1;
|
||||||
string userName = 2;
|
string userName = 2;
|
||||||
string replyUserID = 3;
|
string faceURL = 3;
|
||||||
string replyUserName = 4;
|
string replyUserID = 4;
|
||||||
string contentID = 5;
|
string replyUserName = 5;
|
||||||
string content = 6;
|
string contentID = 6;
|
||||||
int32 createTime = 7;
|
string content = 7;
|
||||||
|
int32 createTime = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
message WorkMoment {
|
message WorkMoment {
|
||||||
string workMomentID = 1;
|
string workMomentID = 1;
|
||||||
string userID = 2;
|
string userID = 2;
|
||||||
string content = 3;
|
string userName = 3;
|
||||||
repeated LikeUser likeUsers = 4;
|
string faceURL = 4;
|
||||||
repeated Comment comments = 5;
|
string content = 5;
|
||||||
repeated string whoCanSeeUserIDList = 6;
|
repeated LikeUser likeUsers = 6;
|
||||||
repeated string whoCantSeeUserIDList = 7;
|
repeated Comment comments = 7;
|
||||||
bool isPrivate = 8;
|
int32 permission = 8;
|
||||||
int32 CreateTime = 10;
|
repeated string permissionUserIDList = 9;
|
||||||
|
repeated string permissionGroupIDList = 10;
|
||||||
|
repeated string atUserIDList = 11;
|
||||||
|
int32 createTime = 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
message CreateOneWorkMomentReq {
|
message CreateOneWorkMomentReq {
|
||||||
@ -187,6 +196,18 @@ message GetWorkMomentByIDResp {
|
|||||||
WorkMoment workMoment = 2;
|
WorkMoment workMoment = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message ChangeWorkMomentPermissionReq {
|
||||||
|
string workMomentID = 1;
|
||||||
|
string opUserID = 2;
|
||||||
|
int32 permission = 3;
|
||||||
|
repeated string permissionUserIDList = 4;
|
||||||
|
string operationID = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ChangeWorkMomentPermissionResp {
|
||||||
|
CommonResp commonResp = 1;
|
||||||
|
}
|
||||||
|
|
||||||
message GetUserWorkMomentsReq {
|
message GetUserWorkMomentsReq {
|
||||||
string userID = 1;
|
string userID = 1;
|
||||||
server_api_params.RequestPagination Pagination = 2;
|
server_api_params.RequestPagination Pagination = 2;
|
||||||
@ -211,32 +232,14 @@ message GetUserFriendWorkMomentsResp {
|
|||||||
server_api_params.ResponsePagination Pagination = 3;
|
server_api_params.ResponsePagination Pagination = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message CommentsMsg {
|
message WorkMomentNotificationMsg {
|
||||||
Comment comment = 1;
|
int32 notificationMsgType = 1;
|
||||||
string workMomentID = 2;
|
Comment comment = 2;
|
||||||
string userID = 3;
|
string workMomentID = 3;
|
||||||
string content = 4;
|
string userID = 4;
|
||||||
}
|
string userName = 5;
|
||||||
|
string faceURL = 6;
|
||||||
message GetUserWorkMomentsCommentsMsgReq {
|
string workMomentContent = 7;
|
||||||
string userID = 1;
|
|
||||||
string operationID = 2;
|
|
||||||
server_api_params.RequestPagination Pagination = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
message GetUserWorkMomentsCommentsMsgResp {
|
|
||||||
CommonResp commonResp = 1;
|
|
||||||
repeated CommentsMsg commentsMsgs = 2;
|
|
||||||
server_api_params.ResponsePagination Pagination = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
message ClearUserWorkMomentsCommentsMsgReq {
|
|
||||||
string userID = 1;
|
|
||||||
string operationID = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message ClearUserWorkMomentsCommentsMsgResp {
|
|
||||||
CommonResp commonResp = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message SetUserWorkMomentsLevelReq {
|
message SetUserWorkMomentsLevelReq {
|
||||||
@ -263,12 +266,11 @@ service OfficeService {
|
|||||||
rpc LikeOneWorkMoment(LikeOneWorkMomentReq) returns(LikeOneWorkMomentResp);
|
rpc LikeOneWorkMoment(LikeOneWorkMomentReq) returns(LikeOneWorkMomentResp);
|
||||||
rpc CommentOneWorkMoment(CommentOneWorkMomentReq) returns(CommentOneWorkMomentResp);
|
rpc CommentOneWorkMoment(CommentOneWorkMomentReq) returns(CommentOneWorkMomentResp);
|
||||||
rpc GetWorkMomentByID(GetWorkMomentByIDReq) returns(GetWorkMomentByIDResp);
|
rpc GetWorkMomentByID(GetWorkMomentByIDReq) returns(GetWorkMomentByIDResp);
|
||||||
|
rpc ChangeWorkMomentPermission(ChangeWorkMomentPermissionReq) returns(ChangeWorkMomentPermissionResp);
|
||||||
/// user self
|
/// user self
|
||||||
rpc GetUserWorkMoments(GetUserWorkMomentsReq) returns(GetUserWorkMomentsResp);
|
rpc GetUserWorkMoments(GetUserWorkMomentsReq) returns(GetUserWorkMomentsResp);
|
||||||
/// users friend
|
/// users friend
|
||||||
rpc GetUserFriendWorkMoments(GetUserFriendWorkMomentsReq) returns(GetUserFriendWorkMomentsResp);
|
rpc GetUserFriendWorkMoments(GetUserFriendWorkMomentsReq) returns(GetUserFriendWorkMomentsResp);
|
||||||
rpc GetUserWorkMomentsCommentsMsg(GetUserWorkMomentsCommentsMsgReq) returns(GetUserWorkMomentsCommentsMsgResp);
|
|
||||||
rpc ClearUserWorkMomentsCommentsMsg(ClearUserWorkMomentsCommentsMsgReq) returns(ClearUserWorkMomentsCommentsMsgResp);
|
|
||||||
rpc SetUserWorkMomentsLevel(SetUserWorkMomentsLevelReq) returns(SetUserWorkMomentsLevelResp);
|
rpc SetUserWorkMomentsLevel(SetUserWorkMomentsLevelReq) returns(SetUserWorkMomentsLevelResp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user