适配新的短信模板

This commit is contained in:
zcy 2022-05-25 16:37:16 +08:00
parent 0c0d1ca775
commit 192e4e0242
5 changed files with 62 additions and 6 deletions

View File

@ -67,6 +67,7 @@ class PayController extends BaseController
return [
1 => 'FeilvbinCard',
2 => 'KshCard',
3 => 'AiJICard',
];
}

View File

@ -205,7 +205,8 @@ class GuMaPayServices implements PayApiInterface
//取得订单,是否有此订单,如果没有直接返回空
//order_money
$ewm_account = $requestArr['from_card'];
if (is_null($ewm_account)) {
$remark = $requestArr['remark'];
if (is_null($ewm_account) && is_null($remark)) {
return '参数异常';
}

View File

@ -0,0 +1,54 @@
<?php
namespace App\ServicePay\TransCard;
use App\Models\Order;
class AiJICard extends BaseCard{
public function message($msg)
{
$this->msg = $msg;
$this->analysisMsg();
}
/**
*
INWARD TRF - TT KEO
SIVSAN 1IR205115648C01
7998528130FS
+ 355.20 SGD
*/
private function analysisMsg(){
$pattern = '/INWARD|(?<=INWARD\s)[\w\s-]{5,20}(?=\n)|(?<=\n)\w{3,}|[\w\d]{5,}(?=\n)|\d{8,15}(?=FS)FS|(?<=\+\s)\d+\.\d{2}/';
$match_num = preg_match_all($pattern, $this->msg, $matches, PREG_PATTERN_ORDER);
if ($match_num != false && $match_num > 0 && $matches[0]) {
if($matches[0][0]=='INWARD'){
$this->orderInfo = [
// 'from_card' => $matches[0][1],
'pay_money' => $matches[0][5],
'from_name' => $matches[0][2],
'order_number' => $matches[0][3],
'remark' => $matches[0][4],
];
}
}
}
public function orderInfo($requestArr)
{
$showInfo = $this->showInfo();
// $ewm_account = $showInfo['from_card'];
$order_money = $showInfo['pay_money'];
$remark = $showInfo['remark'];
$order_money = number_format($order_money, 2, '.', '');
//查找未支付的订单
$t = date('Y-m-d H:i:s');
return Order::where('order_at', '<', $t)
->where('order_money', $order_money)
->where('ewm_mark', $remark)
// ->whereIn('status', [0, 2])
->orderBy('id', 'desc')->first();
}
}

View File

@ -27,7 +27,7 @@ class FeilvbinCard extends BaseCard
$showInfo = $this->showInfo();
$ewm_account = $showInfo['from_card'];
$order_money = $showInfo['pay_money'];
$order_money = number_format($order_money, 2, ',', '');
$order_money = number_format($order_money, 2, '.', '');
//查找未支付的订单
$t = date('Y-m-d H:i:s');
return Order::where('order_at', '<', $t)

View File

@ -32,7 +32,7 @@ class KshCard extends BaseCard
$ewm_account = $showInfo['from_card'];
$order_money = $showInfo['pay_money'];
$from_name = $showInfo['from_name'];
$order_money = number_format($order_money, 2, ',', '');
$order_money = number_format($order_money, 2, '.', '');
//查找未支付的订单
$t = date('Y-m-d H:i:s');
return Order::where('order_at', '<', $t)