chore: 添加开票php文件
This commit is contained in:
35
src/app/api/controller/Invoice.php
Normal file
35
src/app/api/controller/Invoice.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\model\order\OrderCreate as OrderCreateModel;
|
||||
|
||||
class Invoice extends BaseOrderCreateApi
|
||||
{
|
||||
|
||||
/**
|
||||
* 订单申请开票
|
||||
*/
|
||||
public function applyInvoice()
|
||||
{
|
||||
$token = $this->checkToken();
|
||||
if ($token['code'] < 0) return $this->response($token);
|
||||
$order_create = new OrderCreateModel();
|
||||
$data = array_merge(
|
||||
[
|
||||
'order_id' => $this->params['order_id']
|
||||
],
|
||||
$this->getInvoiceParam()
|
||||
);
|
||||
$result = $order_create->initInvoice($data);
|
||||
if ($result['code'] < 0) {
|
||||
return $this->response($result);
|
||||
}
|
||||
$order_create->calculateInvoice();
|
||||
if ($order_create->error) {
|
||||
return $this->response($this->error($order_create->error_msg));
|
||||
}
|
||||
$res = $order_create->saveInvoice();
|
||||
return $this->response($res);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user