sifangpay/app/ServicePay/TransCard/AiJICard.php

55 lines
1.6 KiB
PHP

<?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();
}
}