|
@@ -26,6 +26,20 @@ class RefillCallBack implements refill\IRefillCallBack
|
|
|
|
|
|
public function notify($params)
|
|
public function notify($params)
|
|
{
|
|
{
|
|
|
|
+ $extractOfficialSn = function ($officialSnStr) {
|
|
|
|
+ $officialSn = '';
|
|
|
|
+
|
|
|
|
+ $matches = [];
|
|
|
|
+ if (preg_match_all("/(\d+)/", $officialSnStr, $matches)) {
|
|
|
|
+ foreach ($matches[1] as $item) {
|
|
|
|
+ if (strlen($officialSn) < strlen($item)) {
|
|
|
|
+ $officialSn = $item;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return $officialSn;
|
|
|
|
+ };
|
|
|
|
+
|
|
$status = intval($params['status']);
|
|
$status = intval($params['status']);
|
|
$order_sn = $params['user_order_id'];
|
|
$order_sn = $params['user_order_id'];
|
|
$order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
|
|
$order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
|
|
@@ -35,7 +49,7 @@ class RefillCallBack implements refill\IRefillCallBack
|
|
$order_id = $order_info['order_id'];
|
|
$order_id = $order_info['order_id'];
|
|
|
|
|
|
if ($status === 200) {
|
|
if ($status === 200) {
|
|
- $official_sn = strtolower($params['official_order_id']) == 'null' ? '' : $params['official_order_id'];
|
|
|
|
|
|
+ $official_sn = $extractOfficialSn($params['official_order_id']);
|
|
$data['official_sn'] = $official_sn;
|
|
$data['official_sn'] = $official_sn;
|
|
Model('refill_order')->edit($order_id, $data);
|
|
Model('refill_order')->edit($order_id, $data);
|
|
return [$order_id, true, false, true, $official_sn];
|
|
return [$order_id, true, false, true, $official_sn];
|