aa
This commit is contained in:
@@ -467,3 +467,21 @@ func DeleteMessageRecord(ctx *jxcontext.Context) (err error) {
|
|||||||
_, err = dao.ExecuteSQL(db, sql, sqlParams)
|
_, err = dao.ExecuteSQL(db, sql, sqlParams)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func UpdateUserMessageGroupRead(ctx *jxcontext.Context, reads []*model.MessageGroupRead) (err error) {
|
||||||
|
var (
|
||||||
|
db = dao.GetDB()
|
||||||
|
userID = ctx.GetUserID()
|
||||||
|
)
|
||||||
|
for _, v := range reads {
|
||||||
|
if messageReads, err := dao.GetMessageGroupRead(db, userID, v.GroupID); err == nil {
|
||||||
|
if len(messageReads) > 0 {
|
||||||
|
messageReads[0].UnReadCount += v.UnReadCount
|
||||||
|
dao.UpdateEntity(db, messageReads[0], "UnReadCount")
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|||||||
@@ -214,6 +214,23 @@ func (c *EventController) GetImMessageRecord() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Title 用户未读消息设置
|
||||||
|
// @Description 用户未读消息设置,用户在退出登录,ws关闭,以及关闭小程序或app时调用
|
||||||
|
// @Param token header string true "认证token"
|
||||||
|
// @Param payload query string true "messageGroupRead 格式[{"groupID":,"unReadCount":}]"
|
||||||
|
// @Success 200 {object} controllers.CallResult
|
||||||
|
// @Failure 200 {object} controllers.CallResult
|
||||||
|
// @router /UpdateUserMessageGroupRead [post]
|
||||||
|
func (c *EventController) UpdateUserMessageGroupRead() {
|
||||||
|
c.callUpdateUserMessageGroupRead(func(params *tEventUpdateUserMessageGroupReadParams) (retVal interface{}, errCode string, err error) {
|
||||||
|
var reads []*model.MessageGroupRead
|
||||||
|
if err = jxutils.Strings2Objs(params.Payload, &reads); err == nil {
|
||||||
|
err = event.UpdateUserMessageGroupRead(params.Ctx, reads)
|
||||||
|
}
|
||||||
|
return retVal, "", err
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// @Title 发送聊天消息(限定系统消息)
|
// @Title 发送聊天消息(限定系统消息)
|
||||||
// @Description 发送聊天消息(限定系统消息)
|
// @Description 发送聊天消息(限定系统消息)
|
||||||
// @Param token header string true "认证token"
|
// @Param token header string true "认证token"
|
||||||
|
|||||||
@@ -295,6 +295,15 @@ func init() {
|
|||||||
Filters: nil,
|
Filters: nil,
|
||||||
Params: nil})
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:EventController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:EventController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "UpdateUserMessageGroupRead",
|
||||||
|
Router: `/UpdateUserMessageGroupRead`,
|
||||||
|
AllowHTTPMethods: []string{"post"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:EventController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:EventController"],
|
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:EventController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:EventController"],
|
||||||
beego.ControllerComments{
|
beego.ControllerComments{
|
||||||
Method: "UploadImg",
|
Method: "UploadImg",
|
||||||
|
|||||||
Reference in New Issue
Block a user