From ab240ee7f5225e35a66586e9308cf876586cc5cf Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Thu, 12 Oct 2023 19:35:10 +0800 Subject: [PATCH] update --- .../svc_central_kitchen_for_school_order.go | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) 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)