作者 陈志颖

fix:修复营销年,过滤订单

... ... @@ -29,16 +29,37 @@ func Statistics(header *protocol.RequestHeader, request *protocol.DividendStatis
if e != nil {
log.Error(e)
}
//获取营销年
t := time.Now()
var last time.Time
var first time.Time
boundDate := time.Date(t.Year(), time.March, 31, 23, 59, 59, 0, time.Local) // 营销年界限
fmt.Println("营销年界限:", boundDate)
if t.Before(boundDate) || t.Equal(boundDate) {
first = time.Date(t.Year()-1, time.April, 1, 0, 0, 0, 0, time.Local)
last = time.Date(t.Year(), time.March, 31, 23, 59, 59, 0, time.Local)
} else if t.After(boundDate) {
first = time.Date(t.Year(), time.April, 1, 0, 0, 0, 0, time.Local)
last = time.Date(t.Year()+1, time.March, 31, 23, 59, 59, 0, time.Local)
}
fmt.Println("当前营销年起始:", first, last)
//last := time.Date(t.Year(), time.December, 31, 23, 59, 59, 0, time.Local)
first := time.Date(t.Year(), time.January, 1, 0, 0, 0, 0, time.Local)
last := first.AddDate(1, 0, 0)
//first := time.Date(t.Year(), time.January, 1, 0, 0, 0, 0, time.Local)
//last := first.AddDate(1, 0, 0)
//last := time.Date(t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second(), t.Nanosecond(), time.Local)
//last := utils.GetDayEnd()
if request.StartTime == 0 {
request.StartTime = first.Unix() * 1000
}
if request.EndTime == 0 {
request.EndTime = last.Unix() * 1000
}
//if request.EndTime > last.Unix()*1000 {
// request.EndTime = last.Unix() * 1000
//}
fmt.Print("StartTime: ", request.StartTime, "\n")
fmt.Print("EndTime: ", request.EndTime, "\n")
var orderBetween []*domain.OrderBase
... ... @@ -138,15 +159,18 @@ func OrderList(header *protocol.RequestHeader, request *protocol.DividendOrdersR
}()
rsp = &protocol.DividendOrdersResponse{List: make([]*protocol.DividendOrderListItem, 0)}
endTime := utils.GetDayEnd().Unix() * 1000
count, orders, err = OrderDao.DividendOrders(&domain.DividendOrdersQueryOption{
OrderTypes: domain.UserOrderTypes(domain.Career),
PartnerId: request.PartnerId,
DetailAction: request.DetailAction,
DividendAction: request.DividendAction,
StartTime: request.StartTime,
EndTime: request.EndTime,
Offset: request.PageIndex * request.PageSize,
Limit: request.PageSize,
//EndTime: request.EndTime,
EndTime: endTime,
Offset: request.PageIndex * request.PageSize,
Limit: request.PageSize,
//SortByUpdateTime: domain.DESC,
//SortByCreateTime: domain.DESC,
SortBySalesTime: domain.DESC,
... ...
... ... @@ -227,11 +227,13 @@ func List(header *protocol.RequestHeader, request *protocol.OrderListRequest) (r
} else {
queryOption.BeginTime = utils.GetFirstDateOfMonth(d)
}
if request.EndTime > 0 {
queryOption.EndTime = time.Unix(request.EndTime/1000, 0)
} else {
queryOption.EndTime = utils.GetNextMonthFirstDay(d)
}
//if request.EndTime > 0 {
// queryOption.EndTime = time.Unix(request.EndTime/1000, 0)
//} else {
// queryOption.EndTime = utils.GetNextMonthFirstDay(d)
//}
queryOption.EndTime = utils.GetDayEnd()
// 今日新增实发订单
if request.IsToday {
... ...