|
|
@@ -109,13 +109,15 @@ 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)
|
|
|
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)
|
|
|
sql = strings.Join([]string{sql, s}, " ")
|
|
|
}
|
|
|
if eDateUnix > 0 {
|
|
|
- s := fmt.Sprintf(" UNIX_TIMESTAMP(o.created_at)<=%d", eDateUnix)
|
|
|
+ s := fmt.Sprintf(" AND UNIX_TIMESTAMP(o.created_at)<=%d", eDateUnix)
|
|
|
sql = strings.Join([]string{sql, s}, " ")
|
|
|
}
|
|
|
if len(state) > 0 {
|
|
|
@@ -124,7 +126,6 @@ func GetStaticOrderDetails(bDateUnix, eDateUnix int64, state string, isSend bool
|
|
|
}
|
|
|
s := "and ot.is_send=? group by ot.product_id order by product_id desc"
|
|
|
sql = strings.Join([]string{sql, s}, " ")
|
|
|
-
|
|
|
beego.BeeLogger.Warn("sql=[%s]", sql)
|
|
|
if _, err := orm.NewOrm().Raw(sql, isSend).QueryRows(&details); err != nil {
|
|
|
return nil
|