38 lines
879 B
PHP
38 lines
879 B
PHP
<?php
|
|
|
|
namespace App\ServicePay\TransCard;
|
|
|
|
class ExampleCard extends BaseCard
|
|
{
|
|
private $orderInfo = [];
|
|
|
|
public function message($msg)
|
|
{
|
|
$this->msg = $msg;
|
|
$this->analysisMsg();
|
|
}
|
|
|
|
private function analysisMsg(){
|
|
$pattern = '/[0-9]{10,}|[0-9]{1,}\.[0-9]{1,2}/';
|
|
preg_match_all($pattern, $this->msg, $matches, PREG_PATTERN_ORDER);
|
|
if ($matches[0]) {
|
|
$this->orderInfo = [
|
|
'from_card' => $matches[0][1],
|
|
'pay_money' => $matches[0][0],
|
|
'order_number' => $matches[0][2],
|
|
];
|
|
}
|
|
}
|
|
|
|
public function showInfo()
|
|
{
|
|
$init = [
|
|
'from_card' => null,
|
|
'pay_money' => null,
|
|
'remark' => null,
|
|
'order_number' => null,
|
|
];
|
|
|
|
return array_merge($init, $this->orderInfo);
|
|
}
|
|
} |