|
|
@@ -3,6 +3,7 @@
|
|
|
namespace App\Http\logic\api;
|
|
|
|
|
|
use App\dao\Estatisticas\RechargeWithDraw;
|
|
|
+use App\dao\Pay\AccountPayInfo;
|
|
|
use App\Http\helper\NumConfig;
|
|
|
use App\Inter\CashierInterFace;
|
|
|
use App\Models\PrivateMail;
|
|
|
@@ -29,11 +30,16 @@ class AiPayCashierLogic implements CashierInterFace
|
|
|
$service = new AiPay('AiPayOut');
|
|
|
$config = $service->getConfig();
|
|
|
|
|
|
+ if(!$accountName){
|
|
|
+ $dao = new AccountPayInfo();
|
|
|
+ $$accountName = $dao->randUserName($accountName);
|
|
|
+ }
|
|
|
+
|
|
|
$paymentMethod = $this->resolvePaymentMethod($PixType);
|
|
|
$accountData = $this->buildAccountData($paymentMethod, $accountName, $PixNum, $email, $phone, $IFSCNumber, $BranchBank, $BankNO);
|
|
|
|
|
|
if ($paymentMethod === null || empty($accountData)) {
|
|
|
- Util::WriteLog('AiPay', 'unsupported PixType for withdraw: ' . $PixType);
|
|
|
+ Util::WriteLog('AiPay', 'unsupported PixType for withdraw: ' . $PixType.'_'.$accountName);
|
|
|
return 'fail';
|
|
|
}
|
|
|
|
|
|
@@ -192,16 +198,41 @@ class AiPayCashierLogic implements CashierInterFace
|
|
|
return [];
|
|
|
}
|
|
|
|
|
|
- protected function splitName($name): array
|
|
|
+// protected function splitName($name): array
|
|
|
+// {
|
|
|
+// $name = trim($name ?: 'User');
|
|
|
+// $parts = preg_split('/\s+/', $name, 2);
|
|
|
+// return [
|
|
|
+// 'first' => $parts[0] ?? 'User',
|
|
|
+// 'last' => $parts[1] ?? 'Edward',
|
|
|
+// ];
|
|
|
+// }
|
|
|
+
|
|
|
+ protected function splitName(string $name = null): array
|
|
|
{
|
|
|
- $name = trim($name ?: 'User');
|
|
|
- $parts = preg_split('/\s+/', $name, 2);
|
|
|
+ $name = trim($name ?? '');
|
|
|
+ if ($name === '') $name = 'Willam Edson';
|
|
|
+
|
|
|
+// // 处理 "Last, First"
|
|
|
+// if (str_contains($name, ',')) {
|
|
|
+// $tmp = array_map('trim', explode(',', $name, 2));
|
|
|
+// $name = ($tmp[1] ?? '') . ' ' . ($tmp[0] ?? '');
|
|
|
+// $name = trim($name);
|
|
|
+// }
|
|
|
+
|
|
|
+ // 清洗:保留字母、空格、-、'
|
|
|
+ $name = preg_replace("/[^A-Za-z\\s\\-']/u", ' ', $name);
|
|
|
+ $name = trim(preg_replace('/\s+/', ' ', $name));
|
|
|
+
|
|
|
+ $parts = explode(' ', $name, 2);
|
|
|
+
|
|
|
return [
|
|
|
- 'first' => $parts[0] ?? 'User',
|
|
|
- 'last' => $parts[1] ?? ($parts[0] ?? 'User'),
|
|
|
+ 'first' => $parts[0] ?: 'Willam',
|
|
|
+ 'last' => $parts[1] ?? 'Edward', // 或 'Edward' / 'User'
|
|
|
];
|
|
|
}
|
|
|
|
|
|
+
|
|
|
protected function extractMonth($value): string
|
|
|
{
|
|
|
if (preg_match('/(\d{2})/', (string)$value, $match)) {
|