diff --git a/business/jxcallback/scheduler/defsch/defsch.go b/business/jxcallback/scheduler/defsch/defsch.go index d835570ba..e8116f292 100644 --- a/business/jxcallback/scheduler/defsch/defsch.go +++ b/business/jxcallback/scheduler/defsch/defsch.go @@ -496,7 +496,7 @@ func (s *DefScheduler) createWaybillOn3rdProviders(savedOrderInfo *WatchOrderInf } if err != nil { - partner.CurOrderManager.OnOrderMsg(order, "自动创建三方运单", jxutils.LimitStringLen(err.Error(), 255)) + partner.CurOrderManager.OnOrderMsg(order, "自动创建三方运单", utils.LimitUTF8StringLen(err.Error(), 255)) } } else { err = nil diff --git a/business/jxcallback/scheduler/scheduler.go b/business/jxcallback/scheduler/scheduler.go index a0654a64d..6a5097e2a 100644 --- a/business/jxcallback/scheduler/scheduler.go +++ b/business/jxcallback/scheduler/scheduler.go @@ -23,7 +23,7 @@ var ( ) var ( - ErrOrderStatusIsNotSuitable4CurOperation = errors.New("订单状态不适合当前操作") + ErrOrderStatusIsNotSuitable4CurOperation = errors.New("订单锁定或状态不适合当前操作") ErrOrderStatusAlreadySatisfyCurOperation = errors.New("订单当前状态已满足当前操作") ErrCanNotCreateAtLeastOneWaybill = errors.New("一个运单都不能创建") diff --git a/business/jxutils/jxutils.go b/business/jxutils/jxutils.go index fa812e9ad..e1f18559e 100644 --- a/business/jxutils/jxutils.go +++ b/business/jxutils/jxutils.go @@ -279,13 +279,7 @@ func ComposeSpuName(prefix, name string, maxLen int) (spuName string) { spuName = "[" + prefix + "]" } spuName += name - if maxLen > 0 { - runeList := []rune(spuName) - if len(runeList) > maxLen { - spuName = string(runeList[:maxLen]) - } - } - return spuName + return utils.LimitUTF8StringLen(spuName, maxLen) } func ComposeSkuSpec(spec_quality float32, spec_unit string) (spec string) { diff --git a/business/jxutils/jxutils_cms.go b/business/jxutils/jxutils_cms.go index d39b932d9..bf3595eba 100644 --- a/business/jxutils/jxutils_cms.go +++ b/business/jxutils/jxutils_cms.go @@ -311,12 +311,3 @@ func AddVendorInfo2Err(inErr error, vendorID int) (outErr error) { } return outErr } - -func LimitStringLen(str string, maxLen int) (limitedStr string) { - if maxLen > 0 { - if strLen := len(str); strLen > maxLen { - str = str[:maxLen] - } - } - return str -}