fix: scope coupons by tenant

This commit is contained in:
2026-01-09 16:23:42 +08:00
parent 4d90f547e6
commit ad9dc4615f
6 changed files with 81 additions and 18 deletions

View File

@@ -160,9 +160,12 @@ func (s *user) RealName(ctx context.Context, userID int64, form *user_dto.RealNa
}
// GetNotifications 获取通知
func (s *user) GetNotifications(ctx context.Context, userID int64, typeArg string) ([]user_dto.Notification, error) {
func (s *user) GetNotifications(ctx context.Context, tenantID, userID int64, typeArg string) ([]user_dto.Notification, error) {
tbl, query := models.NotificationQuery.QueryContext(ctx)
query = query.Where(tbl.UserID.Eq(userID))
if tenantID > 0 {
query = query.Where(tbl.TenantID.Eq(tenantID))
}
if typeArg != "" && typeArg != "all" {
query = query.Where(tbl.Type.Eq(typeArg))
}