1
This commit is contained in:
@@ -784,3 +784,55 @@ func (a *API) EcommerceGetOrderIdByPage(poiCode string, startTime, endTime time.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// QuerySkuIsNeedUpc 查看商品是否需要填写upc
|
||||
func (a *API) QuerySkuIsNeedUpc(tagId int) bool {
|
||||
data, err := a.AccessAPI2("retail/field/required/info", true, map[string]interface{}{"tag_id": tagId}, "success_map", "")
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
upc := data.(map[string]interface{})["upc"]
|
||||
upcCode := utils.Interface2Int64WithDefault(upc, 1)
|
||||
return upcCode == 0
|
||||
}
|
||||
|
||||
// 去除多以属性
|
||||
func CommonAttrValueUpdate(commonAttrValue string) string {
|
||||
commonAttrValueObj := make([]*CommonAttrValueList, 0, 0)
|
||||
if err := json.Unmarshal([]byte(commonAttrValue), &commonAttrValueObj); err != nil {
|
||||
return ""
|
||||
}
|
||||
|
||||
result := make([]map[string]interface{}, 0, 0)
|
||||
for _, v := range commonAttrValueObj {
|
||||
commonAttrValueMap := utils.Struct2Map(v, "", false)
|
||||
delete(commonAttrValueMap, "setAttrId")
|
||||
delete(commonAttrValueMap, "setAttrName")
|
||||
delete(commonAttrValueMap, "setValueList")
|
||||
delete(commonAttrValueMap, "valueListSize")
|
||||
delete(commonAttrValueMap, "valueListIterator")
|
||||
result = append(result, commonAttrValueMap)
|
||||
}
|
||||
|
||||
result2, _ := json.Marshal(result)
|
||||
return string(result2)
|
||||
}
|
||||
|
||||
type CommonAttrValueList struct {
|
||||
AttrId int `json:"attrId"`
|
||||
AttrName string `json:"attrName"`
|
||||
ValueList []struct {
|
||||
SetValue bool `json:"setValue"`
|
||||
SetValueId bool `json:"setValueId"`
|
||||
Value string `json:"value"`
|
||||
ValueId int `json:"valueId"`
|
||||
} `json:"valueList"`
|
||||
|
||||
SetAttrId bool `json:"setAttrId"`
|
||||
SetAttrName bool `json:"setAttrName"`
|
||||
SetValueList bool `json:"setValueList"`
|
||||
ValueListIterator []struct {
|
||||
Ref string `json:"$ref"`
|
||||
} `json:"valueListIterator"`
|
||||
ValueListSize int `json:"valueListSize"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user