kefu/router/api.go

641 lines
27 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package router
import (
"github.com/gin-gonic/gin"
"kefu/controller"
controllerAi "kefu/controller/ai"
controllerAiproxy "kefu/controller/aiProxy"
controllerV2 "kefu/controller/v2"
"kefu/middleware"
"kefu/tmpl"
"kefu/ws"
)
func InitApiRouter(engine *gin.Engine) {
//用户身份接口
ucv1 := engine.Group("/uc/v1", middleware.Ipblack, middleware.SetLanguage)
{
//刷新token
ucv1.POST("/refreshToken", controllerV2.PostRefreshTokenV1)
//刷新token
ucv1.POST("/loginCheck", controller.LoginCheckPass)
//访客登录
ucv1.POST("/visitorLogin", middleware.Ipblack, controller.PostVisitorLogin)
}
uc := engine.Group("/uc/v2", middleware.Ipblack, middleware.SetLanguage)
{
//注册
uc.POST("/register", controllerV2.PostUcRegister)
//登录
uc.POST("/loginCheck", controllerV2.PostUcLogin)
//刷新token
uc.POST("/refreshToken", controllerV2.PostRefreshToken)
//解析token
uc.POST("/parseToken", controllerV2.PostParseToken)
//登录
uc.POST("/emailCode", controllerV2.PostEmailCode)
//获取ip地址
uc.GET("/ipAuth", controllerV2.GetIpAuth)
//注册客服
uc.POST("/registerStaff", controller.PostKefuRegister2)
}
//客服接口
kefuV2 := engine.Group("/kefu/v2", middleware.Ipblack, middleware.SetLanguage, middleware.JwtApiV2Middleware)
{
//解析jwt
kefuV2.GET("/parseJwt", controllerV2.GetJwt)
kefuV2.GET("/visitorExt", controller.GetVisitorExt)
}
//访客接口
visitorV2 := engine.Group("/visitor/v2", middleware.Ipblack, middleware.SetLanguage)
{
visitorV2.POST("/login", controllerV2.PostVisitorLogin)
}
//路由分组
v2 := engine.Group("/2", middleware.SetLanguage)
{
//获取企业信息
v2.POST("/entInfo", controller.PostEntInfo)
//分页获取数据
v2.GET("/notices", controller.GetNotice)
//获取消息
v2.GET("/messages", controller.GetMessagesV2)
v2.GET("/messages_unread", controller.GetMessagesVisitorUnread)
v2.POST("/messages_read", controller.PostMessagesVisitorRead)
//同步信息
v2.POST("/syncMessage", middleware.Ipblack, controller.SendSyncMessage)
//发送单条信息
v2.POST("/message", middleware.Ipblack, controller.SendMessageV2)
//查询机器人信息
v2.POST("/robotMessage", middleware.Ipblack, controller.SendRobotMessage)
//微信机器人接口
v2.POST("/wechatRobotMessage", middleware.Ipblack, controller.PostWechatRobotMessage)
//分页获取数据
v2.GET("/messages_page", controller.GetVisitorListMessagesPage)
v2.POST("/message_ask", controller.PostMessagesAsk)
//好评
v2.POST("/comment", controller.PostVisitorComment)
//上传音频
v2.POST("/uploadAudio", middleware.Ipblack, controller.UploadAudioV2)
//搜索问题
v2.GET("/searchQuestion", controller.GetSearchQuestion)
//开放修改属性接口
v2.POST("/visitorAttrs", controller.PostVisitorAttrs)
//获取邮箱验证码
v2.POST("/emailAuthCode", controller.SendEmailAuthCode)
//修改visitor_id
v2.POST("/changeVisitorId", controller.PostChangeVisitorId)
//绑定官网账户
v2.POST("/bindOfficial", controllerV2.PostBindOfficial)
//官网绑定操作
v2.POST("/officialBindIp", controllerV2.PostOfficialBindIp)
//验证是否绑定
//获取ip地址
v2.GET("/isBindOfficial", controllerV2.GetIsBindOfficial)
//发送微信模板消息
v2.POST("/wechatTemplate", controller.PostSendWechatTemplate)
//传递公众号openid发送微信模板消息
v2.POST("/wechatTemplateByOpenid", controller.PostSendWechatTemplateByOpenid)
//小程序同步昵称头像手机
v2.POST("/customerInfo", controller.PostCustomerInfo)
//获取企业信息
v2.GET("/getCustomerInfo", controller.GetCustomerInfo)
//获取营销会员信息
v2.GET("/getKefuCustomerByTel", controller.GetKefuCustomerByTel)
//删除营销会员信息
v2.GET("/delKefuCustomerByTel", controller.DeleteKefuCustomerByTel)
//上传附件
v2.POST("/uploadFile", middleware.Ipblack, controller.UploadFileV2)
//打电话
v2.POST("/callKefu", controller.PostCallKefuV2)
//查快递
v2.GET("/express", controller.GetExpress)
//验证码接口
v2.GET("/captcha", controller.GetCaptchaV2)
//登录接口
v2.POST("/check", controller.PostLoginCheckV2)
//访客登录
v2.POST("/visitorLogin", controller.PostVisitorLogin)
//热门问题
v2.GET("/getTopQuestion", controller.GetTopQuestion)
//客服注册
v2.POST("/register", middleware.KefuIpblack, controller.PostKefuRegister)
//获取配置信息
v2.POST("/openConfigs", controller.GetOpenConfigs)
//chatGPT测试
//v2.GET("/chatGPT", controller.GetChatGPT)
//抖音登录
v2.POST("/douyinLogin", controller.PostDouyinLogin)
v2.GET("/douyinLogin", tmpl.PageDouyinLogin)
//提交询前表单
v2.POST("/postPreVisitorForm", controller.PostPreVisitorForm)
//微信扫码登录
v2.POST("/wechatLoginQrcode", controller.PostWechatLogin)
//查询微信扫码登录
v2.POST("/checkWechatLoginStatus", controller.PostCheckWechatLoginStatus)
//虚拟产品
v2.GET("/virtualProduct/:entId/:kefuName", middleware.KefuAccountCheck, controller.GetVirtualProduct)
//jsapi下单
v2.POST("/jsApiPay", controller.PostJsApiCreateOrder)
v2.POST("/jsApiPayNotifyUrl", controller.PostjsApiPayNotifyUrl)
//南星支付下单
v2.POST("/yiApiPay", controller.PostYiApiPay)
//易支付回调
v2.GET("/:entId/yiApiPayNotifyUrl", controller.GetYiApiPayNotifyUrl)
//查询订单
v2.GET("/productOrders", middleware.Ipblack, controller.GetUserProductOrder)
//轮询订单
v2.POST("/orderStatus", middleware.Ipblack, controller.PostQueryOrder)
//轮询订单
v2.POST("/resetPassword", middleware.KefuIpblack, controller.PostResetPassword)
}
//企业路由分组
entGroup := engine.Group("/ent")
{
entGroup.POST("/email_message", controller.SendEntEmail)
entGroup.GET("/article_cate", middleware.JwtApiMiddleware, controller.GetArticleCates)
entGroup.GET("/article_list", middleware.JwtApiMiddleware, controller.GetArticleList)
}
//客服路由分组
kefuGroup := engine.Group("/kefu")
kefuGroup.Use(middleware.JwtApiMiddleware, middleware.KefuIpblack, middleware.SetLanguage)
{
//获取客服信息
kefuGroup.GET("/kefuinfo", controller.GetKefuInfo)
//解析jwt
kefuGroup.GET("/parseJwt", controllerV2.GetJwtV1)
//app注册
kefuGroup.POST("/appClient", controllerV2.PostAppKefuClient)
kefuGroup.GET("/visitor", controller.GetVisitor)
kefuGroup.GET("/visitor_attr", controller.GetVisitorAttr)
kefuGroup.POST("/visitor_attrs", controller.PostVisitorAttrs)
kefuGroup.POST("/message", controller.SendKefuMessage)
//关闭连接
kefuGroup.GET("/message_close", controller.SendCloseMessageV2)
kefuGroup.GET("/visitor/messages", controller.GetVisitorMessageByKefu)
//分页获取数据
kefuGroup.GET("/messages_page", controller.GetVisitorListMessagesPageBykefu)
kefuGroup.POST("/message_delete", controller.DeleteMessage)
kefuGroup.POST("/messages_read", controller.PostMessagesKefuRead)
kefuGroup.GET("/visitorExt", controller.GetVisitorExt)
kefuGroup.GET("/onlineVisitors", controller.GetKefusVisitorOnlines)
//统计信息
kefuGroup.GET("/statistics", controller.GetStatistics)
//图表统计信息
kefuGroup.GET("/chartStatistics", controllerV2.GetChartStatistic)
//更新在线状态
kefuGroup.GET("/updateOnlineStatus", controller.GetUpdateOnlineStatus)
//给访客打tag
kefuGroup.POST("/visitorTag", controller.PostVisitorTag)
//获取tag
kefuGroup.GET("/tags", controller.GetTags)
//获取访客tags
kefuGroup.GET("/visitorAllTag", controller.GetVisitorAllTags)
//获取访客tags
kefuGroup.GET("/visitorTag", controller.GetVisitorTags)
//删除访客tags
kefuGroup.GET("/delVisitorTag", controller.DelVisitorTag)
//删除tag
kefuGroup.GET("/delThisTag", controller.DeThisTag)
//增加文章分类
kefuGroup.POST("/addArticleCate", middleware.JwtEntMiddleware, controller.PostArticleCate)
//增加文章
kefuGroup.POST("/addArticle", controller.PostArticle)
//删除文章
kefuGroup.GET("/delArticle", controller.DelArticle)
//删除文章分类
kefuGroup.GET("/delArticleCate", middleware.JwtEntMiddleware, controller.DelArticleCate)
//搜索访客列表
kefuGroup.GET("/visitorList", controller.GetVisitorsList)
//获取客服用户
kefuGroup.GET("/kefuUsers", controller.GetKefuListOwn)
//获取二维码
kefuGroup.GET("/qrcode", controller.GetQrcode)
//删除访客
kefuGroup.DELETE("/delVisitor", middleware.JwtEntMiddleware, controller.DelVisitor)
//自动欢迎列表
kefuGroup.GET("/notices", controller.GetNotices)
//添加欢迎
kefuGroup.POST("/notice", controller.PostNotice)
//删除欢迎
kefuGroup.DELETE("/notice", controller.DelNotice)
//更新欢迎
kefuGroup.POST("/updateNotice", controller.PostNoticeSave)
//配置企业
kefuGroup.POST("/entConfigs", middleware.RbacAuth, controller.PostEntConfigs)
//子账号列表
kefuGroup.GET("/kefuList", middleware.RbacAuth, controller.GetKefuListOwn)
//编辑账号
kefuGroup.POST("/kefuInfo", middleware.RbacAuth, controller.PostKefuInfo)
//删除账号
kefuGroup.DELETE("/kefuInfo", middleware.RbacAuth, controller.DeleteKefuInfoOwn)
//切换状态
kefuGroup.POST("/kefuStatus", middleware.RbacAuth, controller.PostKefuInfoStatus)
//查看别的客服
kefuGroup.GET("/kefuSetting", middleware.RbacAuth, controller.GetKefuInfoSettingOwn)
//生成微信菜单
kefuGroup.POST("/wechatMenu", middleware.RbacAuth, controller.PostWechatMenu)
//生成微信菜单
kefuGroup.GET("/mkWechatMenu", middleware.RbacAuth, controller.GetWechatMenu)
//删除微信菜单
kefuGroup.GET("/delWechatMenu", middleware.RbacAuth, controller.GetDelWechatMenu)
//上传微信认证文件
kefuGroup.POST("/uploadWechatAuthFile", controller.PostUploadWechatFile)
//拉黑IP
kefuGroup.POST("/ipblack", controller.PostIpblack)
//IP黑名单列表
kefuGroup.GET("/ipblacks", controller.GetIpblacksByKefuId)
//删除IP
kefuGroup.DELETE("/ipblack", controller.DelIpblack)
//删除访客聊天记录
kefuGroup.GET("/delVisitorMessage", middleware.JwtEntMiddleware, controller.DeleteVisitorMessage)
//添加访客黑名单
kefuGroup.POST("/visitorBlack", controller.PostVisitorBlack)
//访客黑名单
kefuGroup.GET("/visitorBlacks", controller.GeVisitorBlacks)
//删除访客黑名单
kefuGroup.GET("/delVisitorBlack", controller.DelVisitorBlack)
//获取角色
kefuGroup.GET("/roleList", controller.GetRoleListOwn)
//修改过期时间
kefuGroup.POST("/kefuExpiredTime", controller.PostKefuExpiredTime)
//发送评价
kefuGroup.GET("/sendComment", controller.GetSendComment)
//评价列表
kefuGroup.GET("/commentStatistics", controller.GetCommentStatistics)
//评价列表
kefuGroup.GET("/logs", controller.GetLogList)
//上传头像
kefuGroup.POST("/uploadAvator", controller.UploadAvator)
//生成动态二维码链接
kefuGroup.POST("/mkDynicQrcode", controller.PostDynicQrcode)
//编辑器上传图片
kefuGroup.POST("/editorUploadImg", controller.UploadEditorImg)
//自动问答
kefuGroup.GET("/articleCateTop", middleware.JwtEntMiddleware, controller.SetArticleCateTop)
//导出访客聊天记录
kefuGroup.GET("/exportVisitorMessage", controller.GetExportVisitorMessage)
//订单列表
kefuGroup.GET("/orders", controller.GetOrders)
//产品订单列表
kefuGroup.GET("/productOrders", controller.GetProductOrderList)
//发送短信
kefuGroup.GET("/sendSms", controller.SendSmsCode)
//绑定手机
kefuGroup.POST("/bindTel", controller.PostKefuBindTel)
//获取单条企业配置信息
kefuGroup.GET("/entConfig", controller.GetEntConfig)
//获取企业配置信息
kefuGroup.GET("/ent_configs", controller.GetEntConfigs)
//访客来源
kefuGroup.GET("/visitorExtList", controller.GetVisitorExtList)
//访客评价
kefuGroup.GET("/rateList", controller.GetRateList)
//已绑定的微信openid
kefuGroup.GET("/wechatOpenidList", controller.GetWechatOpenidList)
//删除已绑定的微信openid
kefuGroup.GET("/delWechatOpenid", controller.GetDelWechatOpenid)
//营销会员列表
kefuGroup.GET("/customerList", controller.GetCustomersList)
//删除营销会员
kefuGroup.GET("/deleteCustomer", controller.DeleteCustomer)
//更新资料
kefuGroup.POST("/modifyUser", controller.PostUpdateUser)
//上下线
kefuGroup.GET("/upDownLine", controller.GetUpdownLine)
//上下线列表
kefuGroup.GET("/upDownLineList", controller.GetUpDownLineList)
//打电话
kefuGroup.POST("/callVisitor", controller.PostCallVisitorV2)
//上传文件
kefuGroup.POST("/uploadimg", controller.UploadImg)
//上传文件
kefuGroup.POST("/uploadFile", controller.UploadFileV2)
//其他客服
kefuGroup.GET("/otherKefulist", controller.GetOtherKefuList)
//转接
kefuGroup.GET("/transKefu", controller.PostTransKefu)
//监控访客列表
kefuGroup.GET("/monitorList", controller.GetMonitorList)
//发送给监控访客消息
kefuGroup.POST("/monitorMessage", controller.PostMonitorMessage)
//设置机器人信息
kefuGroup.POST("/setRobotInfo", controller.PostSetRobotInfo)
//机器人信息
kefuGroup.GET("/robotInfo", controller.GetRobotInfo)
//一键已读
kefuGroup.GET("/clearUnreadNum", controller.GetClearUnread)
//设置顾客信息
kefuGroup.POST("/setConsumers", controller.PostSetConsumer)
//顾客信息
kefuGroup.GET("/consumers", controller.GetConsumersList)
//删除顾客信息
kefuGroup.GET("/delConsumers", controller.DeleteConsumer)
//学习库列表
kefuGroup.GET("/learns", controller.GetLearnsList)
//学习库状态
kefuGroup.POST("/learnStatus", controller.PostLearnStatus)
//获取企业微信客服列表
kefuGroup.GET("/kefuWeworkList", controller.GetKefuWeworkList)
//获取企业微信客服链接
kefuGroup.GET("/kefuWeworkLink", controller.GetKefuWeworkLink)
//快捷回复搜索
kefuGroup.POST("/replySearch", controller.PostReplySearch)
//企业公用快捷回复
kefuGroup.GET("/entReplys", controller.GetEntReplys)
//添加快捷分组
kefuGroup.POST("/replyGroup", controller.PostReply)
//上传集合
kefuGroup.POST("/collectUpload", controller.PostUploadCollect)
//切换访客状态位
kefuGroup.POST("/visitorState", controller.PostVisitorState)
//AI辅助
kefuGroup.GET("/aiKnowledge", controller.GetKefuAiKnowledge)
//AI消费意图分析
kefuGroup.GET("/aiIntent", controllerAi.PostAiIntent)
kefuGroup.POST("/chatStream", controllerAi.PostChatStream)
kefuGroup.POST("/saveChatStream", controllerAi.PostSaveChatStream)
kefuGroup.GET("/chatCollects", controllerAi.GetChatCollects)
kefuGroup.GET("/cleanChatCollects", controllerAi.GetCleanChatCollects)
kefuGroup.GET("/chatSessions", controllerAi.GetChatSessions)
//AI训练
kefuAiGroup := kefuGroup.Group("/ai").Use(middleware.GetCollectByKefuName)
{
kefuAiGroup.GET("/fileList", controllerAi.GETFileList)
kefuAiGroup.POST("/training", controllerAi.PostTraning)
kefuAiGroup.GET("/delFile", controllerAi.GetDelFile)
kefuAiGroup.GET("/filePoints", controllerAi.GetFilePoints)
kefuAiGroup.GET("/delPoints", controllerAi.GetDelPoints)
kefuAiGroup.POST("/uploadDoc", controllerAi.PostUploadDoc)
kefuAiGroup.POST("/uploadUrl", controllerAi.PostUploadUrl)
kefuAiGroup.POST("/searchPoints", controllerAi.PostSearchPoints)
}
//在线支付
kefuGroup.POST("/createOrder", controller.PostCreateOrder)
//在线支付查询订单
kefuGroup.POST("/queryOrder", controller.PostQueryOrder)
//微信支付查询订单
kefuGroup.POST("/queryWechatOrder", controller.PostQueryWechatOrder)
//独立部署页面
kefuGroup.GET("/downloadDeploy", controller.GetDownloadDeloy)
//修改密码
kefuGroup.POST("/modifypass", controller.PostKefuPass)
//抖音绑定
kefuGroup.Any("/douyin", controller.PostDouyinBind)
//抖音绑定列表
kefuGroup.Any("/douyinList", controller.GetDouyinList)
//设置工作时间
kefuGroup.POST("/postWorkTime", controller.PostWorkTime)
//删除抖音绑定列表
kefuGroup.GET("/deleteDouyin", controller.GetDeleteDouyinList)
//翻译
kefuGroup.GET("/translate", controller.GetKefuTranslate)
//虚拟产品
kefuGroup.GET("/viewVirtualProduct", controller.GetVirtualProductLink)
//虚拟产品
kefuGroup.GET("/virtualProducts", controller.GetVirtualProducts)
//虚拟产品
kefuGroup.POST("/virtualProduct", controller.PostVirtualProduct)
//删除虚拟产品
kefuGroup.GET("/deleteVirtualProduct", controller.DeleteVirtualProduct)
//LLM日志
kefuGroup.GET("/llmLogs", controller.GetLlmLogList)
}
//OpenAI兼容接口
engine.POST("/v1/chat/completions", controller.PostV1ChatCompletions)
//客服路由分组
adminGroup := engine.Group("/admin")
adminGroup.Use(middleware.JwtApiMiddleware, middleware.JwtAdminMiddleware)
{
//充值
adminGroup.POST("/userCharge", controller.PostAdminUserCharge)
adminGroup.POST("/config", controller.PostConfig)
adminGroup.GET("/configs", controller.GetConfigs)
//生成系统永久二维码
//获取永久带参二维码
adminGroup.POST("/userMarketingQrcode", controller.PostUserMarketingQrcode)
}
//聊天室路由分组
//room := engine.Group("/room")
//{
// room.POST("/login", middleware.Ipblack, controller.PostRoomLogin)
// room.POST("/message", middleware.Ipblack, controller.PostRoomMessage)
//}
engine.GET("/captcha", controller.GetCaptcha)
engine.POST("/check", middleware.KefuIpblack, controller.LoginCheckPass)
engine.POST("/check_auth", middleware.JwtApiMiddleware, controller.MainCheckAuth)
engine.GET("/userinfo", middleware.JwtApiMiddleware, controller.GetKefuInfoAll)
//engine.POST("/register", middleware.KefuIpblack, controller.PostKefuRegister)
//engine.POST("/install", controller.PostInstall)
//前后聊天
engine.GET("/ws_kefu", middleware.JwtApiMiddleware, ws.NewKefuServer)
engine.GET("/ws_visitor", middleware.Ipblack, ws.NewVisitorServer)
//网站监控
engine.GET("/ws_monitor", middleware.Ipblack, ws.NewMonitorServer)
//websocket路由分组
//wsGroup := engine.Group("/ws")
//{
// wsGroup.GET("/v2/visitor", middleware.Ipblack, wsV2.VisitorWebsocketServer)
//}
engine.GET("/message_notice", controller.SendVisitorNotice)
//发送单条消息
//上传文件
engine.POST("/uploadimg", middleware.Ipblack, controller.UploadImg)
//上传文件
engine.POST("/uploadfile", middleware.Ipblack, controller.UploadFile)
//上传文件
engine.POST("/uploadaudio", middleware.Ipblack, controller.UploadAudio)
engine.POST("/call_kefu", controller.PostCallKefu)
//获取客服信息
engine.POST("/kefuinfo_peerid", middleware.JwtApiMiddleware, controller.PostKefuPeerId)
engine.GET("/kefuinfo", middleware.JwtApiMiddleware, middleware.RbacAuth, controller.GetKefuInfo)
engine.GET("/kefuinfo_setting", middleware.JwtApiMiddleware, middleware.RbacAuth, controller.GetKefuInfoSetting)
engine.POST("/kefuinfo", middleware.JwtApiMiddleware, middleware.RbacAuth, controller.PostKefuInfo)
engine.GET("/kefulist", middleware.JwtApiMiddleware, middleware.RbacAuth, controller.GetKefuList)
engine.GET("/kefulist_own", middleware.JwtApiMiddleware, middleware.RbacAuth, controller.GetKefuListOwn)
engine.GET("/kefulist_message", middleware.JwtApiMiddleware, middleware.RbacAuth, controller.GetKefuListMessages)
engine.GET("/visitorlist_message", middleware.JwtApiMiddleware, middleware.RbacAuth, controller.GetVisitorListMessages)
engine.GET("/other_kefulist", middleware.JwtApiMiddleware, controller.GetOtherKefuList)
engine.GET("/trans_kefu", middleware.JwtApiMiddleware, controller.PostTransKefu)
engine.POST("/modifyavator", middleware.JwtApiMiddleware, controller.PostKefuAvator)
//角色列表
engine.GET("/roles", middleware.JwtApiMiddleware, middleware.RbacAuth, controller.GetRoleList)
engine.POST("/role", middleware.JwtApiMiddleware, middleware.RbacAuth, controller.PostRole)
engine.GET("/visitors_online", controller.GetVisitorOnlines)
engine.GET("/visitors_kefu_online", middleware.JwtApiMiddleware, controller.GetKefusVisitorOnlines)
engine.GET("/clear_online_tcp", controller.DeleteOnlineTcp)
engine.POST("/visitor_login", controller.PostVisitorLogin)
engine.GET("/visitor_ext", middleware.JwtApiMiddleware, controller.GetVisitorExt)
//engine.POST("/visitor", controller.PostVisitor)
engine.GET("/visitor", middleware.JwtApiMiddleware, controller.GetVisitor)
engine.GET("/visitors", middleware.JwtApiMiddleware, controller.GetVisitors)
engine.GET("/statistics", middleware.JwtApiMiddleware, controller.GetStatistics)
//前台接口
engine.GET("/notice", middleware.SetLanguage, controller.GetNotice)
//engine.GET("/ipblacks_all", middleware.JwtApiMiddleware, controller.GetIpblacks)
//engine.GET("/configs", middleware.JwtApiMiddleware, middleware.RbacAuth, controller.GetConfigs)
//engine.GET("/ent_configs", middleware.JwtApiMiddleware, controller.GetEntConfigs)
engine.POST("/config", middleware.JwtApiMiddleware, middleware.RbacAuth, controller.PostConfig)
engine.GET("/config", controller.GetConfig)
engine.GET("/autoreply", controller.GetAutoReplys)
engine.GET("/replys", middleware.JwtApiMiddleware, controller.GetReplys)
//engine.POST("/reply", middleware.JwtApiMiddleware, controller.PostReply)
engine.GET("/dede", controller.GetDede)
engine.GET("/dedeInfo", controller.GetDedeInfo)
engine.POST("/reply_content", middleware.JwtApiMiddleware, controller.PostReplyContent)
engine.POST("/reply_content_save", middleware.JwtApiMiddleware, controller.PostReplyContentSave)
engine.DELETE("/reply_content", middleware.JwtApiMiddleware, controller.DelReplyContent)
engine.DELETE("/reply", middleware.JwtApiMiddleware, controller.DelReplyGroup)
//engine.POST("/reply_search", middleware.JwtApiMiddleware, controller.PostReplySearch)
engine.GET("/translate", controller.GetTranslate)
//微信
wechat := engine.Group("/wechat")
{
wechat.GET("/checkSignature", controller.GetCheckWeixinSign)
//获取临时带参二维码
wechat.GET("/showQrcode", controller.GetShowQrCode)
//获取永久带参二维码
wechat.GET("/limitQrcode", controller.GetLimitQrcode)
wechat.GET("/visitorQrcode", controller.GetVisitorQrCode)
wechat.Any("/server/:entId/:kefuName", controller.PostWechatServer)
//查询微信绑定表
wechat.GET("/oauth", controller.GetWechatOauth)
//获取小程序用户信息
wechat.GET("/miniUserInfo", controller.GetMiniUserInfo)
//获取小程序手机号
wechat.GET("/miniUserTel", controller.GetMiniUserTel)
//获取微信客服列表
wechat.GET("/workAccountList", controller.GetWorkAccountList)
//发送应用消息
wechat.GET("/sendWorkAppMsg", controller.SendWorkAppMsg)
//接收应用消息
wechat.Any("/receiveWorkAppMsg/:entId", controller.ReceiveWorkAppMsg)
//接收小程序消息推送
wechat.Any("/miniMessage/:entId", controller.GetMiniMessage)
//微信客服的回调配置
//wechat.GET("/wechatKefuCallback/:entId", controller.GetWechatKefuCheckSign)
//企业微信客服消息回调
//wechat.POST("/wechatKefuCallback/:entId", kefuWework.TalkWeixin)
//企业微信客服消息回调v2
wechat.POST("/wechatKefuCallback/:entId", controller.PostEntWechatCallback)
wechat.GET("/wechatKefuCallback/:entId", controller.GetWechatKefuCheckSign)
wechat.POST("/entWechatRobot/:robotCode/:entId/:kefuName", controller.PostEntWechatRobot)
}
//钉钉事件
ding := engine.Group("/ding")
{
ding.Any("/robotMessage/:entId", middleware.CheckKefuExpireByEntid, controller.PostDingRobotMessage)
}
//抖音事件
douyin := engine.Group("/douyin")
{
douyin.Any("/webhooks", controller.PostDouyinWebhooks)
//抖音回调
douyin.Any("/callback", tmpl.PageDouyin)
}
//对外接口
aiProxy := engine.Group("/api/v1/:entId/:kefuName", middleware.KefuAccountCheck, middleware.Ipblack)
{
//机器人消息接口
aiProxy.POST("/robot/chat", controller.PostApiRobotMessage)
//百度文心千帆
aiProxy.Any("/ernieBotTurbo/chat/completions", controllerAiproxy.PostErnieBotTurbocompletions)
aiProxy.Any("/ernieBotTurbo/embeddings", controllerAiproxy.PostErnieBotTurboEmbeddings)
//企业微信应用回调URL
aiProxy.Any("/wework/receiveWorkAppMsg", controller.ReceiveWorkAppMsg)
//企业微信客服消息回调
aiProxy.POST("/wechat/wechatKefuCallback", controller.PostEntWechatCallback)
aiProxy.GET("/wechat/wechatKefuCallback", controller.GetWechatKefuCheckSign)
}
//对外接口
api2 := engine.Group("/api/v2", middleware.Ipblack)
{
//微信支付回调
api2.POST("/wechat_pay/notify", controller.PostWechatPayNotifyUrl)
//生成二维码
api2.GET("/qrcode", controller.GetQrcode)
//获取微信OpenID
api2.GET("/wechatOpenid", controller.GetWechatOpenid)
}
//系统相关
systemGroup := engine.Group("/system")
systemGroup.Use(middleware.JwtApiMiddleware, middleware.AdminAuth)
{
systemGroup.GET("/stop", controller.GetStop)
systemGroup.POST("/saveNews", controller.PostNews)
systemGroup.GET("/delNews", controller.DelNews)
//拉黑IP
systemGroup.POST("/ipblacks", controller.PostSystemIpblack)
//清理内存
systemGroup.GET("/clean", controller.GetClean)
systemGroup.GET("/ipblacks", controller.GetIpblacks)
//分类列表
systemGroup.GET("/cmsCate", controller.GetCmsCate)
//删除分类
systemGroup.GET("/delCmsCate", controller.DelCmsCate)
//增加或编辑分类
systemGroup.POST("/cmsCate", controller.PostCmsCate)
//CMS内容列表
systemGroup.GET("/cmsNews", controller.GetCmsNews)
//增加或编辑CMS内容
systemGroup.POST("/cmsNews", controller.PostCmsNews)
//删除CMS内容
systemGroup.GET("/delCmsNews", controller.DelCmsNews)
//集合列表
systemGroup.GET("/collects", controller.GetCollects)
//增加向量集合
systemGroup.POST("/collect", controller.PostQdrantCollect)
//删除集合
systemGroup.GET("/delCollect", controller.GetDelCollect)
//上传文档
systemGroup.POST("/collectUpload", controller.PostUploadCollect)
//管理员充值
systemGroup.POST("/userCharge", controller.PostAdminUserCharge)
//客服接待上限
systemGroup.POST("/entConfigs", controller.PostEntConfigsByAdmin)
}
//其他接口
otherGroup := engine.Group("/other")
{
otherGroup.POST("/searchAuth", controller.PostSearchAuth)
otherGroup.GET("/domainAuth", controller.GetDomainAuth)
//版本信息
otherGroup.GET("/version", controller.GetOtherVersion)
otherGroup.GET("/news", controller.GetNews)
otherGroup.GET("/checkQrcode", controller.GetCheckQrcode)
otherGroup.GET("/getTopQuestion", controller.GetTopQuestion)
otherGroup.GET("/systemConfig", controller.GetSystemConfig)
otherGroup.GET("/systemStatus", controller.GetStop)
//直接注册成功客服
otherGroup.POST("/registerKefu", controller.PostKefuRegister2)
//切换客服状态
otherGroup.POST("/kefuStatus", controller.PostKefuInfoStatus2)
otherGroup.GET("/aesEncrypt", controller.GetAesEncrypt)
otherGroup.GET("/aesDecrypt", controller.GetAesDecrypt)
otherGroup.GET("/rsaEncrypt", controller.GetRsaEncrypt)
otherGroup.GET("/rsaDecrypt", controller.GetRsaDecrypt)
//RSA签名
otherGroup.POST("/signRsa", controller.GetSignRsa)
//RSA验证签名
otherGroup.POST("/checkSignRsa", controller.PostCheckSignRsa)
//内部接口白名单验证来源IP,传递账号生成token
otherGroup.GET("/internalToken", middleware.SystemIpWhite, controller.InternalToken)
//发送订阅消息测试
otherGroup.GET("/sendMiniSub", controller.GetSendMiniSub)
}
}