This commit is contained in:
gazebo
2019-11-08 16:46:39 +08:00
parent 354bbd2049
commit cf01b4d852

View File

@@ -77,7 +77,26 @@ type DeliveryType struct {
Selected bool `json:"selected"`
}
func (a *API) QueryGoodsList(pageNum, pageSize int, orderBy []map[string]interface{}, queryParameter map[string]interface{}) (retVal []map[string]interface{}, totalCount int, err error) {
type GoodsInfo struct {
AvaliableStockNum int `json:"avaliableStockNum"`
DefaultImageURL string `json:"defaultImageUrl"`
ExistEmptyStock bool `json:"existEmptyStock"`
GoodsID int64 `json:"goodsId"`
IsAllStockEmpty bool `json:"isAllStockEmpty"`
IsCanSell bool `json:"isCanSell"`
IsExistEmptyStock bool `json:"isExistEmptyStock"`
IsMultiSku int `json:"isMultiSku"`
IsPutAway int `json:"isPutAway"`
MaxPrice float64 `json:"maxPrice"`
MinPrice float64 `json:"minPrice"`
PutAwayDate int64 `json:"putAwayDate"`
PutAwayForBackend int `json:"putAwayForBackend"`
SalesNum int `json:"salesNum"`
SortNum int `json:"sortNum"`
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) {
apiParams := map[string]interface{}{
"pageNum": pageNum,
"pageSize": pageSize,
@@ -90,13 +109,11 @@ func (a *API) QueryGoodsList(pageNum, pageSize int, orderBy []map[string]interfa
}
result, err := a.AccessAPI("goods/queryGoodsList", apiParams)
if err == nil {
if pageList, ok := result.(map[string]interface{})["pageList"].([]interface{}); ok {
retVal = utils.Slice2MapSlice(pageList)
}
totalCount = int(utils.MustInterface2Int64(result.(map[string]interface{})["totalCount"]))
return retVal, totalCount, nil
data := result.(map[string]interface{})
totalCount = int(utils.MustInterface2Int64(data["totalCount"]))
err = utils.Map2StructByJson(data["pageList"], &goodsList, false)
}
return nil, 0, err
return goodsList, totalCount, err
}
func (a *API) QueryGoodsDetail(goodsId int64) (retVal map[string]interface{}, err error) {