Merge remote-tracking branch 'origin/tuoyun' into tuoyun

This commit is contained in:
wenxu12345 2021-12-10 11:06:32 +08:00
commit a8201aaa58
19 changed files with 112 additions and 60 deletions

View File

@ -42,17 +42,17 @@ func main() {
for { for {
uidList, err := im_mysql_model.SelectAllUID() uidList, err := im_mysql_model.SelectAllUID()
if err != nil { if err != nil {
log.NewError("999999", err.Error()) //log.NewError("999999", err.Error())
} else { } else {
for _, v := range uidList { for _, v := range uidList {
minSeq, err := commonDB.DB.GetMinSeqFromMongo(v) minSeq, err := commonDB.DB.GetMinSeqFromMongo(v)
if err != nil { if err != nil {
log.NewError("999999", "get user minSeq err", err.Error(), v) //log.NewError("999999", "get user minSeq err", err.Error(), v)
continue continue
} else { } else {
err := commonDB.DB.SetUserMinSeq(v, minSeq) err := commonDB.DB.SetUserMinSeq(v, minSeq)
if err != nil { if err != nil {
log.NewError("999999", "set user minSeq err", err.Error(), v) //log.NewError("999999", "set user minSeq err", err.Error(), v)
} }
} }
time.Sleep(time.Duration(100) * time.Millisecond) time.Sleep(time.Duration(100) * time.Millisecond)

View File

@ -42,7 +42,8 @@ func UserGetSeq(c *gin.Context) {
msgClient := pbMsg.NewChatClient(grpcConn) msgClient := pbMsg.NewChatClient(grpcConn)
reply, err := msgClient.GetMaxAndMinSeq(context.Background(), &pbData) reply, err := msgClient.GetMaxAndMinSeq(context.Background(), &pbData)
if err != nil { if err != nil {
log.ErrorByKv("rpc call failed to getNewSeq", pbData.OperationID, "err", err, "pbData", pbData.String()) log.NewError(params.OperationID, "UserGetSeq rpc failed, ", params, err.Error())
c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "UserGetSeq rpc failed, " + err.Error()})
return return
} }

View File

@ -43,7 +43,8 @@ func UserPullMsg(c *gin.Context) {
msgClient := pbChat.NewChatClient(grpcConn) msgClient := pbChat.NewChatClient(grpcConn)
reply, err := msgClient.PullMessage(context.Background(), &pbData) reply, err := msgClient.PullMessage(context.Background(), &pbData)
if err != nil { if err != nil {
log.ErrorByKv("PullMessage error", pbData.OperationID, "err", err.Error()) log.NewError(params.OperationID, "UserPullMsg rpc failed, ", params, err.Error())
c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "UserPullMsg rpc failed, " + err.Error()})
return return
} }
log.InfoByKv("rpc call success to pullMsgRep", pbData.OperationID, "ReplyArgs", reply.String(), "maxSeq", reply.GetMaxSeq(), log.InfoByKv("rpc call success to pullMsgRep", pbData.OperationID, "ReplyArgs", reply.String(), "maxSeq", reply.GetMaxSeq(),

View File

@ -27,7 +27,7 @@ type paramsUserSendMsg struct {
RecvID string `json:"recvID" binding:"required"` RecvID string `json:"recvID" binding:"required"`
ForceList []string `json:"forceList"` ForceList []string `json:"forceList"`
Content string `json:"content" binding:"required"` Content string `json:"content" binding:"required"`
Options map[string]interface{} `json:"options" ` Options map[string]int32 `json:"options" `
ClientMsgID string `json:"clientMsgID" binding:"required"` ClientMsgID string `json:"clientMsgID" binding:"required"`
OffLineInfo map[string]interface{} `json:"offlineInfo" ` OffLineInfo map[string]interface{} `json:"offlineInfo" `
Ex map[string]interface{} `json:"ext"` Ex map[string]interface{} `json:"ext"`
@ -49,7 +49,7 @@ func newUserSendMsgReq(token string, params *paramsUserSendMsg) *pbChat.UserSend
RecvID: params.Data.RecvID, RecvID: params.Data.RecvID,
ForceList: params.Data.ForceList, ForceList: params.Data.ForceList,
Content: params.Data.Content, Content: params.Data.Content,
Options: utils.MapToJsonString(params.Data.Options), Options: utils.MapIntToJsonString(params.Data.Options),
ClientMsgID: params.Data.ClientMsgID, ClientMsgID: params.Data.ClientMsgID,
OffLineInfo: utils.MapToJsonString(params.Data.OffLineInfo), OffLineInfo: utils.MapToJsonString(params.Data.OffLineInfo),
Ex: utils.MapToJsonString(params.Data.Ex), Ex: utils.MapToJsonString(params.Data.Ex),
@ -77,7 +77,12 @@ func UserSendMsg(c *gin.Context) {
log.Info("", "", "api UserSendMsg call, api call rpc...") log.Info("", "", "api UserSendMsg call, api call rpc...")
reply, _ := client.UserSendMsg(context.Background(), pbData) reply, err := client.UserSendMsg(context.Background(), pbData)
if err != nil {
log.NewError(params.OperationID, "UserSendMsg rpc failed, ", params, err.Error())
c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "UserSendMsg rpc failed, " + err.Error()})
return
}
log.Info("", "", "api UserSendMsg call end..., [data: %s] [reply: %s]", pbData.String(), reply.String()) log.Info("", "", "api UserSendMsg call end..., [data: %s] [reply: %s]", pbData.String(), reply.String())
c.JSON(http.StatusOK, gin.H{ c.JSON(http.StatusOK, gin.H{

View File

@ -15,7 +15,7 @@ import (
type paramsSetReceiveMessageOpt struct { type paramsSetReceiveMessageOpt struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
Option int32 `json:"option" binding:"required"` Option *int32 `json:"option" binding:"required"`
ConversationIdList []string `json:"conversationIdList" binding:"required"` ConversationIdList []string `json:"conversationIdList" binding:"required"`
} }
@ -31,7 +31,7 @@ type SetReceiveMessageOptResp struct {
} }
type paramGetReceiveMessageOpt struct { type paramGetReceiveMessageOpt struct {
ConversationIdList []string `json:"ConversationIdList" binding:"required"` ConversationIdList []string `json:"conversationIdList" binding:"required"`
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
} }
@ -159,7 +159,7 @@ func SetReceiveMessageOpt(c *gin.Context) {
req := &user.SetReceiveMessageOptReq{ req := &user.SetReceiveMessageOptReq{
UId: claims.UID, UId: claims.UID,
Opt: params.Option, Opt: *params.Option,
ConversationId: params.ConversationIdList, ConversationId: params.ConversationIdList,
OperationID: params.OperationID, OperationID: params.OperationID,
} }

View File

@ -54,11 +54,11 @@ func (mc *HistoryConsumerHandler) handleChatWs2Mongo(msg []byte, msgKey string)
pbSaveData.OperationID = pbData.OperationID pbSaveData.OperationID = pbData.OperationID
pbSaveData.RecvID = pbData.RecvID pbSaveData.RecvID = pbData.RecvID
pbSaveData.PlatformID = pbData.PlatformID pbSaveData.PlatformID = pbData.PlatformID
Options := utils.JsonStringToMap(pbData.Options) options := utils.JsonStringToMap(pbData.Options)
//Control whether to store offline messages (mongo) //Control whether to store offline messages (mongo)
isHistory := utils.GetSwitchFromOptions(Options, "history") isHistory := utils.GetSwitchFromOptions(options, "history")
//Control whether to store history messages (mysql) //Control whether to store history messages (mysql)
isPersist := utils.GetSwitchFromOptions(Options, "persistent") isPersist := utils.GetSwitchFromOptions(options, "persistent")
switch pbData.SessionType { switch pbData.SessionType {
case constant.SingleChatType: case constant.SingleChatType:
log.NewDebug(pbSaveData.OperationID, "msg_transfer chat type = SingleChatType", isHistory, isPersist) log.NewDebug(pbSaveData.OperationID, "msg_transfer chat type = SingleChatType", isHistory, isPersist)

View File

@ -40,9 +40,9 @@ func (pc *PersistentConsumerHandler) handleChatWs2Mysql(msg []byte, msgKey strin
log.ErrorByKv("msg_transfer Unmarshal chat err", "", "chat", string(msg), "err", err.Error()) log.ErrorByKv("msg_transfer Unmarshal chat err", "", "chat", string(msg), "err", err.Error())
return return
} }
Options := utils.JsonStringToMap(pbData.Options) options := utils.JsonStringToMap(pbData.Options)
//Control whether to store history messages (mysql) //Control whether to store history messages (mysql)
isPersist := utils.GetSwitchFromOptions(Options, "persistent") isPersist := utils.GetSwitchFromOptions(options, "persistent")
//Only process receiver data //Only process receiver data
if isPersist { if isPersist {
if msgKey == pbData.RecvID && pbData.SessionType == constant.SingleChatType { if msgKey == pbData.RecvID && pbData.SessionType == constant.SingleChatType {

View File

@ -20,15 +20,17 @@ func JGAccountListPush(accounts []string, content, detailContent, platform strin
var au requestBody.Audience var au requestBody.Audience
au.SetAlias(accounts) au.SetAlias(accounts)
var no requestBody.Notification var no requestBody.Notification
no.SetAlert(content) no.SetAlert(content, platform)
no.SetAndroidIntent()
var me requestBody.Message var me requestBody.Message
me.SetMsgContent(detailContent) me.SetMsgContent(detailContent)
var o requestBody.Options
o.SetApnsProduction(false)
var po requestBody.PushObj var po requestBody.PushObj
po.SetPlatform(&pf) po.SetPlatform(&pf)
po.SetAudience(&au) po.SetAudience(&au)
po.SetNotification(&no) po.SetNotification(&no)
po.SetMessage(&me) po.SetMessage(&me)
po.SetOptions(&o)
con, err := json.Marshal(po) con, err := json.Marshal(po)
if err != nil { if err != nil {

View File

@ -1,6 +1,9 @@
package requestBody package requestBody
import "Open_IM/pkg/common/config" import (
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant"
)
type Notification struct { type Notification struct {
Alert string `json:"alert,omitempty"` Alert string `json:"alert,omitempty"`
@ -15,11 +18,23 @@ type Android struct {
} `json:"intent,omitempty"` } `json:"intent,omitempty"`
} }
type Ios struct { type Ios struct {
Alert string `json:"alert,omitempty"`
Sound string `json:"sound,omitempty"`
Badge string `json:"badge,omitempty"`
} }
func (n *Notification) SetAlert(alert string) { func (n *Notification) SetAlert(alert, platform string) {
n.Alert = alert n.Alert = alert
n.Android.Alert = alert switch platform {
case constant.AndroidPlatformStr:
n.Android.Alert = alert
n.SetAndroidIntent()
case constant.IOSPlatformStr:
n.IOS.Alert = alert
n.IOS.Sound = "default"
n.IOS.Badge = "+1"
default:
}
} }
func (n *Notification) SetAndroidIntent() { func (n *Notification) SetAndroidIntent() {
n.Android.Intent.URL = config.Config.Push.Jpns.PushIntent n.Android.Intent.URL = config.Config.Push.Jpns.PushIntent

View File

@ -0,0 +1,9 @@
package requestBody
type Options struct {
ApnsProduction bool `json:"apns_production"`
}
func (o *Options) SetApnsProduction(c bool) {
o.ApnsProduction = c
}

View File

@ -5,6 +5,7 @@ type PushObj struct {
Audience interface{} `json:"audience"` Audience interface{} `json:"audience"`
Notification interface{} `json:"notification,omitempty"` Notification interface{} `json:"notification,omitempty"`
Message interface{} `json:"message,omitempty"` Message interface{} `json:"message,omitempty"`
Options interface{} `json:"options,omitempty"`
} }
func (p *PushObj) SetPlatform(pf *Platform) { func (p *PushObj) SetPlatform(pf *Platform) {
@ -22,3 +23,6 @@ func (p *PushObj) SetNotification(no *Notification) {
func (p *PushObj) SetMessage(m *Message) { func (p *PushObj) SetMessage(m *Message) {
p.Message = m p.Message = m
} }
func (p *PushObj) SetOptions(o *Options) {
p.Options = o
}

View File

@ -12,6 +12,7 @@ import (
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
pbChat "Open_IM/pkg/proto/chat" pbChat "Open_IM/pkg/proto/chat"
pbRelay "Open_IM/pkg/proto/relay" pbRelay "Open_IM/pkg/proto/relay"
"Open_IM/pkg/utils"
"github.com/Shopify/sarama" "github.com/Shopify/sarama"
"github.com/golang/protobuf/proto" "github.com/golang/protobuf/proto"
) )
@ -53,7 +54,7 @@ func (ms *PushConsumerHandler) handleMs2PsChat(msg []byte) {
sendPbData.PlatformID = pbData.PlatformID sendPbData.PlatformID = pbData.PlatformID
sendPbData.RecvSeq = pbData.RecvSeq sendPbData.RecvSeq = pbData.RecvSeq
//Call push module to send message to the user //Call push module to send message to the user
MsgToUser(&sendPbData, pbData.OfflineInfo, pbData.Options) MsgToUser(&sendPbData, pbData.OfflineInfo, utils.JsonStringToMap(pbData.Options))
} }
func (PushConsumerHandler) Setup(_ sarama.ConsumerGroupSession) error { return nil } func (PushConsumerHandler) Setup(_ sarama.ConsumerGroupSession) error { return nil }
func (PushConsumerHandler) Cleanup(_ sarama.ConsumerGroupSession) error { return nil } func (PushConsumerHandler) Cleanup(_ sarama.ConsumerGroupSession) error { return nil }

View File

@ -65,7 +65,7 @@ func (r *RPCServer) PushMsg(_ context.Context, pbData *pbPush.PushMsgReq) (*pbPu
sendPbData.PlatformID = pbData.PlatformID sendPbData.PlatformID = pbData.PlatformID
sendPbData.RecvSeq = pbData.RecvSeq sendPbData.RecvSeq = pbData.RecvSeq
//Call push module to send message to the user //Call push module to send message to the user
MsgToUser(&sendPbData, pbData.OfflineInfo, pbData.Options) MsgToUser(&sendPbData, pbData.OfflineInfo, utils.JsonStringToMap(pbData.Options))
return &pbPush.PushMsgResp{ return &pbPush.PushMsgResp{
ResultCode: 0, ResultCode: 0,
}, nil }, nil

View File

@ -34,12 +34,10 @@ type AtContent struct {
IsAtSelf bool `json:"isAtSelf"` IsAtSelf bool `json:"isAtSelf"`
} }
func MsgToUser(sendPbData *pbRelay.MsgToUserReq, OfflineInfo, Options string) { func MsgToUser(sendPbData *pbRelay.MsgToUserReq, OfflineInfo string, Options map[string]int32) {
var wsResult []*pbRelay.SingleMsgToUser var wsResult []*pbRelay.SingleMsgToUser
MOptions := utils.JsonStringToMap(Options) //Control whether to push message to sender's other terminal isOfflinePush := utils.GetSwitchFromOptions(Options, "offlinePush")
//isSenderSync := utils.GetSwitchFromOptions(MOptions, "senderSync") log.InfoByKv("Get chat from msg_transfer And push chat", sendPbData.OperationID, "PushData", sendPbData, Options, isOfflinePush)
isOfflinePush := utils.GetSwitchFromOptions(MOptions, "offlinePush")
log.InfoByKv("Get chat from msg_transfer And push chat", sendPbData.OperationID, "PushData", sendPbData)
grpcCons := getcdv3.GetConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOnlineMessageRelayName) grpcCons := getcdv3.GetConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOnlineMessageRelayName)
//Online push message //Online push message
log.InfoByKv("test", sendPbData.OperationID, "len grpc", len(grpcCons), "data", sendPbData) log.InfoByKv("test", sendPbData.OperationID, "len grpc", len(grpcCons), "data", sendPbData)
@ -100,9 +98,9 @@ func MsgToUser(sendPbData *pbRelay.MsgToUserReq, OfflineInfo, Options string) {
} }
pushResult, err := push.JGAccountListPush(UIDList, content, jsonCustomContent, constant.PlatformIDToName(t)) pushResult, err := push.JGAccountListPush(UIDList, content, jsonCustomContent, constant.PlatformIDToName(t))
if err != nil { if err != nil {
log.NewError(sendPbData.OperationID, "offline push error", sendPbData.String(), err.Error(), t) log.NewError(sendPbData.OperationID, "offline push error", sendPbData.String(), err.Error(), constant.PlatformIDToName(t))
} else { } else {
log.NewDebug(sendPbData.OperationID, "offline push return result is ", string(pushResult), sendPbData, t) log.NewDebug(sendPbData.OperationID, "offline push return result is ", string(pushResult), sendPbData, constant.PlatformIDToName(t))
} }
} }

View File

@ -71,8 +71,8 @@ func (rpc *rpcChat) UserSendMsg(_ context.Context, pb *pbChat.UserSendMsgReq) (*
} else { } else {
pbData.SendTime = pb.SendTime pbData.SendTime = pb.SendTime
} }
Options := utils.JsonStringToMap(pbData.Options) options := utils.JsonStringToMap(pbData.Options)
isHistory := utils.GetSwitchFromOptions(Options, "history") isHistory := utils.GetSwitchFromOptions(options, "history")
mReq := MsgCallBackReq{ mReq := MsgCallBackReq{
SendID: pb.SendID, SendID: pb.SendID,
RecvID: pb.RecvID, RecvID: pb.RecvID,
@ -190,6 +190,20 @@ func (rpc *rpcChat) UserSendMsg(_ context.Context, pb *pbChat.UserSendMsgReq) (*
} }
}
type WSToMsgSvrChatMsg struct {
SendID string `protobuf:"bytes,1,opt,name=SendID" json:"SendID,omitempty"`
RecvID string `protobuf:"bytes,2,opt,name=RecvID" json:"RecvID,omitempty"`
Content string `protobuf:"bytes,3,opt,name=Content" json:"Content,omitempty"`
MsgFrom int32 `protobuf:"varint,5,opt,name=MsgFrom" json:"MsgFrom,omitempty"`
ContentType int32 `protobuf:"varint,8,opt,name=ContentType" json:"ContentType,omitempty"`
SessionType int32 `protobuf:"varint,9,opt,name=SessionType" json:"SessionType,omitempty"`
OperationID string `protobuf:"bytes,10,opt,name=OperationID" json:"OperationID,omitempty"`
}
func Notification(m *WSToMsgSvrChatMsg, onlineUserOnly bool, offlineInfo interface{}) {
} }
func (rpc *rpcChat) sendMsgToKafka(m *pbChat.WSToMsgSvrChatMsg, key string) error { func (rpc *rpcChat) sendMsgToKafka(m *pbChat.WSToMsgSvrChatMsg, key string) error {
pid, offset, err := rpc.producer.SendMessage(m, key) pid, offset, err := rpc.producer.SendMessage(m, key)
@ -224,10 +238,12 @@ func modifyMessageByUserMessageReceiveOpt(userID, sourceID string, sessionType i
case constant.NotReceiveMessage: case constant.NotReceiveMessage:
return false return false
case constant.ReceiveNotNotifyMessage: case constant.ReceiveNotNotifyMessage:
m := utils.JsonStringToMap(msg.OfflineInfo) options := utils.JsonStringToMap(msg.Options)
utils.SetSwitchFromOptions(m, "offlinePush", 0) if options == nil {
s := utils.MapToJsonString(m) options = make(map[string]int32, 2)
msg.OfflineInfo = s }
utils.SetSwitchFromOptions(options, "offlinePush", 0)
msg.Options = utils.MapIntToJsonString(options)
return true return true
} }

View File

@ -198,14 +198,14 @@ func (d *DataBases) SaveUserChat(uid string, sendTime int64, m *pbMsg.MsgSvrToPu
return errors.New("session == nil") return errors.New("session == nil")
} }
defer session.Close() defer session.Close()
log.NewInfo("", "get mgoSession cost time", getCurrentTimestampByMill()-newTime) log.NewDebug("", "get mgoSession cost time", getCurrentTimestampByMill()-newTime)
c := session.DB(config.Config.Mongo.DBDatabase).C(cChat) c := session.DB(config.Config.Mongo.DBDatabase).C(cChat)
seqUid = getSeqUid(uid, m.RecvSeq) seqUid = getSeqUid(uid, m.RecvSeq)
n, err := c.Find(bson.M{"uid": seqUid}).Count() n, err := c.Find(bson.M{"uid": seqUid}).Count()
if err != nil { if err != nil {
return err return err
} }
log.NewInfo("", "find mgo uid cost time", getCurrentTimestampByMill()-newTime) log.NewDebug("", "find mgo uid cost time", getCurrentTimestampByMill()-newTime)
sMsg := MsgInfo{} sMsg := MsgInfo{}
sMsg.SendTime = sendTime sMsg.SendTime = sendTime
if sMsg.Msg, err = proto.Marshal(m); err != nil { if sMsg.Msg, err = proto.Marshal(m); err != nil {
@ -225,7 +225,7 @@ func (d *DataBases) SaveUserChat(uid string, sendTime int64, m *pbMsg.MsgSvrToPu
return err return err
} }
} }
log.NewInfo("", "insert mgo data cost time", getCurrentTimestampByMill()-newTime) log.NewDebug("", "insert mgo data cost time", getCurrentTimestampByMill()-newTime)
return nil return nil
} }

View File

@ -50,7 +50,7 @@ func (m *WSToMsgSvrChatMsg) Reset() { *m = WSToMsgSvrChatMsg{} }
func (m *WSToMsgSvrChatMsg) String() string { return proto.CompactTextString(m) } func (m *WSToMsgSvrChatMsg) String() string { return proto.CompactTextString(m) }
func (*WSToMsgSvrChatMsg) ProtoMessage() {} func (*WSToMsgSvrChatMsg) ProtoMessage() {}
func (*WSToMsgSvrChatMsg) Descriptor() ([]byte, []int) { func (*WSToMsgSvrChatMsg) Descriptor() ([]byte, []int) {
return fileDescriptor_chat_feb94a5514034c46, []int{0} return fileDescriptor_chat_163a8d226aa6edb5, []int{0}
} }
func (m *WSToMsgSvrChatMsg) XXX_Unmarshal(b []byte) error { func (m *WSToMsgSvrChatMsg) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_WSToMsgSvrChatMsg.Unmarshal(m, b) return xxx_messageInfo_WSToMsgSvrChatMsg.Unmarshal(m, b)
@ -215,7 +215,7 @@ func (m *MsgSvrToPushSvrChatMsg) Reset() { *m = MsgSvrToPushSvrChatMsg{}
func (m *MsgSvrToPushSvrChatMsg) String() string { return proto.CompactTextString(m) } func (m *MsgSvrToPushSvrChatMsg) String() string { return proto.CompactTextString(m) }
func (*MsgSvrToPushSvrChatMsg) ProtoMessage() {} func (*MsgSvrToPushSvrChatMsg) ProtoMessage() {}
func (*MsgSvrToPushSvrChatMsg) Descriptor() ([]byte, []int) { func (*MsgSvrToPushSvrChatMsg) Descriptor() ([]byte, []int) {
return fileDescriptor_chat_feb94a5514034c46, []int{1} return fileDescriptor_chat_163a8d226aa6edb5, []int{1}
} }
func (m *MsgSvrToPushSvrChatMsg) XXX_Unmarshal(b []byte) error { func (m *MsgSvrToPushSvrChatMsg) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_MsgSvrToPushSvrChatMsg.Unmarshal(m, b) return xxx_messageInfo_MsgSvrToPushSvrChatMsg.Unmarshal(m, b)
@ -361,7 +361,7 @@ func (m *PullMessageReq) Reset() { *m = PullMessageReq{} }
func (m *PullMessageReq) String() string { return proto.CompactTextString(m) } func (m *PullMessageReq) String() string { return proto.CompactTextString(m) }
func (*PullMessageReq) ProtoMessage() {} func (*PullMessageReq) ProtoMessage() {}
func (*PullMessageReq) Descriptor() ([]byte, []int) { func (*PullMessageReq) Descriptor() ([]byte, []int) {
return fileDescriptor_chat_feb94a5514034c46, []int{2} return fileDescriptor_chat_163a8d226aa6edb5, []int{2}
} }
func (m *PullMessageReq) XXX_Unmarshal(b []byte) error { func (m *PullMessageReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PullMessageReq.Unmarshal(m, b) return xxx_messageInfo_PullMessageReq.Unmarshal(m, b)
@ -425,7 +425,7 @@ func (m *PullMessageResp) Reset() { *m = PullMessageResp{} }
func (m *PullMessageResp) String() string { return proto.CompactTextString(m) } func (m *PullMessageResp) String() string { return proto.CompactTextString(m) }
func (*PullMessageResp) ProtoMessage() {} func (*PullMessageResp) ProtoMessage() {}
func (*PullMessageResp) Descriptor() ([]byte, []int) { func (*PullMessageResp) Descriptor() ([]byte, []int) {
return fileDescriptor_chat_feb94a5514034c46, []int{3} return fileDescriptor_chat_163a8d226aa6edb5, []int{3}
} }
func (m *PullMessageResp) XXX_Unmarshal(b []byte) error { func (m *PullMessageResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PullMessageResp.Unmarshal(m, b) return xxx_messageInfo_PullMessageResp.Unmarshal(m, b)
@ -500,7 +500,7 @@ func (m *PullMessageBySeqListReq) Reset() { *m = PullMessageBySeqListReq
func (m *PullMessageBySeqListReq) String() string { return proto.CompactTextString(m) } func (m *PullMessageBySeqListReq) String() string { return proto.CompactTextString(m) }
func (*PullMessageBySeqListReq) ProtoMessage() {} func (*PullMessageBySeqListReq) ProtoMessage() {}
func (*PullMessageBySeqListReq) Descriptor() ([]byte, []int) { func (*PullMessageBySeqListReq) Descriptor() ([]byte, []int) {
return fileDescriptor_chat_feb94a5514034c46, []int{4} return fileDescriptor_chat_163a8d226aa6edb5, []int{4}
} }
func (m *PullMessageBySeqListReq) XXX_Unmarshal(b []byte) error { func (m *PullMessageBySeqListReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PullMessageBySeqListReq.Unmarshal(m, b) return xxx_messageInfo_PullMessageBySeqListReq.Unmarshal(m, b)
@ -553,7 +553,7 @@ func (m *GetMaxAndMinSeqReq) Reset() { *m = GetMaxAndMinSeqReq{} }
func (m *GetMaxAndMinSeqReq) String() string { return proto.CompactTextString(m) } func (m *GetMaxAndMinSeqReq) String() string { return proto.CompactTextString(m) }
func (*GetMaxAndMinSeqReq) ProtoMessage() {} func (*GetMaxAndMinSeqReq) ProtoMessage() {}
func (*GetMaxAndMinSeqReq) Descriptor() ([]byte, []int) { func (*GetMaxAndMinSeqReq) Descriptor() ([]byte, []int) {
return fileDescriptor_chat_feb94a5514034c46, []int{5} return fileDescriptor_chat_163a8d226aa6edb5, []int{5}
} }
func (m *GetMaxAndMinSeqReq) XXX_Unmarshal(b []byte) error { func (m *GetMaxAndMinSeqReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetMaxAndMinSeqReq.Unmarshal(m, b) return xxx_messageInfo_GetMaxAndMinSeqReq.Unmarshal(m, b)
@ -601,7 +601,7 @@ func (m *GetMaxAndMinSeqResp) Reset() { *m = GetMaxAndMinSeqResp{} }
func (m *GetMaxAndMinSeqResp) String() string { return proto.CompactTextString(m) } func (m *GetMaxAndMinSeqResp) String() string { return proto.CompactTextString(m) }
func (*GetMaxAndMinSeqResp) ProtoMessage() {} func (*GetMaxAndMinSeqResp) ProtoMessage() {}
func (*GetMaxAndMinSeqResp) Descriptor() ([]byte, []int) { func (*GetMaxAndMinSeqResp) Descriptor() ([]byte, []int) {
return fileDescriptor_chat_feb94a5514034c46, []int{6} return fileDescriptor_chat_163a8d226aa6edb5, []int{6}
} }
func (m *GetMaxAndMinSeqResp) XXX_Unmarshal(b []byte) error { func (m *GetMaxAndMinSeqResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetMaxAndMinSeqResp.Unmarshal(m, b) return xxx_messageInfo_GetMaxAndMinSeqResp.Unmarshal(m, b)
@ -663,7 +663,7 @@ func (m *GatherFormat) Reset() { *m = GatherFormat{} }
func (m *GatherFormat) String() string { return proto.CompactTextString(m) } func (m *GatherFormat) String() string { return proto.CompactTextString(m) }
func (*GatherFormat) ProtoMessage() {} func (*GatherFormat) ProtoMessage() {}
func (*GatherFormat) Descriptor() ([]byte, []int) { func (*GatherFormat) Descriptor() ([]byte, []int) {
return fileDescriptor_chat_feb94a5514034c46, []int{7} return fileDescriptor_chat_163a8d226aa6edb5, []int{7}
} }
func (m *GatherFormat) XXX_Unmarshal(b []byte) error { func (m *GatherFormat) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GatherFormat.Unmarshal(m, b) return xxx_messageInfo_GatherFormat.Unmarshal(m, b)
@ -731,7 +731,7 @@ func (m *MsgFormat) Reset() { *m = MsgFormat{} }
func (m *MsgFormat) String() string { return proto.CompactTextString(m) } func (m *MsgFormat) String() string { return proto.CompactTextString(m) }
func (*MsgFormat) ProtoMessage() {} func (*MsgFormat) ProtoMessage() {}
func (*MsgFormat) Descriptor() ([]byte, []int) { func (*MsgFormat) Descriptor() ([]byte, []int) {
return fileDescriptor_chat_feb94a5514034c46, []int{8} return fileDescriptor_chat_163a8d226aa6edb5, []int{8}
} }
func (m *MsgFormat) XXX_Unmarshal(b []byte) error { func (m *MsgFormat) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_MsgFormat.Unmarshal(m, b) return xxx_messageInfo_MsgFormat.Unmarshal(m, b)
@ -863,7 +863,7 @@ func (m *UserSendMsgReq) Reset() { *m = UserSendMsgReq{} }
func (m *UserSendMsgReq) String() string { return proto.CompactTextString(m) } func (m *UserSendMsgReq) String() string { return proto.CompactTextString(m) }
func (*UserSendMsgReq) ProtoMessage() {} func (*UserSendMsgReq) ProtoMessage() {}
func (*UserSendMsgReq) Descriptor() ([]byte, []int) { func (*UserSendMsgReq) Descriptor() ([]byte, []int) {
return fileDescriptor_chat_feb94a5514034c46, []int{9} return fileDescriptor_chat_163a8d226aa6edb5, []int{9}
} }
func (m *UserSendMsgReq) XXX_Unmarshal(b []byte) error { func (m *UserSendMsgReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UserSendMsgReq.Unmarshal(m, b) return xxx_messageInfo_UserSendMsgReq.Unmarshal(m, b)
@ -1025,7 +1025,7 @@ func (m *UserSendMsgResp) Reset() { *m = UserSendMsgResp{} }
func (m *UserSendMsgResp) String() string { return proto.CompactTextString(m) } func (m *UserSendMsgResp) String() string { return proto.CompactTextString(m) }
func (*UserSendMsgResp) ProtoMessage() {} func (*UserSendMsgResp) ProtoMessage() {}
func (*UserSendMsgResp) Descriptor() ([]byte, []int) { func (*UserSendMsgResp) Descriptor() ([]byte, []int) {
return fileDescriptor_chat_feb94a5514034c46, []int{10} return fileDescriptor_chat_163a8d226aa6edb5, []int{10}
} }
func (m *UserSendMsgResp) XXX_Unmarshal(b []byte) error { func (m *UserSendMsgResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UserSendMsgResp.Unmarshal(m, b) return xxx_messageInfo_UserSendMsgResp.Unmarshal(m, b)
@ -1272,9 +1272,9 @@ var _Chat_serviceDesc = grpc.ServiceDesc{
Metadata: "chat/chat.proto", Metadata: "chat/chat.proto",
} }
func init() { proto.RegisterFile("chat/chat.proto", fileDescriptor_chat_feb94a5514034c46) } func init() { proto.RegisterFile("chat/chat.proto", fileDescriptor_chat_163a8d226aa6edb5) }
var fileDescriptor_chat_feb94a5514034c46 = []byte{ var fileDescriptor_chat_163a8d226aa6edb5 = []byte{
// 981 bytes of a gzipped FileDescriptorProto // 981 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0xdd, 0x6a, 0xe3, 0x46, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0xdd, 0x6a, 0xe3, 0x46,
0x14, 0xc6, 0x92, 0x2d, 0xdb, 0xc7, 0xbf, 0x99, 0x86, 0xec, 0x90, 0x96, 0xd6, 0x88, 0x6d, 0x31, 0x14, 0xc6, 0x92, 0x2d, 0xdb, 0xc7, 0xbf, 0x99, 0x86, 0xec, 0x90, 0x96, 0xd6, 0x88, 0x6d, 0x31,

View File

@ -49,7 +49,7 @@ func (m *PushMsgReq) Reset() { *m = PushMsgReq{} }
func (m *PushMsgReq) String() string { return proto.CompactTextString(m) } func (m *PushMsgReq) String() string { return proto.CompactTextString(m) }
func (*PushMsgReq) ProtoMessage() {} func (*PushMsgReq) ProtoMessage() {}
func (*PushMsgReq) Descriptor() ([]byte, []int) { func (*PushMsgReq) Descriptor() ([]byte, []int) {
return fileDescriptor_push_4f08d2ff54ba8af2, []int{0} return fileDescriptor_push_e44270f7d93180b9, []int{0}
} }
func (m *PushMsgReq) XXX_Unmarshal(b []byte) error { func (m *PushMsgReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PushMsgReq.Unmarshal(m, b) return xxx_messageInfo_PushMsgReq.Unmarshal(m, b)
@ -192,7 +192,7 @@ func (m *PushMsgResp) Reset() { *m = PushMsgResp{} }
func (m *PushMsgResp) String() string { return proto.CompactTextString(m) } func (m *PushMsgResp) String() string { return proto.CompactTextString(m) }
func (*PushMsgResp) ProtoMessage() {} func (*PushMsgResp) ProtoMessage() {}
func (*PushMsgResp) Descriptor() ([]byte, []int) { func (*PushMsgResp) Descriptor() ([]byte, []int) {
return fileDescriptor_push_4f08d2ff54ba8af2, []int{1} return fileDescriptor_push_e44270f7d93180b9, []int{1}
} }
func (m *PushMsgResp) XXX_Unmarshal(b []byte) error { func (m *PushMsgResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PushMsgResp.Unmarshal(m, b) return xxx_messageInfo_PushMsgResp.Unmarshal(m, b)
@ -296,9 +296,9 @@ var _PushMsgService_serviceDesc = grpc.ServiceDesc{
Metadata: "push/push.proto", Metadata: "push/push.proto",
} }
func init() { proto.RegisterFile("push/push.proto", fileDescriptor_push_4f08d2ff54ba8af2) } func init() { proto.RegisterFile("push/push.proto", fileDescriptor_push_e44270f7d93180b9) }
var fileDescriptor_push_4f08d2ff54ba8af2 = []byte{ var fileDescriptor_push_e44270f7d93180b9 = []byte{
// 378 bytes of a gzipped FileDescriptorProto // 378 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x92, 0x5d, 0xeb, 0xda, 0x30, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x92, 0x5d, 0xeb, 0xda, 0x30,
0x14, 0xc6, 0xe9, 0xb4, 0xbe, 0x1c, 0xe7, 0xcb, 0xc2, 0x18, 0xc1, 0x8b, 0x51, 0x64, 0x0c, 0x6f, 0x14, 0xc6, 0xe9, 0xb4, 0xbe, 0x1c, 0xe7, 0xcb, 0xc2, 0x18, 0xc1, 0x8b, 0x51, 0x64, 0x0c, 0x6f,

View File

@ -111,16 +111,16 @@ func MapIntToJsonString(param map[string]int32) string {
dataString := string(dataType) dataString := string(dataType)
return dataString return dataString
} }
func JsonStringToMap(str string) (tempMap map[string]interface{}) { func JsonStringToMap(str string) (tempMap map[string]int32) {
_ = json.Unmarshal([]byte(str), &tempMap) _ = json.Unmarshal([]byte(str), &tempMap)
return tempMap return tempMap
} }
func GetSwitchFromOptions(Options map[string]interface{}, key string) (result bool) { func GetSwitchFromOptions(Options map[string]int32, key string) (result bool) {
if flag, ok := Options[key]; !ok || flag.(int) == 1 { if flag, ok := Options[key]; !ok || flag == 1 {
return true return true
} }
return false return false
} }
func SetSwitchFromOptions(Options map[string]interface{}, key string, value interface{}) { func SetSwitchFromOptions(Options map[string]int32, key string, value int32) {
Options[key] = value Options[key] = value
} }