- 一些与门店商品信息操作相关的API

This commit is contained in:
gazebo
2019-05-26 22:06:04 +08:00
parent 96818a206e
commit c6954769a1
4 changed files with 135 additions and 34 deletions

View File

@@ -20,6 +20,17 @@ type RetailTag struct {
NamePath string `json:"namePath"`
}
type BareStoreSkuInfo struct {
SkuID string `json:"sku_id"`
Price string `json:"price,omitempty"`
Stock string `json:"stock,omitempty"`
}
type BareStoreFoodInfo struct {
AppFoodCode string `json:"app_food_code"`
Skus []*BareStoreSkuInfo `json:"skus"`
}
// 美团分类没有ID就以名字为唯一标识不论级别都必须不能重名
// name和originName的长度不能超过10个字符字符不是字节
// 创建一级分类originName为空name为新分类名secondaryName为空
@@ -100,7 +111,7 @@ func (a *API) RetailBatchInitData(poiCode string, foodDataList []map[string]inte
return err
}
func (a *API) RetailSkuPrice(poiCode string, foodData []map[string]interface{}) (err error) {
func (a *API) RetailSkuPrice(poiCode string, foodData []*BareStoreFoodInfo) (err error) {
_, err = a.AccessAPI("retail/sku/price", false, map[string]interface{}{
KeyAppPoiCode: poiCode,
"food_data": string(utils.MustMarshal(foodData)),
@@ -108,7 +119,7 @@ func (a *API) RetailSkuPrice(poiCode string, foodData []map[string]interface{})
return err
}
func (a *API) RetailSkuStock(poiCode string, foodData []map[string]interface{}) (err error) {
func (a *API) RetailSkuStock(poiCode string, foodData []*BareStoreFoodInfo) (err error) {
_, err = a.AccessAPI("retail/sku/stock", false, map[string]interface{}{
KeyAppPoiCode: poiCode,
"food_data": string(utils.MustMarshal(foodData)),
@@ -146,6 +157,15 @@ func (a *API) RetailSkuSellStatus(poiCode string, foodData []map[string]interfac
return err
}
func (a *API) RetailSkuSellStatus2(poiCode string, foodData []*BareStoreFoodInfo, sellStatus int) (err error) {
_, err = a.AccessAPI("retail/sku/sellStatus", false, map[string]interface{}{
KeyAppPoiCode: poiCode,
"food_data": string(utils.MustMarshal(foodData)),
"sell_status": sellStatus,
})
return err
}
func (a *API) RetailDelete(poiCode, foodCode string) (err error) {
_, err = a.AccessAPI("retail/delete", false, map[string]interface{}{
KeyAppPoiCode: poiCode,