+ UpdateStoreOpTime
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package jd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/jxcallback/scheduler"
|
||||
@@ -113,12 +114,11 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
|
||||
outSystemID = utils.Int2Str(int(store.ID))
|
||||
}
|
||||
params := map[string]interface{}{
|
||||
"outSystemId": outSystemID, // todo 直接修改这个字段可能会有问题
|
||||
"serviceTimeStart1": JxOperationTime2JdOperationTime(store.OpenTime1),
|
||||
"serviceTimeEnd1": JxOperationTime2JdOperationTime(store.CloseTime1),
|
||||
"phone": store.Tel1,
|
||||
"mobile": store.Tel2,
|
||||
"outSystemId": outSystemID, // todo 直接修改这个字段可能会有问题
|
||||
"phone": store.Tel1,
|
||||
"mobile": store.Tel2,
|
||||
}
|
||||
fillOpTimeParams(params, []int16{store.OpenTime1, store.CloseTime1, store.OpenTime2, store.CloseTime2})
|
||||
if store.SyncStatus&(model.SyncFlagNewMask|model.SyncFlagStoreName) != 0 {
|
||||
params["stationName"] = jxutils.ComposeStoreName(store.Name, model.VendorIDJD)
|
||||
}
|
||||
@@ -140,11 +140,6 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
|
||||
params["deliveryRangeRadius"] = utils.Str2Int64WithDefault(store.DeliveryRange, 0)
|
||||
}
|
||||
}
|
||||
openTime2 := JxOperationTime2JdOperationTime(store.OpenTime2)
|
||||
if openTime2 != 0 {
|
||||
params["serviceTimeStart2"] = openTime2
|
||||
params["serviceTimeEnd2"] = JxOperationTime2JdOperationTime(store.CloseTime2)
|
||||
}
|
||||
_, params["closeStatus"] = JxStoreStatus2JdStatus(jxutils.MergeStoreStatus(store.Status, store.JdStoreStatus))
|
||||
globals.SugarLogger.Debug(utils.Format4Output(params, false))
|
||||
if globals.EnableJdStoreWrite {
|
||||
@@ -328,3 +323,33 @@ func (c *PurchaseHandler) UpdateStoreStatus(ctx *jxcontext.Context, storeID int,
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func fillOpTimeParams(params map[string]interface{}, opTimeList []int16) map[string]interface{} {
|
||||
if params == nil {
|
||||
params = make(map[string]interface{})
|
||||
}
|
||||
index := 1
|
||||
opTimeListLen := len(opTimeList)
|
||||
if opTimeListLen > 4 {
|
||||
opTimeListLen = 4
|
||||
}
|
||||
opTimeListLen = opTimeListLen / 2 * 2
|
||||
for k := 0; k < len(opTimeList); k += 2 {
|
||||
if opTimeList[k] != 0 {
|
||||
params[fmt.Sprintf("serviceTimeStart%d", index)] = JxOperationTime2JdOperationTime(int16(opTimeList[k]))
|
||||
params[fmt.Sprintf("serviceTimeEnd%d", index)] = JxOperationTime2JdOperationTime(int16(opTimeList[k+1]))
|
||||
} else {
|
||||
break
|
||||
}
|
||||
index++
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
func (c *PurchaseHandler) UpdateStoreOpTime(ctx *jxcontext.Context, storeID int, vendorStoreID string, opTimeList []int16) (err error) {
|
||||
params := fillOpTimeParams(nil, opTimeList)
|
||||
if globals.EnableJdStoreWrite {
|
||||
err = api.JdAPI.UpdateStoreInfo4Open(vendorStoreID, ctx.GetUserName(), params)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user