Store添加字段AutoEnableAt

This commit is contained in:
gazebo
2019-10-10 09:20:57 +08:00
parent 0bcc7ebb1a
commit de09aeaedd
2 changed files with 40 additions and 25 deletions

View File

@@ -649,8 +649,22 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa
break break
} }
} }
status := 0
if valid["status"] != nil { if valid["status"] != nil {
syncStatus |= model.SyncFlagStoreStatus syncStatus |= model.SyncFlagStoreStatus
status = int(utils.Interface2Int64WithDefault(valid["status"], 0))
if status != model.StoreStatusClosed && status != model.StoreStatusHaveRest {
valid["autoEnableAt"] = nil
} else {
if valid["autoEnableAt"] != nil {
status = model.StoreStatusHaveRest
valid["autoEnableAt"] = utils.Time2Date(utils.Str2Time(utils.Interface2String(valid["autoEnableAt"])))
} else {
status = model.StoreStatusClosed
}
valid["status"] = status
}
} }
if valid["deliveryRange"] != nil { if valid["deliveryRange"] != nil {
@@ -678,7 +692,7 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa
dummy := &model.StoreMap{} dummy := &model.StoreMap{}
kv := make(map[string]interface{}) kv := make(map[string]interface{})
if valid["status"] != nil { if valid["status"] != nil {
if status := int(utils.Interface2Int64WithDefault(valid["status"], 0)); status == model.StoreStatusOpened { if syncStatus&model.SyncFlagStoreStatus != 0 && status == model.StoreStatusOpened {
kv[model.FieldStatus] = status kv[model.FieldStatus] = status
} }
} }

View File

@@ -253,6 +253,7 @@ type Store struct {
DeliveryRangeType int8 `json:"deliveryRangeType"` // 参见相关常量定义 DeliveryRangeType int8 `json:"deliveryRangeType"` // 参见相关常量定义
DeliveryRange string `orm:"type(text)" json:"deliveryRange"` // 如果DeliveryRangeType为DeliveryRangeTypePolygon则为逗号分隔坐标分号分隔的坐标点坐标与Lng和Lat一样都是整数比如 121361504,31189308;121420555,31150238。否则为半径单位为米 DeliveryRange string `orm:"type(text)" json:"deliveryRange"` // 如果DeliveryRangeType为DeliveryRangeTypePolygon则为逗号分隔坐标分号分隔的坐标点坐标与Lng和Lat一样都是整数比如 121361504,31189308;121420555,31150238。否则为半径单位为米
Status int `json:"status"` Status int `json:"status"`
AutoEnableAt *time.Time `orm:"type(datetime);null" json:"autoEnableAt"` // 自动营业时间(临时休息用)
ChangePriceType int8 `json:"changePriceType"` // 修改价格类型,即是否需要审核 ChangePriceType int8 `json:"changePriceType"` // 修改价格类型,即是否需要审核
SMSNotify int8 `orm:"column(sms_notify);" json:"smsNotify"` // 是否通过短信接收订单消息 SMSNotify int8 `orm:"column(sms_notify);" json:"smsNotify"` // 是否通过短信接收订单消息
PrinterDisabled int8 `orm:"default(0)" json:"printerDisabled"` // 是否禁用网络打印机 PrinterDisabled int8 `orm:"default(0)" json:"printerDisabled"` // 是否禁用网络打印机