workMoments

pull/213/head
wangchuxiao 3 years ago
parent a243da8b1e
commit 33211bfb27

@ -206,6 +206,15 @@ func GetWorkMomentByID(c *gin.Context) {
if err := utils.CopyStructFields(&resp.Data.WorkMoment, respPb.WorkMoment); err != nil {
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
}
if err := utils.CopyStructFields(&resp.Data.WorkMoment.AtUserIDList, respPb.WorkMoment.AtUserList); err != nil {
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed")
}
if err := utils.CopyStructFields(&resp.Data.WorkMoment.LikeUserList, respPb.WorkMoment.LikeUserList); err != nil {
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed")
}
if err := utils.CopyStructFields(&resp.Data.WorkMoment.Comments, respPb.WorkMoment.Comments); err != nil {
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed")
}
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
c.JSON(http.StatusOK, resp)
}

@ -286,20 +286,6 @@ func (s *officeServer) CreateOneWorkMoment(_ context.Context, req *pbOffice.Crea
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
}
workMoment.PermissionUserIDList = s.getPermissionUserIDList(req.OperationID, req.WorkMoment.PermissionGroupList, req.WorkMoment.PermissionUserList)
for _, user := range req.WorkMoment.AtUserList {
if user.UserName == "" {
userName, err := imdb.GetUserNameByUserID(user.UserID)
if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetUserNameByUserID failed", user.UserID, err.Error())
continue
}
user.UserName = userName
}
workMoment.AtUserList = append(workMoment.AtUserList, &db.AtUser{
UserID: user.UserID,
UserName: user.UserName,
})
}
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "workMoment to create", workMoment)
err = db.DB.CreateOneWorkMoment(&workMoment)
if err != nil {

@ -45,19 +45,19 @@ type GetWorkMomentByIDReq struct {
}
type WorkMoment struct {
WorkMomentID string `json:"workMomentID"`
UserID string `json:"userID"`
Content string `json:"content"`
LikeUsers []*LikeUser `json:"likeUsers"`
Comments []*Comment `json:"comments"`
WorkMomentID string `json:"workMomentID"`
UserID string `json:"userID"`
Content string `json:"content"`
LikeUserList []*WorkMomentUser `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"`
AtUserIDList []*WorkMomentUser `json:"atUsers"`
CreateTime int32 `json:"createTime,omitempty"`
}
type LikeUser struct {
type WorkMomentUser struct {
UserID string `json:"userID"`
UserName string `json:"userName"`
}

Loading…
Cancel
Save