重构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

@@ -1,7 +1,9 @@
#基本信息
appname = shop
httpport = 3800
httpport = 12308
runmode = dev
siteName = 传奇支付
host=localhost

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

View File

@@ -3,6 +3,7 @@ package main
import (
"github.com/beego/beego/v2/core/logs"
beego "github.com/beego/beego/v2/server/web"
_ "shop/routers"
)
func main() {
@@ -16,7 +17,7 @@ func main() {
func RegisterLogs() {
logs.SetLogger(logs.AdapterFile,
`{
"filename":"../logs/legend.log",
"filename":"../.../logs/legend.log",
"level":4,
"maxlines":0,
"maxsize":0,

View File

@@ -77,19 +77,21 @@
style="width:100px;height: 35px;"><span></span></label>
</li>
</ul>
<h4 style="margin-top: 125px">H5支付(只支持手机端,不支持PC端)</h4>
<ul class="pay-label type">
<li>
<input value="WEIXIN_H5" name="H5" id="WEIXIN_H5" type="radio">
<label for="WEIXIN_H5"><img src="../static/img/weixin.jpg" alt="微信H5"
style="height: 35px;"><span></span></label>
</li>
<li>
<input value="ALI_H5" name="H5" id="ALI_H5" type="radio">
<label for="ALI_H5"><img src="../static/img/zhifubao.png" alt="支付宝H5"
style="height: 35px;"><span></span></label>
</li>
</ul>
<div id="pcOrPhone">
<h4 style="margin-top: 125px">H5支付(只支持手机端,不支持PC端)</h4>
<ul class="pay-label type">
<li>
<input value="WEIXIN_H5" name="H5" id="WEIXIN_H5" type="radio">
<label for="WEIXIN_H5"><img src="../static/img/weixin.jpg" alt="微信H5"
style="height: 35px;"><span></span></label>
</li>
<li>
<input value="ALI_H5" name="H5" id="ALI_H5" type="radio">
<label for="ALI_H5"><img src="../static/img/zhifubao.png" alt="支付宝H5"
style="height: 35px;"><span></span></label>
</li>
</ul>
</div>
<h4 style="margin-top: 120px">快捷支付</h4>
<ul class="pay-label type">
<li>
@@ -151,9 +153,6 @@
return false;
}
});
$(function () {
window.location = "/";
});
</script>
</body>

View File

@@ -41,7 +41,7 @@
<h1 style="font-size:1.5em;color:red;">2.打开对应的app进行支付</h1> <div id="openalipay" style="display: none"></div>
</div>
<div style="color:blue;font-size:13px; display: block;">
方式一直接打开app进行支付APP扫码支付<br/> 方式二截图保存到相册再打开app扫一扫从相册选择图片<br> 温馨提示请不要重复支付不要修改金额否则无法到账 </div> <div class="qrcode-img-wrapper" data-role="qrPayImgWrapper">
方式一直接<label style="color: red;"> {{.openApp}}</label>进行支付APP扫码支付<br/> 方式二截图保存到相册<label style="color: red;"> {{.openApp}}</label>从相册选择图片<br> 温馨提示请不要重复支付不要修改金额否则无法到账 </div> <div class="qrcode-img-wrapper" data-role="qrPayImgWrapper">
<div data-role="qrPayImg" class="qrcode-img-area">
<div class="ui-loading qrcode-loading" data-role="qrPayImgLoading" style="display: none;"></div>
<div style="position: relative;display: inline-block;">