|
|
@@ -29,7 +29,7 @@ func CalcBySchoolTerm(uid int, isTeacher bool, buyPackageReq md2.BuyPackageReq) |
|
|
|
//2、查询出当前合适的package |
|
|
|
var m []model.CentralKitchenForSchoolPackage |
|
|
|
now := time.Now() |
|
|
|
today, _ := time.Parse("2006-01-02", time.Now().Format("2006-01-02")) |
|
|
|
today, _ := time.ParseInLocation("2006-01-02", time.Now().Format("2006-01-02"), time.Local) |
|
|
|
//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 |
|
|
@@ -38,7 +38,7 @@ func CalcBySchoolTerm(uid int, isTeacher bool, buyPackageReq md2.BuyPackageReq) |
|
|
|
if err != nil { |
|
|
|
return |
|
|
|
} |
|
|
|
centralKitchenForSchoolReserveMealTime, _ := time.Parse("2006-01-02 15:04:05", now.Format("2006-01-02")+" "+cfg.Val+":00") |
|
|
|
centralKitchenForSchoolReserveMealTime, _ := time.ParseInLocation("2006-01-02 15:04:05", now.Format("2006-01-02")+" "+cfg.Val+":00", time.Local) |
|
|
|
|
|
|
|
//3、循环拼接数据 |
|
|
|
for _, v := range m { |
|
|
@@ -50,7 +50,7 @@ func CalcBySchoolTerm(uid int, isTeacher bool, buyPackageReq md2.BuyPackageReq) |
|
|
|
} |
|
|
|
for _, v1 := range *centralKitchenForSchoolPackageWithDay { |
|
|
|
//3.1、判断是否小于今天 |
|
|
|
date, _ := time.Parse("2006-01-02", v1.Date) |
|
|
|
date, _ := time.ParseInLocation("2006-01-02", v1.Date, time.Local) |
|
|
|
if today.After(date) { |
|
|
|
continue |
|
|
|
} |
|
|
@@ -69,6 +69,7 @@ func CalcBySchoolTerm(uid int, isTeacher bool, buyPackageReq md2.BuyPackageReq) |
|
|
|
} else { |
|
|
|
amount = centralKitchenForSchoolWithSpecData.BreakfastUnitPrice |
|
|
|
} |
|
|
|
totalPrice += utils.StrToFloat64(amount) |
|
|
|
data = append(data, &model.CentralKitchenForSchoolUserWithDay{ |
|
|
|
Uid: uid, |
|
|
|
IdentityId: buyPackageReq.UserIdentityId, |
|
|
@@ -140,12 +141,12 @@ func CalcByMonth(uid int, isTeacher bool, buyPackageReq md2.BuyPackageReq) (tota |
|
|
|
//2、查询出当前合适的package |
|
|
|
var m []model.CentralKitchenForSchoolPackage |
|
|
|
now := time.Now() |
|
|
|
today, _ := time.Parse("2006-01-02", time.Now().Format("2006-01-02")) |
|
|
|
today, _ := time.ParseInLocation("2006-01-02", time.Now().Format("2006-01-02"), time.Local) |
|
|
|
err = db.Db.Where("enterprise_id =?", buyPackageReq.EnterpriseId).And("id =?", buyPackageReq.PackageId).And("is_delete = 0").And("state = 1").Find(&m) |
|
|
|
if err != nil { |
|
|
|
return |
|
|
|
} |
|
|
|
centralKitchenForSchoolReserveMealTime, _ := time.Parse("2006-01-02 15:04:05", now.Format("2006-01-02")+" "+cfg.Val+":00") |
|
|
|
centralKitchenForSchoolReserveMealTime, _ := time.ParseInLocation("2006-01-02 15:04:05", now.Format("2006-01-02")+" "+cfg.Val+":00", time.Local) |
|
|
|
|
|
|
|
//3、循环拼接数据 |
|
|
|
for _, v := range m { |
|
|
@@ -157,7 +158,7 @@ func CalcByMonth(uid int, isTeacher bool, buyPackageReq md2.BuyPackageReq) (tota |
|
|
|
} |
|
|
|
for _, v1 := range *centralKitchenForSchoolPackageWithDay { |
|
|
|
//3.1、判断是否小于今天 |
|
|
|
date, _ := time.Parse("2006-01-02", v1.Date) |
|
|
|
date, _ := time.ParseInLocation("2006-01-02", v1.Date, time.Local) |
|
|
|
if today.After(date) { |
|
|
|
continue |
|
|
|
} |
|
|
@@ -247,13 +248,13 @@ func CalcByDay(uid int, isTeacher bool, buyPackageReq md2.BuyPackageReq) (totalP |
|
|
|
} |
|
|
|
|
|
|
|
now := time.Now() |
|
|
|
today, _ := time.Parse("2006-01-02", time.Now().Format("2006-01-02")) |
|
|
|
centralKitchenForSchoolReserveMealTime, _ := time.Parse("2006-01-02 15:04:05", now.Format("2006-01-02")+" "+cfg.Val+":00") |
|
|
|
today, _ := time.ParseInLocation("2006-01-02", time.Now().Format("2006-01-02"), time.Local) |
|
|
|
centralKitchenForSchoolReserveMealTime, _ := time.ParseInLocation("2006-01-02 15:04:05", now.Format("2006-01-02")+" "+cfg.Val+":00", time.Local) |
|
|
|
|
|
|
|
//2、循环拼接数据 |
|
|
|
for _, v1 := range buyPackageReq.WithDays { |
|
|
|
//2.1、判断是否小于今天 |
|
|
|
date, _ := time.Parse("2006-01-02", v1.Date) |
|
|
|
date, _ := time.ParseInLocation("2006-01-02", v1.Date, time.Local) |
|
|
|
if today.After(date) { |
|
|
|
continue |
|
|
|
} |
|
|
|