瀏覽代碼

处理合并冲突文件RefillOil.php

zhaoming 1 年之前
父節點
當前提交
8266f296fe
共有 2 個文件被更改,包括 13 次插入3 次删除
  1. 3 3
      helper/refill/api/xyz/leyou/RefillOil.php
  2. 10 0
      helper/refill/api/xyz/leyou/config.php

+ 3 - 3
helper/refill/api/xyz/leyou/RefillOil.php

@@ -77,7 +77,7 @@ class RefillOil extends refill\IRefillOil
             }
           return '';
         };
-
+        
         $params['username'] = config::USER_NAME;
         $params['orderNumber'] = $refill_info['order_sn'];
         $params['sign'] = $this->sign($params);
@@ -98,8 +98,8 @@ class RefillOil extends refill\IRefillOil
             {
                 $status = $resp['data']['status'];
                 if ($status === 5) {
-                    $updata['official_sn'] = $waterno_by_voucher($resp['data']['voucher']);
-                    Model('refill_order')->edit($refill_info['order_id'], $updata);
+                    $official_sn = config::extract_official_sn($resp['data']['voucher']);
+                    Model('refill_order')->edit($refill_info['order_id'], ['official_sn' => $official_sn]);
                     $order_state = ORDER_STATE_SUCCESS;
                 } elseif ($status === 6) {
                     $order_state = ORDER_STATE_CANCEL;

+ 10 - 0
helper/refill/api/xyz/leyou/config.php

@@ -51,4 +51,14 @@ class config
         'money',
         'orderTime'
     ];
+
+    public static function extract_official_sn($voucher): string
+    {
+        $matches = [];
+        if (preg_match("/\:(\d+)/", $voucher, $matches)) {
+            return $matches[1];
+        } else {
+            return '';
+        }
+    }
 }