作者 陈志颖

feat:增加今日订单统计

... ... @@ -199,7 +199,8 @@ func List(header *protocol.RequestHeader, request *protocol.OrderListRequest) (r
Limit: request.PageSize,
Offset: request.PageSize * request.PageIndex,
//SortByUpdateTime: domain.DESC,
SortByCreateTime: domain.DESC,
//SortByCreateTime: domain.DESC,
SortBySalesTime: domain.DESC,
PartnerId: request.PartnerId,
PartnerCategoryId: request.JoinWay,
OrderType: request.OrderType,
... ... @@ -211,6 +212,15 @@ func List(header *protocol.RequestHeader, request *protocol.OrderListRequest) (r
if request.EndTime > 0 {
queryOption.EndTime = time.Unix(request.EndTime/1000, 0)
}
// 今日订单
if request.IsToday {
timeStr := time.Now().Format("2006-01-02")
t, _ := time.Parse("2006-01-02", timeStr)
beginTimeNum := t.Unix()
endTimeNum := beginTimeNum + 86400
queryOption.BeginTime = time.Unix(beginTimeNum, 0)
queryOption.EndTime = time.Unix(endTimeNum, 0)
}
total, orders, _ = OrderRepository.Find(utils.ObjectJsonToMap(queryOption))
if len(orders) != 0 {
for i := range orders {
... ...
... ... @@ -79,8 +79,8 @@ func (repository *OrderBaseRepository) Find(queryOptions map[string]interface{})
query := NewQuery(tx.Model(&OrderBaseModels), queryOptions)
query.SetWhere(`"order_base".partner_id= ?`, "partnerId").
SetWhere(`"order_base".order_type= ?`, "orderType").
SetWhere(`"order_base".create_time >= ?`, "beginTime").
SetWhere(`"order_base".create_time < ?`, "endTime").
SetWhere(`"order_base".sale_date >= ?`, "beginTime").
SetWhere(`"order_base".sale_date < ?`, "endTime").
//SetWhere(`"order_base".is_disable = ?`, "isDisable").
SetLimit().
SetOrder(`order_base.create_time`, "sortByCreateTime").
... ...
... ... @@ -88,9 +88,9 @@ type OrderListRequest struct {
PageSize int `json:"pageSize" valid:"Required"`
OrderType int `json:"-"`
OrderTypes []int `json:"-"`
PartnerId int64 `json:"partnerId"`
JoinWay int `json:"joinWay"` //合伙方式(0或不传,即所有合伙方式)
IsToday bool `json:"isToday"`
PartnerId int64 `json:"partnerId"`
JoinWay int `json:"joinWay"` //合伙方式(0或不传,即所有合伙方式)
}
type OrderListResponse struct {
List []*OrderListItem `json:"list"`
... ...