35 lines
929 B
PHP
35 lines
929 B
PHP
<?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);
|
|
}
|
|
} |