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.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.Next()
})

View File

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