Browse Source

申请开票接口优化 增加事务2

master
wanghongjun 2 years ago
parent
commit
5e49ac4484
  1. 4
      app/controller/api/InvoiceIssuance.php

4
app/controller/api/InvoiceIssuance.php

@ -33,6 +33,9 @@ class InvoiceIssuance extends Base
if ($id) {
$where[] = ['id', '!=', $id];
}
Db::startTrans();
$query_id = InvoiceIssuanceModel::where($data)->where($where)->value('id');
if ($query_id) {
throw new \Exception('当前开票项目已申请开票');
@ -42,7 +45,6 @@ class InvoiceIssuance extends Base
$data['mobile'] = $params['mobile'];
$data['email'] = $params['email'];
Db::startTrans();
//验证 、 新建抬头、获取抬头id
validate(InvoiceHeadValidate::class)->scene('type')->check($data);
validate(InvoiceHeadValidate::class)->scene('type'.$data['type'])->check($data);

Loading…
Cancel
Save