Accept Merge Request #63: (yonghui -> mark)
Merge Request: 导出平台未营业门店 Created By: @苏尹岚 Accepted By: @苏尹岚 URL: https://rosydev.coding.net/p/jx-callback/d/jx-callback/git/merge/63
This commit is contained in:
@@ -135,6 +135,7 @@ type VendorStoreExcel struct {
|
|||||||
Status string `json:"营业状态"`
|
Status string `json:"营业状态"`
|
||||||
Tel1 string `json:"电话1"`
|
Tel1 string `json:"电话1"`
|
||||||
Tel2 string `json:"电话2"`
|
Tel2 string `json:"电话2"`
|
||||||
|
Address string `json:"地址"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -174,6 +175,7 @@ var (
|
|||||||
"营业状态",
|
"营业状态",
|
||||||
"电话1",
|
"电话1",
|
||||||
"电话2",
|
"电话2",
|
||||||
|
"地址",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -2290,13 +2292,18 @@ func GetVendorStoreInfo(ctx *jxcontext.Context, vendorIDList []int, isAsync, isC
|
|||||||
storeListJD []VendorStoreExcel
|
storeListJD []VendorStoreExcel
|
||||||
storeListMT []VendorStoreExcel
|
storeListMT []VendorStoreExcel
|
||||||
storeListEB []VendorStoreExcel
|
storeListEB []VendorStoreExcel
|
||||||
|
storeIDs []string
|
||||||
)
|
)
|
||||||
taskSeqFunc := func(task *tasksch.SeqTask, step int, params ...interface{}) (result interface{}, err error) {
|
taskSeqFunc := func(task *tasksch.SeqTask, step int, params ...interface{}) (result interface{}, err error) {
|
||||||
switch step {
|
switch step {
|
||||||
case 0:
|
case 0:
|
||||||
for _, vendorID := range vendorIDList {
|
for _, vendorID := range vendorIDList {
|
||||||
iStoreHandler, _ := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.IStoreHandler)
|
iStoreHandler, _ := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.IStoreHandler)
|
||||||
storeIDs, err := iStoreHandler.GetAllStoresVendorID(ctx, "") // TODO
|
if vendorID == model.VendorIDEBAI {
|
||||||
|
storeIDs, err = ebai.CurPurchaseHandler.GetShopIDsByPage()
|
||||||
|
} else {
|
||||||
|
storeIDs, err = iStoreHandler.GetAllStoresVendorID(ctx, "")
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
@@ -2322,6 +2329,7 @@ func GetVendorStoreInfo(ctx *jxcontext.Context, vendorIDList []int, isAsync, isC
|
|||||||
VendorStoreName: storeDetail.Name,
|
VendorStoreName: storeDetail.Name,
|
||||||
Tel1: storeDetail.Tel1,
|
Tel1: storeDetail.Tel1,
|
||||||
Tel2: storeDetail.Tel2,
|
Tel2: storeDetail.Tel2,
|
||||||
|
Address: storeDetail.Address,
|
||||||
Status: StoreStatus2Chinese(storeDetail.Status),
|
Status: StoreStatus2Chinese(storeDetail.Status),
|
||||||
}
|
}
|
||||||
retVal = []VendorStoreExcel{storeExcel}
|
retVal = []VendorStoreExcel{storeExcel}
|
||||||
@@ -2330,7 +2338,7 @@ func GetVendorStoreInfo(ctx *jxcontext.Context, vendorIDList []int, isAsync, isC
|
|||||||
}
|
}
|
||||||
taskParallel := tasksch.NewParallelTask("获取各平台未营业门店", tasksch.NewParallelConfig().SetIsContinueWhenError(isContinueWhenError), ctx, taskFunc, storeIDs)
|
taskParallel := tasksch.NewParallelTask("获取各平台未营业门店", tasksch.NewParallelConfig().SetIsContinueWhenError(isContinueWhenError), ctx, taskFunc, storeIDs)
|
||||||
tasksch.HandleTask(taskParallel, task, true).Run()
|
tasksch.HandleTask(taskParallel, task, true).Run()
|
||||||
storeList, err := taskParallel.GetResult(0)
|
storeList, _ := taskParallel.GetResult(0)
|
||||||
for _, v := range storeList {
|
for _, v := range storeList {
|
||||||
if vendorID == model.VendorIDJD {
|
if vendorID == model.VendorIDJD {
|
||||||
storeListJD = append(storeListJD, v.(VendorStoreExcel))
|
storeListJD = append(storeListJD, v.(VendorStoreExcel))
|
||||||
|
|||||||
@@ -509,3 +509,28 @@ func (c *PurchaseHandler) UpdateStoreCustomID(ctx *jxcontext.Context, vendorOrgC
|
|||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *PurchaseHandler) GetShopListByPage(status, proxy_business_state int) (shopList []*ebaiapi.ShopList, err error) {
|
||||||
|
var (
|
||||||
|
pageCount = 500
|
||||||
|
pageNum = 1
|
||||||
|
)
|
||||||
|
for {
|
||||||
|
shopListPage, _, err2 := api.EbaiAPI.GetShopListByPage(status, proxy_business_state, pageCount, pageNum)
|
||||||
|
err = err2
|
||||||
|
shopList = append(shopList, shopListPage...)
|
||||||
|
if len(shopList) < pageCount {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
pageNum++
|
||||||
|
}
|
||||||
|
return shopList, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *PurchaseHandler) GetShopIDsByPage() (vendorStoreIDs []string, err error) {
|
||||||
|
shopList, err := c.GetShopListByPage(ebaiapi.ShopStatusOnLine, ebaiapi.ProxyBusinessState)
|
||||||
|
for _, v := range shopList {
|
||||||
|
vendorStoreIDs = append(vendorStoreIDs, v.Wid)
|
||||||
|
}
|
||||||
|
return vendorStoreIDs, err
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user