|
|
@@ -256,6 +256,7 @@ type AppointTimeInfoInstrument struct {
|
|
|
IsAppointAvailable int // 是否默认可预约 1是 2否
|
|
|
InAdvance int // 需要提前预约时间 单位小时
|
|
|
FurtherRange int // 未来可预约范围 单位周
|
|
|
+ FurtherLimit int // 非优先预约人员可预约时间/小时
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -347,6 +348,7 @@ func (s Service) AppointTimeInfo(req *equipment2.AppointTimeInfoReq, userinfo re
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
+ var furtherLimit *gtime.Time
|
|
|
if qualificationCount == 0 {
|
|
|
err := s.Dao.DB.Model("base_equipment_advance_time").
|
|
|
Where("EquipmentId = ?", req.InstrumentId).
|
|
|
@@ -357,6 +359,9 @@ func (s Service) AppointTimeInfo(req *equipment2.AppointTimeInfoReq, userinfo re
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
+ if instr.FurtherLimit != 0 {
|
|
|
+ furtherLimit = gtime.Now().Add(time.Hour * time.Duration(instr.FurtherLimit))
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
unavailable := []TimeSpan{}
|
|
|
@@ -434,6 +439,7 @@ func (s Service) AppointTimeInfo(req *equipment2.AppointTimeInfoReq, userinfo re
|
|
|
}
|
|
|
|
|
|
return map[string]interface{}{
|
|
|
+ "further_limit": furtherLimit,
|
|
|
"further_range": instr.FurtherRange,
|
|
|
"time_split": timesplit,
|
|
|
"begin_at": instr.BeginAt.Time.Format("15:04:05"),
|
|
|
@@ -522,6 +528,15 @@ func (s Service) RateChange(InstrumentId, rate int) error {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
+func (s Service) UpdateFurtherLimit(id, limit int) error {
|
|
|
+ _, err := s.Dao.DB.Model("Instrument").Update("FurtherLimit = "+strconv.Itoa(limit), "Id = "+
|
|
|
+ strconv.Itoa(id))
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
// IsAdvance 是否有优先预约资格
|
|
|
func (s Service) IsAdvance(id int32, instrumentId int) (isAdvance int, err error) {
|
|
|
equipmentQualification := equipment2.BaseEquipmentQualification{}
|