mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-09 19:45:58 +08:00
ws
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -166,5 +166,4 @@ service msg {
|
||||
rpc GetSendMsgStatus(GetSendMsgStatusReq) returns(GetSendMsgStatusResp);
|
||||
rpc GetSuperGroupMsg(GetSuperGroupMsgReq) returns(GetSuperGroupMsgResp);
|
||||
rpc GetWriteDiffMsg(GetWriteDiffMsgReq) returns(GetWriteDiffMsgResp);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user