This commit is contained in:
weiz 2024-05-30 10:52:14 +08:00
parent 4a45ea83ef
commit 3fdce4ef4c

View File

@ -120,4 +120,29 @@
})->toArray();
return $this->data($data);
}
public function fdz(){
$params = $this->request->post(['invoice_id']);
if(empty($params['invoice_id'])){
return $this->fail('参数错误');
}
$invoice = Db::name('oa_invoice')->where('id',$params['invoice_id'])->find();
if(empty($invoice)){
return $this->fail('开票信息不存在');
}
Db::startTrans();
try {
Db::name('oa_invoice_income')->where('inid',$params['invoice_id'])->delete();
Db::name('oa_invoice')->where('id',$params['invoice_id'])->update([
'enter_amount' => 0,
'enter_time' => 0,
'is_cash' => 0
]);
Db::commit();
return $this->success('ok');
} catch (\Exception $e) {
Db::rollback();
return $this->fail();
}
}
}