feat: 同步知识库与工作台相关改动
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user