1
This commit is contained in:
parent
729665593f
commit
d94b61920f
@ -1,6 +1,8 @@
|
|||||||
package shopcart
|
package shopcart
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"f5"
|
||||||
|
"main/constant"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -9,6 +11,27 @@ type ShopCartApi struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *ShopCartApi) List(c *gin.Context) {
|
func (this *ShopCartApi) List(c *gin.Context) {
|
||||||
|
rspObj := &struct {
|
||||||
|
ErrCode int32 `json:"errcode"`
|
||||||
|
ErrMsg string `json:"errmsg"`
|
||||||
|
Data []interface{} `json:"data"`
|
||||||
|
}{}
|
||||||
|
openId := c.MustGet("open_id").(string)
|
||||||
|
f5.GetGoStyleDb().OrmSelectOne(
|
||||||
|
constant.BCNFT_DB,
|
||||||
|
"t_shopcart",
|
||||||
|
[][]string{
|
||||||
|
{"open_id", openId},
|
||||||
|
},
|
||||||
|
func (err error, ds* f5.DataSet) {
|
||||||
|
if err != nil {
|
||||||
|
rspObj.ErrCode = 500
|
||||||
|
rspObj.ErrMsg = "server internal error"
|
||||||
|
c.JSON(200, rspObj)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
c.JSON(200, rspObj)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *ShopCartApi) Add(c *gin.Context) {
|
func (this *ShopCartApi) Add(c *gin.Context) {
|
||||||
|
@ -61,6 +61,14 @@ type StreamPagination struct {
|
|||||||
Remaining int32 `json:"remaining"`
|
Remaining int32 `json:"remaining"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ShopCart struct {
|
||||||
|
CurrIdx uint32 `json:"curr_idx"`
|
||||||
|
Goolds map[string] struct {
|
||||||
|
SortIdx uint32 `json:"sort_idx"`
|
||||||
|
CreateTime uint32 `json:"createtime"`
|
||||||
|
} `json:"goods"`
|
||||||
|
}
|
||||||
|
|
||||||
type NftCache interface {
|
type NftCache interface {
|
||||||
GetRawData() string
|
GetRawData() string
|
||||||
GetJsonData() interface{}
|
GetJsonData() interface{}
|
||||||
|
10
server/marketserver/middleware/jwtauth.go
Normal file
10
server/marketserver/middleware/jwtauth.go
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
package middleware
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
)
|
||||||
|
|
||||||
|
func JwtAuth(c *gin.Context) {
|
||||||
|
//tokenHeader := c.Request.Header.Get("Authorization")
|
||||||
|
c.Next()
|
||||||
|
}
|
@ -9,7 +9,7 @@ type ShopCartRouter struct{}
|
|||||||
|
|
||||||
func (this *ShopCartRouter) InitRouter() {
|
func (this *ShopCartRouter) InitRouter() {
|
||||||
api := v1.ApiGroupApp.ShopCartApiGroup
|
api := v1.ApiGroupApp.ShopCartApiGroup
|
||||||
f5.GetApp().GetGinEngine().GET("/shopcart/list", api.ShopCartApi.List)
|
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/add", api.ShopCartApi.Add)
|
||||||
f5.GetApp().GetGinEngine().POST("/api/shopcart/del", api.ShopCartApi.Del)
|
f5.GetApp().GetGinEngine().POST("/api/shopcart/del", api.ShopCartApi.Del)
|
||||||
f5.GetApp().GetGinEngine().POST("/api/shopcart/clear", api.ShopCartApi.Clear)
|
f5.GetApp().GetGinEngine().POST("/api/shopcart/clear", api.ShopCartApi.Clear)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user