发票管理apiadmin
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

93 lines
2.7 KiB

<?php
declare (strict_types=1);
namespace app\controller\api;
use app\service\invoice\InvoiceIssuanceService;
use app\service\webService\FeeService;
use fast\FuncException;
class Test extends Base
{
public function index()
{
try {
$data = [
'pucode' => '',
'expire_time' => '',
'id' => ''
];
$InvoiceIssuanceService = new InvoiceIssuanceService();
$result = $InvoiceIssuanceService->IssueAnInvoice($data);
if ($result !== true) {
throw new FuncException($result);
}
} catch (\Exception $e) {
dump($e);die;
}
}
public function getWechatData()
{
$pucode = '41108008';
$FeeService = new FeeService($pucode);
return $FeeService->getUsers();
}
public function apiInvoiceIssuance()
{
try {
$param = $this->request->param();
validate()->rule([
'pucode|用户编号' => 'require|number|max:10',
'expire_time|开票日期' => 'require|number|max:11',
'id|编号' => 'require|number|max:11'
])->check($param);
$data = (new \app\service\invoice\TempInvoiceService())->IssueAnInvoice($param);
return $this->buildSuccess($data);
} catch (\Exception $e) {
return $this->buildFailed(0, $e->getMessage());
}
}
public function saveSummaryReport()
{
try {
$param = $this->request->param();
validate()->rule([
'report_date|结报日期' => 'require|date'
])->check($param);
$data = (new \app\service\invoice\TempInvoiceService())->tempSaveSummaryReport($param['report_date']);
if (!is_array($data)) {
throw new \Exception($data);
}
return $this->buildSuccess($data);
} catch (\Exception $e) {
return $this->buildFailed(0, $e->getMessage());
}
}
public function apiFinalReport()
{
try {
$param = $this->request->param();
validate()->rule([
'report_date|结报日期' => 'require|date',
'zje|float' => 'require',
])->check($param);
$data = (new \app\service\invoice\TempInvoiceService())->tempFinalReport($param['report_date'], $param['zje']);
if (!is_array($data)) {
throw new \Exception($data);
}
return $this->buildSuccess($data);
} catch (\Exception $e) {
return $this->buildFailed(0, $e->getMessage());
}
}
}