|
|
@@ -108,16 +108,19 @@ func GetAllDetailsOrderId(oId string) (items []*OrderDetail) {
|
|
|
}
|
|
|
|
|
|
//获取商品销售统计
|
|
|
-func GetStaticOrderDetails(bDateUnix, eDateUnix int64, state string, isSend bool) (details []*OrderDetail) {
|
|
|
- beego.BeeLogger.Warn("bDateUnix=[%d]", bDateUnix)
|
|
|
- beego.BeeLogger.Warn("eDateUnix=[%d]", eDateUnix)
|
|
|
+func GetStaticOrderDetails(bDate, eDate time.Time, state string, isSend bool) (details []*OrderDetail) {
|
|
|
+ bDateStr := bDate.Format("2006-01-02 15:04:05") //2015-06-15 08:52:32
|
|
|
+ eDateStr := eDate.Format("2006-01-02 15:04:05") //2015-06-15 08:52:32
|
|
|
+
|
|
|
+ beego.BeeLogger.Warn("bDate=[%s]", bDateStr)
|
|
|
+ beego.BeeLogger.Warn("eDate=[%s]", eDateStr)
|
|
|
sql := "select sum(ot.nums) as nums ,price,ot.product_id,ot.product_name from order_details ot left join orders o on ot.order_id=o.id where "
|
|
|
- if bDateUnix > 0 {
|
|
|
- s := fmt.Sprintf(" UNIX_TIMESTAMP(o.created_at)>=%d", bDateUnix)
|
|
|
+ if bDate.Unix() > 0 {
|
|
|
+ s := fmt.Sprintf(" date_add(o.created_at,interval 8 hour)>=%s", bDateStr)
|
|
|
sql = strings.Join([]string{sql, s}, " ")
|
|
|
}
|
|
|
- if eDateUnix > 0 {
|
|
|
- s := fmt.Sprintf(" AND UNIX_TIMESTAMP(o.created_at)<=%d", eDateUnix)
|
|
|
+ if eDate.Unix() > 0 {
|
|
|
+ s := fmt.Sprintf(" AND date_add(o.created_at,,interval 8 hour)<=%s", eDateStr)
|
|
|
sql = strings.Join([]string{sql, s}, " ")
|
|
|
}
|
|
|
if len(state) > 0 {
|