|
@@ -51,17 +51,24 @@ func Statistics(header *protocol.RequestHeader, request *protocol.DividendStatis |
|
@@ -51,17 +51,24 @@ func Statistics(header *protocol.RequestHeader, request *protocol.DividendStatis |
51
|
|
51
|
|
52
|
//last := time.Date(t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second(), t.Nanosecond(), time.Local)
|
52
|
//last := time.Date(t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second(), t.Nanosecond(), time.Local)
|
53
|
//last := utils.GetDayEnd()
|
53
|
//last := utils.GetDayEnd()
|
54
|
- if request.StartTime == 0 {
|
54
|
+
|
|
|
55
|
+ // 请求开始时间和结束时间都为0时,默认从营销年开始统计
|
|
|
56
|
+ if request.StartTime == 0 && request.EndTime == 0 {
|
55
|
request.StartTime = first.Unix() * 1000
|
57
|
request.StartTime = first.Unix() * 1000
|
56
|
- }
|
|
|
57
|
- if request.EndTime == 0 {
|
|
|
58
|
request.EndTime = last.Unix() * 1000
|
58
|
request.EndTime = last.Unix() * 1000
|
|
|
59
|
+ } else if request.StartTime > 0 && request.EndTime > 0 { // 判断结束时间是否超过今天,超过今天的结束时间到今天为止
|
|
|
60
|
+ currentDayEnd := utils.GetDayEnd().Unix() * 1000
|
|
|
61
|
+ if request.EndTime >= currentDayEnd {
|
|
|
62
|
+ request.EndTime = currentDayEnd
|
|
|
63
|
+ }
|
59
|
}
|
64
|
}
|
|
|
65
|
+
|
60
|
//if request.EndTime > last.Unix()*1000 {
|
66
|
//if request.EndTime > last.Unix()*1000 {
|
61
|
// request.EndTime = last.Unix() * 1000
|
67
|
// request.EndTime = last.Unix() * 1000
|
62
|
//}
|
68
|
//}
|
63
|
fmt.Print("StartTime: ", request.StartTime, "\n")
|
69
|
fmt.Print("StartTime: ", request.StartTime, "\n")
|
64
|
fmt.Print("EndTime: ", request.EndTime, "\n")
|
70
|
fmt.Print("EndTime: ", request.EndTime, "\n")
|
|
|
71
|
+
|
65
|
var orderBetween []*domain.OrderBase
|
72
|
var orderBetween []*domain.OrderBase
|
66
|
for i := range orderAll {
|
73
|
for i := range orderAll {
|
67
|
if orderAll[i].SaleDate.Unix() >= (request.StartTime/1000) && orderAll[i].SaleDate.Unix() < (request.EndTime/1000) {
|
74
|
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 |
|
@@ -159,7 +166,11 @@ func OrderList(header *protocol.RequestHeader, request *protocol.DividendOrdersR |
159
|
}()
|
166
|
}()
|
160
|
rsp = &protocol.DividendOrdersResponse{List: make([]*protocol.DividendOrderListItem, 0)}
|
167
|
rsp = &protocol.DividendOrdersResponse{List: make([]*protocol.DividendOrderListItem, 0)}
|
161
|
|
168
|
|
162
|
- endTime := utils.GetDayEnd().Unix() * 1000
|
169
|
+ // 判断时间是否超过今天
|
|
|
170
|
+ currentDayEnd := utils.GetDayEnd().Unix() * 1000
|
|
|
171
|
+ if request.EndTime >= currentDayEnd {
|
|
|
172
|
+ request.EndTime = currentDayEnd
|
|
|
173
|
+ }
|
163
|
|
174
|
|
164
|
count, orders, err = OrderDao.DividendOrders(&domain.DividendOrdersQueryOption{
|
175
|
count, orders, err = OrderDao.DividendOrders(&domain.DividendOrdersQueryOption{
|
165
|
OrderTypes: domain.UserOrderTypes(domain.Career),
|
176
|
OrderTypes: domain.UserOrderTypes(domain.Career),
|
|
@@ -167,12 +178,9 @@ func OrderList(header *protocol.RequestHeader, request *protocol.DividendOrdersR |
|
@@ -167,12 +178,9 @@ func OrderList(header *protocol.RequestHeader, request *protocol.DividendOrdersR |
167
|
DetailAction: request.DetailAction,
|
178
|
DetailAction: request.DetailAction,
|
168
|
DividendAction: request.DividendAction,
|
179
|
DividendAction: request.DividendAction,
|
169
|
StartTime: request.StartTime,
|
180
|
StartTime: request.StartTime,
|
170
|
- //EndTime: request.EndTime,
|
|
|
171
|
- EndTime: endTime,
|
181
|
+ EndTime: request.EndTime,
|
172
|
Offset: request.PageIndex * request.PageSize,
|
182
|
Offset: request.PageIndex * request.PageSize,
|
173
|
Limit: request.PageSize,
|
183
|
Limit: request.PageSize,
|
174
|
- //SortByUpdateTime: domain.DESC,
|
|
|
175
|
- //SortByCreateTime: domain.DESC,
|
|
|
176
|
SortBySalesTime: domain.DESC,
|
184
|
SortBySalesTime: domain.DESC,
|
177
|
JoinWays: request.JoinWays,
|
185
|
JoinWays: request.JoinWays,
|
178
|
})
|
186
|
})
|