This commit is contained in:
苏尹岚
2020-11-30 11:01:37 +08:00
parent 8eb3ef3488
commit b9c15efec4
4 changed files with 51 additions and 10 deletions

View File

@@ -52,6 +52,7 @@ func InitServiceInfo(version string, buildTime time.Time, gitCommit string) {
"vendorTypeName": model.VendorTypeName,
"vendorName": model.VendorChineseNames,
"vendorImg": model.VendorImg,
"vendorColors": model.VendorColors,
"orderStatus": model.OrderStatusName,
"waybillStatus": model.WaybillStatusName,
"orderTypeName": model.OrderTypeName,

View File

@@ -1,7 +1,6 @@
package event
import (
"encoding/json"
"fmt"
"regexp"
"strings"
@@ -169,12 +168,18 @@ func CreateMessageGroup(ctx *jxcontext.Context, userID, userID2, groupName strin
}
dao.WrapAddIDCULDEntity(messageGroup, ctx.GetUserName())
dao.WrapAddIDCULDEntity(messageGroupMember, ctx.GetUserName())
dao.CreateEntity(db, messageGroup)
dao.CreateEntity(db, messageGroupMember)
if data, err := json.Marshal(messageGroup); err == nil {
json.Unmarshal(data, &messageGroupResult)
messageGroupResult.Name = user.Name
// messageGroupResult.MessageGroupMembers = append(messageGroupResult.MessageGroupMembers, messageGroupMember)
err = dao.CreateEntity(db, messageGroup)
err = dao.CreateEntity(db, messageGroupMember)
if err == nil {
messageGroupRead := &model.MessageGroupRead{
GroupID: groupID,
UserID: userID,
}
dao.WrapAddIDCULEntity(messageGroupRead, ctx.GetUserName())
messageGroupRead2 := messageGroupRead
messageGroupRead2.UserID = userID2
dao.CreateEntity(db, messageGroupRead)
dao.CreateEntity(db, messageGroupRead2)
}
} else {
userMembers, err := dao.GetUserMember(db, userID, model.MemberTypeNormal)
@@ -202,8 +207,14 @@ func CreateMessageGroup(ctx *jxcontext.Context, userID, userID2, groupName strin
messageGroup.Name = user.Name + "的集团"
}
dao.WrapAddIDCULDEntity(messageGroup, ctx.GetUserName())
dao.CreateEntity(db, messageGroup)
// messageGroupResult.MessageGroup = *messageGroup
if err = dao.CreateEntity(db, messageGroup); err == nil {
messageGroupRead := &model.MessageGroupRead{
GroupID: groupID,
UserID: userID,
}
dao.WrapAddIDCULEntity(messageGroupRead, ctx.GetUserName())
dao.CreateEntity(db, messageGroupRead)
}
}
return messageGroupResult, err
}
@@ -289,7 +300,14 @@ func AddMessageGroup(ctx *jxcontext.Context, groupID int, userID string) (err er
Type: model.GroupMemberTypeNormal,
}
dao.WrapAddIDCULDEntity(messageGroupMember, ctx.GetUserName())
dao.CreateEntity(db, messageGroupMember)
if err = dao.CreateEntity(db, messageGroupMember); err == nil {
messageGroupRead := &model.MessageGroupRead{
GroupID: groupID,
UserID: userID,
}
dao.WrapAddIDCULEntity(messageGroupRead, ctx.GetUserName())
dao.CreateEntity(db, messageGroupRead)
}
return err
}

View File

@@ -130,6 +130,13 @@ var (
VendorIDJDShop: "http://image.jxc4.com/image/7c43ebbcbdbc0ef31fe028f680c0a7e3.tem.png",
}
VendorColors = map[int]string{
VendorIDJD: "#3CC518",
VendorIDMTWM: "#FFB14A",
VendorIDEBAI: "#E43428",
VendorIDJDShop: "#51A7FC",
}
VendorInfoMap = map[int]*VendorInfo{
VendorIDJD: &VendorInfo{
Name: "京东到家",

View File

@@ -66,6 +66,7 @@ type ImMessageRecord struct {
Seq int `json:"seq"`
Weight int `json:"weight"`
Height int `json:"height"`
// UnReadFlag int `json:"unReadFlag"` //未读标志为1则此条消息未读
UserInfo *GetUserResult `orm:"-" json:"userInfo"`
}
@@ -110,3 +111,17 @@ func (*MessageGroupMember) TableIndex() [][]string {
[]string{"MemberUserID"},
}
}
type MessageGroupRead struct {
ModelIDCUL
GroupID int `orm:"column(group_id)" json:"groupID"` //组ID
UserID string `orm:"size(48);column(user_id)" json:"userID"` //创建组的userID
UnReadCount int `json:"unReadCount"` //未读数
}
func (*MessageGroupRead) TableIndex() [][]string {
return [][]string{
[]string{"UserID", "GroupID"},
}
}