79614b2d07
- Updated multiple repository and service files to replace imports from "github.com/mlogclub/simple/web/params" with "cs-agent/internal/pkg/httpx/params". - Adjusted context handling in auth_service and ws_service to use gin.Context instead of iris.Context. - Ensured consistent usage of HTTP status responses across websocket handlers.
30 lines
743 B
Go
30 lines
743 B
Go
package api
|
|
|
|
import (
|
|
"cs-agent/internal/pkg/openidentity"
|
|
"cs-agent/internal/services"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/mlogclub/simple/web"
|
|
)
|
|
|
|
type CustomerController struct {
|
|
Ctx *gin.Context
|
|
}
|
|
|
|
func (c *CustomerController) PostSession_exchange() *web.JsonResult {
|
|
channel := services.ChannelService.GetEnabledChannel(c.Ctx)
|
|
if channel == nil {
|
|
return web.JsonErrorMsg("接入渠道不存在或已停用")
|
|
}
|
|
externalUser, err := openidentity.GetExternalUser(c.Ctx, services.ChannelService.GetUserTokenSecret(channel))
|
|
if err != nil {
|
|
return web.JsonError(err)
|
|
}
|
|
resp, err := services.CustomerSessionService.Exchange(channel, *externalUser)
|
|
if err != nil {
|
|
return web.JsonError(err)
|
|
}
|
|
return web.JsonData(resp)
|
|
}
|