From 6b024f53dac06396e0f6ad1ea45a8ddd21620d34 Mon Sep 17 00:00:00 2001 From: wanghongjun <1445693971@qq,com> Date: Thu, 26 Dec 2024 15:28:43 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=B0=B4=E5=8A=A1=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E6=8A=AC=E5=A4=B4=E4=BF=A1=E6=81=AF=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/api/InvoiceIssuance.php | 39 ++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/app/controller/api/InvoiceIssuance.php b/app/controller/api/InvoiceIssuance.php index 1f3e4c1..8d8f996 100644 --- a/app/controller/api/InvoiceIssuance.php +++ b/app/controller/api/InvoiceIssuance.php @@ -7,6 +7,7 @@ use app\model\InvoiceIssuance as InvoiceIssuanceModel; use app\model\InvoiceIssuanceData; use app\model\WechatPucode; use app\service\invoice\InvoiceIssuanceService; +use app\service\webService\FeeService; use app\util\ReturnCode; use app\validate\InvoiceHeadValidate; use app\validate\InvoiceIssuanceValidate; @@ -120,6 +121,44 @@ class InvoiceIssuance extends Base } } + /** + * 获取抬头信息 + * @return Response + */ + public function getFeeInvoiceHead(): Response + { + try { + $wechat_user_id = $this->request->wechat_user_id; + + $pucode = (new WechatPucode())->where('wechat_user_id', $wechat_user_id)->value('pucode'); + + $FeeService = new FeeService($pucode); + $feeUserInfo = $FeeService->getUsers(); + if (!$feeUserInfo) { + throw new \Exception('用户信息获取失败'); + } + $data = [ + 'title' => $feeUserInfo['UserName'] ?? '', + ]; + $data['type'] = 0; + if ($feeUserInfo['UserCategoryID'] == '普通居民') { + $data['type'] = 1; + } + + if ($data['type'] === 0) { + $data['tax_number'] = empty($feeUserInfo['CertificateCode']) ? $feeUserInfo['CertificateCode'] : ''; + $data['address'] = $feeUserInfo['MaillingAddress']; + $data['telephone'] = $feeUserInfo['Telephone']; + $data['bank_name'] = $feeUserInfo['BankName']; + $data['bank_account'] = $feeUserInfo['BankAccountCode']; + } + + return $this->buildSuccess($data); + } catch (\Exception $e) { + return $this->buildFailed(ReturnCode::NOT_EXISTS, $e->getMessage()); + } + } + /** * 新增、编辑 * @return Response