by Robin at 20240911; notificaton

This commit is contained in:
Leufolium 2024-09-11 15:44:49 +08:00
parent 947b2ed877
commit b5f0159358
10 changed files with 113 additions and 0 deletions

View File

@ -327,3 +327,9 @@ const (
Notification_NotRead = 0 //未读
Notification_Read = 1 //已读
)
// 系统通知表的推送状态
const (
NotificationStatus_Created = 0 //已创建
NotificationStatus_Pushed = 1 //已推送
)

View File

@ -38,3 +38,32 @@ type ApiListBySessionIdResp struct {
base.BaseResponse
Data *ApiListBySessionIdData `json:"data"`
}
// op 更新
type ApiUpdateByIdsReq struct {
base.BaseRequest
*dbstruct.ContactCustomerService
Ids []int64
}
type ApiUpdateByIdsData struct {
}
type ApiUpdateByIdsResp struct {
base.BaseResponse
Data *ApiUpdateByIdsData `json:"data"`
}
// op 一键已读
type ApiReadAllReq struct {
base.BaseRequest
SessionId *int64 `json:"session_id"`
}
type ApiReadAllData struct {
}
type ApiReadAllResp struct {
base.BaseResponse
Data *ApiReadAllData `json:"data"`
}

View File

@ -82,3 +82,17 @@ type OpListBySessionIdResp struct {
base.BaseResponse
Data *OpListBySessionIdData `json:"data"`
}
// op 一键已读
type OpReadAllReq struct {
base.BaseRequest
SessionId *int64 `json:"session_id"`
}
type OpReadAllData struct {
}
type OpReadAllResp struct {
base.BaseResponse
Data *OpReadAllData `json:"data"`
}

View File

@ -21,3 +21,17 @@ func (p *ApiListBySessionIdReq) ProvideNotNullValue() (params []*validator.JsonP
params = append(params, validator.NewInt64PtrParam("session_id should not be null", p.SessionId))
return params
}
// op 按id更新
func (p *ApiUpdateByIdsReq) ProvideNotNullValue() (params []*validator.JsonParam) {
params = make([]*validator.JsonParam, 0)
params = append(params, validator.NewInt64SliceParam("欲更新的联系客服Ids为空", p.Ids))
return params
}
// op 一键已读
func (p *ApiReadAllReq) ProvideNotNullValue() (params []*validator.JsonParam) {
params = make([]*validator.JsonParam, 0)
params = append(params, validator.NewInt64PtrParam("请填写对话ID", p.SessionId))
return params
}

View File

@ -28,3 +28,10 @@ func (p *OpListBySessionIdReq) ProvideNotNullValue() (params []*validator.JsonPa
params = append(params, validator.NewInt64PtrParam("session_id should not be null", p.SessionId))
return params
}
// op 一键已读
func (p *OpReadAllReq) ProvideNotNullValue() (params []*validator.JsonParam) {
params = make([]*validator.JsonParam, 0)
params = append(params, validator.NewInt64PtrParam("请填写对话ID", p.SessionId))
return params
}

View File

@ -48,3 +48,18 @@ type ApiListResp struct {
base.BaseResponse
Data *ApiListByMidData `json:"data"`
}
// op 统计未读总数
type ApiCountUnreadByMidReq struct {
base.BaseRequest
SessionId *int64 `json:"session_id"`
}
type ApiCountUnreadByMidData struct {
UnreadCount int64 `json:"unread_count"`
}
type ApiCountUnreadByMidResp struct {
base.BaseResponse
Data *ApiCountUnreadByMidData `json:"data"`
}

View File

@ -96,3 +96,18 @@ type OpListResp struct {
base.BaseResponse
Data *OpListData `json:"data"`
}
// op 统计未读总数
type OpCountUnreadByMidReq struct {
base.BaseRequest
SessionId *int64 `json:"session_id"`
}
type OpCountUnreadByMidData struct {
UnreadCount int64 `json:"unread_count"`
}
type OpCountUnreadByMidResp struct {
base.BaseResponse
Data *OpCountUnreadByMidData `json:"data"`
}

View File

@ -20,3 +20,10 @@ func (p *ApiListByMidReq) ProvideNotNullValue() (params []*validator.JsonParam)
params = append(params, validator.NewInt64PtrParam("mid should not be null", p.Mid))
return params
}
// api 统计未读总数
func (p *ApiCountUnreadByMidReq) ProvideNotNullValue() (params []*validator.JsonParam) {
params = make([]*validator.JsonParam, 0)
params = append(params, validator.NewInt64PtrParam("请输入对话id!", p.SessionId))
return params
}

View File

@ -4963,6 +4963,8 @@ func (s *Service) OpGetSingleDistributeHisList(ctx *gin.Context, req *single_dis
// Notification
func (s *Service) OpCreateNotification(ctx *gin.Context, req *notificationproto.OpCreateReq) (ec errcode.ErrCode) {
ec = errcode.ErrCodeNotificationSrvOk
req.Status = goproto.Int64(consts.NotificationStatus_Created)
err := _DefaultNotification.OpCreate(ctx, req)
if err != nil {
logger.Error("OpCreate fail, req: %v, err: %v", util.ToJson(req), err)

View File

@ -9,6 +9,10 @@ type Notification struct {
Message *string `json:"message" bson:"message"` // 消息内容
Thumbnail *MediaComponent `json:"thumbnail" bson:"thumbnail"` // 缩略图
LinkText *string `json:"link_text" bson:"link_text"` // 链接文案
Action *string `json:"action" bson:"action"` // 行为
Params *string `json:"params" bson:"params"` // 参数
PushTime *int64 `json:"push_time" bson:"push_time"` // 推送时间
Status *int64 `json:"status" bson:"status"` // 推送状态
IsRead *int64 `json:"is_read" bson:"is_read"` // 是否已读
Ct *int64 `json:"ct" bson:"ct"` // 创建时间
Ut *int64 `json:"ut" bson:"ut"` // 更新时间