Merge branch 'master' of e.coding.net:rosydev/baseapi
This commit is contained in:
@@ -96,18 +96,31 @@ type GoodsInfo struct {
|
|||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) QueryGoodsList(pageNum, pageSize int, orderBy []map[string]interface{}, queryParameter map[string]interface{}) (goodsList []*GoodsInfo, totalCount int, err error) {
|
type QueryGoodsListParam struct {
|
||||||
apiParams := map[string]interface{}{
|
PageNum int `json:"pageNum"`
|
||||||
"pageNum": pageNum,
|
PageSize int `json:"pageSize"`
|
||||||
"pageSize": pageSize,
|
OrderBy
|
||||||
|
GoodsParameter
|
||||||
|
}
|
||||||
|
|
||||||
|
type OrderBy struct {
|
||||||
|
Field string `json:"field"` //排序字段名: sortNum:按照sort字段排序 putAwayDate:按照上下架时间排序 salesNum:按照销量排序 availableStockNum:按照库存排序 price:按照价格排序
|
||||||
|
Sort string `json:"sort"` //升降/降序 DESC/ASC,只能是这两个值,不区分大小写
|
||||||
|
}
|
||||||
|
|
||||||
|
type GoodsParameter struct {
|
||||||
|
GoodsStatus int `json:"goodsStatus"` //商品状态:0-上架中 1-下架中 2-已售罄
|
||||||
|
GoodsClassifyID int `json:"goodsClassifyId"` //分组id
|
||||||
|
Search string `json:"search"` //搜索框输入内容商品名称
|
||||||
|
GoodsPrice float32 `json:"goodsPrice"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *API) QueryGoodsList(queryParam *QueryGoodsListParam) (goodsList []*GoodsInfo, totalCount int, err error) {
|
||||||
|
param := make(map[string]interface{})
|
||||||
|
if queryParam != nil {
|
||||||
|
param = utils.Struct2FlatMap(queryParam)
|
||||||
}
|
}
|
||||||
if orderBy != nil {
|
result, err := a.AccessAPI("goods/queryGoodsList", param)
|
||||||
apiParams["orderBy"] = orderBy
|
|
||||||
}
|
|
||||||
if queryParameter != nil {
|
|
||||||
apiParams["queryParameter"] = queryParameter
|
|
||||||
}
|
|
||||||
result, err := a.AccessAPI("goods/queryGoodsList", apiParams)
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
data := result.(map[string]interface{})
|
data := result.(map[string]interface{})
|
||||||
totalCount = int(utils.MustInterface2Int64(data["totalCount"]))
|
totalCount = int(utils.MustInterface2Int64(data["totalCount"]))
|
||||||
|
|||||||
Reference in New Issue
Block a user