Pārlūkot izejas kodu

update

add_mode
DengBiao pirms 1 gada
vecāks
revīzija
3a6d827340
1 mainītis faili ar 31 papildinājumiem un 12 dzēšanām
  1. +31
    -12
      app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go

+ 31
- 12
app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go Parādīt failu

@@ -738,15 +738,32 @@ func CentralKitchenForSchoolReserveList(req md.CentralKitchenForSchoolReserveLis
}
}

var centralKitchenForSchoolUserWithDayIds []string
if req.StartDate != "" && req.EndDate != "" {
var m []model.CentralKitchenForSchoolUserWithDay
if err1 := db.Db.In("state", []int{enum2.CentralKitchenForSchoolUserWithDayStateForWait, enum2.CentralKitchenForSchoolUserWithDayStateForAlready}).
And("date >= ? And date <= ?", req.StartDate, req.EndDate).Asc("date").Find(&m); err != nil {
return nil, 0, err1
}
for _, v := range m {
centralKitchenForSchoolUserWithDayIds = append(centralKitchenForSchoolUserWithDayIds, v.OrdNo)
//var centralKitchenForSchoolUserWithDayIds []string
//if req.StartDate != "" && req.EndDate != "" {
// var m []model.CentralKitchenForSchoolUserWithDay
// if err1 := db.Db.In("state", []int{enum2.CentralKitchenForSchoolUserWithDayStateForWait, enum2.CentralKitchenForSchoolUserWithDayStateForAlready}).
// And("date >= ? And date <= ?", req.StartDate, req.EndDate).Asc("date").Find(&m); err != nil {
// return nil, 0, err1
// }
// for _, v := range m {
// centralKitchenForSchoolUserWithDayIds = append(centralKitchenForSchoolUserWithDayIds, v.OrdNo)
// }
//}

var months []time.Month
if req.StartDate != "" {
sDate, _ := time.ParseInLocation("2006-01-02 15:04:05", req.StartDate, time.Local)
eDate, _ := time.ParseInLocation("2006-01-02 15:04:05", req.EndDate, time.Local)
_, sMonth, _ := sDate.Date()
_, eMonth, _ := eDate.Date()
diffMonth := sMonth - eMonth
if diffMonth == 0 {
//TODO::查询一个月
months = append(months, sMonth)
} else {
for i := sMonth; i <= eMonth; i++ {
months = append(months, i)
}
}
}

@@ -774,10 +791,12 @@ func CentralKitchenForSchoolReserveList(req md.CentralKitchenForSchoolReserveLis
if len(classWithUserIdentityIdsTwo) > 0 {
sess.In("user_identity.id", classWithUserIdentityIdsTwo)
}
if len(centralKitchenForSchoolUserWithDayIds) > 0 {
sess.In("central_kitchen_for_school_package_ord.out_trade_no", centralKitchenForSchoolUserWithDayIds)
//if len(centralKitchenForSchoolUserWithDayIds) > 0 {
// sess.In("central_kitchen_for_school_package_ord.out_trade_no", centralKitchenForSchoolUserWithDayIds)
//}
if len(months) > 0 {
sess.In("central_kitchen_for_school_package_ord_for_reserve.reserve_month", months)
}

var m []*db.CentralKitchenForSchoolPackageOrdForReserveWithUserIdentity
count, err = sess.
Join("LEFT", "central_kitchen_for_school_package_ord", "central_kitchen_for_school_package_ord_for_reserve.out_trade_no = central_kitchen_for_school_package_ord.out_trade_no").


Notiek ielāde…
Atcelt
Saglabāt