|
@@ -69,14 +69,14 @@ class RefillOil extends refill\IRefillOil
|
|
|
|
|
|
public function query($refill_info)
|
|
|
{
|
|
|
- $waterno_by_voucher = function ($voucher): string
|
|
|
+ $extract_official_sn = function ($voucher): string
|
|
|
{
|
|
|
$matches = [];
|
|
|
- $ret = preg_match("/\:(\d+)/", $voucher, $matches);
|
|
|
- if ($ret === 1 && !empty($matches)) {
|
|
|
+ if (preg_match("/\:(\d+)/", $voucher, $matches)) {
|
|
|
return $matches[1];
|
|
|
+ } else {
|
|
|
+ return '';
|
|
|
}
|
|
|
- return '';
|
|
|
};
|
|
|
|
|
|
$params['username'] = config::USER_NAME;
|
|
@@ -99,8 +99,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 = $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;
|