正在显示
5 个修改的文件
包含
56 行增加
和
1 行删除
@@ -111,6 +111,8 @@ spec: | @@ -111,6 +111,8 @@ spec: | ||
111 | value: "http://allied-creation-basic-dev.fjmaimaimai.com" | 111 | value: "http://allied-creation-basic-dev.fjmaimaimai.com" |
112 | - name: SMS_SERVE_HOST | 112 | - name: SMS_SERVE_HOST |
113 | value: "https://sms.fjmaimaimai.com:9897" | 113 | value: "https://sms.fjmaimaimai.com:9897" |
114 | + - name: SUPLUS_SALE_APP | ||
115 | + value: "http://suplus-sale-app-gateway-test.fjmaimaimai.com" | ||
114 | # - name: REDIS_HOST | 116 | # - name: REDIS_HOST |
115 | # valueFrom: | 117 | # valueFrom: |
116 | # configMapKeyRef: | 118 | # configMapKeyRef: |
@@ -115,6 +115,8 @@ spec: | @@ -115,6 +115,8 @@ spec: | ||
115 | value: "https://allied-creation-basic-test.fjmaimaimai.com" | 115 | value: "https://allied-creation-basic-test.fjmaimaimai.com" |
116 | - name: SMS_SERVE_HOST | 116 | - name: SMS_SERVE_HOST |
117 | value: "https://sms.fjmaimaimai.com:9897" | 117 | value: "https://sms.fjmaimaimai.com:9897" |
118 | + - name: SUPLUS_SALE_APP | ||
119 | + value: "http://suplus-sale-app-gateway-test.fjmaimaimai.com" | ||
118 | # - name: REDIS_HOST | 120 | # - name: REDIS_HOST |
119 | # valueFrom: | 121 | # valueFrom: |
120 | # configMapKeyRef: | 122 | # configMapKeyRef: |
@@ -8,7 +8,7 @@ import ( | @@ -8,7 +8,7 @@ import ( | ||
8 | const SERVICE_NAME = "allied-creation-gateway" | 8 | const SERVICE_NAME = "allied-creation-gateway" |
9 | 9 | ||
10 | var LOG_LEVEL = "debug" | 10 | var LOG_LEVEL = "debug" |
11 | -var LOG_TYPE = "console"// file, console, es | 11 | +var LOG_TYPE = "console" // file, console, es |
12 | var LOG_FRAMEWORK = "beego" // beego logrus | 12 | var LOG_FRAMEWORK = "beego" // beego logrus |
13 | var LOG_FILE = "app.log" | 13 | var LOG_FILE = "app.log" |
14 | var LOG_PREFIX = "[allied-creation-gateway]" | 14 | var LOG_PREFIX = "[allied-creation-gateway]" |
@@ -27,6 +27,9 @@ var ALLIED_CREATION_COOPERATION_HOST = "http://localhost:8082" // "http://allied | @@ -27,6 +27,9 @@ var ALLIED_CREATION_COOPERATION_HOST = "http://localhost:8082" // "http://allied | ||
27 | //通用模块短信服务 | 27 | //通用模块短信服务 |
28 | var SMS_SERVE_HOST = "https://sms.fjmaimaimai.com:9897" | 28 | var SMS_SERVE_HOST = "https://sms.fjmaimaimai.com:9897" |
29 | 29 | ||
30 | +//素加销售导航服务 | ||
31 | +var SUPLUS_SALE_APP = "http://suplus-sale-app-gateway-test.fjmaimaimai.com" | ||
32 | + | ||
30 | // TODO:特殊短信验证码,不验证,正式环境注入空 | 33 | // TODO:特殊短信验证码,不验证,正式环境注入空 |
31 | var SMSCODE_ALL_POWER = "999512" | 34 | var SMSCODE_ALL_POWER = "999512" |
32 | 35 | ||
@@ -55,4 +58,7 @@ func init() { | @@ -55,4 +58,7 @@ func init() { | ||
55 | if os.Getenv("SMSCODE_ALL_POWER") != "" { | 58 | if os.Getenv("SMSCODE_ALL_POWER") != "" { |
56 | SMSCODE_ALL_POWER = os.Getenv("SMSCODE_ALL_POWER") | 59 | SMSCODE_ALL_POWER = os.Getenv("SMSCODE_ALL_POWER") |
57 | } | 60 | } |
61 | + if os.Getenv("SUPLUS_SALE_APP") != "" { | ||
62 | + SUPLUS_SALE_APP = os.Getenv("SUPLUS_SALE_APP") | ||
63 | + } | ||
58 | } | 64 | } |
1 | +package mobile_client | ||
2 | + | ||
3 | +import ( | ||
4 | + "fmt" | ||
5 | + | ||
6 | + "github.com/beego/beego/v2/client/httplib" | ||
7 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant" | ||
8 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/port/beego/controllers" | ||
9 | +) | ||
10 | + | ||
11 | +//代理请求转发 | ||
12 | + | ||
13 | +type ReverseProxyController struct { | ||
14 | + controllers.BaseController | ||
15 | +} | ||
16 | + | ||
17 | +func (controller *ReverseProxyController) SuplusSaleApp() { | ||
18 | + //routePrefix := "/suplus-sale-app" | ||
19 | + proxyHostUrl := constant.SUPLUS_SALE_APP + "/v1/platform/district" | ||
20 | + req := httplib.Post(proxyHostUrl) | ||
21 | + req.Header("Content-Type", "application/json") | ||
22 | + req = req.Body(controller.Ctx.Input.RequestBody) | ||
23 | + fmt.Println(string(controller.Ctx.Input.RequestBody)) | ||
24 | + // req.JSONBody() b.req.Header.Set(, "application/json") | ||
25 | + respData, err := req.Bytes() | ||
26 | + if err != nil { | ||
27 | + controller.Response(nil, err) | ||
28 | + return | ||
29 | + } | ||
30 | + controller.Ctx.Output.Header("Content-Type", "application/json; charset=utf-8") | ||
31 | + controller.Ctx.Output.Body(respData) | ||
32 | + | ||
33 | +} |
1 | +package routers | ||
2 | + | ||
3 | +import ( | ||
4 | + "github.com/beego/beego/v2/server/web" | ||
5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/port/beego/controllers/mobile_client" | ||
6 | +) | ||
7 | + | ||
8 | +func init() { | ||
9 | + | ||
10 | + /***** 转发销售导航的请求*****/ | ||
11 | + web.Router("/suplus-sale-app/v1/platform/district", &mobile_client.ReverseProxyController{}, "post:SuplusSaleApp") | ||
12 | +} |
-
请 注册 或 登录 后发表评论