Merge remote-tracking branch 'origin/mark' into yonghui

This commit is contained in:
苏尹岚
2019-12-18 15:19:39 +08:00
11 changed files with 77 additions and 17 deletions

View File

@@ -319,6 +319,12 @@ func getGetStoresSkusBaseSQL(db *dao.DaoDB, storeIDs, skuIDs []int, isFocus bool
sqlParams = append(sqlParams, skuID)
}
}
if lockTimeStr, ok := params["lockTime"].(string); ok && lockTimeStr != "" {
if timeList, err2 := jxutils.BatchStr2Time(lockTimeStr); err2 == nil {
sql += " AND (t4.jd_lock_time > ? OR t4.mtwm_lock_time > ? OR t4.ebai_lock_time > ? OR t4.jx_lock_time > ?)"
sqlParams = append(sqlParams, timeList[0], timeList[0], timeList[0], timeList[0])
}
}
if isFocus {
if params["fromStatus"] != nil {
fromStatus := params["fromStatus"].(int)
@@ -451,6 +457,7 @@ func GetStoresSkusNew(ctx *jxcontext.Context, storeIDs, skuIDs []int, isFocus bo
t4.ebai_id, t4.mtwm_id,
t4.jd_sync_status, t4.ebai_sync_status, t4.mtwm_sync_status,
t4.jd_price, t4.ebai_price, t4.mtwm_price, t4.jx_price,
t4.jd_lock_time, t4.ebai_lock_time, t4.mtwm_lock_time, t4.jx_lock_time,
t4.status_sale_begin, t4.status_sale_end
`, jdVendorIDField) + sql
var tmpList []*tGetStoresSkusInfo

View File

@@ -235,6 +235,9 @@ func formalizeStoreSkuList(inSkuList []*dao.StoreSkuSyncInfo) []*dao.StoreSkuSyn
func sku2Update(vendorID int, sku *dao.StoreSkuSyncInfo, syncStatus int8) (item *dao.KVUpdateItem) {
kvs := map[string]interface{}{}
if !isSkuLockTimeValid(sku) {
kvs[dao.GetVendorLockTimeStructField(model.VendorNames[vendorID])] = nil
}
if syncStatus&(model.SyncFlagDeletedMask|model.SyncFlagNewMask|model.SyncFlagModifiedMask) != 0 {
if model.IsSyncStatusNew(syncStatus) {
sku.SkuSyncStatus = 0
@@ -289,6 +292,10 @@ func updateStoreSku(db *dao.DaoDB, vendorID int, storeSkuList []*dao.StoreSkuSyn
return num, err
}
func isSkuLockTimeValid(sku *dao.StoreSkuSyncInfo) bool {
return sku.LockTime != nil && time.Now().Sub(*sku.LockTime) < 0
}
func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, isFull bool, vendorID, storeID int, nameIDs, skuIDs, excludeSkuIDs []int, useVendorPriceDirectly, isContinueWhenError bool) (err error) {
db := dao.GetDB()
storeDetail, err := dao.GetStoreDetail(db, storeID, vendorID)
@@ -335,7 +342,8 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, isFull bo
}
now := jxutils.OperationTime2HourMinuteFormat(time.Now())
for _, sku := range skus {
if !useVendorPriceDirectly {
if !useVendorPriceDirectly &&
!isSkuLockTimeValid(sku) {
sku.VendorPrice = 0
}
sku.MergedStatus = MergeSkuSaleStatusWithStoreOpTime(sku, storeDetail, now)