From de895227efbec16aee360e6530ee8199ce29e6c7 Mon Sep 17 00:00:00 2001 From: "yan.y" Date: Thu, 9 May 2024 21:26:13 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=BB=E8=BE=91=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/api/common.go | 2 +- business/models/dataModel.go | 6 +++--- business/utils/commonUtil.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/business/api/common.go b/business/api/common.go index 15c6f78..7d510e6 100644 --- a/business/api/common.go +++ b/business/api/common.go @@ -180,7 +180,7 @@ func DataInit() { for _, value := range serviceTimesList { AddrServiceMap[value.ServiceAddrId] = value } - zap_server.ZAPLOG.Info("dataInit AddrServiceMap : ", zap.Any("AddrServiceMap", CarMap)) + zap_server.ZAPLOG.Info("dataInit AddrServiceMap : ", zap.Any("AddrServiceMap", AddrServiceMap)) } func DataCacheJob() { diff --git a/business/models/dataModel.go b/business/models/dataModel.go index 61520ef..fe99b63 100644 --- a/business/models/dataModel.go +++ b/business/models/dataModel.go @@ -227,7 +227,7 @@ type ReserveTimeFilter struct { // AddrServiceTime 服务地址时间排期 type AddrServiceTime struct { - Id int `gorm:"primaryKey;autoIncrement" json:"id"` //id - ServiceAddrId int64 `gorm:"index;not null" json:"ServiceAddrId"` //服务地址ID - Times string `gorm:"index;not null" json:"times"` //时间列表 + Id int `gorm:"primaryKey;autoIncrement" json:"id"` //id + ServiceAddrId int64 `gorm:"not null" json:"ServiceAddrId"` //服务地址ID + Times string `gorm:"not null" json:"times"` //时间列表 } diff --git a/business/utils/commonUtil.go b/business/utils/commonUtil.go index 1314b3a..bdbaa0c 100644 --- a/business/utils/commonUtil.go +++ b/business/utils/commonUtil.go @@ -56,7 +56,7 @@ func GetStrDays(day int, minute int, reserveMap map[string]models.ReserveTimeFil orderNum, existOrderNum := orderNumMap[nextHour.Format("2006-01-02 15:04")] if (nextHour.Hour() >= workStart && nextHour.Hour() < workEnd) && (!existsDay && !existsHour) && !existOrderTime { key := nextHour.Format("2006-01-02") - if _, ok := serviceDaysMap[key]; !ok { + if _, ok := serviceDaysMap[key]; len(serviceDaysMap) > 0 && !ok { //不存在服务配置中返回false dayHoursMap[key] = append(dayHoursMap[key], TimeObject{ Time: nextHour.Format("15:04"),