正在显示
1 个修改的文件
包含
6 行增加
和
1 行删除
@@ -78,7 +78,12 @@ class Invoice extends Api | @@ -78,7 +78,12 @@ class Invoice extends Api | ||
78 | 'invoice_type' => $param['invoice_type'], | 78 | 'invoice_type' => $param['invoice_type'], |
79 | ]; | 79 | ]; |
80 | } | 80 | } |
81 | - $res = Db::name('invoice_ziliao')->insert($data); | 81 | + $invoice_id = Db::name('invoice_ziliao')->where(['type' => $param['type']])->where(['invoice_type' => $param['invoice_type']])->value('id'); |
82 | + if (empty($invoice_id)) { | ||
83 | + $res = Db::name('invoice_ziliao')->insert($data); | ||
84 | + } else { | ||
85 | + $res = Db::name('invoice_ziliao')->where(['id' => $invoice_id])->update($data); | ||
86 | + } | ||
82 | if ($res) { | 87 | if ($res) { |
83 | $this->success('成功', 1); | 88 | $this->success('成功', 1); |
84 | } else { | 89 | } else { |
-
请 注册 或 登录 后发表评论