ci = &get_instance(); $this->ci->load->model('receiver/order/receiver_orders_model', 'orders_model'); $this->ci->load->model('receiver/order/receiver_order_datas_model'); $this->ci->load->library('TcOrc'); } public function get_row($oid) { $row = $this->ci->receiver_order_datas_model->get(['o_id' => $oid]); if (!$row) { $this->ci->receiver_order_datas_model->add(['o_id' => $oid, 'c_time' => time()]); $row = $this->ci->receiver_order_datas_model->get(['o_id' => $oid]); } return $row; } public function data_status($o_data, $order_status) { $result = [ 'contract_img' => ['text' => '未上传', 'type' => 0, 'color' => self::COLOR_UN_UPLOAD], //合同图片 'pay_img' => ['text' => '未上传', 'type' => 0, 'color' => self::COLOR_UN_UPLOAD], //支付凭证 'cardida' => ['text' => '未上传', 'type' => 0, 'color' => self::COLOR_UN_UPLOAD], //身份证 'business_licence' => ['text' => '未上传', 'type' => 0, 'color' => self::COLOR_UN_UPLOAD], //营业执照 'equity_ck_img' => ['text' => '未上传', 'type' => 0, 'color' => self::COLOR_UN_UPLOAD], //权益确认书 'bill_img' => ['text' => '未上传', 'type' => 1, 'color' => self::COLOR_UN_UPLOAD], //发票 'delivery_ck_img' => ['text' => '未上传', 'type' => 2, 'color' => self::COLOR_UN_UPLOAD], //交车确认图片 'car_img' => ['text' => '未上传', 'type' => 2, 'color' => self::COLOR_UN_UPLOAD], //行驶证 'car_auth_img' => ['text' => '未上传', 'type' => 2, 'color' => self::COLOR_UN_UPLOAD], //车机实名认证 'insurance_img' => ['text' => '未上传', 'type' => 2, 'color' => self::COLOR_UN_UPLOAD], //交强险图片 ]; foreach ($result as $key => $item) { if ($o_data[$key]) { if ($order_status > $item['type']) { $result[$key]['text'] = '已审核'; $result[$key]['color'] = self::COLOR_CHECK; } else { $result[$key]['text'] = '已上传'; $result[$key]['color'] = self::COLOR_IS_UPLOAD; } } } return $result; } /** * 识别发票 * @param $oid * @param $url * @return array */ public function orc_bill_img($oid, $url) { $result = $this->ci->tcorc->CarInvoiceInfos($url); if (!$result['code']) { return ['code' => 0, 'msg' => $result['msg']]; } $data = $result['data']['CarInvoiceInfos']; $bill_name = $bill_code = $bill_time = ''; $row = $this->ci->orders_model->get(['id' => $oid]); foreach ($data as $val) { if ($val['Name'] == '开票日期') { $bill_time = $val['Value']; } if ($val['Name'] == '发票代码' && $val['Value']) { $bill_code = $val['Value']; } if ($val['Name'] == '发票号码' && $val['Value']) { $bill_code = $val['Value']; } if ($val['Name'] == '购买方名称'){ $bill_name = $val['Value']; } } if (!$bill_code) return ['code' => 0, 'msg' => '未识别到发票代码']; if ($bill_name != $row['name']) return ['code' => 0, 'msg' => '车主信息不一致']; //更新订单开票时间 if($bill_time){ $this->ci->orders_model->update(['bill_time' => $bill_time], ['id' => $oid]); } return ['code' => 1, 'msg' => '识别成功', 'data' => $data]; } }