feat: 同步知识库与工作台相关改动

This commit is contained in:
Jackzhou
2026-08-24 10:40:15 +08:00
parent 8d0588827d
commit 4f33b036d1
50 changed files with 8034 additions and 273 deletions
@@ -1,6 +1,8 @@
package api
import (
"strings"
"github.com/gin-gonic/gin"
"eaisalestrain/backend/internal/middleware"
@@ -28,6 +30,26 @@ func notifyAllEmployees(ntype, title, content, link string) {
}
}
func notifyAdmins(ntype, title, content, link string) {
var users []model.User
store.DB.Where("role = ? AND status = ?", "admin", "active").Select("id").Find(&users)
for _, u := range users {
notifyUser(u.ID, ntype, title, content, link)
}
}
func notifyUsersByOwner(owner, ntype, title, content, link string) {
owner = strings.TrimSpace(owner)
if owner == "" || owner == "待指派" {
return
}
var users []model.User
store.DB.Where("status = ? AND (full_name = ? OR username = ?)", "active", owner, owner).Select("id").Find(&users)
for _, u := range users {
notifyUser(u.ID, ntype, title, content, link)
}
}
// MyNotifications GET /api/notifications?unread_only=true —— 我的通知列表
func MyNotifications(c *gin.Context) {
u := middleware.CurrentUser(c)