This commit is contained in:
aozhiwei 2024-06-20 13:30:31 +08:00
parent d94b61920f
commit 6860d1fe77
2 changed files with 18 additions and 5 deletions

View File

@ -1,8 +1,10 @@
package shopcart package shopcart
import ( import (
"q5"
"f5" "f5"
"main/constant" "main/constant"
"main/common"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -30,6 +32,13 @@ func (this *ShopCartApi) List(c *gin.Context) {
c.JSON(200, rspObj) c.JSON(200, rspObj)
return return
} }
cartDb := new(common.ShopCart)
if q5.DecodeJson(ds.GetByName("data"), cartDb) == nil {
q5.Sort[common.ShopCartGoods](cartDb.Goods,
func (a *common.ShopCartGoods, b *common.ShopCartGoods) bool{
return a.SortIdx < b.SortIdx
})
}
c.JSON(200, rspObj) c.JSON(200, rspObj)
}) })
} }

View File

@ -61,12 +61,16 @@ type StreamPagination struct {
Remaining int32 `json:"remaining"` Remaining int32 `json:"remaining"`
} }
type ShopCartGoods struct {
NetId int32 `json:"net_id"`
ContractAddress uint32 `json:"address"`
SortIdx uint32 `json:"idx"`
CreateTime int32 `json:"addtime"`
}
type ShopCart struct { type ShopCart struct {
CurrIdx uint32 `json:"curr_idx"` CurrSortIdx uint32 `json:"curr_sort_idx"`
Goolds map[string] struct { Goods []*ShopCartGoods `json:"goods"`
SortIdx uint32 `json:"sort_idx"`
CreateTime uint32 `json:"createtime"`
} `json:"goods"`
} }
type NftCache interface { type NftCache interface {