Files
ai-agent/internal/handlers/api/customer_handler.go
T
mlogclub c6c1c00141 feat: add dashboard handlers for roles, sessions, skill definitions, tags, tickets, users, and WeChat integration
- Implement role management endpoints including listing, creating, updating, and deleting roles.
- Add session management endpoints for viewing and revoking sessions.
- Create skill definition management endpoints for CRUD operations and status updates.
- Introduce tag management endpoints for handling tags with sorting and status updates.
- Develop ticket management endpoints for viewing, creating, updating, and managing ticket progress.
- Implement user management endpoints for CRUD operations, role assignments, and password resets.
- Add WeChat callback handlers for verifying and processing messages.
2026-05-23 22:30:30 +08:00

30 lines
743 B
Go

package api
import (
"cs-agent/internal/pkg/httpx"
"cs-agent/internal/pkg/openidentity"
"cs-agent/internal/services"
"github.com/gin-gonic/gin"
"github.com/mlogclub/simple/web"
)
func CustomerPostSession_exchange(ctx *gin.Context) {
channel := services.ChannelService.GetEnabledChannel(ctx)
if channel == nil {
httpx.WriteJSON(ctx, web.JsonErrorMsg("接入渠道不存在或已停用"))
return
}
externalUser, err := openidentity.GetExternalUser(ctx, services.ChannelService.GetUserTokenSecret(channel))
if err != nil {
httpx.WriteJSON(ctx, err)
return
}
resp, err := services.CustomerSessionService.Exchange(channel, *externalUser)
if err != nil {
httpx.WriteJSON(ctx, err)
return
}
httpx.WriteJSON(ctx, resp)
}