Refactor code

pull/141/head
wenxu12345 3 years ago
parent 0dc5c9dbac
commit 1c362e4871

@ -78,9 +78,10 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR
//Time stamp + MD5 to generate group chat id //Time stamp + MD5 to generate group chat id
groupId := utils.Md5(strconv.FormatInt(time.Now().UnixNano(), 10)) groupId := utils.Md5(strconv.FormatInt(time.Now().UnixNano(), 10))
//to group //to group
groupInfo := db.Group{GroupID: groupId} groupInfo := db.Group{}
utils.CopyStructFields(&groupInfo, req.GroupInfo) utils.CopyStructFields(&groupInfo, req.GroupInfo)
groupInfo.CreatorUserID = req.OpUserID groupInfo.CreatorUserID = req.OpUserID
groupInfo.GroupID = groupId
err := imdb.InsertIntoGroup(groupInfo) err := imdb.InsertIntoGroup(groupInfo)
if err != nil { if err != nil {
log.NewError(req.OperationID, "InsertIntoGroup failed, ", err.Error(), groupInfo) log.NewError(req.OperationID, "InsertIntoGroup failed, ", err.Error(), groupInfo)

Loading…
Cancel
Save