Parcourir la source

update

add_mode
DengBiao il y a 1 an
Parent
révision
315fa3ab84
2 fichiers modifiés avec 8 ajouts et 4 suppressions
  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 Voir le fichier

@@ -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 Voir le fichier

@@ -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


Chargement…
Annuler
Enregistrer