重构gateway和shop模拟商城

This commit is contained in:
kongyuebin
2021-09-16 16:24:34 +08:00
parent 2a98cbd9ac
commit 4967a137ec
58 changed files with 90 additions and 5644 deletions

View File

@@ -21,7 +21,7 @@ type HomeAction struct {
/*加载首页及数据*/
func (c *HomeAction) ShowHome() {
//取值
siteName, _ := beego.AppConfig.String("site.name")
siteName, _ := beego.AppConfig.String("siteName")
orderNo := xid.New().String()
productName := "测试应用-支付功能体验(非商品消费)"

View File

@@ -51,7 +51,7 @@ func (c *PayController) Pay() {
str := "/scan.html?" + "orderNo=" + orderNo + "&orderPrice=" + amount + "&qrCode=" + response.Qrcode + "&payWayCode=" + isScan
c.Redirect(str, 302)
} else {
flash.Error("请求失败,生成二维码失败")
flash.Error(response.Msg)
flash.Store(&c.Controller)
c.Redirect("/error.html", 302)
}

View File

@@ -38,15 +38,15 @@ type ResponseJSON struct {
}
const (
HOST = "http://localhost:10081"
HOST = "http://localhost:12309"
SCAN_HOST = HOST + "/gateway/scan"
H5_HOST = HOST + "/gateway/h5"
SYT_HOST = HOST + "/gateway/syt"
FAST_HOST = HOST + "/gateway/fast"
NOTIFY_URL = HOST + "/shop/notify"
RETURN_URL = HOST + "/shop/return"
PAY_KEY = "kkkkbmrb9gijhrt0th4naoag"
PAY_SERCET = "ssssbmrb9gijhrt0th4naob0"
PAY_KEY = "kkkkc254gk8isf001cqrj6p0"
PAY_SERCET = "ssssc254gk8isf001cqrj6pg"
)
func (c *ScanShopController) Prepare() {
@@ -77,7 +77,7 @@ func (c *ScanShopController) Shop(requestHost string) *ResponseJSON {
if err != nil {
logs.Error("扫码请求失败")
responseJSON.Code = -1
responseJSON.Msg = response + " ;" + err.Error()
responseJSON.Msg = response + " ;" + response
} else {
statusCode := gojson.Json(response).Get("statusCode").Tostring()
if statusCode != "00" {
@@ -115,6 +115,12 @@ func (c *ScanShopController) ScanRender() {
if strings.Contains(payWayCode, "UNION") {
c.Data["payTypeName"] = "云闪付app"
c.Data["openApp"] = "云闪付app [扫一扫]"
} else if strings.Contains(payWayCode, "WEIXIN") {
c.Data["payTypeName"] = "微信APP"
c.Data["openApp"] = "打开微信 [扫一扫]"
} else if strings.Contains(payWayCode, "ALI") {
c.Data["payTypeName"] = "支付宝APP"
c.Data["openApp"] = "打开支付宝 [扫一扫]"
}
c.Data["qrCode"] = qrCode
c.Data["orderNo"] = orderNo