caipin 4 years ago
parent
commit
744784aaa9
1 changed files with 13 additions and 1 deletions
  1. 13 1
      web/api/project_account_api.go

+ 13 - 1
web/api/project_account_api.go

@@ -12,6 +12,7 @@ import (
 	"github.com/kataras/iris/v12"
 	"go.mod/services"
 	"go.mod/web/utils"
+	"go.mod/web/viewmodels"
 )
 
 type ProjectAccountApi struct {
@@ -80,10 +81,19 @@ func (c *ProjectAccountApi) GetList() {
 // @Tags 项目账号相关
 // @Description 获得项目账号角色列表
 // @Security ApiKeyAuth
+// @Param   name     body    string     true        "检索内容"
 // @Success 200 {string} string	"{code:0成功,-1参数类错误,-2服务端内部错误,msg:错误信息}"
 // @Router /api/projectAccount/group [get]
 func (c *ProjectAccountApi) GetGroup() {
 
+	// 获得检索关键字
+	AccountData := viewmodels.ProjectAccount{}
+	err := c.Ctx.ReadJSON(&AccountData)
+	if err != nil {
+		c.Ctx.JSON(iris.Map{"code": -1, "msg": fmt.Sprintf("JSON转换异常, error=%s", err)})
+		return
+	}
+
 	// 获得项目ID
 	projectId, err := utils.GetProjectId(c.Ctx)
 	if err != nil {
@@ -91,7 +101,9 @@ func (c *ProjectAccountApi) GetGroup() {
 		return
 	}
 
-	accountData := c.ServiceProjectAccount.GetAll(projectId)
+	// accountData := c.ServiceProjectAccount.GetAll(projectId)
+	// 检索
+	accountData := c.ServiceProjectAccount.Search(AccountData.Name, projectId)
 
 	roleDate := map[int]string{
 		1: "建设单位",