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