project.go 1.6 KB
Newer Older
E
eoLinker API Management 已提交
1 2 3
package project

import (
Y
Your Name 已提交
4 5
	"github.com/eolinker/goku-api-gateway/common/pdao"
	"github.com/eolinker/goku-api-gateway/server/dao"
黄孟柱 已提交
6
	entity "github.com/eolinker/goku-api-gateway/server/entity/console-entity"
E
eoLinker API Management 已提交
7
)
Y
Your Name 已提交
8 9 10
var (
	projectDao dao.ProjectDao
)
E
eoLinker API Management 已提交
11

Y
Your Name 已提交
12 13 14
func init() {
	pdao.Need(&projectDao)
}
Y
Your Name 已提交
15
//AddProject 新建项目
E
eoLinker API Management 已提交
16
func AddProject(projectName string) (bool, interface{}, error) {
Y
Your Name 已提交
17
	return projectDao.AddProject(projectName)
E
eoLinker API Management 已提交
18 19
}

Y
Your Name 已提交
20
//EditProject 修改项目信息
E
eoLinker API Management 已提交
21
func EditProject(projectName string, projectID int) (bool, string, error) {
Y
Your Name 已提交
22
	return projectDao.EditProject(projectName, projectID)
E
eoLinker API Management 已提交
23 24
}

Y
Your Name 已提交
25
//DeleteProject 修改项目信息
E
eoLinker API Management 已提交
26
func DeleteProject(projectID int) (bool, string, error) {
Y
Your Name 已提交
27
	flag, result, err := projectDao.DeleteProject(projectID)
Y
Your Name 已提交
28

E
eoLinker API Management 已提交
29 30 31
	return flag, result, err
}

Y
Your Name 已提交
32
//BatchDeleteProject 批量删除项目
E
eoLinker API Management 已提交
33
func BatchDeleteProject(projectIDList string) (bool, string, error) {
Y
Your Name 已提交
34
	flag, result, err := projectDao.BatchDeleteProject(projectIDList)
E
eoLinker API Management 已提交
35 36 37
	return flag, result, err
}

Y
Your Name 已提交
38
//GetProjectInfo 获取项目信息
E
eoLinker API Management 已提交
39
func GetProjectInfo(projectID int) (bool, entity.Project, error) {
Y
Your Name 已提交
40
	return projectDao.GetProjectInfo(projectID)
E
eoLinker API Management 已提交
41 42
}

Y
Your Name 已提交
43
//GetProjectList 获取项目列表
E
eoLinker API Management 已提交
44
func GetProjectList(keyword string) (bool, []*entity.Project, error) {
Y
Your Name 已提交
45
	return projectDao.GetProjectList(keyword)
E
eoLinker API Management 已提交
46 47
}

Y
Your Name 已提交
48
//CheckProjectIsExist 检查项目是否存在
E
eoLinker API Management 已提交
49
func CheckProjectIsExist(projectID int) (bool, error) {
Y
Your Name 已提交
50
	return projectDao.CheckProjectIsExist(projectID)
E
eoLinker API Management 已提交
51 52
}

Y
Your Name 已提交
53 54
//GetAPIListFromProjectNotInStrategy 获取项目列表中没有被策略组绑定的接口
func GetAPIListFromProjectNotInStrategy() (bool, []map[string]interface{}, error) {
Y
Your Name 已提交
55
	return projectDao.GetAPIListFromProjectNotInStrategy()
E
eoLinker API Management 已提交
56
}