|
@@ -54,55 +54,27 @@ func BuyPackageForAli(c *gin.Context, req md.BuyPackageReq) (outTradeNo, tradeNo |
|
|
var totalPrice float64 |
|
|
var totalPrice float64 |
|
|
var data []*model.CentralKitchenForSchoolUserWithDay |
|
|
var data []*model.CentralKitchenForSchoolUserWithDay |
|
|
if req.Kind == 1 { |
|
|
if req.Kind == 1 { |
|
|
if req.IsBuyByMealLabel { |
|
|
|
|
|
totalPrice, data, err = CalcBySchoolTerm(user.Id, isTeacher, req) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
totalPrice, data, err = OldCalcBySchoolTerm(user.Id, isTeacher, req) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
totalPrice, data, err = CalcBySchoolTerm(user.Id, isTeacher, req) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if req.Kind == 2 { |
|
|
if req.Kind == 2 { |
|
|
if req.IsBuyByMealLabel { |
|
|
|
|
|
totalPrice, data, err = CalcByMonth(user.Id, isTeacher, req) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
totalPrice, data, err = OldCalcByMonth(user.Id, isTeacher, req) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
totalPrice, data, err = CalcByMonth(user.Id, isTeacher, req) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if req.Kind == 3 { |
|
|
if req.Kind == 3 { |
|
|
if req.IsBuyByMealLabel { |
|
|
|
|
|
totalPrice, data, err = CalcByDay(user.Id, isTeacher, req) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
totalPrice, data, err = OldCalcByDay(user.Id, isTeacher, req) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
totalPrice, data, err = CalcByDay(user.Id, isTeacher, req) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if req.Kind == 4 { |
|
|
if req.Kind == 4 { |
|
|
if req.IsBuyByMealLabel { |
|
|
|
|
|
totalPrice, data, err = CalcSupplementaryByDay(user.Id, isTeacher, req) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
totalPrice, data, err = OldCalcSupplementaryByDay(user.Id, isTeacher, req) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
totalPrice, data, err = CalcSupplementaryByDay(user.Id, isTeacher, req) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
total = utils.Float64ToStr(totalPrice) |
|
|
total = utils.Float64ToStr(totalPrice) |
|
@@ -197,55 +169,27 @@ func BuyPackageForWx(c *gin.Context, req md.BuyPackageReq) (outTradeNo, total st |
|
|
var totalPrice float64 |
|
|
var totalPrice float64 |
|
|
var data []*model.CentralKitchenForSchoolUserWithDay |
|
|
var data []*model.CentralKitchenForSchoolUserWithDay |
|
|
if req.Kind == 1 { |
|
|
if req.Kind == 1 { |
|
|
if req.IsBuyByMealLabel { |
|
|
|
|
|
totalPrice, data, err = CalcBySchoolTerm(user.Id, isTeacher, req) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
totalPrice, data, err = OldCalcBySchoolTerm(user.Id, isTeacher, req) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
totalPrice, data, err = CalcBySchoolTerm(user.Id, isTeacher, req) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if req.Kind == 2 { |
|
|
if req.Kind == 2 { |
|
|
if req.IsBuyByMealLabel { |
|
|
|
|
|
totalPrice, data, err = CalcByMonth(user.Id, isTeacher, req) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
totalPrice, data, err = OldCalcByMonth(user.Id, isTeacher, req) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
totalPrice, data, err = CalcByMonth(user.Id, isTeacher, req) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if req.Kind == 3 { |
|
|
if req.Kind == 3 { |
|
|
if req.IsBuyByMealLabel { |
|
|
|
|
|
totalPrice, data, err = CalcByDay(user.Id, isTeacher, req) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
totalPrice, data, err = OldCalcByDay(user.Id, isTeacher, req) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
totalPrice, data, err = CalcByDay(user.Id, isTeacher, req) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if req.Kind == 4 { |
|
|
if req.Kind == 4 { |
|
|
if req.IsBuyByMealLabel { |
|
|
|
|
|
totalPrice, data, err = CalcSupplementaryByDay(user.Id, isTeacher, req) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
totalPrice, data, err = OldCalcSupplementaryByDay(user.Id, isTeacher, req) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
totalPrice, data, err = CalcSupplementaryByDay(user.Id, isTeacher, req) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
total = utils.Float64ToStr(totalPrice) |
|
|
total = utils.Float64ToStr(totalPrice) |
|
|