作者 陈志颖

合并分支 'dev' 到 'test'

fix:修改统计



查看合并请求 !61
... ... @@ -267,6 +267,10 @@ func newQueryOption(request *protocolx.PartnersRequest) map[string]interface{} {
queryOption["startTime"] = request.StartTime / 1000
}
if request.EndTime > 0 {
currentDayEnd := utils.GetDayEnd().Unix() * 1000
if request.EndTime >= currentDayEnd {
request.EndTime = currentDayEnd
}
queryOption["endTime"] = request.EndTime / 1000
}
queryOption["limit"] = request.PageSize
... ...
... ... @@ -110,6 +110,10 @@ func newQueryOptionV2(request *protocolx.PartnersRequest) map[string]interface{}
queryOption["startTime"] = request.StartTime / 1000
}
if request.EndTime > 0 {
currentDayEnd := utils.GetDayEnd().Unix() * 1000
if request.EndTime >= currentDayEnd {
request.EndTime = currentDayEnd
}
queryOption["endTime"] = request.EndTime / 1000
}
if request.Keyword != "" {
... ...
... ... @@ -51,17 +51,24 @@ func Statistics(header *protocol.RequestHeader, request *protocol.DividendStatis
//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 {
// 请求开始时间和结束时间都为0时,默认从营销年开始统计
if request.StartTime == 0 && request.EndTime == 0 {
request.StartTime = first.Unix() * 1000
}
if request.EndTime == 0 {
request.EndTime = last.Unix() * 1000
} else if request.StartTime > 0 && request.EndTime > 0 { // 判断结束时间是否超过今天,超过今天的结束时间到今天为止
currentDayEnd := utils.GetDayEnd().Unix() * 1000
if request.EndTime >= currentDayEnd {
request.EndTime = currentDayEnd
}
}
//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
for i := range orderAll {
if orderAll[i].SaleDate.Unix() >= (request.StartTime/1000) && orderAll[i].SaleDate.Unix() < (request.EndTime/1000) {
... ... @@ -159,7 +166,11 @@ func OrderList(header *protocol.RequestHeader, request *protocol.DividendOrdersR
}()
rsp = &protocol.DividendOrdersResponse{List: make([]*protocol.DividendOrderListItem, 0)}
endTime := utils.GetDayEnd().Unix() * 1000
// 判断时间是否超过今天
currentDayEnd := utils.GetDayEnd().Unix() * 1000
if request.EndTime >= currentDayEnd {
request.EndTime = currentDayEnd
}
count, orders, err = OrderDao.DividendOrders(&domain.DividendOrdersQueryOption{
OrderTypes: domain.UserOrderTypes(domain.Career),
... ... @@ -167,12 +178,9 @@ func OrderList(header *protocol.RequestHeader, request *protocol.DividendOrdersR
DetailAction: request.DetailAction,
DividendAction: request.DividendAction,
StartTime: request.StartTime,
//EndTime: request.EndTime,
EndTime: endTime,
EndTime: request.EndTime,
Offset: request.PageIndex * request.PageSize,
Limit: request.PageSize,
//SortByUpdateTime: domain.DESC,
//SortByCreateTime: domain.DESC,
SortBySalesTime: domain.DESC,
JoinWays: request.JoinWays,
})
... ...
... ... @@ -122,7 +122,7 @@ func orderTotalStatic(order *domain.OrderBase) interface{} {
/**
* @Author SteveChan
* @Description //TODO 订单统计
* @Description // 订单统计
* @Date 18:14 2021/1/28
* @Param
* @return
... ... @@ -222,18 +222,22 @@ func List(header *protocol.RequestHeader, request *protocol.OrderListRequest) (r
}
// 当月累计实发订单
d := time.Now()
if request.StartTime > 0 {
if request.StartTime > 0 { // 开始时间处理
queryOption.BeginTime = time.Unix(request.StartTime/1000, 0)
} else {
} else { // 开始时间为0,默认从这个月初开始
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 { // 结束时间处理,判断时间是否超过今天
currentDayEnd := utils.GetDayEnd().Unix() * 1000
if request.EndTime >= currentDayEnd {
request.EndTime = currentDayEnd
}
queryOption.EndTime = time.Unix(request.EndTime/1000, 0)
} else { // 请求结束时间为0,默认到今天结束
//queryOption.EndTime = utils.GetNextMonthFirstDay(d)
queryOption.EndTime = utils.GetDayEnd()
}
// 今日新增实发订单
if request.IsToday {
... ...