|
|
@@ -8,11 +8,13 @@ import ( |
|
|
|
"applet/app/enum" |
|
|
|
"applet/app/utils" |
|
|
|
"errors" |
|
|
|
"fmt" |
|
|
|
"time" |
|
|
|
) |
|
|
|
|
|
|
|
func OrderList(req md.CentralKitchenForSchoolOrderListReq) (m []model.CentralKitchenForSchoolPackageOrd, total int64, err error) { |
|
|
|
sess := db.Db.Desc("id").Where("user_identity_id =?", req.UserIdentityId).Limit(req.Limit, (req.Page-1)*req.Limit) |
|
|
|
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) |
|
|
|
total, err = sess.FindAndCount(&m) |
|
|
|
if err != nil { |
|
|
@@ -21,6 +23,21 @@ func OrderList(req md.CentralKitchenForSchoolOrderListReq) (m []model.CentralKit |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
func OrderStatistic(req md.CentralKitchenForSchoolOrderListReq) (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 create_at >= '%s' And create_at <= '%s' and ord_state = '%d'", req.UserIdentityId, req.StartDate, req.EndDate, req.OrdState) |
|
|
|
mapArr1, err := db.QueryNativeString(db.Db, sql) |
|
|
|
if err != nil { |
|
|
|
return |
|
|
|
} |
|
|
|
if mapArr1 == nil { |
|
|
|
total = 0 |
|
|
|
} else { |
|
|
|
total = utils.StrToFloat64(mapArr1[0]["sum_total"]) |
|
|
|
} |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
func CentralKitchenForSchoolOrderRefund(req md.CentralKitchenForSchoolOrderRefundReq) (err error) { |
|
|
|
sysCfgDb := db.SysCfgDb{} |
|
|
|
sysCfgDb.Set() |
|
|
@@ -110,6 +127,7 @@ func CentralKitchenForSchoolOrderRefundList(req md.CentralKitchenForSchoolOrderR |
|
|
|
OutRequestNo: v.CentralKitchenForSchoolUserRefundDay.OutRequestNo, |
|
|
|
Kind: v.CentralKitchenForSchoolUserWithDay.Kind, |
|
|
|
CreateAt: v.CentralKitchenForSchoolUserRefundDay.CreateAt, |
|
|
|
RefundDate: v.CentralKitchenForSchoolUserRefundDay.RefundDate, |
|
|
|
Date: v.CentralKitchenForSchoolUserWithDay.Date, |
|
|
|
State: v.CentralKitchenForSchoolUserRefundDay.State, |
|
|
|
Memo: v.CentralKitchenForSchoolUserRefundDay.Memo, |
|
|
|