优化客服云权限安全与访客IP解析

This commit is contained in:
yml2213
2026-08-31 13:43:45 +08:00
parent 523a306d5e
commit bdf67395ab
24 changed files with 365 additions and 48 deletions
+2 -2
View File
@@ -21,7 +21,7 @@ func (h *CustomerHandler) Export(c *gin.Context) {
source := c.Query("source")
query := model.DB.Where("tenant_id = ?", tenantID)
if !middleware.CanAccessAllData(c, "chat_history") {
if !middleware.CanAccessAllData(c, "customer") {
assignedCustomers := model.DB.Model(&model.Session{}).
Select("customer_id").
Where("tenant_id = ? AND agent_id = ?", tenantID, middleware.GetUserID(c))
@@ -76,7 +76,7 @@ func (h *SessionHandler) Export(c *gin.Context) {
to := c.Query("to")
query := model.DB.Model(&model.Session{}).Where("sessions.tenant_id = ?", tenantID)
if !middleware.CanAccessAllData(c, "customer") {
if !middleware.CanAccessAllData(c, "chat_history") {
query = query.Where("sessions.agent_id = ? OR sessions.status = ?", middleware.GetUserID(c), "waiting")
}
if status != "" {