simple.go 665 字节
Newer Older
E
eoLinker API Management 已提交
1 2 3 4 5
package discovery

import (
	"net/http"

黄孟柱 已提交
6 7
	"github.com/eolinker/goku-api-gateway/console/controller"
	"github.com/eolinker/goku-api-gateway/console/module/service"
E
eoLinker API Management 已提交
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
)

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

	vs, def, err := service.SimpleList()
	if err != nil {
		controller.WriteError(w, "100000", "data", err.Error(), err)
		return
	}
	data := make(map[string]interface{})
	data["default"] = def
	data["list"] = vs
	controller.WriteResultInfoWithPage(w, "serviceDiscovery", "data", data, controller.NewItemNum(len(vs)))
}