作者 tangxuhui

调试更新

{"D:\\workspaceGo\\src\\allied-creation-basic\\pkg\\port\\beego":1629526811710336200}
\ No newline at end of file
{"D:\\workspaceGo\\src\\allied-creation-basic\\pkg\\port\\beego":1629527715980690100}
\ No newline at end of file
... ...
... ... @@ -7,15 +7,15 @@ import (
)
type ReadNoticeCommand struct {
UserId int `json:"userId" valid:"Required"` //读取谁的消息读
NoticeId int `json:"noticeId"` //消息id
ReadAll bool `json:"readAll"` //是否全部标记为已读
UserBaseId int `json:"userBaseId"` //读取谁的消息读
NoticeId int `json:"noticeId"` //消息id
ReadAll bool `json:"readAll"` //是否全部标记为已读
}
func (readNoticeCommand *ReadNoticeCommand) Valid(validation *validation.Validation) {
if !readNoticeCommand.ReadAll {
if readNoticeCommand.NoticeId <= 0 {
validation.AddError("消息id", "未填写")
if readNoticeCommand.UserBaseId <= 0 {
validation.AddError("userBaseId", "未填写")
}
}
}
... ...
... ... @@ -679,7 +679,7 @@ func (noticePersonalService *NoticePersonalService) ReadNotice(readNoticeCommand
} else {
noticePersonalDao = value
}
_, err = noticePersonalDao.ReadNoticePersonal(int64(readNoticeCommand.UserId),
_, err = noticePersonalDao.ReadNoticePersonal(int64(readNoticeCommand.UserBaseId),
readNoticeCommand.NoticeId, readNoticeCommand.ReadAll)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ...
... ... @@ -22,7 +22,7 @@ func NewNoticePersonalDao(transactionContext *pgTransaction.TransactionContext)
}
//
func (dao *NoticePersonalDao) ReadNoticePersonal(userId int64, noticeId int, readAll bool) (int, error) {
func (dao *NoticePersonalDao) ReadNoticePersonal(userBaseId int64, noticeId int, readAll bool) (int, error) {
tx := dao.transactionContext.PgTx
updateData := map[string]interface{}{
"is_read": domain.NoticePersonalIsRead,
... ... @@ -30,7 +30,7 @@ func (dao *NoticePersonalDao) ReadNoticePersonal(userId int64, noticeId int, rea
if readAll {
result, err := tx.Model(&updateData).
TableExpr("notice_personals").
Where("user_id=?", userId).
Where("user_base_id=?", userBaseId).
Where("is_read=?", domain.NoticePersonalIsNotRead).
Update()
if err != nil {
... ... @@ -41,7 +41,6 @@ func (dao *NoticePersonalDao) ReadNoticePersonal(userId int64, noticeId int, rea
result, err := tx.Model(&updateData).
TableExpr("notice_personals").
Where("notice_personal_id=?", noticeId).
Where("user_id=?", userId).
Update()
if err != nil {
return 0, err
... ...