51 lines
1.7 KiB
PHP
51 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\ServicePay\TransCard;
|
|
|
|
use App\Models\Order;
|
|
|
|
class WugandaCard extends BaseCard
|
|
{
|
|
|
|
public function message($msg)
|
|
{
|
|
//You have received UGX 10000
|
|
//from ABUK KHOT CHAN,
|
|
//256775751711 on 2022-07-05
|
|
//22:33:18. Reason: 1. New
|
|
//balance: UGX 3654870. ID:
|
|
//16502598440.
|
|
$this->msg = $msg;
|
|
$pattern = '/(?<=UGX\s)\d+(?=\s)|(?<=from\s)[\w\s]+|\d{5,}(?=\s)|(?<=ID:\s)\d+(?=\.)|\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}|(?<=Reason:\s).*(?=\.)/';
|
|
$match_num = preg_match_all($pattern, $this->msg, $matches, PREG_PATTERN_ORDER);
|
|
if ($match_num != false && $match_num > 0 && $matches[0]) {
|
|
$this->orderInfo = [
|
|
'pay_money' => $matches[0][0],
|
|
'from_name' => $matches[0][1],
|
|
'from_card' => $matches[0][2],
|
|
'sms_date' => $matches[0][3],
|
|
'remark' => $matches[0][4],
|
|
'order_number' => $matches[0][5],
|
|
];
|
|
}
|
|
}
|
|
|
|
public function orderInfo($requestArr)
|
|
{
|
|
$showInfo = $this->showInfo();
|
|
$ewm_account = $showInfo['from_card'];
|
|
|
|
$order_money = $showInfo['pay_money'];
|
|
$from_name = $showInfo['from_name'];
|
|
$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_account', $ewm_account)
|
|
// ->whereRaw('substr(ewm_account,-4,4)=?', [$ewm_account])
|
|
// ->whereIn('status', [0, 2])
|
|
->orderBy('id', 'desc')->first();
|
|
}
|
|
} |