update Notification

This commit is contained in:
aichy126 2023-05-25 16:49:05 +08:00
parent 0a4f75323c
commit bd079a0040
3 changed files with 10 additions and 6 deletions

View File

@ -96,10 +96,14 @@ func (nr *notificationRepo) GetNotificationPage(ctx context.Context, searchCond
session := nr.data.DB.NewSession()
session = session.Desc("updated_at")
cond := &entity.Notification{
UserID: searchCond.UserID,
Type: searchCond.Type,
}
if searchCond.InboxType > 0 {
cond.MsgType = searchCond.InboxType
}
total, err = pager.Help(searchCond.Page, searchCond.PageSize, &notificationList, cond, session)
if err != nil {
err = errors.InternalServer(reason.DatabaseError).WithError(err).WithStack()

View File

@ -7,10 +7,10 @@ const (
NotificationRead = 2
NotificationStatusNormal = 1
NotificationStatusDelete = 10
NotificationInboxTypeAll = 1
NotificationInboxTypePosts = 2
NotificationInboxTypeAll = 0
NotificationInboxTypePosts = 1
NotificationInboxTypeVotes = 2
NotificationInboxTypeInvites = 3
NotificationInboxTypeVotes = 4
)
var NotificationType = map[string]int{

View File

@ -125,9 +125,9 @@ func (ns *NotificationService) GetNotificationPage(ctx context.Context, searchCo
}
searchInboxType := schema.NotificationInboxTypeAll
if searchType == schema.NotificationTypeInbox {
searchInboxType, ok = schema.NotificationInboxType[searchCond.InboxTypeStr]
if !ok {
return pager.NewPageModel(0, resp), nil
_, ok = schema.NotificationInboxType[searchCond.InboxTypeStr]
if ok {
searchInboxType = schema.NotificationInboxType[searchCond.InboxTypeStr]
}
}
searchCond.Type = searchType