From 2e15e38091d372d92a6c1e05593a704d69455235 Mon Sep 17 00:00:00 2001 From: zyd Date: Wed, 24 Jun 2020 17:45:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AD=97=E6=AE=B5=E8=BF=87?= =?UTF-8?q?=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/handler/proxyhandler.go | 11 +++++++---- src/model/response.go | 17 +++++++++-------- src/service/field.go | 2 +- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/handler/proxyhandler.go b/src/handler/proxyhandler.go index 008062f..a2ff54b 100644 --- a/src/handler/proxyhandler.go +++ b/src/handler/proxyhandler.go @@ -70,10 +70,13 @@ func Proxy(c *gin.Context) { Return(res) return nil })) - - c.Request.URL = testutils.ParseURI(proxyData.RealUrl) - c.Request.RequestURI = proxyData.RealUrl - c.Request.Host = getHost(proxyData.RealUrl) + query := "" + if proxyData.Data_service_type1 == 2 { + query = "?f=json" + } + c.Request.URL = testutils.ParseURI(proxyData.RealUrl + query) + c.Request.RequestURI = proxyData.RealUrl + query + c.Request.Host = getHost(proxyData.RealUrl + query) f.ServeHTTP(c.Writer, c.Request) } diff --git a/src/model/response.go b/src/model/response.go index d4b0ef7..8061932 100644 --- a/src/model/response.go +++ b/src/model/response.go @@ -1,14 +1,15 @@ package model type ProxyData struct { - RealUrl string `json:"req_url" xorm:"req_url"` - ResFields string `json:"res_fields" xorm:"res_fields text"` - Count int `json:"count" xorm:"count"` - Sensituve_word string `json:"sensituve_word" xorm:"sensituve_word"` - Sensitive_count int `json:"sensitive_count" xorm:"sensitive_count"` - Apply_id int `json:"apply_id" xorm:"apply_id"` - Service_id int `json:"service_id" xorm:"service_id"` - User_id string `json:"user_id" xorm:"user_id"` + RealUrl string `json:"req_url" xorm:"req_url"` + ResFields string `json:"res_fields" xorm:"res_fields text"` + Count int `json:"count" xorm:"count"` + Sensituve_word string `json:"sensituve_word" xorm:"sensituve_word"` + Sensitive_count int `json:"sensitive_count" xorm:"sensitive_count"` + Apply_id int `json:"apply_id" xorm:"apply_id"` + Service_id int `json:"service_id" xorm:"service_id"` + User_id string `json:"user_id" xorm:"user_id"` + Data_service_type1 int `json:"data_service_type1" xorm:"data_service_type1"` } type WebRes struct { diff --git a/src/service/field.go b/src/service/field.go index 7da731e..f97117d 100644 --- a/src/service/field.go +++ b/src/service/field.go @@ -386,7 +386,7 @@ func GetRealPath(applyId string) (res model.ProxyData, err error) { } has, err := db. Select(`service_apply.res_fields as res_fields,service.req_url as req_url,service_request_spcs.count as count,service_safe_config.sensituve_word as sensituve_word -,service_request_spcs.sensitive_count as sensitive_count,service_apply.service_id as service_id,service_apply.id as apply_id,service_apply.user_id as user_id`). +,service_request_spcs.sensitive_count as sensitive_count,service_apply.service_id as service_id,service_apply.id as apply_id,service_apply.user_id as user_id,service.data_service_type1`). Table(`service`). Join(`inner`, `service_apply`, `service_apply.service_id = service.id`). Join(`left`, `service_request_spcs`, `service_request_spcs.id = service_apply.request_spcs_id`). -- 2.26.0