京东商城增加图片等api
This commit is contained in:
@@ -51,6 +51,36 @@ func (a *API) AccessStorePage(fullURL string, bizParams map[string]interface{},
|
||||
return retVal, err
|
||||
}
|
||||
|
||||
func (a *API) AccessStorePage2(fullURL string, bizParams map[string]interface{}) (retVal map[string]interface{}, err error) {
|
||||
if a.GetCookieCount() == 0 {
|
||||
return nil, fmt.Errorf("需要设置Store Cookie才能使用此方法")
|
||||
}
|
||||
data, _ := json.Marshal(bizParams)
|
||||
err = platformapi.AccessPlatformAPIWithRetry(a.client,
|
||||
func() *http.Request {
|
||||
request, _ := http.NewRequest(http.MethodPost, fullURL, strings.NewReader(string(data)))
|
||||
request.Header.Set("Content-Type", "application/json;charset=UTF-8")
|
||||
a.FillRequestCookies(request)
|
||||
return request
|
||||
},
|
||||
a.config,
|
||||
func(response *http.Response, bodyStr string, jsonResult1 map[string]interface{}) (errLevel string, err error) {
|
||||
if jsonResult1 == nil {
|
||||
return platformapi.ErrLevelRecoverableErr, fmt.Errorf("mapData is nil")
|
||||
}
|
||||
if err == nil {
|
||||
if jsonResult1["error_response"] != nil {
|
||||
errLevel = platformapi.ErrLevelGeneralFail
|
||||
err = utils.NewErrorCode(jsonResult1["error_response"].(map[string]interface{})["zh_desc"].(string), jsonResult1["error_response"].(map[string]interface{})["code"].(string))
|
||||
baseapi.SugarLogger.Debugf("jdeclp AccessAPI failed, jsonResult1:%s", utils.Format4Output(jsonResult1, true))
|
||||
}
|
||||
retVal = jsonResult1
|
||||
}
|
||||
return errLevel, err
|
||||
})
|
||||
return retVal, err
|
||||
}
|
||||
|
||||
type CreateShopCategoryParam struct {
|
||||
HomeShow string `json:"homeShow"`
|
||||
ID string `json:"id"`
|
||||
@@ -80,3 +110,89 @@ func (a *API) UpdateStoreStatus(storeID, storeStatus int) (err error) {
|
||||
}, true)
|
||||
return err
|
||||
}
|
||||
|
||||
type NewInfoListResult struct {
|
||||
ID int `json:"id"`
|
||||
VenderID int `json:"venderId"`
|
||||
CompanyID interface{} `json:"companyId"`
|
||||
CompanyName interface{} `json:"companyName"`
|
||||
StoreType interface{} `json:"storeType"`
|
||||
Name string `json:"name"`
|
||||
AddCode int `json:"addCode"`
|
||||
AddCodeName interface{} `json:"addCodeName"`
|
||||
AddName string `json:"addName"`
|
||||
AddCode1 int `json:"addCode1"`
|
||||
AddCode2 int `json:"addCode2"`
|
||||
AddCode4 interface{} `json:"addCode4"`
|
||||
BussinessBeginTime interface{} `json:"bussinessBeginTime"`
|
||||
BussinessEndTime interface{} `json:"bussinessEndTime"`
|
||||
AddNameExtend interface{} `json:"addNameExtend"`
|
||||
Coordinate interface{} `json:"coordinate"`
|
||||
CommodityNum int `json:"commodityNum"`
|
||||
Status interface{} `json:"status"`
|
||||
Created interface{} `json:"created"`
|
||||
Modified interface{} `json:"modified"`
|
||||
Phone interface{} `json:"phone"`
|
||||
EncryptPhone interface{} `json:"encryptPhone"`
|
||||
StoreGroupIds interface{} `json:"storeGroupIds"`
|
||||
VirtualStoresIds interface{} `json:"virtualStoresIds"`
|
||||
VirtualStoresInDB interface{} `json:"virtualStoresInDB"`
|
||||
Address interface{} `json:"address"`
|
||||
Account interface{} `json:"account"`
|
||||
UserName interface{} `json:"userName"`
|
||||
Pwd interface{} `json:"pwd"`
|
||||
CrmPwd interface{} `json:"crmPwd"`
|
||||
Type interface{} `json:"type"`
|
||||
AccountIsAuth interface{} `json:"accountIsAuth"`
|
||||
Slogan interface{} `json:"slogan"`
|
||||
Mobilephone interface{} `json:"mobilephone"`
|
||||
EncryptMobilephone interface{} `json:"encryptMobilephone"`
|
||||
UnboundedBizType interface{} `json:"unboundedBizType"`
|
||||
ExStoreID string `json:"exStoreId"`
|
||||
ExStoreSource interface{} `json:"exStoreSource"`
|
||||
MdImg interface{} `json:"mdImg"`
|
||||
AccountName interface{} `json:"accountName"`
|
||||
StoreStatus int `json:"storeStatus"`
|
||||
BusinessTime interface{} `json:"businessTime"`
|
||||
IsBindingPurse interface{} `json:"isBindingPurse"`
|
||||
GroupName interface{} `json:"groupName"`
|
||||
SplitID interface{} `json:"splitId"`
|
||||
BusinessID interface{} `json:"businessId"`
|
||||
BrandID interface{} `json:"brandId"`
|
||||
ReturnType interface{} `json:"returnType"`
|
||||
PhoneType interface{} `json:"phoneType"`
|
||||
AfterPhone interface{} `json:"afterPhone"`
|
||||
DeptID interface{} `json:"deptId"`
|
||||
Remark interface{} `json:"remark"`
|
||||
AuditStatus int `json:"auditStatus"`
|
||||
CategoryID1 interface{} `json:"categoryId1"`
|
||||
CategoryID2 interface{} `json:"categoryId2"`
|
||||
CategoryName1 interface{} `json:"categoryName1"`
|
||||
CategoryName2 interface{} `json:"categoryName2"`
|
||||
ImgURL interface{} `json:"imgUrl"`
|
||||
StoreStatusName string `json:"storeStatusName"`
|
||||
AuditStatusName string `json:"auditStatusName"`
|
||||
OperateStatus interface{} `json:"operateStatus"`
|
||||
Pin interface{} `json:"pin"`
|
||||
}
|
||||
|
||||
//京东商城查询门店营业状态
|
||||
//https://stores.shop.jd.com/stores/newInfoList
|
||||
func (a *API) NewInfoList(storeID int64) (newInfoListResult *NewInfoListResult, err error) {
|
||||
var newInfoListResult2 []*NewInfoListResult
|
||||
result, err := a.AccessStorePage2("https://stores.shop.jd.com/stores/newInfoList", map[string]interface{}{
|
||||
"storeId": storeID,
|
||||
"inCache": 0,
|
||||
"index": 1,
|
||||
"pageSize": 10,
|
||||
"companyName": nil,
|
||||
"exStoreId": nil,
|
||||
"storeName": nil,
|
||||
"storeStatus": nil,
|
||||
})
|
||||
if err == nil {
|
||||
utils.Map2StructByJson(result["list"], &newInfoListResult2, false)
|
||||
}
|
||||
newInfoListResult = newInfoListResult2[0]
|
||||
return newInfoListResult, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user