|
|
@@ -80,7 +80,8 @@ class NotificationModel
|
|
|
*/
|
|
|
public function getUserNotifications(int $userId, array $params = [], int $page = 1, int $limit = 10)
|
|
|
{
|
|
|
- $query = NotificationEntity::where(function ($query) use ($userId) {
|
|
|
+ $query = MessageNotificationsModel::with(['template'])
|
|
|
+ ->where(function ($query) use ($userId) {
|
|
|
$query->where('user_id', $userId)
|
|
|
->whereOr('user_id', 0); // 包括全局通知
|
|
|
});
|
|
|
@@ -105,7 +106,7 @@ class NotificationModel
|
|
|
->toArray();
|
|
|
|
|
|
// 获取未读数量
|
|
|
- $unreadCount = NotificationEntity::where(function ($query) use ($userId) {
|
|
|
+ $unreadCount = MessageNotificationsModel::where(function ($query) use ($userId) {
|
|
|
$query->where('user_id', $userId)
|
|
|
->whereOr('user_id', 0);
|
|
|
})->where('is_read', 0)->count();
|