+ GetAllStoresVendorID
This commit is contained in:
@@ -3,6 +3,8 @@ package partner
|
||||
import "git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||
|
||||
type IStoreHandler interface {
|
||||
GetAllStoresVendorID(ctx *jxcontext.Context) (vendorStoreIDs []string, err error)
|
||||
|
||||
UpdateStoreStatus(ctx *jxcontext.Context, storeID int, vendorStoreID string, status int) (err error)
|
||||
// opTime格式为整数1130代表11:30
|
||||
UpdateStoreOpTime(ctx *jxcontext.Context, storeID int, vendorStoreID string, opTimeList []int) (err error)
|
||||
|
||||
@@ -572,28 +572,24 @@ func (c *PurchaseHandler) ListOrders(ctx *jxcontext.Context, parentTask tasksch.
|
||||
}
|
||||
fromDate := utils.Time2Date(queryDate)
|
||||
toDate := fromDate.Add(24*time.Hour - 1)
|
||||
var shopList []*ebaiapi.ShopInfo
|
||||
var vendorStoreIDs []string
|
||||
if vendorStoreID == "" {
|
||||
shopList, err = api.EbaiAPI.ShopList(ebaiapi.SysStatusAll)
|
||||
vendorStoreIDs, err = c.GetAllStoresVendorID(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
shopList = []*ebaiapi.ShopInfo{
|
||||
&ebaiapi.ShopInfo{
|
||||
BaiduShopID: utils.Str2Int64(vendorStoreID),
|
||||
},
|
||||
}
|
||||
vendorStoreIDs = []string{vendorStoreID}
|
||||
}
|
||||
task := tasksch.NewParallelTask("ebai ListOrders", nil, ctx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
shop := batchItemList[0].(*ebaiapi.ShopInfo)
|
||||
orderList, err := api.EbaiAPI.OrderListAll("", shop.BaiduShopID, fromDate.Unix(), toDate.Unix(), 0)
|
||||
vendorStoreID := batchItemList[0].(string)
|
||||
orderList, err := api.EbaiAPI.OrderListAll("", utils.Str2Int64(vendorStoreID), fromDate.Unix(), toDate.Unix(), 0)
|
||||
if err == nil {
|
||||
retVal = orderList
|
||||
}
|
||||
return retVal, err
|
||||
}, shopList)
|
||||
}, vendorStoreIDs)
|
||||
tasksch.HandleTask(task, parentTask, true).Run()
|
||||
orderList, err := task.GetResult(0)
|
||||
if err == nil && len(orderList) > 0 {
|
||||
|
||||
@@ -465,3 +465,14 @@ func (c *PurchaseHandler) UpdateStoreOpTime(ctx *jxcontext.Context, storeID int,
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *PurchaseHandler) GetAllStoresVendorID(ctx *jxcontext.Context) (vendorStoreIDs []string, err error) {
|
||||
shopList, err := api.EbaiAPI.ShopList(ebaiapi.SysStatusAll)
|
||||
if err == nil && len(shopList) > 0 {
|
||||
vendorStoreIDs = make([]string, len(shopList))
|
||||
for k, v := range shopList {
|
||||
vendorStoreIDs[k] = utils.Int64ToStr(v.BaiduShopID)
|
||||
}
|
||||
}
|
||||
return vendorStoreIDs, err
|
||||
}
|
||||
|
||||
@@ -184,13 +184,8 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
|
||||
// }
|
||||
|
||||
///////////////////////
|
||||
func (p *PurchaseHandler) GetAllStoreIDsFromRemote() ([]string, error) {
|
||||
result, err := api.JdAPI.GetStationsByVenderId()
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) GetAllStoresFromRemote() ([]*model.Store, error) {
|
||||
ids, err := p.GetAllStoreIDsFromRemote()
|
||||
ids, err := p.GetAllStoresVendorID(jxcontext.AdminCtx)
|
||||
if err == nil {
|
||||
retVal := make([]*model.Store, len(ids))
|
||||
for index, id := range ids {
|
||||
@@ -355,3 +350,8 @@ func (c *PurchaseHandler) UpdateStoreOpTime(ctx *jxcontext.Context, storeID int,
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *PurchaseHandler) GetAllStoresVendorID(ctx *jxcontext.Context) (vendorStoreIDs []string, err error) {
|
||||
vendorStoreIDs, err = api.JdAPI.GetStationsByVenderId()
|
||||
return vendorStoreIDs, err
|
||||
}
|
||||
|
||||
@@ -536,7 +536,7 @@ func (c *PurchaseHandler) ListOrders(ctx *jxcontext.Context, parentTask tasksch.
|
||||
|
||||
var vendorStoreIDs []string
|
||||
if vendorStoreID == "" {
|
||||
vendorStoreIDs, err = api.MtwmAPI.PoiGetIDs()
|
||||
vendorStoreIDs, err = c.GetAllStoresVendorID(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -192,3 +192,8 @@ func (c *PurchaseHandler) UpdateStoreOpTime(ctx *jxcontext.Context, storeID int,
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *PurchaseHandler) GetAllStoresVendorID(ctx *jxcontext.Context) (vendorStoreIDs []string, err error) {
|
||||
vendorStoreIDs, err = api.MtwmAPI.PoiGetIDs()
|
||||
return vendorStoreIDs, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user