This commit is contained in:
wangchuxiao
2022-12-05 14:53:16 +08:00
parent b2be663ba6
commit 71c836ae1a
6 changed files with 29 additions and 18 deletions
+5 -4
View File
@@ -2,9 +2,9 @@ package call_back_struct
type CallbackUserOnlineReq struct {
UserStatusCallbackReq
Token string `json:"token"`
Seq int `json:"seq"`
IsAppBackground bool `json:"isAppBackground"`
Token string `json:"token"`
Seq int `json:"seq"`
IsAppBackgroundStatusChanged bool `json:"isAppBackgroundStatusChanged"`
}
type CallbackUserOnlineResp struct {
@@ -13,7 +13,8 @@ type CallbackUserOnlineResp struct {
type CallbackUserOfflineReq struct {
UserStatusCallbackReq
Seq int `json:"seq"`
Seq int `json:"seq"`
IsAppBackgroundStatusChanged bool `json:"isAppBackgroundStatusChanged"`
}
type CallbackUserOfflineResp struct {
+5 -3
View File
@@ -73,11 +73,13 @@ func (d *DataBases) GetExtendMsgSet(ID string, index int32, opts *GetExtendMsgSe
return &set, err
}
func (d *DataBases) InsertExtendMsg(ID string, index int32, msg *ExtendMsg) error {
func (d *DataBases) InsertExtendMsg(ID string, index int32, msg *ExtendMsg) (msgIndex int32, err error) {
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cExtendMsgSet)
_, err := c.UpdateOne(ctx, bson.M{"uid": GetExtendMsgSetID(ID, index)}, bson.M{"$set": bson.M{"create_time": utils.GetCurrentTimestampBySecond(), "$inc": bson.M{"extend_msg_num": 1}, "$push": bson.M{"extend_msgs": msg}}})
return err
result := c.FindOneAndUpdate(ctx, bson.M{"uid": GetExtendMsgSetID(ID, index)}, bson.M{"$set": bson.M{"create_time": utils.GetCurrentTimestampBySecond(), "$inc": bson.M{"extend_msg_num": 1}, "$push": bson.M{"extend_msgs": msg}}})
set := &ExtendMsgSet{}
err = result.Decode(set)
return set.ExtendMsgNum, err
}
func (d *DataBases) UpdateOneExtendMsgSet(ID string, index, MsgIndex int32, msg *ExtendMsg, msgSet *ExtendMsgSet) error {
-1
View File
@@ -166,5 +166,4 @@ service msg {
rpc GetSendMsgStatus(GetSendMsgStatusReq) returns(GetSendMsgStatusResp);
rpc GetSuperGroupMsg(GetSuperGroupMsgReq) returns(GetSuperGroupMsgResp);
rpc GetWriteDiffMsg(GetWriteDiffMsgReq) returns(GetWriteDiffMsgResp);
}