From 206d11c81b4fdd284510e4298ead0fe28c81ae9d Mon Sep 17 00:00:00 2001 From: elf <360197197@qq.com> Date: Thu, 31 Aug 2023 02:05:42 +0800 Subject: [PATCH] yh --- app/Command/MineCommand.php | 17 ++++++++++- app/Model/Withdraw.php | 2 +- app/Model/WithdrawApply.php | 2 +- app/Service/PaymentService.php | 2 ++ payment.sql | 56 +++++++++++++++++++++++++++++++++- 5 files changed, 75 insertions(+), 4 deletions(-) diff --git a/app/Command/MineCommand.php b/app/Command/MineCommand.php index b615ff1..5604889 100644 --- a/app/Command/MineCommand.php +++ b/app/Command/MineCommand.php @@ -47,7 +47,7 @@ class MineCommand extends HyperfCommand public function handle(): void { $this->getBalance(); - $this->transferWithdraw(); + $this->getRequestData(); return; // $this->notify('http://ceshi-shop.hkcpex.com/index.php/pay/notify/baofu_f_register', $this->getApp(), ['userId' => '30684']); $this->notify('http://ceshi-shop.hkcpex.com/index.php/pay/notify/baofu_f_bind_card', $this->getApp(), ['userId' => '23121', 'bindCardFlag' => true]); @@ -136,6 +136,21 @@ class MineCommand extends HyperfCommand ] ], ]; + $data = [ + 'userId' => 'ELF1990', + 'accountName' => '廖金灵', + 'outApplyNo' => time() . rand(1000, 9999), + 'amount' => '1', + 'summary' => '测试', + 'notifyUrl' => 'http://124.223.222.61:9501/notify/test-notify' + ]; + $data = [ + 'userId' => 'ELF1990', + 'agreementNo' => '312023082200002060225', + 'outWithdrawNo' => time() . rand(1000, 9999), + 'amount' => '1', + 'notifyUrl' => 'http://124.223.222.61:9501/notify/test-notify' + ]; $params = [ 'app_id' => $app->app_id, 'nonce_str' => StringHelper::getRandomString(16), diff --git a/app/Model/Withdraw.php b/app/Model/Withdraw.php index e1184dc..cab297d 100644 --- a/app/Model/Withdraw.php +++ b/app/Model/Withdraw.php @@ -6,7 +6,7 @@ namespace App\Model; class Withdraw extends Model { - protected $table = 'withdraw'; + protected $table = 'withdraws'; public function app() { diff --git a/app/Model/WithdrawApply.php b/app/Model/WithdrawApply.php index c519d08..e627aee 100644 --- a/app/Model/WithdrawApply.php +++ b/app/Model/WithdrawApply.php @@ -14,7 +14,7 @@ class WithdrawApply extends Model public const STATUS_SUCCESS = 'SUCCESS'; public const STATUS_FAILED = 'FAILED'; - protected $table = 'withdraw_apply'; + protected $table = 'withdraw_applies'; public function app() { diff --git a/app/Service/PaymentService.php b/app/Service/PaymentService.php index 4c3cf89..646527b 100644 --- a/app/Service/PaymentService.php +++ b/app/Service/PaymentService.php @@ -630,6 +630,7 @@ class PaymentService extends AbstractService $withdraw->out_withdraw_no = $data['outWithdrawNo']; $withdraw->amount = $data['amount']; $withdraw->status = 'PREPARE'; + $withdraw->applied_at = date('Y-m-d H:i:s'); $withdraw->notify_url = $data['notifyUrl']; $withdraw->save(); @@ -669,6 +670,7 @@ class PaymentService extends AbstractService $withdraw->status = $params['status']; $withdraw->fee = $params['fee']; $withdraw->fee_acc = $params['fee_acc'] ?? ''; + $withdraw->finished_at = $params['finished_at'] ?? null; $withdraw->save(); return $withdraw; } diff --git a/payment.sql b/payment.sql index 9d86a5a..4f5d1a7 100644 --- a/payment.sql +++ b/payment.sql @@ -233,4 +233,58 @@ add column `remark` varchar(255) NOT NULL DEFAULT '' after return_url; alter table orders add column `channel_id` varchar(32) NOT NULL DEFAULT '' after market_info, -add column `channel_app_id` varchar(32) NOT NULL DEFAULT '' after market_info; \ No newline at end of file +add column `channel_app_id` varchar(32) NOT NULL DEFAULT '' after market_info; + +CREATE TABLE `withdraws` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID', + `app_id` varchar(16) NOT NULL COMMENT '应用ID', + `member_id` varchar(32) NOT NULL, + `user_id` varchar(32) NOT NULL, + `withdraw_no` varchar(32) NOT NULL, + `out_withdraw_no` varchar(32) NOT NULL, + `amount` int(11) NOT NULL DEFAULT 0, + `agreement_no` varchar(32) NOT NULL DEFAULT '', + `fee` int(11) NOT NULL DEFAULT 0, + `fee_acc` tinyint(1) NOT NULL DEFAULT 0, + `withdraw_url` varchar(255) NOT NULL DEFAULT '', + `applied_at` datetime DEFAULT NULL, + `notify_url` varchar(255) NOT NULL DEFAULT '', + `status` varchar(16) NOT NULL DEFAULT '', + `error_code` varchar(64) NOT NULL DEFAULT '', + `error_message` varchar(120) NOT NULL DEFAULT '', + `finished_at` datetime DEFAULT NULL, + `third_withdraw_no` varchar(32) NOT NULL DEFAULT '', + `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`) USING BTREE, + KEY `idx_appid` (`app_id`) USING BTREE, + KEY `idx_memberid` (`member_id`) USING BTREE, + KEY `idx_createdat` (`created_at`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC; + +CREATE TABLE `withdraw_applies` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID', + `app_id` varchar(16) NOT NULL COMMENT '应用ID', + `member_id` varchar(32) NOT NULL, + `user_id` varchar(32) NOT NULL, + `apply_no` varchar(32) NOT NULL, + `batch_num` varchar(32) NOT NULL, + `out_apply_no` varchar(32) NOT NULL, + `amount` int(11) NOT NULL DEFAULT 0, + `fee` int(11) NOT NULL DEFAULT 0, + `account_name` varchar(32) NOT NULL DEFAULT '', + `summary` varchar(255) NOT NULL DEFAULT '', + `applied_at` datetime DEFAULT NULL, + `notify_url` varchar(255) NOT NULL DEFAULT '', + `status` varchar(16) NOT NULL DEFAULT '', + `error_code` varchar(64) NOT NULL DEFAULT '', + `error_message` varchar(120) NOT NULL DEFAULT '', + `third_apply_no` varchar(32) NOT NULL DEFAULT '', + `third_batch_num` varchar(32) NOT NULL DEFAULT '', + `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`) USING BTREE, + KEY `idx_appid` (`app_id`) USING BTREE, + KEY `idx_memberid` (`member_id`) USING BTREE, + KEY `idx_createdat` (`created_at`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC; \ No newline at end of file