apiGroup.go 1.2 KB
Newer Older
E
eoLinker API Management 已提交
1 2 3
package api

import (
黄孟柱 已提交
4
	"github.com/eolinker/goku-api-gateway/server/dao"
Y
Your Name 已提交
5
	consolemysql "github.com/eolinker/goku-api-gateway/server/dao/console-mysql"
E
eoLinker API Management 已提交
6 7
)

Y
Your Name 已提交
8 9 10
//AddAPIGroup 新建接口分组
func AddAPIGroup(groupName string, projectID, parentGroupID int) (bool, interface{}, error) {
	return consolemysql.AddAPIGroup(groupName, projectID, parentGroupID)
E
eoLinker API Management 已提交
11 12
}

Y
Your Name 已提交
13 14 15
//EditAPIGroup 修改接口分组
func EditAPIGroup(groupName string, groupID, projectID int) (bool, string, error) {
	return consolemysql.EditAPIGroup(groupName, groupID, projectID)
E
eoLinker API Management 已提交
16 17
}

Y
Your Name 已提交
18 19 20
//DeleteAPIGroup 删除接口分组
func DeleteAPIGroup(projectID, groupID int) (bool, string, error) {
	flag, result, err := consolemysql.DeleteAPIGroup(projectID, groupID)
E
eoLinker API Management 已提交
21 22 23 24 25 26 27 28 29 30
	if flag {
		dao.UpdateTable("goku_gateway_strategy")
		dao.UpdateTable("goku_gateway_api")
		dao.UpdateTable("goku_conn_strategy_api")
		dao.UpdateTable("goku_conn_plugin_strategy")
		dao.UpdateTable("goku_conn_plugin_api")
	}
	return flag, result, err
}

Y
Your Name 已提交
31 32 33
//GetAPIGroupList 获取接口分组列表
func GetAPIGroupList(projectID int) (bool, []map[string]interface{}, error) {
	return consolemysql.GetAPIGroupList(projectID)
E
eoLinker API Management 已提交
34 35
}

Y
Your Name 已提交
36 37 38
//UpdateAPIGroupScript 更新接口分组脚本
func UpdateAPIGroupScript() bool {
	return consolemysql.UpdateAPIGroupScript()
E
eoLinker API Management 已提交
39
}