Skip to content

Commit

Permalink
商店模拟系统升级
Browse files Browse the repository at this point in the history
  • Loading branch information
kongyuebin authored and kongyuebin committed Nov 18, 2021
1 parent cc55140 commit 96413c3
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 68 deletions.
12 changes: 6 additions & 6 deletions shop/controllers/page_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 := "测试应用-支付功能体验(非商品消费)"

Expand All @@ -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"
}
6 changes: 3 additions & 3 deletions shop/controllers/pay.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions shop/controllers/scan_shop.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ 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"
"strings"
)

type ScanShopController struct {
beego.Controller
web.Controller
Params map[string]string
}

Expand Down
51 changes: 0 additions & 51 deletions shop/enums/enums.go

This file was deleted.

12 changes: 6 additions & 6 deletions shop/routers/router.go
Original file line number Diff line number Diff line change
@@ -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")
}

0 comments on commit 96413c3

Please sign in to comment.