You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.5 KiB
55 lines
1.5 KiB
<?php
|
|
|
|
namespace app\model;
|
|
|
|
use think\Model;
|
|
|
|
class InvoiceIssuanceData extends Model
|
|
{
|
|
|
|
/**
|
|
* 保存 税务接口
|
|
* @param $invoice_issuance_id
|
|
* @param $bdznsrsbh
|
|
* @param $jsyj
|
|
* @param $assetID
|
|
* @param $pdf_filepath
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
* @throws \think\db\exception\DbException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
*/
|
|
public function saveData($invoice_issuance_id, $bdznsrsbh, $jsyj, $assetID, $pdf_filepath)
|
|
{
|
|
$query = $this->where('invoice_issuance_id', $invoice_issuance_id)->find();
|
|
$save = [
|
|
'bdznsrsbh' => $bdznsrsbh,
|
|
'jsyj' => $jsyj,
|
|
'assetID' => $assetID,
|
|
'pdf_filepath' => $pdf_filepath,
|
|
];
|
|
if ($query) {
|
|
$save['update_time'] = time();
|
|
$query->save($save);
|
|
} else {
|
|
$save['create_time'] = time();
|
|
$this->save($save);
|
|
}
|
|
}
|
|
|
|
public function saveField($invoice_issuance_id, $field, $value, $type = 1)
|
|
{
|
|
$where = ['invoice_issuance_id' => $invoice_issuance_id];
|
|
if ($type == 1) $where['status'] = 1;
|
|
$query = $this->where($where)->find();
|
|
$save = [$field => $value];
|
|
if ($query) {
|
|
$save['update_time'] = time();
|
|
$query->save($save);
|
|
} else {
|
|
$save['create_time'] = time();
|
|
$save['invoice_issuance_id'] = $invoice_issuance_id;
|
|
$this->save($save);
|
|
}
|
|
}
|
|
|
|
}
|
|
|