1
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
||||
"fmt"
|
||||
push "git.rosy.net.cn/jx-callback/business/jxutils/unipush"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/weixinmsg"
|
||||
"math"
|
||||
"net/url"
|
||||
"regexp"
|
||||
"strings"
|
||||
@@ -756,6 +755,15 @@ func (c *PurchaseHandler) ListOrders(ctx *jxcontext.Context, vendorOrgCode strin
|
||||
return nil, fmt.Errorf("queryDate必须指定")
|
||||
}
|
||||
queryDate = utils.Time2Date(queryDate)
|
||||
endData := queryDate.AddDate(0, 0, -6)
|
||||
if time.Now().Day()-queryDate.Day() > 90 {
|
||||
return nil, fmt.Errorf("只能查询九十天的数据")
|
||||
}
|
||||
if time.Now().Day()-queryDate.Day() > 7 {
|
||||
endData = queryDate.AddDate(0, 0, 7)
|
||||
} else {
|
||||
endData = time.Now()
|
||||
}
|
||||
|
||||
var vendorStoreIDs []string
|
||||
if vendorStoreID == "" {
|
||||
@@ -770,30 +778,32 @@ func (c *PurchaseHandler) ListOrders(ctx *jxcontext.Context, vendorOrgCode strin
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
vendorStoreID := batchItemList[0].(string)
|
||||
var orderIDs []string
|
||||
seqStart := 1
|
||||
i := 0
|
||||
//seqStart := 1
|
||||
//i := 0
|
||||
for {
|
||||
batchSize := int(math.Min(math.Pow(2, float64(i*3)), float64(mtwmapi.MaxGap4GetOrderIdByDaySeq)))
|
||||
seqEnd := seqStart + batchSize - 1
|
||||
var tmpOrderIDs []int64
|
||||
if seqStart == seqEnd {
|
||||
if vendorOderID, err2 := getAPI(vendorOrgCode, 0, vendorStoreID).GetOrderIdByDaySeqSingle(vendorStoreID, queryDate, seqStart); err2 == nil {
|
||||
tmpOrderIDs = []int64{vendorOderID}
|
||||
}
|
||||
} else {
|
||||
tmpOrderIDs, err = getAPI(vendorOrgCode, 0, vendorStoreID).GetOrderIdByDaySeq(vendorStoreID, queryDate, seqStart, seqEnd)
|
||||
}
|
||||
//batchSize := int(math.Min(math.Pow(2, float64(i*3)), float64(mtwmapi.MaxGap4GetOrderIdByDaySeq)))
|
||||
//seqEnd := seqStart + batchSize - 1
|
||||
//var tmpOrderIDs []int64
|
||||
//if seqStart == seqEnd {
|
||||
// if vendorOderID, err2 := getAPI(vendorOrgCode, 0, vendorStoreID).GetOrderIdByDaySeqSingle(vendorStoreID, queryDate, seqStart); err2 == nil {
|
||||
// tmpOrderIDs = []int64{vendorOderID}
|
||||
// }
|
||||
//} else {
|
||||
// tmpOrderIDs, err = getAPI(vendorOrgCode, 0, vendorStoreID).GetOrderIdByDaySeq(vendorStoreID, queryDate, seqStart, seqEnd)
|
||||
//}
|
||||
|
||||
tmpOrderIDs, _ := getAPI(vendorOrgCode, 0, vendorStoreID).EcommerceGetOrderIdByPage(vendorStoreID, queryDate, endData)
|
||||
if len(tmpOrderIDs) > 0 {
|
||||
for _, v := range tmpOrderIDs {
|
||||
orderIDs = append(orderIDs, utils.Int64ToStr(v))
|
||||
}
|
||||
}
|
||||
if err != nil || len(tmpOrderIDs) < batchSize {
|
||||
if err != nil /*|| len(tmpOrderIDs) < batchSize */ {
|
||||
err = nil
|
||||
break
|
||||
}
|
||||
seqStart = seqEnd + 1
|
||||
i++
|
||||
//seqStart = seqEnd + 1
|
||||
//i++
|
||||
}
|
||||
retVal = orderIDs
|
||||
return retVal, nil
|
||||
|
||||
Reference in New Issue
Block a user