必要时清除门店商品价格锁定时间
This commit is contained in:
@@ -235,6 +235,9 @@ func formalizeStoreSkuList(inSkuList []*dao.StoreSkuSyncInfo) []*dao.StoreSkuSyn
|
|||||||
|
|
||||||
func sku2Update(vendorID int, sku *dao.StoreSkuSyncInfo, syncStatus int8) (item *dao.KVUpdateItem) {
|
func sku2Update(vendorID int, sku *dao.StoreSkuSyncInfo, syncStatus int8) (item *dao.KVUpdateItem) {
|
||||||
kvs := map[string]interface{}{}
|
kvs := map[string]interface{}{}
|
||||||
|
if !isSkuLockTimeValid(sku) {
|
||||||
|
kvs[dao.GetVendorLockTimeStructField(model.VendorNames[vendorID])] = nil
|
||||||
|
}
|
||||||
if syncStatus&(model.SyncFlagDeletedMask|model.SyncFlagNewMask|model.SyncFlagModifiedMask) != 0 {
|
if syncStatus&(model.SyncFlagDeletedMask|model.SyncFlagNewMask|model.SyncFlagModifiedMask) != 0 {
|
||||||
if model.IsSyncStatusNew(syncStatus) {
|
if model.IsSyncStatusNew(syncStatus) {
|
||||||
sku.SkuSyncStatus = 0
|
sku.SkuSyncStatus = 0
|
||||||
@@ -289,6 +292,10 @@ func updateStoreSku(db *dao.DaoDB, vendorID int, storeSkuList []*dao.StoreSkuSyn
|
|||||||
return num, err
|
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) {
|
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()
|
db := dao.GetDB()
|
||||||
storeDetail, err := dao.GetStoreDetail(db, storeID, vendorID)
|
storeDetail, err := dao.GetStoreDetail(db, storeID, vendorID)
|
||||||
@@ -336,7 +343,7 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, isFull bo
|
|||||||
now := jxutils.OperationTime2HourMinuteFormat(time.Now())
|
now := jxutils.OperationTime2HourMinuteFormat(time.Now())
|
||||||
for _, sku := range skus {
|
for _, sku := range skus {
|
||||||
if !useVendorPriceDirectly &&
|
if !useVendorPriceDirectly &&
|
||||||
(sku.LockTime == nil || time.Now().Sub(*sku.LockTime) > 0) {
|
!isSkuLockTimeValid(sku) {
|
||||||
sku.VendorPrice = 0
|
sku.VendorPrice = 0
|
||||||
}
|
}
|
||||||
sku.MergedStatus = MergeSkuSaleStatusWithStoreOpTime(sku, storeDetail, now)
|
sku.MergedStatus = MergeSkuSaleStatusWithStoreOpTime(sku, storeDetail, now)
|
||||||
|
|||||||
@@ -160,6 +160,10 @@ func GetCategoryIDDBField(prefix string) string {
|
|||||||
return ConvertDBFieldPrefix(prefix) + "_category_id"
|
return ConvertDBFieldPrefix(prefix) + "_category_id"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetVendorLockTimeStructField(prefix string) string {
|
||||||
|
return ConvertStructFieldPrefix(prefix) + "LockTime"
|
||||||
|
}
|
||||||
|
|
||||||
func value2Value(srcValue, dstValue reflect.Value, copyType int) {
|
func value2Value(srcValue, dstValue reflect.Value, copyType int) {
|
||||||
srcType := srcValue.Type()
|
srcType := srcValue.Type()
|
||||||
for i := 0; i < srcType.NumField(); i++ {
|
for i := 0; i < srcType.NumField(); i++ {
|
||||||
|
|||||||
Reference in New Issue
Block a user