From 762c589b757d57c8527885cf52af037af356ca17 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 30 Oct 2020 14:18:03 +0800 Subject: [PATCH] 1 --- server/analyseapi/riskmgr.go | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/server/analyseapi/riskmgr.go b/server/analyseapi/riskmgr.go index 191abcb..bb60dfc 100644 --- a/server/analyseapi/riskmgr.go +++ b/server/analyseapi/riskmgr.go @@ -203,8 +203,21 @@ func (this *RiskMgr) __opsDump(w* http.ResponseWriter, r *http.Request) { defer this.launchBlackListMutex.Unlock() defer this.blockProvinceCityHashMutex.Unlock() - xobj := q5.NewMxoObject() - xobj.SetXValue("errcode", q5.NewXInt32(0)) - xobj.SetXValue("errcode", q5.NewXString("")) - q5.Response(w, xobj.ToJsonStr()) + fillRespObj := func(respObj* q5.MutableXObject, attrName string, mapObj* map[string]int32) { + list := q5.NewMxoArray() + for key, _ := range *mapObj { + list.PushXValue(q5.NewXString(key)) + } + respObj.SetXObject(attrName, list.AsXObject()) + } + + respObj := q5.NewMxoObject() + respObj.SetXValue("errcode", q5.NewXInt32(0)) + respObj.SetXValue("errcode", q5.NewXString("")) + fillRespObj(respObj, "ip_white_list", &this.ipWhiteList) + fillRespObj(respObj, "ip_black_list", &this.ipBlackList) + fillRespObj(respObj, "launch_white_list", &this.launchWhiteList) + fillRespObj(respObj, "launch_black_list", &this.launchBlackList) + fillRespObj(respObj, "block_province_city_list", &this.blockProvinceCityHash) + q5.Response(w, respObj.ToJsonStr()) }