This commit is contained in:
苏尹岚
2021-03-15 17:00:58 +08:00
parent df5ad51e3d
commit 99c751af74
7 changed files with 294 additions and 13 deletions

View File

@@ -19,15 +19,15 @@ func init() {
baseapi.Init(sugarLogger)
// 菜市
// api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "")
api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "")
// 果园
// api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "")
//商超
api = New("5873", "41c479790a76f86326f89e8048964739", "", "") //token_nH_IlcWQKAkZBqklwItNRw
// api = New("5873", "41c479790a76f86326f89e8048964739", "", "") //token_nH_IlcWQKAkZBqklwItNRw
cookieStr := `
acctId=62884810; token=0_0_vJux6rcmm0XIzoI885_aew-gnfofUw9SR-a-QkLw*; brandId=-1; wmPoiId=-1;
__mta=188489239.1577327492709.1577327492709.1577327492709.1; uuid=e8034a4d222c4b51b81c.1574126611.1.0.0; _ga=GA1.2.827950563.1574128001; uuid_update=true; _lxsdk_cuid=16eb02a8a02c8-0a92cb9af9798c-3d375b01-15f900-16eb02a8a02c8; _lxsdk=16eb02a8a02c8-0a92cb9af9798c-3d375b01-15f900-16eb02a8a02c8; device_uuid=!aaa93749-2445-4e1e-b178-956ac0ea5e45; t_lxid=1719bfe9d5e30-0cf08957b60ff-3d375b01-15f900-1719bfe9d5fc8-tid; pushToken=0-AQeAm60pIt3VbpGu3MbPpMfRVaeCxP9tacRSFq7lmI*; lsu=; mtcdn=K; wpush_server_url=wss://wpush.meituan.com; e_u_id_3299326472=e5ae16afe444349d24af7d33b66620a1; acctId=57396785; token=05dB_LgouAsXUZyajkn4BYPNqwhsIKOlpJVj8bCpWU_k*; brandId=-1; wmPoiId=-1; isOfflineSelfOpen=0; city_id=0; isChain=1; existBrandPoi=true; ignore_set_router_proxy=true; region_id=; region_version=0; newCategory=true; bsid=u1QwYRWkS6s4UbPe51pD2yxb39UkgViO2fo-eOwBX5KneNsBZsAPYAbAnl7IiE0b-MqLwRQRt7QwwU79IkPepA; cityId=510100; provinceId=510000; city_location_id=0; location_id=0; JSESSIONID=on9wehapo37eso6i98ot3p97; shopCategory=food; set_info=%7B%22wmPoiId%22%3A-1%2C%22ignoreSetRouterProxy%22%3Atrue%7D; cacheTimeMark=2021-03-15; pharmacistAccount=0; _lxsdk_s=17834f8e90f-c8b-674-c89%7C%7C19
`
api.SetCookieWithStr(cookieStr)
}

View File

