|
|
@@ -49,7 +49,7 @@ class WeightBaseController
|
|
|
|
|
|
// 2.获取快递单号
|
|
|
$logistic_number = $this->getCodeValue($params);
|
|
|
-
|
|
|
+ if(!$logistic_number)return $this->getLogisticNumberIsNullMessage($params);
|
|
|
// 3、获取称重设备
|
|
|
$measuringMachine = $this->getMeasuringMachine($params);
|
|
|
|
|
|
@@ -150,6 +150,10 @@ class WeightBaseController
|
|
|
return json_encode(['success' => false, 'message' => '更新包裹信息出现异常'], JSON_UNESCAPED_UNICODE);
|
|
|
}
|
|
|
|
|
|
+ public function getLogisticNumberIsNullMessage($params)
|
|
|
+ {
|
|
|
+ return json_encode(['success'=>false,'message'=>'快递单号过滤后为空'],JSON_UNESCAPED_UNICODE); }
|
|
|
+
|
|
|
// endregion
|
|
|
|
|
|
// region ---参数校验
|
|
|
@@ -388,9 +392,9 @@ class WeightBaseController
|
|
|
* 快递单号 string 处理
|
|
|
*
|
|
|
* @param $code
|
|
|
- * @return string
|
|
|
+ * @return string|null
|
|
|
*/
|
|
|
- public function processCodeStr($code): string
|
|
|
+ public function processCodeStr($code): ?string
|
|
|
{
|
|
|
$codes = [];
|
|
|
preg_match_all('/[\w]+/',$code,$codes);
|
|
|
@@ -402,7 +406,7 @@ class WeightBaseController
|
|
|
if(strlen($a) == strlen($b))return 0;
|
|
|
return strlen($a) < strlen($b) ? 1 : -1;
|
|
|
});
|
|
|
- return $codes[0];
|
|
|
+ return $codes[0] ?? null;
|
|
|
}
|
|
|
|
|
|
// endregion
|