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());