project.go 1.6 KB
Newer Older
E
eoLinker API Management 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
package project

import (
	"github.com/eolinker/goku/server/dao"
	console_mysql "github.com/eolinker/goku/server/dao/console-mysql"
	entity "github.com/eolinker/goku/server/entity/console-entity"
)

// 新建项目
func AddProject(projectName string) (bool, interface{}, error) {
	return console_mysql.AddProject(projectName)
}

// 修改项目信息
func EditProject(projectName string, projectID int) (bool, string, error) {
	return console_mysql.EditProject(projectName, projectID)
}

// 修改项目信息
func DeleteProject(projectID int) (bool, string, error) {
	flag, result, err := console_mysql.DeleteProject(projectID)
	if flag {
		name := "goku_gateway_api"
		dao.UpdateTable(name)
	}
	return flag, result, err
}

// 批量删除项目
func BatchDeleteProject(projectIDList string) (bool, string, error) {
	flag, result, err := console_mysql.BatchDeleteProject(projectIDList)
	if flag {
		name := "goku_gateway_api"
		dao.UpdateTable(name)
	}
	return flag, result, err
}

// 获取项目信息
func GetProjectInfo(projectID int) (bool, entity.Project, error) {
	return console_mysql.GetProjectInfo(projectID)
}

// 获取项目列表
func GetProjectList(keyword string) (bool, []*entity.Project, error) {
	return console_mysql.GetProjectList(keyword)
}

// 检查项目是否存在
func CheckProjectIsExist(projectID int) (bool, error) {
	return console_mysql.CheckProjectIsExist(projectID)
}

// 获取项目列表中没有被策略组绑定的接口
func GetApiListFromProjectNotInStrategy() (bool, []map[string]interface{}, error) {
	return console_mysql.GetApiListFromProjectNotInStrategy()
}