thirdpayment
elf 11 months ago
parent 759824d42e
commit 75293323dc

@ -96,8 +96,8 @@ class AccountController extends AbstractController
public function openAccount(RequestInterface $request) public function openAccount(RequestInterface $request)
{ {
$userInfo = $this->checkUser($request); $userInfo = $this->checkUser($request);
$requestLog = $this->createRequestLog(['userId' => 'ACT_' . $userInfo['userId']]); $userId = $this->resetUserId($userInfo['userId']);
var_dump($requestLog->toArray()); $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); $url = $this->userService->register($requestLog->getData(), $requestLog->app, $requestLog->request_token);
return $this->success(['url' => $url]); return $this->success(['url' => $url]);
} }
@ -105,7 +105,8 @@ class AccountController extends AbstractController
public function bindCard(RequestInterface $request) public function bindCard(RequestInterface $request)
{ {
$userInfo = $this->checkUser($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); $url = $this->userService->bindCard($requestLog->getData(), $requestLog->app, $requestLog->request_token);
return $this->success(['url' => $url]); return $this->success(['url' => $url]);
} }
@ -113,9 +114,10 @@ class AccountController extends AbstractController
public function transferPay(RequestInterface $request) public function transferPay(RequestInterface $request)
{ {
$userInfo = $this->checkUser($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([ $requestLog = $this->createRequestLog([
'userId' => 'ACT_' . $userInfo['userId'], 'userId' => $userId,
'goodsName' => '充值', 'goodsName' => '充值',
'agreementNo' => $bankCard->agreement_no, 'agreementNo' => $bankCard->agreement_no,
'notifyUrl' => 'http://www.baidu.com', 'notifyUrl' => 'http://www.baidu.com',
@ -143,11 +145,17 @@ class AccountController extends AbstractController
public function getUserInfo(RequestInterface $request) public function getUserInfo(RequestInterface $request)
{ {
$userInfo = $this->checkUser($request); $userInfo = $this->checkUser($request);
var_dump($userInfo);
$account = Account::where('id', $userInfo['userId'])->first(); $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']); $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']); $bankCard = BankCard::where('user_id', $userId)->first(['bank_name', 'card_user_name']);
return $this->success(['username' => $account->username, 'userInfo' => $user, 'bankCard' => $bankCard]); 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'); $userId = $requestLog->getDataValue('userId');
$appId = $requestLog->app_id; $appId = $requestLog->app_id;
$source = 0; $this->userService->rsyncUser($params['loginNo'], $appId, $userId);
if ($requestLog->request_uri == '/register-user') {
$source = 1;
}
$this->userService->rsyncUser($params['loginNo'], $appId, $userId, $source);
$result = $this->notify( $result = $this->notify(
$requestLog->getDataValue('notifyUrl'), $requestLog->getDataValue('notifyUrl'),

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

Loading…
Cancel
Save