|
@@ -152,7 +152,7 @@ class Pricing extends Api
|
|
|
$uid = $this->auth->id;
|
|
|
if(input('type')==1) {
|
|
|
$rule = [
|
|
|
- 'order_no'=>'require',
|
|
|
+ 'cp_order_no'=>'require',
|
|
|
'invoice_type'=>'require',
|
|
|
'invoice_shape'=>'require',
|
|
|
'type'=>'require',
|
|
@@ -165,7 +165,7 @@ class Pricing extends Api
|
|
|
];
|
|
|
}else if(input('type')==2){
|
|
|
$rule = [
|
|
|
- 'order_no'=>'require',
|
|
|
+ 'cp_order_no'=>'require',
|
|
|
'invoice_type'=>'require',
|
|
|
'invoice_shape'=>'require',
|
|
|
'type'=>'require',
|
|
@@ -181,15 +181,16 @@ class Pricing extends Api
|
|
|
}
|
|
|
$data = $this->_validate($rule);
|
|
|
$data['uid'] = $uid;
|
|
|
+ $data['order_no'] = pay_no($uid);
|
|
|
if(!empty(Order::where('order_no', $data['order_no'])->value('billing_status'))){
|
|
|
$this->error('订单已申请发票');
|
|
|
}
|
|
|
DB::startTrans();
|
|
|
try {
|
|
|
- OrderInvoice::create($data);
|
|
|
+ $OrderInvoice = OrderInvoice::create($data);
|
|
|
Order::where('order_no', $data['order_no'])->update(['billing_status' => 1]);
|
|
|
Db::commit();
|
|
|
- $this->success('申请成功');
|
|
|
+ $this->success('申请成功',$OrderInvoice);
|
|
|
}catch (Exception $exception){
|
|
|
DB::rollback();
|
|
|
$this->error($exception);
|