コード例 #1
0
ファイル: request.go プロジェクト: EagleChen/vchain-server
func GetRequestRequestGroup(w http.ResponseWriter, r *http.Request) {
	vars := mux.Vars(r)
	uuid := vars["uuid"]

	req := model.GetRequest(uuid)
	if req == nil || req.GroupUuid == "" {
		w.WriteHeader(http.StatusNotFound)
		return
	}

	rg := model.GetRequestGroup(req.GroupUuid)
	if req == nil {
		w.WriteHeader(http.StatusInternalServerError)
		return
	}

	result := struct {
		Requests     []*model.Request `json:"requests"`
		ParentsIndex []int            `json:"parents_index"`
	}{}

	result.ParentsIndex = rg.ParentsIndex
	result.Requests = rg.DetailRequests()

	json.NewEncoder(w).Encode(result)
}
コード例 #2
0
ファイル: request.go プロジェクト: EagleChen/vchain-server
func GetRequestInvokeChain(w http.ResponseWriter, r *http.Request) {
	vars := mux.Vars(r)
	uuid := vars["uuid"]

	req := model.GetRequest(uuid)
	if req == nil || req.GroupUuid == "" {
		w.WriteHeader(http.StatusNotFound)
		return
	}

	rg := model.GetRequestGroup(req.GroupUuid)
	if req == nil {
		w.WriteHeader(http.StatusInternalServerError)
		return
	}

	ic := model.GetInvokeChain(rg.InvokeChainId)
	if ic == nil {
		w.WriteHeader(http.StatusInternalServerError)
		return
	}

	json.NewEncoder(w).Encode(ic)
}