|
|
|
@ -4,6 +4,12 @@ namespace app\service\invoice; |
|
|
|
|
|
|
|
use app\model\InvoiceHead; |
|
|
|
use app\model\InvoiceIssuance; |
|
|
|
use Endroid\QrCode\Builder\Builder; |
|
|
|
use Endroid\QrCode\Encoding\Encoding; |
|
|
|
use Endroid\QrCode\ErrorCorrectionLevel\ErrorCorrectionLevelHigh; |
|
|
|
use Endroid\QrCode\Label\Alignment\LabelAlignmentCenter; |
|
|
|
use Endroid\QrCode\Label\Font\NotoSans; |
|
|
|
use Endroid\QrCode\Writer\PngWriter; |
|
|
|
|
|
|
|
class InvoiceIssuanceService |
|
|
|
{ |
|
|
|
@ -59,4 +65,29 @@ class InvoiceIssuanceService |
|
|
|
return $data->toArray(); |
|
|
|
} |
|
|
|
|
|
|
|
public static function getQrCode() |
|
|
|
{ |
|
|
|
|
|
|
|
//$ChinaTaxes = new ChinaTaxes(); |
|
|
|
|
|
|
|
$codeUrl = 'http://www.longazi.vip/blog/22';//$ChinaTaxes->downTaxPaymentProve(); |
|
|
|
|
|
|
|
|
|
|
|
$result = Builder::create() |
|
|
|
->writer(new PngWriter()) |
|
|
|
->writerOptions([]) |
|
|
|
->data($codeUrl) |
|
|
|
->encoding(new Encoding('UTF-8')) |
|
|
|
->errorCorrectionLevel(new ErrorCorrectionLevelHigh()) |
|
|
|
->size(300) |
|
|
|
->margin(10) |
|
|
|
->labelText('发票已开具,请扫描二维码获取发票!') |
|
|
|
->labelFont(new NotoSans(20)) |
|
|
|
->labelAlignment(new LabelAlignmentCenter()) |
|
|
|
->validateResult(false) |
|
|
|
->build(); |
|
|
|
|
|
|
|
return $result->getDataUri(); |
|
|
|
} |
|
|
|
|
|
|
|
} |