diff --git a/plugins/union_pay_redpack/internal/union_pay_redpack.go b/plugins/union_pay_redpack/internal/union_pay_redpack.go index 6f3908a..79561e2 100644 --- a/plugins/union_pay_redpack/internal/union_pay_redpack.go +++ b/plugins/union_pay_redpack/internal/union_pay_redpack.go @@ -5,7 +5,9 @@ import ( "fmt" "gitea.cdlsxd.cn/BaseSystem/plugin/proto" "github.com/carlmjohnson/requests" + "net/http" "plugins/union_pay_redpack/internal/po" + "time" ) // 插件通信信息,若不对应则会报错panic @@ -64,7 +66,10 @@ func (p *UnionPayCpnService) Query(ctx context.Context, request *proto.QueryRequ } var response po.QueryResp url := fmt.Sprintf("%s%s", c.BaseUri, queryMethod) - err = requests.URL(url).Headers(headers(c, uv, queryBizMethod)).BodyJSON(uv).ToJSON(&response).Fetch(ctx) + + h := new(http.Client) + h.Timeout = 100 * time.Millisecond + err = requests.URL(url).Client(h).Headers(headers(c, uv, queryBizMethod)).BodyJSON(uv).ToJSON(&response).Fetch(ctx) if err != nil { return nil, fmt.Errorf("请求异常,msg:" + err.Error()) }