浏览代码

update

add_mode
DengBiao 1年前
父节点
当前提交
315fa3ab84
共有 2 个文件被更改,包括 8 次插入4 次删除
  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 查看文件

@@ -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 查看文件

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


正在加载...
取消
保存