|
|
@@ -9,7 +9,10 @@ import ( |
|
|
|
) |
|
|
|
|
|
|
|
func OrderRelateListByTimeByStateNew(Db *xorm.Engine, uid interface{}, task *model.UserLevelUpgradeTask) (float64, error) { |
|
|
|
timeStr := "" |
|
|
|
timeStr := " and olr.level=0 " |
|
|
|
if task.TaskType == 25 { |
|
|
|
timeStr = " and olr.level>=0 " |
|
|
|
} |
|
|
|
t := time.Now() |
|
|
|
stime := time.Date(t.Year(), t.Month(), t.Day()-task.WithinDays, t.Hour(), 0, 0, 0, t.Location()) |
|
|
|
etime := t |
|
|
@@ -62,7 +65,7 @@ FROM ord_list_relate olr |
|
|
|
LEFT JOIN duoyou_ord_list dol ON olr.oid =dol.oid |
|
|
|
LEFT JOIN recharge_order ro ON olr.oid =ro.oid |
|
|
|
LEFT JOIN playlet_sale_order pso ON olr.oid =pso.custom_oid |
|
|
|
WHERE olr.uid = ? and olr.level=0 %s AND (ol.state in(%s) or pco.state=1 or dol.id>0 or ro.status<>'已退款' or pso.status<>'订单退款'); |
|
|
|
WHERE olr.uid = ? %s AND (ol.state in(%s) or pco.state=1 or dol.id>0 or ro.status<>'已退款' or pso.status<>'订单退款'); |
|
|
|
` |
|
|
|
sqlTpl = fmt.Sprintf(sqlTpl, timeStr, state) |
|
|
|
todayResult, err := QueryNativeString(Db, sqlTpl, uid) |
|
|
@@ -74,7 +77,10 @@ WHERE olr.uid = ? and olr.level=0 %s AND (ol.state in(%s) or pco.state=1 or dol. |
|
|
|
} |
|
|
|
|
|
|
|
func MallOrderRelateListByTimeByStateNew(Db *xorm.Engine, uid interface{}, task *model.UserLevelUpgradeTask) (float64, error) { |
|
|
|
timeStr := "" |
|
|
|
timeStr := " and olr.level=0 " |
|
|
|
if task.TaskType == 25 { |
|
|
|
timeStr = " and olr.level>=0 " |
|
|
|
} |
|
|
|
t := time.Now() |
|
|
|
stime := time.Date(t.Year(), t.Month(), t.Day()-task.WithinDays, t.Hour(), 0, 0, 0, t.Location()) |
|
|
|
etime := t |
|
|
@@ -105,7 +111,7 @@ func MallOrderRelateListByTimeByStateNew(Db *xorm.Engine, uid interface{}, task |
|
|
|
sqlTpl := `SELECT cast(SUM(olr.amount) as decimal(50,6)) AS amount |
|
|
|
FROM mall_ord_list_relate olr |
|
|
|
LEFT JOIN mall_ord ol ON olr.oid = ol.ord_id |
|
|
|
WHERE olr.uid = ? and olr.level=0 %s AND ol.state IN (%s); |
|
|
|
WHERE olr.uid = ? %s AND ol.state IN (%s); |
|
|
|
` |
|
|
|
sqlTpl = fmt.Sprintf(sqlTpl, timeStr, state) |
|
|
|
todayResult, err := QueryNativeString(Db, sqlTpl, uid) |
|
|
@@ -116,7 +122,10 @@ WHERE olr.uid = ? and olr.level=0 %s AND ol.state IN (%s); |
|
|
|
return sum, nil |
|
|
|
} |
|
|
|
func O2oOrderRelateListByTimeByStateNew(Db *xorm.Engine, uid interface{}, task *model.UserLevelUpgradeTask) (float64, error) { |
|
|
|
timeStr := "" |
|
|
|
timeStr := " and olr.level=0 " |
|
|
|
if task.TaskType == 25 { |
|
|
|
timeStr = " and olr.level>=0 " |
|
|
|
} |
|
|
|
t := time.Now() |
|
|
|
stime := time.Date(t.Year(), t.Month(), t.Day()-task.WithinDays, t.Hour(), 0, 0, 0, t.Location()) |
|
|
|
etime := t |
|
|
@@ -157,7 +166,7 @@ func O2oOrderRelateListByTimeByStateNew(Db *xorm.Engine, uid interface{}, task * |
|
|
|
FROM mall_ord_list_relate olr |
|
|
|
LEFT JOIN o2o_ord ol ON olr.oid = ol.ord_id |
|
|
|
LEFT JOIN o2o_pay_to_merchant optm ON optm.pay_id = olr.oid |
|
|
|
WHERE olr.uid = ? and olr.level=0 %s AND (ol.state IN (%s) or optm.state>=1); |
|
|
|
WHERE olr.uid = ? %s AND (ol.state IN (%s) or optm.state>=1); |
|
|
|
` |
|
|
|
sqlTpl = fmt.Sprintf(sqlTpl, timeStr, state) |
|
|
|
todayResult, err := QueryNativeString(Db, sqlTpl, uid) |
|
|
@@ -168,7 +177,10 @@ WHERE olr.uid = ? and olr.level=0 %s AND (ol.state IN (%s) or optm.state>=1); |
|
|
|
return sum, nil |
|
|
|
} |
|
|
|
func B2cOrderRelateListByTimeByStateNew(Db *xorm.Engine, uid interface{}, task *model.UserLevelUpgradeTask) (float64, error) { |
|
|
|
timeStr := "" |
|
|
|
timeStr := " and olr.level=0 " |
|
|
|
if task.TaskType == 25 { |
|
|
|
timeStr = " and olr.level>=0 " |
|
|
|
} |
|
|
|
t := time.Now() |
|
|
|
stime := time.Date(t.Year(), t.Month(), t.Day()-task.WithinDays, t.Hour(), 0, 0, 0, t.Location()) |
|
|
|
etime := t |
|
|
@@ -199,7 +211,7 @@ func B2cOrderRelateListByTimeByStateNew(Db *xorm.Engine, uid interface{}, task * |
|
|
|
sqlTpl := `SELECT cast(SUM(olr.amount) as decimal(50,6)) AS amount |
|
|
|
FROM mall_ord_list_relate olr |
|
|
|
LEFT JOIN b2c_ord ol ON olr.oid = ol.ord_id |
|
|
|
WHERE olr.uid = ? and olr.level=0 %s AND ol.state IN (%s); |
|
|
|
WHERE olr.uid = ? %s AND ol.state IN (%s); |
|
|
|
` |
|
|
|
sqlTpl = fmt.Sprintf(sqlTpl, timeStr, state) |
|
|
|
todayResult, err := QueryNativeString(Db, sqlTpl, uid) |
|
|
|