mirror of
https://github.com/kongyuebin1/dongfeng-pay.git
synced 2024-11-14 14:39:21 +08:00
商店模拟系统升级
This commit is contained in:
parent
cc55140103
commit
96413c3c16
@ -10,18 +10,18 @@
|
|||||||
package controllers
|
package controllers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
beego "github.com/beego/beego/v2/server/web"
|
"github.com/beego/beego/v2/server/web"
|
||||||
"github.com/rs/xid"
|
"github.com/rs/xid"
|
||||||
)
|
)
|
||||||
|
|
||||||
type HomeAction struct {
|
type HomeAction struct {
|
||||||
beego.Controller
|
web.Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
/*加载首页及数据*/
|
/*加载首页及数据*/
|
||||||
func (c *HomeAction) ShowHome() {
|
func (c *HomeAction) ShowHome() {
|
||||||
//取值
|
//取值
|
||||||
siteName, _ := beego.AppConfig.String("siteName")
|
siteName, _ := web.AppConfig.String("siteName")
|
||||||
orderNo := xid.New().String()
|
orderNo := xid.New().String()
|
||||||
productName := "测试应用-支付功能体验(非商品消费)"
|
productName := "测试应用-支付功能体验(非商品消费)"
|
||||||
|
|
||||||
@ -33,8 +33,8 @@ func (c *HomeAction) ShowHome() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *HomeAction) ErrorPage() {
|
func (c *HomeAction) ErrorPage() {
|
||||||
flash := beego.ReadFromRequest(&c.Controller)
|
flash := web.ReadFromRequest(&c.Controller)
|
||||||
error := flash.Data["error"]
|
e := flash.Data["error"]
|
||||||
c.Data["error"] = error
|
c.Data["error"] = e
|
||||||
c.TplName = "error.html"
|
c.TplName = "error.html"
|
||||||
}
|
}
|
||||||
|
@ -11,18 +11,18 @@ package controllers
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/beego/beego/v2/core/logs"
|
"github.com/beego/beego/v2/core/logs"
|
||||||
beego "github.com/beego/beego/v2/server/web"
|
"github.com/beego/beego/v2/server/web"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
type PayController struct {
|
type PayController struct {
|
||||||
beego.Controller
|
web.Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *PayController) Pay() {
|
func (c *PayController) Pay() {
|
||||||
orderNo := strings.TrimSpace(c.GetString("orderid"))
|
orderNo := strings.TrimSpace(c.GetString("orderid"))
|
||||||
flash := beego.NewFlash()
|
flash := web.NewFlash()
|
||||||
if orderNo == "" {
|
if orderNo == "" {
|
||||||
flash.Error("订单号为空")
|
flash.Error("订单号为空")
|
||||||
flash.Store(&c.Controller)
|
flash.Store(&c.Controller)
|
||||||
|
@ -12,7 +12,7 @@ package controllers
|
|||||||
import (
|
import (
|
||||||
"github.com/beego/beego/v2/client/httplib"
|
"github.com/beego/beego/v2/client/httplib"
|
||||||
"github.com/beego/beego/v2/core/logs"
|
"github.com/beego/beego/v2/core/logs"
|
||||||
beego "github.com/beego/beego/v2/server/web"
|
"github.com/beego/beego/v2/server/web"
|
||||||
"github.com/skip2/go-qrcode"
|
"github.com/skip2/go-qrcode"
|
||||||
"github.com/widuu/gojson"
|
"github.com/widuu/gojson"
|
||||||
"shop/utils"
|
"shop/utils"
|
||||||
@ -20,7 +20,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type ScanShopController struct {
|
type ScanShopController struct {
|
||||||
beego.Controller
|
web.Controller
|
||||||
Params map[string]string
|
Params map[string]string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,51 +0,0 @@
|
|||||||
/***************************************************
|
|
||||||
** @Desc : This file for 枚举
|
|
||||||
** @Time : 2018-7-26 10:13
|
|
||||||
** @Author : Joker
|
|
||||||
** @File : enums.go
|
|
||||||
** @Last Modified by : Joker
|
|
||||||
** @Last Modified time: 2018-08-30 16:32:33
|
|
||||||
** @Software: GoLand
|
|
||||||
****************************************************/
|
|
||||||
package enums
|
|
||||||
|
|
||||||
/*支付方式*/
|
|
||||||
var paySubType = map[string]string{
|
|
||||||
"": "所有",
|
|
||||||
"WEIXIN_SCAN": "微信扫码",
|
|
||||||
"UNION_SCAN": "银联扫码",
|
|
||||||
"ALI_SCAN": "支付宝扫码",
|
|
||||||
|
|
||||||
"WEIXIN_H5": "微信H5",
|
|
||||||
"ALI_H5": "支付宝H5",
|
|
||||||
|
|
||||||
"UNION_FAST": "银联快捷",
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetPaySubType() map[string]string {
|
|
||||||
return paySubType
|
|
||||||
}
|
|
||||||
|
|
||||||
/*银行编码*/
|
|
||||||
var bankCode = map[string]string{
|
|
||||||
"01020000": "ICBC", //工商银行
|
|
||||||
"01030000": "ABC", //农业银行
|
|
||||||
"01040000": "BOC", //中国银行
|
|
||||||
"01050000": "CCB", //建设银行
|
|
||||||
"03010000": "BOCOM", //交通银行
|
|
||||||
"03020000": "CNCB", //中信银行
|
|
||||||
"03030000": "CEB", //中信银行
|
|
||||||
"03040000": "HXB", //光大银行
|
|
||||||
"03050000": "CMBC", //民生银行
|
|
||||||
"03060000": "GDB", //广发银行
|
|
||||||
"04100000": "PAB", //平安银行
|
|
||||||
"03080000": "CMB", //招商银行
|
|
||||||
"03090000": "CIB", //兴业银行
|
|
||||||
"03170000": "BOHC", //渤海银行
|
|
||||||
"03200000": "BEAI", //东亚银行
|
|
||||||
"04012900": "BOS", //上海银行
|
|
||||||
"04031000": "BCCB", //北京银行
|
|
||||||
"04083320": "NBBC", //宁波银行
|
|
||||||
"04243010": "NJBC", //南京银行
|
|
||||||
"64296510": "CDSBC", //成都银行
|
|
||||||
}
|
|
@ -1,14 +1,14 @@
|
|||||||
package routers
|
package routers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
beego "github.com/beego/beego/v2/server/web"
|
"github.com/beego/beego/v2/server/web"
|
||||||
"shop/controllers"
|
"shop/controllers"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
beego.Router("/", &controllers.HomeAction{}, "*:ShowHome") //初始化首页
|
web.Router("/", &controllers.HomeAction{}, "*:ShowHome") //初始化首页
|
||||||
beego.Router("/pay.html", &controllers.PayController{}, "*:Pay")
|
web.Router("/pay.html", &controllers.PayController{}, "*:Pay")
|
||||||
beego.Router("/pay_requst.html", &controllers.ScanShopController{})
|
web.Router("/pay_requst.html", &controllers.ScanShopController{})
|
||||||
beego.Router("/scan.html", &controllers.ScanShopController{}, "*:ScanRender")
|
web.Router("/scan.html", &controllers.ScanShopController{}, "*:ScanRender")
|
||||||
beego.Router("/error.html", &controllers.HomeAction{}, "*:ErrorPage")
|
web.Router("/error.html", &controllers.HomeAction{}, "*:ErrorPage")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user