diff --git a/app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go b/app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go index 4e7174a..6d8b0b2 100644 --- a/app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go +++ b/app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go @@ -852,7 +852,7 @@ func CentralKitchenForSchoolReserveList(req md.CentralKitchenForSchoolReserveLis if count2 > 0 { state = 3 stateZh = "部分退款" - count3, err3 := centralKitchenForSchoolUserWithDayDb.CountCentralKitchenForSchoolUserWithDay(v.CentralKitchenForSchoolPackageOrdForReserve.OutTradeNo, v.CentralKitchenForSchoolPackageOrdForReserve.Kind) + count3, err3 := centralKitchenForSchoolUserWithDayDb.CountCentralKitchenForSchoolUserWithDay(v.CentralKitchenForSchoolPackageOrdForReserve.OutTradeNo, v.CentralKitchenForSchoolPackageOrdForReserve.MealTimeStart, v.CentralKitchenForSchoolPackageOrdForReserve.MealTimeEnd, v.CentralKitchenForSchoolPackageOrdForReserve.Kind) if err1 != nil { return nil, 0, err3 } diff --git a/app/db/db_central_kitchen_for_school_user_with_day.go b/app/db/db_central_kitchen_for_school_user_with_day.go index 214db75..3e165c8 100644 --- a/app/db/db_central_kitchen_for_school_user_with_day.go +++ b/app/db/db_central_kitchen_for_school_user_with_day.go @@ -97,9 +97,11 @@ func (centralKitchenForSchoolUserWithDayDb *CentralKitchenForSchoolUserWithDayDb return count, nil } -func (centralKitchenForSchoolUserWithDayDb *CentralKitchenForSchoolUserWithDayDb) CountCentralKitchenForSchoolUserWithDay(ordNo string, kind int) (count int64, err error) { +func (centralKitchenForSchoolUserWithDayDb *CentralKitchenForSchoolUserWithDayDb) CountCentralKitchenForSchoolUserWithDay(ordNo, startDate, endDate string, kind int) (count int64, err error) { var m model.CentralKitchenForSchoolUserWithDay - count, err = centralKitchenForSchoolUserWithDayDb.Db.Where("ord_no =?", ordNo).And("kind =?", kind).Count(&m) + count, err = centralKitchenForSchoolUserWithDayDb.Db.Where("ord_no =?", ordNo). + And("date >= ?", startDate).And("date <= ?", endDate). + And("kind =?", kind).Count(&m) return count, nil }