diff --git a/app/Controller/Payment/AccountController.php b/app/Controller/Payment/AccountController.php index f11f40b..9cab875 100644 --- a/app/Controller/Payment/AccountController.php +++ b/app/Controller/Payment/AccountController.php @@ -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; + } } diff --git a/app/Controller/Payment/NotifyController.php b/app/Controller/Payment/NotifyController.php index 731b022..283aea1 100644 --- a/app/Controller/Payment/NotifyController.php +++ b/app/Controller/Payment/NotifyController.php @@ -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'), diff --git a/app/Service/UserService.php b/app/Service/UserService.php index a5bb041..3f590bd 100644 --- a/app/Service/UserService.php +++ b/app/Service/UserService.php @@ -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;