This commit is contained in:
aozhiwei 2024-06-21 08:45:43 +08:00
parent df6798dad1
commit 1f0622ac64
2 changed files with 12 additions and 4 deletions

View File

@ -62,6 +62,13 @@ func JwtAuth(c *gin.Context) {
} }
rspObj.ErrCode = q5.SafeToInt32(jsonRspObj.ErrCode) rspObj.ErrCode = q5.SafeToInt32(jsonRspObj.ErrCode)
rspObj.ErrMsg = jsonRspObj.ErrMsg rspObj.ErrMsg = jsonRspObj.ErrMsg
if rspObj.ErrCode != 0 {
rspObj.ErrCode = 501
rspObj.ErrMsg = "jwt error"
c.JSON(200, rspObj)
c.Abort()
return
}
c.Set("open_id", jsonRspObj.Decoded.Sub) c.Set("open_id", jsonRspObj.Decoded.Sub)
c.Next() c.Next()
}) })

View File

@ -9,8 +9,9 @@ type ShopCartRouter struct{}
func (this *ShopCartRouter) InitRouter() { func (this *ShopCartRouter) InitRouter() {
api := v1.ApiGroupApp.ShopCartApiGroup api := v1.ApiGroupApp.ShopCartApiGroup
f5.GetApp().GetGinEngine().GET("/api/shopcart/list", api.ShopCartApi.List) shopCartGroup := f5.GetApp().GetGinEngine().Group("/api/shopcart")
f5.GetApp().GetGinEngine().POST("/api/shopcart/add", api.ShopCartApi.Add) shopCartGroup.GET("/list", api.ShopCartApi.List)
f5.GetApp().GetGinEngine().POST("/api/shopcart/del", api.ShopCartApi.Del) shopCartGroup.POST("/add", api.ShopCartApi.Add)
f5.GetApp().GetGinEngine().POST("/api/shopcart/clear", api.ShopCartApi.Clear) shopCartGroup.POST("/del", api.ShopCartApi.Del)
shopCartGroup.POST("/clear", api.ShopCartApi.Clear)
} }