|
|
@@ -8,6 +8,9 @@ use App\Models\Config;
|
|
|
use App\Models\Recharge;
|
|
|
use App\Services\Payment\SanJinService;
|
|
|
use App\Services\PaymentOrderService;
|
|
|
+use App\Services\QianBaoWithdrawService;
|
|
|
+use App\Services\Payment\QianBaoService;
|
|
|
+
|
|
|
use Illuminate\Validation\ValidationException;
|
|
|
|
|
|
use Exception;
|
|
|
@@ -53,7 +56,12 @@ class Wallet extends BaseController
|
|
|
]);
|
|
|
$member_id = request()->user->member_id;
|
|
|
$res = PaymentOrderService::createPay($member_id, $params['amount'], $params['payment_type']);
|
|
|
- return $this->success($res);
|
|
|
+ if ($res['code'] == 0) {
|
|
|
+ return $this->success($res);
|
|
|
+ }
|
|
|
+ return $this->error($res['text']);
|
|
|
+ } catch (ValidationException $e) {
|
|
|
+ return $this->error($e->validator->errors()->first());
|
|
|
} catch (\Exception $e) {
|
|
|
return $this->error($e->getMessage());
|
|
|
}
|
|
|
@@ -67,7 +75,6 @@ class Wallet extends BaseController
|
|
|
try {
|
|
|
$member_id = request()->user->member_id;
|
|
|
$params = request()->validate([
|
|
|
- 'amount' => ['required', 'numeric', 'min:0.01'],
|
|
|
'type' => ['required', 'string'],
|
|
|
]);
|
|
|
$receivingType = ConfigService::getVal("receiving_type");
|
|
|
@@ -94,6 +101,8 @@ class Wallet extends BaseController
|
|
|
'qrcode' => $qrCode,
|
|
|
// 'photo' => InputFile::create($qrCode),
|
|
|
]);
|
|
|
+ } catch (ValidationException $e) {
|
|
|
+ return $this->error($e->validator->errors()->first());
|
|
|
} catch (\Exception $e) {
|
|
|
return $this->error($e->getMessage());
|
|
|
}
|
|
|
@@ -130,4 +139,68 @@ class Wallet extends BaseController
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取提现通道
|
|
|
+ */
|
|
|
+ public function withdrawChannel()
|
|
|
+ {
|
|
|
+ $list = QianBaoService::withdrawChannel();
|
|
|
+ $data[] = ['label' => 'USDT', 'value' => 'USDT'];
|
|
|
+ foreach ($list as $key => $item) {
|
|
|
+ $data[] = ['label' => $item, 'value' => $key];
|
|
|
+ }
|
|
|
+ return $this->success($data);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 提现(自动到账): DF001 支付宝转卡/DF002 支付宝转支付宝
|
|
|
+ */
|
|
|
+ public function autoPayout()
|
|
|
+ {
|
|
|
+ try {
|
|
|
+ $params = request()->validate([
|
|
|
+ 'amount' => ['required', 'numeric', 'min:0.01'],
|
|
|
+ 'channel' => ['required', 'string'],
|
|
|
+ 'bank_name' => ['required', 'string'],
|
|
|
+ 'account' => ['required', 'string'],
|
|
|
+ 'card_no' => ['required', 'string'],
|
|
|
+ ]);
|
|
|
+ $member_id = request()->user->member_id;
|
|
|
+ $res = PaymentOrderService::autoCreatePayout($member_id, $params['amount'], $params['channel'], $params['bank_name'], $params['account'], $params['card_no']);
|
|
|
+ if (empty($res['text'])) {
|
|
|
+ return $this->success($res);
|
|
|
+ }
|
|
|
+ return $this->error($res['text']);
|
|
|
+ } catch (ValidationException $e) {
|
|
|
+ return $this->error($e->validator->errors()->first());
|
|
|
+ } catch (Exception $e) {
|
|
|
+ return $this->error($e->getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 提现(手动到账): DF001 支付宝转卡; DF002 支付宝转支付宝; DF005数字人民币
|
|
|
+ */
|
|
|
+ public function payout() {
|
|
|
+ try {
|
|
|
+ $params = request()->validate([
|
|
|
+ 'amount' => ['required', 'numeric', 'min:0.01'],
|
|
|
+ 'channel' => ['required', 'string'],
|
|
|
+ 'bank_name' => ['required', 'string'],
|
|
|
+ 'account' => ['required', 'string'],
|
|
|
+ 'card_no' => ['required', 'string'],
|
|
|
+ ]);
|
|
|
+ $member_id = request()->user->member_id;
|
|
|
+ $res = QianBaoWithdrawService::createOrder($member_id, $params['amount'], $params['channel'], $params['bank_name'], $params['account'], $params['card_no']);
|
|
|
+ if (empty($res['text'])) {
|
|
|
+ return $this->success($res);
|
|
|
+ }
|
|
|
+ return $this->error($res['text']);
|
|
|
+ } catch (ValidationException $e) {
|
|
|
+ return $this->error($e->validator->errors()->first());
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ return $this->error($e->getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|