feat(pay): switch checkout counter to SPA redirect + JSON API

- redirect `/pay/checkout-counter/:trade_id` to `/cashier/:trade_id`
- add `/pay/checkout-counter-resp/:trade_id` for checkout JSON payload
- remove embedded `static` release and keep `www` as the web bundle source
- regenerate PWA/www assets and move chain icons to `/www/images/chains`
This commit is contained in:
line-6000
2026-04-29 00:34:58 +08:00
parent 785a162f88
commit 9c533a7ff8
199 changed files with 242 additions and 1810 deletions
+6 -18
View File
@@ -1,11 +1,8 @@
package comm
import (
"html/template"
"net/http"
"path/filepath"
"github.com/GMWalletApp/epusdt/config"
"github.com/GMWalletApp/epusdt/model/response"
"github.com/GMWalletApp/epusdt/model/service"
"github.com/labstack/echo/v4"
@@ -13,12 +10,12 @@ import (
// CheckoutCounter 收银台
// @Summary Checkout counter page
// @Description Render the payment checkout counter HTML page for a given trade
// @Description Render the payment checkout counter JSON response for a given trade
// @Tags Payment
// @Produce html
// @Produce json
// @Param trade_id path string true "Trade ID"
// @Success 200 {string} string "HTML page"
// @Router /pay/checkout-counter/{trade_id} [get]
// @Success 200 {object} response.CheckoutCounterResponse
// @Router /pay/checkout-counter-resp/{trade_id} [get]
func (c *BaseCommController) CheckoutCounter(ctx echo.Context) (err error) {
tradeId := ctx.Param("trade_id")
resp, err := service.GetCheckoutCounterByTradeId(tradeId)
@@ -26,22 +23,13 @@ func (c *BaseCommController) CheckoutCounter(ctx echo.Context) (err error) {
if err == service.ErrOrder {
// Unknown trade id: render the page with empty payload
// (client side shows a friendly "order not found" screen).
tmpl, tmplErr := template.ParseFiles(filepath.Join(config.StaticFilePath, "index.html"))
if tmplErr != nil {
return ctx.String(http.StatusInternalServerError, tmplErr.Error())
}
ctx.Response().Status = http.StatusNotFound
emptyResp := response.CheckoutCounterResponse{}
return tmpl.Execute(ctx.Response(), emptyResp)
return c.SucJson(ctx, emptyResp)
}
return ctx.String(http.StatusInternalServerError, err.Error())
}
tmpl, err := template.ParseFiles(filepath.Join(config.StaticFilePath, "index.html"))
if err != nil {
return ctx.String(http.StatusInternalServerError, err.Error())
}
return tmpl.Execute(ctx.Response(), resp)
return c.SucJson(ctx, resp)
}
// CheckStatus 支付状态检测