diff --git a/shop/controllers/page_controller.go b/shop/controllers/page_controller.go index a762ef7..3847868 100644 --- a/shop/controllers/page_controller.go +++ b/shop/controllers/page_controller.go @@ -10,18 +10,18 @@ package controllers import ( - beego "github.com/beego/beego/v2/server/web" + "github.com/beego/beego/v2/server/web" "github.com/rs/xid" ) type HomeAction struct { - beego.Controller + web.Controller } /*加载首页及数据*/ func (c *HomeAction) ShowHome() { //取值 - siteName, _ := beego.AppConfig.String("siteName") + siteName, _ := web.AppConfig.String("siteName") orderNo := xid.New().String() productName := "测试应用-支付功能体验(非商品消费)" @@ -33,8 +33,8 @@ func (c *HomeAction) ShowHome() { } func (c *HomeAction) ErrorPage() { - flash := beego.ReadFromRequest(&c.Controller) - error := flash.Data["error"] - c.Data["error"] = error + flash := web.ReadFromRequest(&c.Controller) + e := flash.Data["error"] + c.Data["error"] = e c.TplName = "error.html" } diff --git a/shop/controllers/pay.go b/shop/controllers/pay.go index c3ed27e..2da71a8 100644 --- a/shop/controllers/pay.go +++ b/shop/controllers/pay.go @@ -11,18 +11,18 @@ package controllers import ( "github.com/beego/beego/v2/core/logs" - beego "github.com/beego/beego/v2/server/web" + "github.com/beego/beego/v2/server/web" "strconv" "strings" ) type PayController struct { - beego.Controller + web.Controller } func (c *PayController) Pay() { orderNo := strings.TrimSpace(c.GetString("orderid")) - flash := beego.NewFlash() + flash := web.NewFlash() if orderNo == "" { flash.Error("订单号为空") flash.Store(&c.Controller) diff --git a/shop/controllers/scan_shop.go b/shop/controllers/scan_shop.go index af0113a..60faf3c 100644 --- a/shop/controllers/scan_shop.go +++ b/shop/controllers/scan_shop.go @@ -12,7 +12,7 @@ package controllers import ( "github.com/beego/beego/v2/client/httplib" "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/widuu/gojson" "shop/utils" @@ -20,7 +20,7 @@ import ( ) type ScanShopController struct { - beego.Controller + web.Controller Params map[string]string } diff --git a/shop/enums/enums.go b/shop/enums/enums.go deleted file mode 100644 index 1869d71..0000000 --- a/shop/enums/enums.go +++ /dev/null @@ -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", //成都银行 -} diff --git a/shop/routers/router.go b/shop/routers/router.go index f1738a7..920ea21 100644 --- a/shop/routers/router.go +++ b/shop/routers/router.go @@ -1,14 +1,14 @@ package routers import ( - beego "github.com/beego/beego/v2/server/web" + "github.com/beego/beego/v2/server/web" "shop/controllers" ) func init() { - beego.Router("/", &controllers.HomeAction{}, "*:ShowHome") //初始化首页 - beego.Router("/pay.html", &controllers.PayController{}, "*:Pay") - beego.Router("/pay_requst.html", &controllers.ScanShopController{}) - beego.Router("/scan.html", &controllers.ScanShopController{}, "*:ScanRender") - beego.Router("/error.html", &controllers.HomeAction{}, "*:ErrorPage") + web.Router("/", &controllers.HomeAction{}, "*:ShowHome") //初始化首页 + web.Router("/pay.html", &controllers.PayController{}, "*:Pay") + web.Router("/pay_requst.html", &controllers.ScanShopController{}) + web.Router("/scan.html", &controllers.ScanShopController{}, "*:ScanRender") + web.Router("/error.html", &controllers.HomeAction{}, "*:ErrorPage") }