abiao лет назад: 5
Родитель
Сommit
402067b5c2

+ 5 - 5
go/gopath/src/fohow.com/apps/models/summary_model/user_perfomance.go

@@ -70,8 +70,8 @@ func GetSumOrderPerfomance(wxUserId, orderType, beginTime, endTime int64) int64
 	ret := &Ret{}
 	o := orm.NewOrm()
 	tbn := "orders"
-	sql := fmt.Sprintf("SELECT sum(`paied_price`-`freight`) as count FROM `%s` WHERE  paied_at >? and paied_at<? and  status in (?, ?, ?) and wx_user_id=? and order_type=?;", tbn)
-	err := o.Raw(sql, beginTime, endTime, order_model.STATUS_PROCESSING, order_model.STATUS_DISPATCH, order_model.STATUS_COMPLETE, wxUserId, orderType).QueryRow(ret)
+	sql := fmt.Sprintf("SELECT sum(`paied_price`-`freight`) as count FROM `%s` WHERE  paied_at > %d and paied_at< %d and  status in (?, ?, ?) and wx_user_id=? and order_type=?;", tbn, beginTime, endTime)
+	err := o.Raw(sql, order_model.STATUS_PROCESSING, order_model.STATUS_DISPATCH, order_model.STATUS_COMPLETE, wxUserId, orderType).QueryRow(ret)
 	if err != nil {
 		beego.BeeLogger.Error("GetSumOrderPerfomance err=[%s]", err)
 		return 0
@@ -90,7 +90,7 @@ func GetSumShopPerfomance(wxUserId, beginTime, endTime int64) int64 {
 	ret := &Ret{}
 	o := orm.NewOrm()
 	tbn := "shop_applications"
-	sql := fmt.Sprintf("SELECT sum(`total`) as count FROM `%s` WHERE  UNIX_TIMESTAMP(pass_time)>? and UNIX_TIMESTAMP(pass_time)<? and  status=? and wx_user_id=? ;", tbn)
+	sql := fmt.Sprintf("SELECT sum(`total`) as count FROM `%s` WHERE pass_time>FROM_UNIXTIME(?) and pass_time<FROM_UNIXTIME(?) and  status=? and wx_user_id=? ;", tbn)
 	err := o.Raw(sql, beginTime, endTime, state, wxUserId).QueryRow(ret)
 	if err != nil {
 		beego.BeeLogger.Error("GetSumShopPerfomance err=[%s]", err)
@@ -110,8 +110,8 @@ func GetSumBalancePerfomance(wxUserId, beginTime, endTime int64) int64 {
 	ret := &Ret{}
 	o := orm.NewOrm()
 	tbn := "balance_orders"
-	sql := fmt.Sprintf("SELECT sum(`paied_price`) as count FROM `%s` WHERE  paied_at>? and paied_at<? and  state=? and wx_user_id=? ;", tbn)
-	err := o.Raw(sql, beginTime, endTime, state, wxUserId).QueryRow(ret)
+	sql := fmt.Sprintf("SELECT sum(`paied_price`) as count FROM `%s` WHERE  paied_at> %d and paied_at< %d and  state=? and wx_user_id=? ;", tbn, beginTime, endTime)
+	err := o.Raw(sql, state, wxUserId).QueryRow(ret)
 	if err != nil {
 		beego.BeeLogger.Error("GetSumBalancePerfomance err=[%s]", err)
 		return 0