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.
48 lines
1.5 KiB
48 lines
1.5 KiB
<?php
|
|
|
|
namespace app\controller\task;
|
|
|
|
use app\model\InvoiceIssuance as InvoiceIssuanceModel;
|
|
use app\service\invoice\InvoiceIssuanceService;
|
|
|
|
class InvoiceIssuanceTask extends Base
|
|
{
|
|
|
|
/**
|
|
* 申请开票任务
|
|
* @return \think\Response
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
* @throws \think\db\exception\DbException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
*/
|
|
public function runIssueAnInvoice()
|
|
{
|
|
$limit = 100;
|
|
$where = ['status' => 0, 'delete_time' => 0];
|
|
$InvoiceIssuanceData = (new InvoiceIssuanceModel())->where($where)->page($limit)->select();
|
|
foreach ($InvoiceIssuanceData as $InvoiceIssuanceValue) {
|
|
(new InvoiceIssuanceService())->IssueAnInvoice($InvoiceIssuanceValue);
|
|
}
|
|
return $this->buildSuccess();
|
|
}
|
|
|
|
|
|
/**
|
|
* 开票失败 修改为虚拟 继续发起
|
|
* @return \think\Response
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
* @throws \think\db\exception\DbException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
*/
|
|
public function runCancelInitiateAgain()
|
|
{
|
|
$limit = 100;
|
|
$where = ['status' => 2, 'delete_time' => 0];
|
|
$InvoiceIssuanceData = (new InvoiceIssuanceModel())->where($where)->page($limit)->select();
|
|
foreach ($InvoiceIssuanceData as $InvoiceIssuanceValue) {
|
|
(new InvoiceIssuanceService())->cancelInitiateAgain($InvoiceIssuanceValue);
|
|
}
|
|
return $this->buildSuccess();
|
|
}
|
|
|
|
}
|
|
|