diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 3712983eb..50b86a75d 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -267,11 +267,7 @@ func (c *OrderManager) SaveOrder(order *model.GoodsOrder, isAdjust bool, db *dao } else { isDuplicated = true order.DuplicatedCount++ - if order.Status == model.OrderStatusCanceled || order.Status == model.OrderStatusFinished { - db.Db.Update(order, "DuplicatedCount", "Status") - } else { - db.Db.Update(order, "DuplicatedCount") - } + db.Db.Update(order, "DuplicatedCount") baseapi.SugarLogger.Infof("saveOrder duplicated orderid:%s msg received", order.VendorOrderID) } } diff --git a/business/jxcallback/orderman/orderman_ext.go b/business/jxcallback/orderman/orderman_ext.go index d519d086b..e7568f063 100644 --- a/business/jxcallback/orderman/orderman_ext.go +++ b/business/jxcallback/orderman/orderman_ext.go @@ -23,6 +23,9 @@ import ( const ( maxLastHours = 7 * 24 // 最多只能查询7天内的订单数据 defLastHours = 2 * 24 // 缺省是两天内的订单 + + orderMixTimeImmediatelyArrive = 8 + orderMixTimeDelayArrive = 5 ) type tWaybillExt struct { @@ -992,11 +995,11 @@ func (c *OrderManager) AmendMissingOrders(ctx *jxcontext.Context, vendorIDs []in } else { if goodsOrder.Status != model.OrderStatusFinished && goodsOrder.Status != model.OrderStatusCanceled { if goodsOrder.BusinessType == model.BusinessTypeImmediate { - if time.Now().Sub(goodsOrder.CreatedAt).Hours() >= 8 { + if time.Now().Sub(goodsOrder.CreatedAt).Hours() >= orderMixTimeImmediatelyArrive { missingOrderList = append(missingOrderList, pair) } } else { - if time.Now().Sub(goodsOrder.ExpectedDeliveredTime).Hours() >= 5 { + if time.Now().Sub(goodsOrder.ExpectedDeliveredTime).Hours() >= orderMixTimeDelayArrive { missingOrderList = append(missingOrderList, pair) } } @@ -1010,6 +1013,9 @@ func (c *OrderManager) AmendMissingOrders(ctx *jxcontext.Context, vendorIDs []in if handler := partner.GetPurchaseOrderHandlerFromVendorID(pair.VendorID); handler != nil { order, err2 := handler.GetOrder(pair.VendorOrgCode, pair.VendorOrderID) if err = err2; err == nil { + if order.Status == model.OrderStatusCanceled || order.Status == model.OrderStatusFinished { + err = c.UpdateOrderFields(order, []string{"Status"}) + } isDuplicated, err2 := c.SaveOrder(order, false, dao.GetDB()) if err2 == nil && !isDuplicated { retVal = []int{1} diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index bdc3f8f65..ec780e523 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -1150,9 +1150,8 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor if valid["status"] != nil { syncStatus |= model.SyncFlagStoreStatus } - if valid["vendorStoreName"] != nil { - vendorStoreName := valid["vendorStoreName"].(string) - if utf8.RuneCountInString(vendorStoreName) > 13 && vendorID == model.VendorIDJD { + if vendorStoreName, ok := valid["vendorStoreName"].(string); ok { + if utf8.RuneCountInString(vendorStoreName) > jdapi.MaxStoreNameLen && vendorID == model.VendorIDJD { return 0, fmt.Errorf("门店名称不允许超过13位!") } syncStatus |= model.SyncFlagStoreName diff --git a/business/jxutils/jxutils.go b/business/jxutils/jxutils.go index 666d3dcbe..84057d206 100644 --- a/business/jxutils/jxutils.go +++ b/business/jxutils/jxutils.go @@ -328,7 +328,7 @@ func FloatWeight2Int(weight float32) int { } func ComposeSkuName(prefix, name, comment, unit string, spec_quality float32, spec_unit string, maxLen int, exPrefix string, exPrefixBegin, exPrefixEnd time.Time) (skuName string) { - if exPrefix != "" && exPrefixBegin != utils.ZeroTimeValue && exPrefixEnd != utils.ZeroTimeValue { + if exPrefix != "" && !utils.IsTimeZero(exPrefixBegin) && !utils.IsTimeZero(exPrefixEnd) { if time.Now().Before(exPrefixEnd) && time.Now().After(exPrefixBegin) { skuName = exPrefix } diff --git a/business/model/dao/store_sku.go b/business/model/dao/store_sku.go index 1a970d05d..86b4bac83 100644 --- a/business/model/dao/store_sku.go +++ b/business/model/dao/store_sku.go @@ -514,7 +514,7 @@ func newGetFullStoreSkus(db *DaoDB, vendorID, storeID int) (skus []*StoreSkuSync t1.id bind_id, t1.price, t1.unit_price, t1.status store_sku_status, t1.%s_sync_status sku_sync_status, t1.store_id, t1.deleted_at bind_deleted_at, t2.*, t2.id sku_id, t2m.vendor_thing_id vendor_sku_id, - t3.id name_id, t3.prefix, t3.name, t3.unit, t3.upc, + t3.id name_id, t3.prefix, t3.name, t3.unit, t3.upc, t3.ex_prefix, t3.ex_prefix_begin, t3.ex_prefix_end, IF(t11.%s <> '', t11.%s, t3.img) img, IF(t12.%s <> '', t12.%s, t3.img2) img2, t13.%s desc_img, diff --git a/business/partner/purchase/ebai/store_sku2.go b/business/partner/purchase/ebai/store_sku2.go index 3da268f76..ec7e619d8 100644 --- a/business/partner/purchase/ebai/store_sku2.go +++ b/business/partner/purchase/ebai/store_sku2.go @@ -245,7 +245,7 @@ func genSkuParamsFromStoreSkuInfo2(storeSku *dao.StoreSkuSyncInfo, isCreate bool }) } params = map[string]interface{}{ - "name": utils.LimitUTF8StringLen(utils.FilterEmoji(storeSku.SkuName), ebaiapi.MaxSkuNameByteCount), + "name": utils.LimitMixedStringLen(storeSku.SkuName, ebaiapi.MaxSkuNameByteCount), "left_num": model.MaxStoreSkuStockQty, "category_id": utils.Str2Int64(storeSku.VendorCatID), "predict_cat": 0, // 不使用推荐类目