refactor(conf): 删除未使用的配置项
- 移除了 conf/app.conf 中的 [gateway2]配置节 - 删除了 internal/config/config.go 中的 GetGateway2 和 GetRechargeTMall 函数 - 在 internal/utils/client/client.go 和 internal/integrations/scan_shop.go 中添加了请求超时设置
This commit is contained in:
@@ -24,9 +24,6 @@ db = 0
|
||||
[gateway]
|
||||
url = http://127.0.0.1:12309
|
||||
|
||||
[gateway2]
|
||||
url = http://127.0.0.1:12401
|
||||
|
||||
[partial]
|
||||
url = http://127.0.0.1:12310
|
||||
|
||||
|
||||
@@ -17,14 +17,6 @@ func GetMMValue() (gUrl string) {
|
||||
return fmt.Sprintf("%s/gateway/getAllowedMM", GetGateway())
|
||||
}
|
||||
|
||||
func GetGateway2() (url string) {
|
||||
url, err := web.AppConfig.String("gateway2::url")
|
||||
if err != nil {
|
||||
url = "http://localhost:12401"
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func GetPartialUrl() (url string) {
|
||||
url, err := web.AppConfig.String("partial::url")
|
||||
if err != nil {
|
||||
@@ -32,7 +24,3 @@ func GetPartialUrl() (url string) {
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func GetRechargeTMall() string {
|
||||
return fmt.Sprintf("%s/api/recharge/tMallGame/account/getOneByRandom", GetGateway2())
|
||||
}
|
||||
|
||||
@@ -62,7 +62,9 @@ func (c *ScanShopController) Shop(ctx context.Context, requestHost, payKey strin
|
||||
sign := utils.GetMD5SignMF(c.Params, merchantInfo.MerchantSecret)
|
||||
c.Params["sign"] = sign
|
||||
logs.Info(reqUrl, c.Params)
|
||||
//添加超时时间
|
||||
req := httplib.NewBeegoRequestWithCtx(ctx, reqUrl, "POST")
|
||||
req.SetTimeout(30*time.Second, 30*time.Second)
|
||||
req.SetTransport(otelhttp.NewTransport(http.DefaultTransport))
|
||||
for k, v := range c.Params {
|
||||
req.Param(k, v)
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"shop/internal/traceRouter"
|
||||
"time"
|
||||
|
||||
"github.com/beego/beego/v2/client/httplib"
|
||||
"github.com/beego/beego/v2/core/logs"
|
||||
@@ -40,6 +41,7 @@ func Get(ctx context.Context, baseUrl string, params map[string]string) (result
|
||||
req.Header.Set("tokenFrom", "iframe")
|
||||
//设置trace
|
||||
client := http.Client{}
|
||||
client.Timeout = time.Second * 30
|
||||
otel.GetTextMapPropagator().Inject(ctx, propagation.HeaderCarrier(req.Header))
|
||||
resp, err := client.Do(req)
|
||||
if resp != nil {
|
||||
@@ -66,6 +68,7 @@ func Post(ctx context.Context, baseUrl string, params map[string]string, data ma
|
||||
realUrl.RawQuery = urlParams.Encode()
|
||||
req := httplib.NewBeegoRequestWithCtx(ctx, realUrl.String(), "POST")
|
||||
otel.GetTextMapPropagator().Inject(ctx, propagation.HeaderCarrier(req.GetRequest().Header))
|
||||
req.SetTimeout(30*time.Second, 30*time.Second)
|
||||
_, _ = req.JSONBody(data)
|
||||
response, err := req.String()
|
||||
return response, err
|
||||
|
||||
@@ -1,12 +1,3 @@
|
||||
/***************************************************
|
||||
** @Desc : This file for ...
|
||||
** @Time : 2019/8/21 10:21
|
||||
** @Author : yuebin
|
||||
** @File : date_time
|
||||
** @Last Modified by : yuebin
|
||||
** @Last Modified time: 2019/8/21 10:21
|
||||
** @Software: GoLand
|
||||
****************************************************/
|
||||
package utils
|
||||
|
||||
import "time"
|
||||
|
||||
@@ -1,12 +1,3 @@
|
||||
/***************************************************
|
||||
** @Desc : generate login verify code image
|
||||
** @Time : 2019/8/7 17:14
|
||||
** @Author : yuebin
|
||||
** @File : login_verify_code
|
||||
** @Last Modified by : yuebin
|
||||
** @Last Modified time: 2019/8/7 17:14
|
||||
** @Software: GoLand
|
||||
****************************************************/
|
||||
package utils
|
||||
|
||||
import (
|
||||
|
||||
Reference in New Issue
Block a user