fix(notice): 个人域软删过滤改用 withJoin 关系别名

This commit is contained in:
augushong
2026-10-12 15:37:10 +00:00
parent 77e75fcc0b
commit 588a99a354

View File

@@ -61,15 +61,15 @@ class NoticeBase extends AdminController
->withJoin('notice', 'LEFT')
->where('system_notice_target.admin_id', $adminId)
->where('system_notice_target.channel', NoticeService::CHANNEL_INMAIL)
// 软删通知不进个人域(管理页删除后此处消失)
->where('system_notice.delete_time', 0)
// 软删通知不进个人域(管理页删除后此处消失);别名 notice 为 withJoin 的关系名
->where('notice.delete_time', 0)
->where($where)
->count();
$list = $this->model
->withJoin('notice', 'LEFT')
->where('system_notice_target.admin_id', $adminId)
->where('system_notice_target.channel', NoticeService::CHANNEL_INMAIL)
->where('system_notice.delete_time', 0)
->where('notice.delete_time', 0)
->where($where)
->page($page, $limit)
->order($this->sort)
@@ -99,7 +99,7 @@ class NoticeBase extends AdminController
->where('system_notice_target.id', (int) $id)
->where('system_notice_target.admin_id', $adminId)
// 软删通知不进个人域(管理页删除后详情不可打开)
->where('system_notice.delete_time', 0)
->where('notice.delete_time', 0)
->find();
if (empty($row)) {
$this->error('消息不存在或无权查看');