ソースを参照

update

add_mode
DengBiao 1年前
コミット
bb88fcc024
1個のファイルの変更28行の追加13行の削除
  1. +28
    -13
      app/customer/svc/svc_central_kitchen_for_school_package.go

+ 28
- 13
app/customer/svc/svc_central_kitchen_for_school_package.go ファイルの表示

@@ -25,15 +25,18 @@ func CalcBySchoolTerm(uid int, isTeacher bool, buyPackageReq md2.BuyPackageReq)
if err != nil {
return
}
classWithUserDb := db.ClassWithUserDb{}
classWithUserDb.Set()
classWithUserInfo, err := classWithUserDb.GetInfoByUserIdentityId(buyPackageReq.UserIdentityId)
if err != nil {
return
}

//2、查询出当前合适的package
var m []model.CentralKitchenForSchoolPackage
now := time.Now()
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
//}

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
@@ -67,7 +70,7 @@ func CalcBySchoolTerm(uid int, isTeacher bool, buyPackageReq md2.BuyPackageReq)
if isTeacher {
amount = centralKitchenForSchoolWithSpecData.BreakfastUnitPriceForTeacher
} else {
amount = centralKitchenForSchoolWithSpecData.BreakfastUnitPrice
amount = classWithUserInfo.Period.BreakfastUnitPrice
}
totalPrice += utils.StrToFloat64(amount)
data = append(data, &model.CentralKitchenForSchoolUserWithDay{
@@ -86,7 +89,7 @@ func CalcBySchoolTerm(uid int, isTeacher bool, buyPackageReq md2.BuyPackageReq)
if isTeacher {
amount = centralKitchenForSchoolWithSpecData.LunchUnitPriceForTeacher
} else {
amount = centralKitchenForSchoolWithSpecData.LunchUnitPrice
amount = classWithUserInfo.Period.LunchUnitPrice
}
totalPrice += utils.StrToFloat64(amount)

@@ -106,7 +109,7 @@ func CalcBySchoolTerm(uid int, isTeacher bool, buyPackageReq md2.BuyPackageReq)
if isTeacher {
amount = centralKitchenForSchoolWithSpecData.DinnerUnitPriceForTeacher
} else {
amount = centralKitchenForSchoolWithSpecData.DinnerUnitPrice
amount = classWithUserInfo.Period.DinnerUnitPrice
}
totalPrice += utils.StrToFloat64(amount)
data = append(data, &model.CentralKitchenForSchoolUserWithDay{
@@ -140,6 +143,12 @@ func CalcByMonth(uid int, isTeacher bool, buyPackageReq md2.BuyPackageReq) (tota
if err != nil {
return
}
classWithUserDb := db.ClassWithUserDb{}
classWithUserDb.Set()
classWithUserInfo, err := classWithUserDb.GetInfoByUserIdentityId(buyPackageReq.UserIdentityId)
if err != nil {
return
}

//2、查询出当前合适的package
var m []model.CentralKitchenForSchoolPackage
@@ -179,7 +188,7 @@ func CalcByMonth(uid int, isTeacher bool, buyPackageReq md2.BuyPackageReq) (tota
if isTeacher {
amount = centralKitchenForSchoolWithSpecData.BreakfastUnitPriceForTeacher
} else {
amount = centralKitchenForSchoolWithSpecData.BreakfastUnitPrice
amount = classWithUserInfo.Period.BreakfastUnitPrice
}

totalPrice += utils.StrToFloat64(amount)
@@ -199,7 +208,7 @@ func CalcByMonth(uid int, isTeacher bool, buyPackageReq md2.BuyPackageReq) (tota
if isTeacher {
amount = centralKitchenForSchoolWithSpecData.LunchUnitPriceForTeacher
} else {
amount = centralKitchenForSchoolWithSpecData.LunchUnitPrice
amount = classWithUserInfo.Period.LunchUnitPrice
}
totalPrice += utils.StrToFloat64(amount)

@@ -219,7 +228,7 @@ func CalcByMonth(uid int, isTeacher bool, buyPackageReq md2.BuyPackageReq) (tota
if isTeacher {
amount = centralKitchenForSchoolWithSpecData.DinnerUnitPriceForTeacher
} else {
amount = centralKitchenForSchoolWithSpecData.DinnerUnitPrice
amount = classWithUserInfo.Period.DinnerUnitPrice
}
totalPrice += utils.StrToFloat64(amount)
data = append(data, &model.CentralKitchenForSchoolUserWithDay{
@@ -252,6 +261,12 @@ func CalcByDay(uid int, isTeacher bool, buyPackageReq md2.BuyPackageReq) (totalP
if err != nil {
return
}
classWithUserDb := db.ClassWithUserDb{}
classWithUserDb.Set()
classWithUserInfo, err := classWithUserDb.GetInfoByUserIdentityId(buyPackageReq.UserIdentityId)
if err != nil {
return
}

now := time.Now()
today, _ := time.ParseInLocation("2006-01-02", time.Now().Format("2006-01-02"), time.Local)
@@ -278,7 +293,7 @@ func CalcByDay(uid int, isTeacher bool, buyPackageReq md2.BuyPackageReq) (totalP
if isTeacher {
amount = centralKitchenForSchoolWithSpecData.BreakfastUnitPriceForTeacher
} else {
amount = centralKitchenForSchoolWithSpecData.BreakfastUnitPrice
amount = classWithUserInfo.Period.BreakfastUnitPrice
}

data = append(data, &model.CentralKitchenForSchoolUserWithDay{
@@ -298,7 +313,7 @@ func CalcByDay(uid int, isTeacher bool, buyPackageReq md2.BuyPackageReq) (totalP
if isTeacher {
amount = centralKitchenForSchoolWithSpecData.LunchUnitPriceForTeacher
} else {
amount = centralKitchenForSchoolWithSpecData.LunchUnitPrice
amount = classWithUserInfo.Period.LunchUnitPrice
}
totalPrice += utils.StrToFloat64(amount)
data = append(data, &model.CentralKitchenForSchoolUserWithDay{
@@ -317,7 +332,7 @@ func CalcByDay(uid int, isTeacher bool, buyPackageReq md2.BuyPackageReq) (totalP
if isTeacher {
amount = centralKitchenForSchoolWithSpecData.DinnerUnitPriceForTeacher
} else {
amount = centralKitchenForSchoolWithSpecData.DinnerUnitPrice
amount = classWithUserInfo.Period.DinnerUnitPrice
}
totalPrice += utils.StrToFloat64(amount)
data = append(data, &model.CentralKitchenForSchoolUserWithDay{


読み込み中…
キャンセル
保存