diff --git a/app/customer/md/md_pay.go b/app/customer/md/md_pay.go index 59460a8..4cd2e75 100644 --- a/app/customer/md/md_pay.go +++ b/app/customer/md/md_pay.go @@ -1,13 +1,14 @@ package md type BuyPackageReq struct { - EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"` - UserIdentityId int `json:"user_identity_id" binding:"required" label:"用户身份id"` - PackageId int `json:"package_id" label:"套餐ID"` - Kind int `json:"kind" binding:"required" label:"购买类型(1:按学期购买 2:按月购买 3:按天购买 4:补餐)"` - IsBuyBreakfast int `json:"is_buy_breakfast" label:"是否购买早餐(1:是 2:否)"` - IsBuyLunch int `json:"is_buy_lunch" label:"是否购买午餐(1:是 2:否)"` - IsBuyDinner int `json:"is_buy_dinner" label:"是否购买晚餐(1:是 2:否)"` + EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"` + UserIdentityId int `json:"user_identity_id" binding:"required" label:"用户身份id"` + PackageId int `json:"package_id" label:"套餐ID"` + PackageIds []int `json:"package_ids" label:"套餐ID"` + Kind int `json:"kind" binding:"required" label:"购买类型(1:按学期购买 2:按月购买 3:按天购买 4:补餐)"` + IsBuyBreakfast int `json:"is_buy_breakfast" label:"是否购买早餐(1:是 2:否)"` + IsBuyLunch int `json:"is_buy_lunch" label:"是否购买午餐(1:是 2:否)"` + IsBuyDinner int `json:"is_buy_dinner" label:"是否购买晚餐(1:是 2:否)"` WithDays []struct { Date string `json:"date" label:"日期"` IsBuyBreakfast int `json:"is_buy_breakfast" label:"是否购买早餐(1:是 2:否)"` diff --git a/app/customer/svc/svc_central_kitchen_for_school_package.go b/app/customer/svc/svc_central_kitchen_for_school_package.go index 955a1b7..7eb34ef 100644 --- a/app/customer/svc/svc_central_kitchen_for_school_package.go +++ b/app/customer/svc/svc_central_kitchen_for_school_package.go @@ -30,7 +30,11 @@ func CalcBySchoolTerm(uid int, isTeacher bool, buyPackageReq md2.BuyPackageReq) var m []model.CentralKitchenForSchoolPackage now := time.Now() today, _ := time.Parse("2006-01-02", time.Now().Format("2006-01-02")) - err = db.Db.Where("enterprise_id =?", buyPackageReq.EnterpriseId).And("end_date > ?", now.Format("2006-01-02 15:04:05")).And("is_delete = 0").And("state = 1").Desc("end_date").Find(&m) + //err = db.Db.Where("enterprise_id =?", buyPackageReq.EnterpriseId).And("end_date > ?", now.Format("2006-01-02 15:04:05")).And("is_delete = 0").And("state = 1").Desc("end_date").Find(&m) + //if err != nil { + // return + //} + err = db.Db.Where("enterprise_id =?", buyPackageReq.EnterpriseId).In("id", buyPackageReq.PackageIds).And("is_delete = 0").And("state = 1").Desc("end_date").Find(&m) if err != nil { return }