@@ -142,13 +142,292 @@ func (a *API) GetStoreInfo(storeID string) (storeInfo map[string]interface{}, er
return retVal, err
}
type GetStandardProductListWithCondResult struct {
IsMedicare bool `json:"isMedicare"`
SpVideoVo interface{} `json:"spVideoVo"`
LockStatus int `json:"lockStatus"`
LockTips interface{} `json:"lockTips"`
SpPicContent string `json:"spPicContent"`
ExistInPoi bool `json:"existInPoi"`
MonthSale int `json:"monthSale"`
Skus []struct {
ShelfNum string `json:"shelfNum"`
ItemNum string `json:"itemNum"`
LimitStock int `json:"limitStock"`
Sequence int `json:"sequence"`
Weight float64 `json:"weight"`
Price interface{} `json:"price"`
WeightUnit string `json:"weightUnit"`
SkuAttrs interface{} `json:"skuAttrs"`
Spec string `json:"spec"`
Stock interface{} `json:"stock"`
MinOrderCount int `json:"minOrderCount"`
Unit string `json:"unit"`
UpcCode string `json:"upcCode"`
BizValue interface{} `json:"bizValue"`
ProductName interface{} `json:"productName"`
BoxPrice float64 `json:"boxPrice"`
BoxNum int `json:"boxNum"`
ID int `json:"id"`
} `json:"skus"`
CategoryAttrMap struct {
Num1200000088 struct {
SupportFilter int `json:"supportFilter"`
Application string `json:"application"`
OptionMaxSize int `json:"optionMaxSize"`
TextMaxLength int `json:"textMaxLength"`
CharacterType string `json:"characterType"`
SupportExtend string `json:"supportExtend"`
AttrName string `json:"attrName"`
Sequence int `json:"sequence"`
Level int `json:"level"`
InputType int `json:"inputType"`
WmPoiID int `json:"wmPoiId"`
CategoryID int `json:"categoryId"`
IsLeaf int `json:"isLeaf"`
SpuID int `json:"spuId"`
ValueList []struct {
Sequence int `json:"sequence"`
Text interface{} `json:"text"`
IsLeaf int `json:"isLeaf"`
ValueID int `json:"valueId"`
ValueIDPath string `json:"valueIdPath"`
ValuePath string `json:"valuePath"`
Selected int `json:"selected"`
Value string `json:"value"`
} `json:"valueList"`
AttrID int `json:"attrId"`
AttrType int `json:"attrType"`
TemplateID int `json:"templateId"`
IsRequired int `json:"isRequired"`
ID int `json:"id"`
} `json:"1200000088"`
Num1200000094 struct {
SupportFilter int `json:"supportFilter"`
Application string `json:"application"`
OptionMaxSize int `json:"optionMaxSize"`
TextMaxLength int `json:"textMaxLength"`
CharacterType string `json:"characterType"`
SupportExtend string `json:"supportExtend"`
AttrName string `json:"attrName"`
Sequence int `json:"sequence"`
Level int `json:"level"`
InputType int `json:"inputType"`
WmPoiID int `json:"wmPoiId"`
CategoryID int `json:"categoryId"`
IsLeaf int `json:"isLeaf"`
SpuID int `json:"spuId"`
ValueList []struct {
Sequence int `json:"sequence"`
Text interface{} `json:"text"`
IsLeaf int `json:"isLeaf"`
ValueID int `json:"valueId"`
ValueIDPath string `json:"valueIdPath"`
ValuePath string `json:"valuePath"`
Selected int `json:"selected"`
Value string `json:"value"`
} `json:"valueList"`
AttrID int `json:"attrId"`
AttrType int `json:"attrType"`
TemplateID int `json:"templateId"`
IsRequired int `json:"isRequired"`
ID int `json:"id"`
} `json:"1200000094"`
Num1200000135 struct {
SupportFilter int `json:"supportFilter"`
Application string `json:"application"`
OptionMaxSize int `json:"optionMaxSize"`
TextMaxLength int `json:"textMaxLength"`
CharacterType string `json:"characterType"`
SupportExtend string `json:"supportExtend"`
AttrName string `json:"attrName"`
Sequence int `json:"sequence"`
Level int `json:"level"`
InputType int `json:"inputType"`
WmPoiID int `json:"wmPoiId"`
CategoryID int `json:"categoryId"`
IsLeaf int `json:"isLeaf"`
SpuID int `json:"spuId"`
ValueList []struct {
Sequence int `json:"sequence"`
Text interface{} `json:"text"`
IsLeaf int `json:"isLeaf"`
ValueID int `json:"valueId"`
ValueIDPath interface{} `json:"valueIdPath"`
ValuePath interface{} `json:"valuePath"`
Selected int `json:"selected"`
Value string `json:"value"`
} `json:"valueList"`
AttrID int `json:"attrId"`
AttrType int `json:"attrType"`
TemplateID int `json:"templateId"`
IsRequired int `json:"isRequired"`
ID int `json:"id"`
} `json:"1200000135"`
Num1200000210 struct {
SupportFilter int `json:"supportFilter"`
Application string `json:"application"`
OptionMaxSize int `json:"optionMaxSize"`
TextMaxLength int `json:"textMaxLength"`
CharacterType string `json:"characterType"`
SupportExtend string `json:"supportExtend"`
AttrName string `json:"attrName"`
Sequence int `json:"sequence"`
Level int `json:"level"`
InputType int `json:"inputType"`
WmPoiID int `json:"wmPoiId"`
CategoryID int `json:"categoryId"`
IsLeaf int `json:"isLeaf"`
SpuID int `json:"spuId"`
ValueList []struct {
Sequence int `json:"sequence"`
Text interface{} `json:"text"`
IsLeaf int `json:"isLeaf"`
ValueID int `json:"valueId"`
ValueIDPath interface{} `json:"valueIdPath"`
ValuePath interface{} `json:"valuePath"`
Selected int `json:"selected"`
Value string `json:"value"`
} `json:"valueList"`
AttrID int `json:"attrId"`
AttrType int `json:"attrType"`
TemplateID int `json:"templateId"`
IsRequired int `json:"isRequired"`
ID int `json:"id"`
} `json:"1200000210"`
} `json:"categoryAttrMap"`
SpuSaleAttrMap interface{} `json:"spuSaleAttrMap"`
OriginName string `json:"originName"`
SetOrigin bool `json:"setOrigin"`
SetWeightUnit bool `json:"setWeightUnit"`
AvgPrice int `json:"avgPrice"`
SetAvgPrice bool `json:"setAvgPrice"`
SetEan bool `json:"setEan"`
SetShelfStatus bool `json:"setShelfStatus"`
ShelfStatus int `json:"shelfStatus"`
RefCount int `json:"refCount"`
SetRefCount bool `json:"setRefCount"`
IsReceipt int `json:"is_receipt"`
SetPic bool `json:"setPic"`
CheckerID int `json:"checkerId"`
SetCheckerID bool `json:"setCheckerId"`
CheckerName string `json:"checkerName"`
SetCheckerName bool `json:"setCheckerName"`
CheckRemark interface{} `json:"checkRemark"`
SetCheckRemark bool `json:"setCheckRemark"`
CheckTime int `json:"checkTime"`
SetCheckTime bool `json:"setCheckTime"`
IsMulitEan int `json:"isMulitEan"`
SetIsMulitEan bool `json:"setIsMulitEan"`
SetCategoryNamePath bool `json:"setCategoryNamePath"`
CategoryIDPath string `json:"categoryIdPath"`
SetCategoryIDPath bool `json:"setCategoryIdPath"`
SetBrandNamePath bool `json:"setBrandNamePath"`
SuggestedPrice int `json:"suggestedPrice"`
SetSuggestedPrice bool `json:"setSuggestedPrice"`
SetRiseMax bool `json:"setRiseMax"`
SetDropMax bool `json:"setDropMax"`
ExpPeriod int `json:"expPeriod"`
SetExpPeriod bool `json:"setExpPeriod"`
ExpUnit int `json:"expUnit"`
SetExpUnit bool `json:"setExpUnit"`
SuppleFact string `json:"suppleFact"`
SetSuppleFact bool `json:"setSuppleFact"`
SubOrigin int `json:"subOrigin"`
SetSubOrigin bool `json:"setSubOrigin"`
SalePriceWeight int `json:"salePriceWeight"`
SetSalePriceWeight bool `json:"setSalePriceWeight"`
SrcPic string `json:"srcPic"`
SetSrcPic bool `json:"setSrcPic"`
BrandZhName interface{} `json:"brandZhName"`
SetBrandZhName bool `json:"setBrandZhName"`
BrandEnName interface{} `json:"brandEnName"`
SetBrandEnName bool `json:"setBrandEnName"`
SetIsReceipt bool `json:"setIs_receipt"`
ReceiptorID int `json:"receiptorId"`
SetReceiptorID bool `json:"setReceiptorId"`
SpecNew float64 `json:"specNew"`
SetSpecNew bool `json:"setSpecNew"`
SpecUnit string `json:"specUnit"`
SetSpecUnit bool `json:"setSpecUnit"`
SpecCount int `json:"specCount"`
SetSpecCount bool `json:"setSpecCount"`
SpecCountUnit string `json:"specCountUnit"`
SetSpecCountUnit bool `json:"setSpecCountUnit"`
IsBigSpec int `json:"isBigSpec"`
SetIsBigSpec bool `json:"setIsBigSpec"`
WeightNew float64 `json:"weightNew"`
SetWeightNew bool `json:"setWeightNew"`
Description string `json:"description"`
Sequence int `json:"sequence"`
SetSize bool `json:"setSize"`
Source int `json:"source"`
Origin int `json:"origin"`
OriginType int `json:"originType"`
SetName bool `json:"setName"`
SetID bool `json:"setId"`
Weight int `json:"weight"`
SetWeight bool `json:"setWeight"`
Valid int `json:"valid"`
BrandID int `json:"brandId"`
CategoryName string `json:"categoryName"`
CategoryID int `json:"categoryId"`
WeightUnit interface{} `json:"weightUnit"`
Pic string `json:"pic"`
Spec string `json:"spec"`
Ctime int `json:"ctime"`
EanList []string `json:"eanList"`
CategoryNamePath string `json:"categoryNamePath"`
Utime int `json:"utime"`
Unit string `json:"unit"`
IsSp int `json:"isSp"`
Ean string `json:"ean"`
CheckStatus int `json:"checkStatus"`
SpName string `json:"spName"`
BrandNamePath string `json:"brandNamePath"`
Cuid int `json:"cuid"`
RiseMax int `json:"riseMax"`
DropMax int `json:"dropMax"`
SetSpName bool `json:"setSpName"`
SetOriginType bool `json:"setOriginType"`
SetIsSp bool `json:"setIsSp"`
SetBrandID bool `json:"setBrandId"`
SetCheckStatus bool `json:"setCheckStatus"`
EanListSize int `json:"eanListSize"`
EanListIterator []string `json:"eanListIterator"`
SetEanList bool `json:"setEanList"`
SetCategoryID bool `json:"setCategoryId"`
SetSpec bool `json:"setSpec"`
Muid int `json:"muid"`
SetMuid bool `json:"setMuid"`
SetSource bool `json:"setSource"`
SetUnit bool `json:"setUnit"`
SetSequence bool `json:"setSequence"`
SetCtime bool `json:"setCtime"`
SetUtime bool `json:"setUtime"`
SetValid bool `json:"setValid"`
SetDescription bool `json:"setDescription"`
Cuname interface{} `json:"cuname"`
SetCuname bool `json:"setCuname"`
Muname interface{} `json:"muname"`
SetMuname bool `json:"setMuname"`
SetCuid bool `json:"setCuid"`
SetCategoryName bool `json:"setCategoryName"`
Name string `json:"name"`
ID int `json:"id"`
Size string `json:"size"`
}
//https://shangoue.meituan.com/reuse/sc/product/retail/r/getStandardProductListWithCond
func (a *API) GetStandardProductListWithCond(upc string) (err error) {
func (a *API) GetStandardProductListWithCond(upc string) (getStandardProductListWithCondResult *GetStandardProductListWithCondResult, err error) {
params := map[string]interface{}{
"keyword": upc,
"pageNo": 1,
"pageSize": 20,
}
_, err = a.AccessUserPage("reuse/sc/product/retail/r/getStandardProductListWithCond", params)
return err
result, err := a.AccessUserPage("reuse/sc/product/retail/r/getStandardProductListWithCond", params)
if err == nil {
utils.Map2StructByJson(result["list"].([]interface{})[0], &getStandardProductListWithCondResult, false)
}
return getStandardProductListWithCondResult, err
}

View File

@@ -43,9 +43,9 @@ func TestGetStoreInfo(t *testing.T) {
}
func TestGetStandardProductListWithCond(t *testing.T) {
err := api.GetStandardProductListWithCond("6925436710085")
result, err := api.GetStandardProductListWithCond("6925436710085")
if err != nil {
t.Fatal(err)
}
// t.Log(utils.Format4Output(result, false))
t.Log(utils.Format4Output(result, false))
}