thirdpayment
elf 11 months ago
parent 759824d42e
commit 75293323dc

@ -96,8 +96,8 @@ class AccountController extends AbstractController
public function openAccount(RequestInterface $request)
{
$userInfo = $this->checkUser($request);
$requestLog = $this->createRequestLog(['userId' => 'ACT_' . $userInfo['userId']]);
var_dump($requestLog->toArray());
$userId = $this->resetUserId($userInfo['userId']);
$requestLog = $this->createRequestLog(['userId' => $userId, 'returnUrl' => 'http://124.223.222.61:9701/account.html']);
$url = $this->userService->register($requestLog->getData(), $requestLog->app, $requestLog->request_token);
return $this->success(['url' => $url]);
}
@ -105,7 +105,8 @@ class AccountController extends AbstractController
public function bindCard(RequestInterface $request)
{
$userInfo = $this->checkUser($request);
$requestLog = $this->createRequestLog(['userId' => 'ACT_' . $userInfo['userId']]);
$userId = $this->resetUserId($userInfo['userId']);
$requestLog = $this->createRequestLog(['userId' => $userId]);
$url = $this->userService->bindCard($requestLog->getData(), $requestLog->app, $requestLog->request_token);
return $this->success(['url' => $url]);
}
@ -113,9 +114,10 @@ class AccountController extends AbstractController
public function transferPay(RequestInterface $request)
{
$userInfo = $this->checkUser($request);
$bankCard = BankCard::where('user_id', 'ACT_' . $userInfo['userId'])->first();
$userId = $this->resetUserId($userInfo['userId']);
$bankCard = BankCard::where('user_id', $userId)->first();
$requestLog = $this->createRequestLog([
'userId' => 'ACT_' . $userInfo['userId'],
'userId' => $userId,
'goodsName' => '充值',
'agreementNo' => $bankCard->agreement_no,
'notifyUrl' => 'http://www.baidu.com',
@ -143,11 +145,17 @@ class AccountController extends AbstractController
public function getUserInfo(RequestInterface $request)
{
$userInfo = $this->checkUser($request);
var_dump($userInfo);
$account = Account::where('id', $userInfo['userId'])->first();
$userId = 'ACT_' . $userInfo['userId'];
$userId = $this->resetUserId($userInfo['userId']);
$user = User::where('user_id', $userId)->first(['realname_flag', 'bind_card_flag', 'set_pwd_flag', 'mobile', 'real_name', 'certificate_no', 'user_type', 'apply_no', 'is_platform_account']);
$bankCard = BankCard::where('user_id', $userId)->first(['bank_name', 'card_user_name']);
return $this->success(['username' => $account->username, 'userInfo' => $user, 'bankCard' => $bankCard]);
}
private function resetUserId($accountId) {
if ($accountId == 2) {
return 'ELF1990';
}
return 'ACT_' . $accountId;
}
}

@ -46,11 +46,7 @@ class NotifyController extends AbstractController
$userId = $requestLog->getDataValue('userId');
$appId = $requestLog->app_id;
$source = 0;
if ($requestLog->request_uri == '/register-user') {
$source = 1;
}
$this->userService->rsyncUser($params['loginNo'], $appId, $userId, $source);
$this->userService->rsyncUser($params['loginNo'], $appId, $userId);
$result = $this->notify(
$requestLog->getDataValue('notifyUrl'),

@ -41,13 +41,13 @@ class UserService extends AbstractService
return $url;
}
public function rsyncUser($memberId, $appId, $userId, $source = 0) {
public function rsyncUser($memberId, $appId, $userId) {
$baofu = new Baofu();
$userInfo = $baofu->queryCustomerInfo($memberId);
return $this->saveUser($userInfo, $appId, $userId, $source);
}
public function saveUser($userInfo, $appId, $userId, $source = 0) {
public function saveUser($userInfo, $appId, $userId) {
$memberId = $userInfo['loginNo'] ?? $userInfo['loginMobile'];
$user = User::where('app_id', $appId)->where('member_id', $memberId)->first();
if ($user) {
@ -62,7 +62,6 @@ class UserService extends AbstractService
$user->certificate_no = $userInfo['certificateNo'] ?? '';
$user->user_type = $userInfo['customerType'];
$user->apply_no = $userInfo['applyNo'] ?? '';
$user->source = $source;
} else {
$user = new User();
$user->user_id = $userId;
@ -79,7 +78,6 @@ class UserService extends AbstractService
$user->certificate_no = $userInfo['certificateNo'] ?? '';
$user->user_type = $userInfo['customerType'];
$user->apply_no = $userInfo['applyNo'] ?? '';
$user->source = $source;
}
$user->save();
return $user;

Loading…
Cancel
Save