Pārlūkot izejas kodu

update

add_mode
DengBiao pirms 1 gada
vecāks
revīzija
315fa3ab84
2 mainītis faili ar 8 papildinājumiem un 4 dzēšanām
  1. +7
    -3
      app/customer/svc/order/svc_central_kitchen_for_school_order.go
  2. +1
    -1
      app/db/db_central_kitchen_for_school_user_with_day.go

+ 7
- 3
app/customer/svc/order/svc_central_kitchen_for_school_order.go Parādīt failu

@@ -166,9 +166,11 @@ func CentralKitchenForSchoolMyReserve(userIdentityId int, date, startDate, endDa
//2、构造数据
var totalBreakfast, totalLunch, totalDinner, total int
var dateMap = map[string]*md.CentralKitchenForSchoolMyReserveRespList{}
var dateMapKey []string
for _, v := range *list {
if v.State == enum.CentralKitchenForSchoolUserWithDayStateForWait || v.State == enum.CentralKitchenForSchoolUserWithDayStateForAlready {
if dateMap[v.Date] == nil {
dateMapKey = append(dateMapKey, v.Date)
dateMap[v.Date] = &md.CentralKitchenForSchoolMyReserveRespList{}
}
dateMap[v.Date].Date = v.Date
@@ -187,12 +189,14 @@ func CentralKitchenForSchoolMyReserve(userIdentityId int, date, startDate, endDa
}
}
}

for _, value := range dateMapKey {
resp.List = append(resp.List, *dateMap[value])
}

resp.Total = total
resp.LunchTotal = totalLunch
resp.DinnerTotal = totalDinner
resp.BreakfastTotal = totalBreakfast
for _, v := range dateMap {
resp.List = append(resp.List, *v)
}
return
}

+ 1
- 1
app/db/db_central_kitchen_for_school_user_with_day.go Parādīt failu

@@ -32,7 +32,7 @@ func (centralKitchenForSchoolUserWithDayDb *CentralKitchenForSchoolUserWithDayDb
func (centralKitchenForSchoolUserWithDayDb *CentralKitchenForSchoolUserWithDayDb) FindCentralKitchenForSchoolUserWithDayByDate(sDate, eDate string) (*[]model.CentralKitchenForSchoolUserWithDay, error) {
var m []model.CentralKitchenForSchoolUserWithDay
if err := centralKitchenForSchoolUserWithDayDb.Db.Where("identity_id =?", centralKitchenForSchoolUserWithDayDb.IdentityId).
And("date >= ? And date <= ?", sDate, eDate).Desc("id").Find(&m); err != nil {
And("date >= ? And date <= ?", sDate, eDate).Asc("date").Find(&m); err != nil {
return nil, logx.Error(err)
}
return &m, nil


Notiek ielāde…
Atcelt
Saglabāt