|
|
|
@ -4,6 +4,7 @@ namespace app\controller\api; |
|
|
|
|
|
|
|
use app\model\InvoiceHead; |
|
|
|
use app\model\InvoiceIssuance as InvoiceIssuanceModel; |
|
|
|
use app\model\WechatPucode; |
|
|
|
use app\service\invoice\InvoiceIssuanceService; |
|
|
|
use app\util\ReturnCode; |
|
|
|
use app\validate\InvoiceHeadValidate; |
|
|
|
@ -23,7 +24,7 @@ class InvoiceIssuance extends Base |
|
|
|
|
|
|
|
$params = $this->request->post(); |
|
|
|
|
|
|
|
$list = InvoiceIssuanceService::getListPage($params,$this->request->wechat_user_id); |
|
|
|
$list = InvoiceIssuanceService::getListPage($params, $this->request->wechat_user_id); |
|
|
|
|
|
|
|
return $this->buildSuccess($list); |
|
|
|
} catch (\Exception $e) { |
|
|
|
@ -31,6 +32,56 @@ class InvoiceIssuance extends Base |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public function getApplyData() |
|
|
|
{ |
|
|
|
$wechat_user_id = $this->request->wechat_user_id; |
|
|
|
|
|
|
|
$WechatPucode = new WechatPucode(); |
|
|
|
$pucode = $WechatPucode->where('wechat_user_id',$wechat_user_id)->order('create_time desc')->value('pucode'); |
|
|
|
|
|
|
|
$projectArr = InvoiceIssuanceModel::$projectArr; |
|
|
|
|
|
|
|
unset($projectArr[0]); |
|
|
|
|
|
|
|
return $this->buildSuccess([ |
|
|
|
'pucode' => $pucode ?: '', |
|
|
|
'project_arr' => $projectArr |
|
|
|
]); |
|
|
|
} |
|
|
|
|
|
|
|
public function getInvoiceHead() |
|
|
|
{ |
|
|
|
|
|
|
|
try { |
|
|
|
$wechat_user_id = $this->request->wechat_user_id; |
|
|
|
|
|
|
|
$param = $this->request->get(); |
|
|
|
|
|
|
|
validate(InvoiceHeadValidate::class)->scene('type')->check($param); |
|
|
|
|
|
|
|
$where = [ |
|
|
|
'wechat_user_id' => $wechat_user_id, |
|
|
|
'type' => $param['type'] |
|
|
|
]; |
|
|
|
|
|
|
|
$field = 'title,tax_number'; |
|
|
|
if (!$param['type']) { |
|
|
|
$field .= ',address,telephone,bank_name,bank_account'; |
|
|
|
} |
|
|
|
|
|
|
|
$InvoiceHead = new InvoiceHead; |
|
|
|
$data = $InvoiceHead->where($where)->field($field)->find(); |
|
|
|
|
|
|
|
if (!$data) { |
|
|
|
throw new \Exception('数据不存在'); |
|
|
|
} |
|
|
|
|
|
|
|
return $this->buildSuccess($data->toArray()); |
|
|
|
} catch (\Exception $e) { |
|
|
|
return $this->buildFailed(ReturnCode::NOT_EXISTS, $e->getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public function add() |
|
|
|
{ |
|
|
|
|
|
|
|
|