Browse Source

获取水务接口抬头信息接口

master
wanghongjun 1 year ago
parent
commit
6b024f53da
  1. 39
      app/controller/api/InvoiceIssuance.php

39
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

Loading…
Cancel
Save