作者 tangxuhui

添加 销售导航数据转发

... ... @@ -111,6 +111,8 @@ spec:
value: "http://allied-creation-basic-dev.fjmaimaimai.com"
- name: SMS_SERVE_HOST
value: "https://sms.fjmaimaimai.com:9897"
- name: SUPLUS_SALE_APP
value: "http://suplus-sale-app-gateway-test.fjmaimaimai.com"
# - name: REDIS_HOST
# valueFrom:
# configMapKeyRef:
... ...
... ... @@ -115,6 +115,8 @@ spec:
value: "https://allied-creation-basic-test.fjmaimaimai.com"
- name: SMS_SERVE_HOST
value: "https://sms.fjmaimaimai.com:9897"
- name: SUPLUS_SALE_APP
value: "http://suplus-sale-app-gateway-test.fjmaimaimai.com"
# - name: REDIS_HOST
# valueFrom:
# configMapKeyRef:
... ...
... ... @@ -8,7 +8,7 @@ import (
const SERVICE_NAME = "allied-creation-gateway"
var LOG_LEVEL = "debug"
var LOG_TYPE = "console"// file, console, es
var LOG_TYPE = "console" // file, console, es
var LOG_FRAMEWORK = "beego" // beego logrus
var LOG_FILE = "app.log"
var LOG_PREFIX = "[allied-creation-gateway]"
... ... @@ -27,6 +27,9 @@ var ALLIED_CREATION_COOPERATION_HOST = "http://localhost:8082" // "http://allied
//通用模块短信服务
var SMS_SERVE_HOST = "https://sms.fjmaimaimai.com:9897"
//素加销售导航服务
var SUPLUS_SALE_APP = "http://suplus-sale-app-gateway-test.fjmaimaimai.com"
// TODO:特殊短信验证码,不验证,正式环境注入空
var SMSCODE_ALL_POWER = "999512"
... ... @@ -55,4 +58,7 @@ func init() {
if os.Getenv("SMSCODE_ALL_POWER") != "" {
SMSCODE_ALL_POWER = os.Getenv("SMSCODE_ALL_POWER")
}
if os.Getenv("SUPLUS_SALE_APP") != "" {
SUPLUS_SALE_APP = os.Getenv("SUPLUS_SALE_APP")
}
}
... ...
package mobile_client
import (
"fmt"
"github.com/beego/beego/v2/client/httplib"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/port/beego/controllers"
)
//代理请求转发
type ReverseProxyController struct {
controllers.BaseController
}
func (controller *ReverseProxyController) SuplusSaleApp() {
//routePrefix := "/suplus-sale-app"
proxyHostUrl := constant.SUPLUS_SALE_APP + "/v1/platform/district"
req := httplib.Post(proxyHostUrl)
req.Header("Content-Type", "application/json")
req = req.Body(controller.Ctx.Input.RequestBody)
fmt.Println(string(controller.Ctx.Input.RequestBody))
// req.JSONBody() b.req.Header.Set(, "application/json")
respData, err := req.Bytes()
if err != nil {
controller.Response(nil, err)
return
}
controller.Ctx.Output.Header("Content-Type", "application/json; charset=utf-8")
controller.Ctx.Output.Body(respData)
}
... ...
package routers
import (
"github.com/beego/beego/v2/server/web"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/port/beego/controllers/mobile_client"
)
func init() {
/***** 转发销售导航的请求*****/
web.Router("/suplus-sale-app/v1/platform/district", &mobile_client.ReverseProxyController{}, "post:SuplusSaleApp")
}
... ...