正在显示
4 个修改的文件
包含
7 行增加
和
8 行删除
@@ -7,15 +7,15 @@ import ( | @@ -7,15 +7,15 @@ import ( | ||
7 | ) | 7 | ) |
8 | 8 | ||
9 | type ReadNoticeCommand struct { | 9 | type ReadNoticeCommand struct { |
10 | - UserId int `json:"userId" valid:"Required"` //读取谁的消息读 | 10 | + UserBaseId int `json:"userBaseId"` //读取谁的消息读 |
11 | NoticeId int `json:"noticeId"` //消息id | 11 | NoticeId int `json:"noticeId"` //消息id |
12 | ReadAll bool `json:"readAll"` //是否全部标记为已读 | 12 | ReadAll bool `json:"readAll"` //是否全部标记为已读 |
13 | } | 13 | } |
14 | 14 | ||
15 | func (readNoticeCommand *ReadNoticeCommand) Valid(validation *validation.Validation) { | 15 | func (readNoticeCommand *ReadNoticeCommand) Valid(validation *validation.Validation) { |
16 | if !readNoticeCommand.ReadAll { | 16 | if !readNoticeCommand.ReadAll { |
17 | - if readNoticeCommand.NoticeId <= 0 { | ||
18 | - validation.AddError("消息id", "未填写") | 17 | + if readNoticeCommand.UserBaseId <= 0 { |
18 | + validation.AddError("userBaseId", "未填写") | ||
19 | } | 19 | } |
20 | } | 20 | } |
21 | } | 21 | } |
@@ -679,7 +679,7 @@ func (noticePersonalService *NoticePersonalService) ReadNotice(readNoticeCommand | @@ -679,7 +679,7 @@ func (noticePersonalService *NoticePersonalService) ReadNotice(readNoticeCommand | ||
679 | } else { | 679 | } else { |
680 | noticePersonalDao = value | 680 | noticePersonalDao = value |
681 | } | 681 | } |
682 | - _, err = noticePersonalDao.ReadNoticePersonal(int64(readNoticeCommand.UserId), | 682 | + _, err = noticePersonalDao.ReadNoticePersonal(int64(readNoticeCommand.UserBaseId), |
683 | readNoticeCommand.NoticeId, readNoticeCommand.ReadAll) | 683 | readNoticeCommand.NoticeId, readNoticeCommand.ReadAll) |
684 | if err != nil { | 684 | if err != nil { |
685 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 685 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
@@ -22,7 +22,7 @@ func NewNoticePersonalDao(transactionContext *pgTransaction.TransactionContext) | @@ -22,7 +22,7 @@ func NewNoticePersonalDao(transactionContext *pgTransaction.TransactionContext) | ||
22 | } | 22 | } |
23 | 23 | ||
24 | // | 24 | // |
25 | -func (dao *NoticePersonalDao) ReadNoticePersonal(userId int64, noticeId int, readAll bool) (int, error) { | 25 | +func (dao *NoticePersonalDao) ReadNoticePersonal(userBaseId int64, noticeId int, readAll bool) (int, error) { |
26 | tx := dao.transactionContext.PgTx | 26 | tx := dao.transactionContext.PgTx |
27 | updateData := map[string]interface{}{ | 27 | updateData := map[string]interface{}{ |
28 | "is_read": domain.NoticePersonalIsRead, | 28 | "is_read": domain.NoticePersonalIsRead, |
@@ -30,7 +30,7 @@ func (dao *NoticePersonalDao) ReadNoticePersonal(userId int64, noticeId int, rea | @@ -30,7 +30,7 @@ func (dao *NoticePersonalDao) ReadNoticePersonal(userId int64, noticeId int, rea | ||
30 | if readAll { | 30 | if readAll { |
31 | result, err := tx.Model(&updateData). | 31 | result, err := tx.Model(&updateData). |
32 | TableExpr("notice_personals"). | 32 | TableExpr("notice_personals"). |
33 | - Where("user_id=?", userId). | 33 | + Where("user_base_id=?", userBaseId). |
34 | Where("is_read=?", domain.NoticePersonalIsNotRead). | 34 | Where("is_read=?", domain.NoticePersonalIsNotRead). |
35 | Update() | 35 | Update() |
36 | if err != nil { | 36 | if err != nil { |
@@ -41,7 +41,6 @@ func (dao *NoticePersonalDao) ReadNoticePersonal(userId int64, noticeId int, rea | @@ -41,7 +41,6 @@ func (dao *NoticePersonalDao) ReadNoticePersonal(userId int64, noticeId int, rea | ||
41 | result, err := tx.Model(&updateData). | 41 | result, err := tx.Model(&updateData). |
42 | TableExpr("notice_personals"). | 42 | TableExpr("notice_personals"). |
43 | Where("notice_personal_id=?", noticeId). | 43 | Where("notice_personal_id=?", noticeId). |
44 | - Where("user_id=?", userId). | ||
45 | Update() | 44 | Update() |
46 | if err != nil { | 45 | if err != nil { |
47 | return 0, err | 46 | return 0, err |
-
请 注册 或 登录 后发表评论