Merge remote-tracking branch 'origin/mark' into don
This commit is contained in:
@@ -649,8 +649,22 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa
|
||||
break
|
||||
}
|
||||
}
|
||||
status := 0
|
||||
if valid["status"] != nil {
|
||||
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 {
|
||||
@@ -678,7 +692,7 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa
|
||||
dummy := &model.StoreMap{}
|
||||
kv := make(map[string]interface{})
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -728,7 +742,15 @@ func EnableHaveRestStores(ctx *jxcontext.Context, isAsync, isContinueWhenError b
|
||||
task := tasksch.NewParallelTask("EnableHaveRestStores", tasksch.NewParallelConfig().SetIsContinueWhenError(isContinueWhenError), ctx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
store := batchItemList[0].(*StoreExt)
|
||||
var autoEnableAt time.Time
|
||||
if store.AutoEnableAt != nil {
|
||||
autoEnableAt = *store.AutoEnableAt
|
||||
} else {
|
||||
autoEnableAt = utils.Time2Date(time.Now().Add(24 * time.Hour)) // 临时休息,但没有设置恢复营业时间,缺省是第二天
|
||||
}
|
||||
if time.Now().Sub(autoEnableAt) >= -2*time.Hour {
|
||||
err = SetStoreStatus(ctx, store.ID, model.StoreStatusOpened)
|
||||
}
|
||||
return nil, err
|
||||
}, storeInfo.Stores)
|
||||
tasksch.ManageTask(task).Run()
|
||||
|
||||
@@ -253,6 +253,7 @@ type Store struct {
|
||||
DeliveryRangeType int8 `json:"deliveryRangeType"` // 参见相关常量定义
|
||||
DeliveryRange string `orm:"type(text)" json:"deliveryRange"` // 如果DeliveryRangeType为DeliveryRangeTypePolygon,则为逗号分隔坐标,分号分隔的坐标点(坐标与Lng和Lat一样,都是整数),比如 121361504,31189308;121420555,31150238。否则为半径,单位为米
|
||||
Status int `json:"status"`
|
||||
AutoEnableAt *time.Time `orm:"type(datetime);null" json:"autoEnableAt"` // 自动营业时间(临时休息用)
|
||||
ChangePriceType int8 `json:"changePriceType"` // 修改价格类型,即是否需要审核
|
||||
SMSNotify int8 `orm:"column(sms_notify);" json:"smsNotify"` // 是否通过短信接收订单消息
|
||||
PrinterDisabled int8 `orm:"default(0)" json:"printerDisabled"` // 是否禁用网络打印机
|
||||
|
||||
Reference in New Issue
Block a user