|
|
@@ -37,27 +37,27 @@ func OrderList(req md.CentralKitchenForSchoolOrderListReq, platform string) (m [ |
|
|
|
|
|
|
|
func OrderStatistic(req md.CentralKitchenForSchoolOrderListReq, platform string) (total float64, err error) { |
|
|
|
var sql = fmt.Sprintf("SELECT SUM(total_price) AS sum_total FROM central_kitchen_for_school_package_ord where "+ |
|
|
|
"user_identity_id = '%d' and ord_state = '%d'", req.UserIdentityId, req.OrdState) |
|
|
|
"user_identity_id = '%d' and ord_state = '%d' and state != 2", req.UserIdentityId, req.OrdState) |
|
|
|
if req.StartDate != "" && req.EndDate != "" { |
|
|
|
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'", req.UserIdentityId, req.StartDate, req.EndDate, req.OrdState) |
|
|
|
"user_identity_id = '%d' and create_at >= '%s' And create_at <= '%s' and ord_state = '%d' and state != 2", req.UserIdentityId, req.StartDate, req.EndDate, req.OrdState) |
|
|
|
} |
|
|
|
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 ord_state = '%d' and pay_way = '%d'", req.UserIdentityId, req.OrdState, enum2.PayWayForAli) |
|
|
|
"user_identity_id = '%d' and ord_state = '%d' and pay_way = '%d' and state != 2", req.UserIdentityId, req.OrdState, enum2.PayWayForAli) |
|
|
|
|
|
|
|
if req.StartDate != "" && req.EndDate != "" { |
|
|
|
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) |
|
|
|
"user_identity_id = '%d' and create_at >= '%s' And create_at <= '%s' and ord_state = '%d' and pay_way = '%d' and state != 2", 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 ord_state = '%d' and pay_way = '%d'", req.UserIdentityId, req.OrdState, enum2.PayWayForWx) |
|
|
|
"user_identity_id = '%d' and ord_state = '%d' and pay_way = '%d' and state != 2", req.UserIdentityId, req.OrdState, enum2.PayWayForWx) |
|
|
|
if req.StartDate != "" && req.EndDate != "" { |
|
|
|
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) |
|
|
|
"user_identity_id = '%d' and create_at >= '%s' And create_at <= '%s' and ord_state = '%d' and pay_way = '%d' and state != 2", req.UserIdentityId, req.StartDate, req.EndDate, req.OrdState, enum2.PayWayForWx) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|