|
|
@ -27,11 +27,12 @@ class RechargeController extends AbstractController
|
|
|
|
|
|
|
|
|
|
|
|
public function getMemberInfo(RequestInterface $request) {
|
|
|
|
public function getMemberInfo(RequestInterface $request) {
|
|
|
|
[$app, $prePayLog] = $this->checkToken($request->input('stoken', ''));
|
|
|
|
[$app, $prePayLog] = $this->checkToken($request->input('stoken', ''));
|
|
|
|
$user = User::where('out_member_id', $prePayLog->out_member_id)->first();
|
|
|
|
$outMemberId = $prePayLog->out_member_id;
|
|
|
|
|
|
|
|
$user = User::where('app_id', $app->app_id)->where('out_member_id', $outMemberId)->first();
|
|
|
|
$bankCard = null;
|
|
|
|
$bankCard = null;
|
|
|
|
$userInfo = null;
|
|
|
|
$userInfo = null;
|
|
|
|
if ($user) {
|
|
|
|
if ($user) {
|
|
|
|
$bankCard = BankCard::where('member_id', $user->member_id)->where('status', BankCard::STATUS_ACTIVE)->first();
|
|
|
|
$bankCard = BankCard::where('app_id', $app->app_id)->where('out_member_id', $outMemberId)->where('status', BankCard::STATUS_ACTIVE)->first();
|
|
|
|
$userInfo = [
|
|
|
|
$userInfo = [
|
|
|
|
'name' => $user->real_name ?? '',
|
|
|
|
'name' => $user->real_name ?? '',
|
|
|
|
'cardNo' => $user->card_no ?? '',
|
|
|
|
'cardNo' => $user->card_no ?? '',
|
|
|
@ -77,32 +78,35 @@ class RechargeController extends AbstractController
|
|
|
|
if (empty($bankCardNo)) {
|
|
|
|
if (empty($bankCardNo)) {
|
|
|
|
throw new BusinessException('请输入银行卡号');
|
|
|
|
throw new BusinessException('请输入银行卡号');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$memberId = $this->paymentService->generateMemberId($app->app_key, $cardNo);
|
|
|
|
|
|
|
|
$user = User::where('member_id', $memberId)->first();
|
|
|
|
$outMemberId = $prePayLog->out_member_id;
|
|
|
|
|
|
|
|
$user = User::where('app_id', $app->app_id)->where('out_member_id', $outMemberId)->first();
|
|
|
|
$bankCard = null;
|
|
|
|
$bankCard = null;
|
|
|
|
if ($user) {
|
|
|
|
if ($user) {
|
|
|
|
if (empty($user->out_member_id)) {
|
|
|
|
$bankCard = BankCard::where('app_id', $app->app_id)
|
|
|
|
$user->out_member_id = $prePayLog->out_member_id;
|
|
|
|
->where('out_member_id', $outMemberId)
|
|
|
|
$user->save();
|
|
|
|
->where('bank_card_no', $bankCardNo)
|
|
|
|
}
|
|
|
|
->where('status', BankCard::STATUS_ACTIVE)->first();
|
|
|
|
$bankCard = BankCard::where('member_id', $user->member_id)->where('bank_card_no', $bankCardNo)->where('status', BankCard::STATUS_ACTIVE)->first();
|
|
|
|
$mobile = $user->mobile;
|
|
|
|
|
|
|
|
$cardNo = $user->cardNo;
|
|
|
|
|
|
|
|
$name = $user->real_name;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ($bankCard) {
|
|
|
|
if ($bankCard) {
|
|
|
|
$outOrderNo = $prePayLog->out_order_no;
|
|
|
|
$outOrderNo = $prePayLog->out_order_no;
|
|
|
|
$nextStep = 'confirm-pay';
|
|
|
|
$nextStep = 'confirm-pay';
|
|
|
|
$amount = $prePayLog->amount > 0 ? $prePayLog->amount : intval($amount * 100);
|
|
|
|
$amount = $prePayLog->amount > 0 ? $prePayLog->amount : intval($amount * 100);
|
|
|
|
$bizData = $this->paymentService->protocolPayPreRequest($this->buildPrepayParams($prePayLog->out_member_id, $outOrderNo, $bankCard->protocol, $amount, $prePayLog->notify_url, $app));
|
|
|
|
$bizData = $this->paymentService->protocolPayPreRequest($this->buildPrepayParams($outMemberId, $outOrderNo, $bankCard->protocol, $amount, $prePayLog->notify_url, $app));
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$mchOrderNo = StringHelper::generateBankCardOrderNo();
|
|
|
|
$mchOrderNo = StringHelper::generateBankCardOrderNo();
|
|
|
|
$nextStep = 'confirm-bind';
|
|
|
|
$nextStep = 'confirm-bind';
|
|
|
|
$bizData = $this->paymentService->bindCard($this->buildBindCardParams(
|
|
|
|
$bizData = $this->paymentService->bindCard($this->buildBindCardParams(
|
|
|
|
$mchOrderNo, $prePayLog->out_member_id, $name, $cardNo, $mobile, $bankCardNo, $app
|
|
|
|
$mchOrderNo, $outMemberId, $name, $cardNo, $mobile, $bankCardNo, $app
|
|
|
|
));
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $this->success([
|
|
|
|
return $this->success([
|
|
|
|
'nextStep' => $nextStep,
|
|
|
|
'nextStep' => $nextStep,
|
|
|
|
'outMemberId' => $prePayLog->out_member_id,
|
|
|
|
'outMemberId' => $outMemberId,
|
|
|
|
'bizData' => $bizData
|
|
|
|
'bizData' => $bizData
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -313,6 +317,7 @@ class RechargeController extends AbstractController
|
|
|
|
'owx0tlx' => ['password' => 'lSoLW28NxtMlxUazC8p', 'app_id' => '202304270000004'],
|
|
|
|
'owx0tlx' => ['password' => 'lSoLW28NxtMlxUazC8p', 'app_id' => '202304270000004'],
|
|
|
|
'ioexlp2' => ['password' => 'wwU8Ir3Xp0rxXssA9NV', 'app_id' => '202305270000001'],
|
|
|
|
'ioexlp2' => ['password' => 'wwU8Ir3Xp0rxXssA9NV', 'app_id' => '202305270000001'],
|
|
|
|
'lix73nxIN' => ['password' => 'a01@lWl3dfNmT', 'app_id' => '202306140000001'],
|
|
|
|
'lix73nxIN' => ['password' => 'a01@lWl3dfNmT', 'app_id' => '202306140000001'],
|
|
|
|
|
|
|
|
'xtIxt2x3L' => ['password' => 'sd3@xxgNtxxJipOmT', 'app_id' => '202306200000001'],
|
|
|
|
];
|
|
|
|
];
|
|
|
|
return $users[$username] ?? null;
|
|
|
|
return $users[$username] ?? null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|