list.go 576 字节
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
package discovery

import (
	"net/http"

	"github.com/eolinker/goku/console/controller"
	"github.com/eolinker/goku/console/module/service"
)

func list(w http.ResponseWriter, r *http.Request) {
	_, err := controller.CheckLogin(w, r, controller.OperationLoadBalance, controller.OperationREAD)
	if err != nil {
		return
	}

	_ = r.ParseForm()

	keyword := r.FormValue("keyword")
	infos, err := service.List(keyword)
	if err != nil {
		controller.WriteError(w, "100000", "data", err.Error(), err)
		return
	}

	controller.WriteResultInfo(w, "serviceDiscovery", "data", infos)

}