From da51a600882059cba959e53c833450e03a240980 Mon Sep 17 00:00:00 2001 From: lccsw <805383944@qq.com> Date: Thu, 4 Dec 2025 10:11:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8F=91=E7=A5=A8=E8=AF=86?= =?UTF-8?q?=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- agent/admin/controllers/auto/Subsidy.php | 23 ++++++++++++++++++- .../libraries/entity/AutoUserCouponEntity.php | 2 +- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/agent/admin/controllers/auto/Subsidy.php b/agent/admin/controllers/auto/Subsidy.php index 2bfcaf55..b002d23e 100644 --- a/agent/admin/controllers/auto/Subsidy.php +++ b/agent/admin/controllers/auto/Subsidy.php @@ -19,6 +19,7 @@ class Subsidy extends BaseController $this->auto_series_model->set_db('ssdb'); $this->biz_model->set_db('ssdb'); $this->receiver_orders_model->set_db('ssdb'); + $this->load->library('TcOrc'); } public function index_post() @@ -35,6 +36,26 @@ class Subsidy extends BaseController if (!$result->isSuccess()) { throw new Exception($result->getMessage()); } + $reqData = $result->getData(); + //识别发票 + if ($params['businessImg'] && $reqData['orderId']) { + $url = build_qiniu_image_url($params['businessImg']); + $billTime = ""; + $ocrResult = $this->tcorc->CarInvoiceInfos($url); + if ($ocrResult['code'] && $ocrResult['data']['CarInvoiceInfos']) { + $carInvoiceInfos = $ocrResult['data']['CarInvoiceInfos']; + foreach ($carInvoiceInfos as $item) { + if ($item['Name'] == '开票日期') { + $billTime = str_replace(['年', '月', '日'], ['-', '-', ''], $item['Value']); + break; + } + } + $billTime = date('Y-m-d', strtotime($billTime)); + } + if ($billTime) { + $this->receiver_orders_model->update(['bill_time' => $billTime], ['id' => $reqData['orderId']]); + } + } $this->return_response(); } catch (Exception $e) { $this->return_json($e->getMessage()); @@ -86,7 +107,7 @@ class Subsidy extends BaseController if ($row['businessImg']) { $insuranceFile[] = ['url' => $row['businessImg'] ? build_qiniu_image_url($row['businessImg']) : '']; } - if($row['contractImg']){ + if ($row['contractImg']) { $contractFile[] = ['url' => $row['contractImg'] ? build_qiniu_image_url($row['contractImg']) : '']; } $data = [ diff --git a/common/libraries/entity/AutoUserCouponEntity.php b/common/libraries/entity/AutoUserCouponEntity.php index a9cd5f94..89622649 100644 --- a/common/libraries/entity/AutoUserCouponEntity.php +++ b/common/libraries/entity/AutoUserCouponEntity.php @@ -170,7 +170,7 @@ class AutoUserCouponEntity $this->ci->load->model('app/licheb/app_licheb_users_model'); $this->ci->app_licheb_users_model->set_db('ssdb'); $this->ci->app_licheb_users_model->sendSmsToManager($bizId, "门店新增了一个订单,请及时到小程序“理车宝-订单”进行处理。"); - return new MyRESPONSE(EXIT_SUCCESS, '核销成功'); + return new MyRESPONSE(EXIT_SUCCESS, '核销成功', ['orderId' => $orderId]); } catch (Exception $e) { $this->ci->db->trans_rollback(); return new MyResponse(EXIT_ERROR, $e->getMessage());