mirror of
https://github.com/YFGaia/dify-plus.git
synced 2026-06-04 10:14:00 +08:00
52 lines
1.7 KiB
Go
52 lines
1.7 KiB
Go
package gaia
|
|
|
|
import (
|
|
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
|
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
|
|
"github.com/flipped-aurora/gin-vue-admin/server/model/gaia"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
type SystemApi struct{}
|
|
|
|
// GetDingTalk 获取钉钉系统配置
|
|
// @Tags System
|
|
// @Summary 获取钉钉系统配置
|
|
// @Security ApiKeyAuth
|
|
// @accept application/json
|
|
// @Produce application/json
|
|
// @Param data query gaia.Tenants true "用id查询tenants表"
|
|
// @Success 200 {object} response.Response{data=gaia.Tenants,msg=string} "查询成功"
|
|
// @Router /gaia/system/dingtalk [get]
|
|
func (systemApi *SystemApi) GetDingTalk(c *gin.Context) {
|
|
var config = make(map[string]interface{})
|
|
config["host"] = global.GVA_CONFIG.Gaia.Url
|
|
config["config"] = systemIntegratedService.GetIntegratedConfig(gaia.SystemIntegrationDingTalk)
|
|
response.OkWithData(config, c)
|
|
}
|
|
|
|
// SetDingTalk 设置钉钉系统配置
|
|
// @Tags System
|
|
// @Summary 设置钉钉系统配置
|
|
// @Security ApiKeyAuth
|
|
// @accept application/json
|
|
// @Produce application/json
|
|
// @Param data query gaia.Tenants true "用id查询tenants表"
|
|
// @Success 200 {object} response.Response{data=gaia.Tenants,msg=string} "查询成功"
|
|
// @Router /gaia/system/dingtalk [post]
|
|
func (systemApi *SystemApi) SetDingTalk(c *gin.Context) {
|
|
var err error
|
|
var req gaia.SystemIntegration
|
|
if err = c.ShouldBindJSON(&req); err != nil {
|
|
response.FailWithMessage(err.Error(), c)
|
|
return
|
|
}
|
|
// update
|
|
req.Classify = gaia.SystemIntegrationDingTalk
|
|
if err = systemIntegratedService.SetIntegratedConfig(req, req.Test); err != nil {
|
|
response.FailWithMessage(err.Error(), c)
|
|
return
|
|
}
|
|
response.OkWithData("ok", c)
|
|
}
|