diff --git a/app/customer/svc/order/svc_central_kitchen_for_school_order.go b/app/customer/svc/order/svc_central_kitchen_for_school_order.go index 8cb01ce..7f97022 100644 --- a/app/customer/svc/order/svc_central_kitchen_for_school_order.go +++ b/app/customer/svc/order/svc_central_kitchen_for_school_order.go @@ -17,12 +17,15 @@ func OrderList(req md.CentralKitchenForSchoolOrderListReq, platform string) (m [ sess := db.Db.Desc("id").Where("user_identity_id =?", req.UserIdentityId). And("create_at >= ? And create_at <= ?", req.StartDate, req.EndDate).Limit(req.Limit, (req.Page-1)*req.Limit) sess.And("ord_state = ?", req.OrdState) - if platform == "alipay_applet" { - sess.And("pay_way = ?", enum2.PayWayForAli) - } - if platform == "wx_applet" { - sess.And("pay_way = ?", enum2.PayWayForWx) + if req.OrdState == enum.CentralKitchenForSchoolPackageOrdOrdStateForWait { + if platform == "alipay_applet" { + sess.And("pay_way = ?", enum2.PayWayForAli) + } + if platform == "wx_applet" { + sess.And("pay_way = ?", enum2.PayWayForWx) + } } + total, err = sess.FindAndCount(&m) if err != nil { return @@ -32,13 +35,15 @@ func OrderList(req md.CentralKitchenForSchoolOrderListReq, platform string) (m [ func OrderStatistic(req md.CentralKitchenForSchoolOrderListReq, platform string) (total float64, err error) { var sql string - if platform == "alipay_applet" { - sql = fmt.Sprintf("SELECT SUM(total_price) AS sum_total FROM central_kitchen_for_school_package_ord where "+ - "user_identity_id = '%d' and create_at >= '%s' And create_at <= '%s' and ord_state = '%d' and pay_way = '%d'", req.UserIdentityId, req.StartDate, req.EndDate, req.OrdState, enum2.PayWayForAli) - } - if platform == "wx_applet" { - sql = fmt.Sprintf("SELECT SUM(total_price) AS sum_total FROM central_kitchen_for_school_package_ord where "+ - "user_identity_id = '%d' and create_at >= '%s' And create_at <= '%s' and ord_state = '%d' and pay_way = '%d'", req.UserIdentityId, req.StartDate, req.EndDate, req.OrdState, enum2.PayWayForWx) + if req.OrdState == enum.CentralKitchenForSchoolPackageOrdOrdStateForWait { + if platform == "alipay_applet" { + sql = fmt.Sprintf("SELECT SUM(total_price) AS sum_total FROM central_kitchen_for_school_package_ord where "+ + "user_identity_id = '%d' and create_at >= '%s' And create_at <= '%s' and ord_state = '%d' and pay_way = '%d'", req.UserIdentityId, req.StartDate, req.EndDate, req.OrdState, enum2.PayWayForAli) + } + if platform == "wx_applet" { + sql = fmt.Sprintf("SELECT SUM(total_price) AS sum_total FROM central_kitchen_for_school_package_ord where "+ + "user_identity_id = '%d' and create_at >= '%s' And create_at <= '%s' and ord_state = '%d' and pay_way = '%d'", req.UserIdentityId, req.StartDate, req.EndDate, req.OrdState, enum2.PayWayForWx) + } } mapArr1, err := db.QueryNativeString(db.Db, sql)