add-api-BizLicense
This commit is contained in:
@@ -108,6 +108,17 @@ class Main extends HD_Controller
|
||||
array('name' => '查看详情', 'url' => '/app/liche/cash/lists'),
|
||||
),
|
||||
);
|
||||
|
||||
//购车
|
||||
$this->load->model('app/liche/app_liche_orders_model');
|
||||
$value = $this->app_liche_orders_model->count(['pid'=>0]);
|
||||
$list[] = array(
|
||||
'title' => '购车订单(笔)',
|
||||
'value' => $value,
|
||||
'btns' => array(
|
||||
array('name' => '查看详情', 'url' => '/app/liche/order'),
|
||||
),
|
||||
);
|
||||
$conditions[] = array('icon' => 'am-icon-home', 'list' => $list);
|
||||
|
||||
/*实时数据 end*/
|
||||
|
||||
@@ -0,0 +1,164 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Created by Vim.
|
||||
* User: lcc
|
||||
* Date: 2021/11/30
|
||||
* Time: 10:02
|
||||
*/
|
||||
class Order extends HD_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('receiver/order/receiver_orders_model', 'orders_model');
|
||||
$this->load->model('app/liche/app_liche_orders_model');
|
||||
$this->load->model('sys/sys_company_model');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->lists();
|
||||
}
|
||||
|
||||
public function lists()
|
||||
{
|
||||
$input = $this->input->get();
|
||||
$page = $input['page'];
|
||||
$size = $input['size'];
|
||||
!$page && $page = 1;
|
||||
!$size && $size = 10;
|
||||
|
||||
$lists = [];
|
||||
$where = [
|
||||
'pid' => 0,
|
||||
'status>=' => 0
|
||||
];
|
||||
$count = $this->app_liche_orders_model->count($where);
|
||||
if($count){
|
||||
$rows = $this->app_liche_orders_model->select($where,'id desc',$page,$size,'id,o_id,sid,c_time');
|
||||
$type_arr = $this->app_liche_orders_model->get_type_arr();
|
||||
|
||||
foreach($rows as $key => $val){
|
||||
$sub_lists = [];
|
||||
$sub_where = [
|
||||
'pid>' => 0,
|
||||
'o_id' => $val['o_id'],
|
||||
'status>=' => 0
|
||||
];
|
||||
$sub_rows = $this->app_liche_orders_model->select($sub_where, 'id asc', 1, 20, 'id,total_price,pay_price,type,pay_time,mch_id,descrip,status');
|
||||
if($sub_rows){
|
||||
foreach($sub_rows as $item){
|
||||
$company = '';
|
||||
if ($item['mch_id']) {
|
||||
$company = $this->sys_company_model->get(['wx_mchid' => $item['mch_id']], 'short');
|
||||
}
|
||||
$sub_lists[] = [
|
||||
'id' => $item['id'],
|
||||
'total_price' => $item['total_price'],
|
||||
'pay_price' => $item['pay_price'],
|
||||
'type_cn' => $type_arr[$item['type']],
|
||||
'descrip' => $item['descrip'],
|
||||
'status' => $item['status'],
|
||||
'company' => $company ? $company['short'] : '',
|
||||
];
|
||||
}
|
||||
}
|
||||
$lists[] = [
|
||||
'o_id' => $val['o_id'],
|
||||
'sid' => $val['sid'],
|
||||
'c_time' => date('Y-m-d H:i',$val['c_time']),
|
||||
'sub_lists' => $sub_lists
|
||||
];
|
||||
}
|
||||
}
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['_title'] = '购车订单列表';
|
||||
$this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count);
|
||||
|
||||
return $this->show_view('/app/liche/order/lists', true);
|
||||
}
|
||||
|
||||
public function get()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
// TODO: Implement add() method.
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function del()
|
||||
{
|
||||
// TODO: Implement del() method.
|
||||
}
|
||||
|
||||
public function batch()
|
||||
{
|
||||
// TODO: Implement batch() method.
|
||||
}
|
||||
|
||||
public function export()
|
||||
{
|
||||
// TODO: Implement export() method.
|
||||
}
|
||||
//确认收款
|
||||
public function edit_pay(){
|
||||
$id = $this->input->post('id');
|
||||
$row = $this->app_liche_orders_model->get(['id'=>$id]);
|
||||
if(!$row){
|
||||
return $this->show_json(SYS_CODE_FAIL, '订单不存在');
|
||||
}
|
||||
if($row['status']){
|
||||
return $this->show_json(SYS_CODE_FAIL, '订单已支付');
|
||||
}
|
||||
$this->load->service('apporder/payment_service', array('app_id' => 1));
|
||||
$descrip = '后台确认线下交款';
|
||||
$p_row = $this->app_liche_orders_model->get(['id'=>$row['pid']]);
|
||||
if($row['type']==3 && !$p_row['status']){ //尾款
|
||||
//未支付金额
|
||||
$pay = $this->app_liche_orders_model->sum('total_price',['type'=>3,'o_id'=>$row['o_id'],'id!='=>$row['id']]);
|
||||
$need_pay = $row['total_price'] - $pay['total_price'];
|
||||
if($need_pay<=0){
|
||||
return $this->show_json(SYS_CODE_FAIL, '需支付金额必须大于0');
|
||||
}
|
||||
$this->load->helper('order');
|
||||
$sid = create_order_no(350200,'liche',1,$row['type']);
|
||||
$sub_data = [
|
||||
'o_id' => $row['o_id'],
|
||||
'sid' => $sid,
|
||||
'uid' => $row['uid'],
|
||||
'mch_id' => $row['mch_id'],
|
||||
'pid' => $row['id'],
|
||||
'brand_id' => $row['brand_id'],
|
||||
's_id' => $row['s_id'],
|
||||
'v_id' => $row['v_id'],
|
||||
'cor_id' => $row['cor_id'],
|
||||
'incor_id' => $row['incor_id'],
|
||||
'total_price' => $need_pay,
|
||||
'type' => 3,
|
||||
'c_time' => time()
|
||||
];
|
||||
$res = $this->app_liche_orders_model->add($sub_data);
|
||||
if(!$res){
|
||||
return $this->show_json(SYS_CODE_FAIL, '创建订单失败');
|
||||
}
|
||||
$result = $this->payment_service->after_pay_liche($sid,$need_pay,$descrip);
|
||||
}else{
|
||||
$result = $this->payment_service->after_pay_liche($row['sid'],$row['total_price'],$descrip);
|
||||
}
|
||||
if($result['code']){
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}else{
|
||||
return $this->show_json(SYS_CODE_FAIL, $result['msg']);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -437,8 +437,8 @@ class OrdersList
|
||||
$lists = [];
|
||||
if ($count) {
|
||||
$fileds = "$t1.id,$t1.o_id,$t1.status,";
|
||||
$fileds .= "$t2.rid,$t2.sid,$t2.name,$t2.mobile,$t2.brand_id,$t2.s_id,$t2.v_id,$t2.cor_id,$t2.incor_id,$t2.price,$t2.deposit,$t2.payway,$t2.c_time, {$t2}.admin_id,{$t2}.order_time,{$t2}.bill_time";
|
||||
$rows = $this->ci->order_signs_model->select_order($where, "$t2.order_time desc", $page, $size, $fileds);
|
||||
$fileds .= "$t2.rid,$t2.sid,$t2.name,$t2.mobile,$t2.brand_id,$t2.s_id,$t2.v_id,$t2.cor_id,$t2.incor_id,$t2.price,$t2.deposit,$t2.payway,$t2.c_time, {$t2}.admin_id,{$t2}.order_time,{$t2}.bill_time,{$t2}.biz_id";
|
||||
$rows = $this->ci->order_signs_model->select_order($where, "$t2.c_time desc", $page, $size, $fileds);
|
||||
$brand_arr = $series_arr = $v_arr = $cor_arr = $incor_arr = array();
|
||||
$admin_ids = array();
|
||||
if ($rows) {
|
||||
@@ -511,7 +511,7 @@ class OrdersList
|
||||
$fields['admin_name'] = $admin ? $admin['uname'] : '';
|
||||
$fields['price'] = $val['price'] > 1 ? number_format($val['price']) : number_format($val['price'], 2);
|
||||
$fields['deposit'] = $val['deposit'] > 1 ? number_format($val['deposit']) : number_format($val['deposit'], 2);
|
||||
$fields['biz_name'] = $map_biz[$admin['biz_id']];
|
||||
$fields['biz_name'] = $map_biz[$val['biz_id']];
|
||||
$fields['cf_title'] = $customers[$val['rid']][0]['cf_title'];
|
||||
$cf_name = '';
|
||||
$cfroms[$customers[$val['rid']][0]['cf_id']][0]['title'] && $cf_name = $cfroms[$customers[$val['rid']][0]['cf_id']][0]['title'].'(线上)<br>';
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
<div class="coms-table-wrap mt10">
|
||||
<form id="vue-app" class=" form-search coms-table-hd clearfix no-border" onsubmit="return false"
|
||||
action="/app/liche/member/index">
|
||||
<div class="am-form am-form-horizontal">
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">手机号码:</label>
|
||||
<div class="am-para-inline w150">
|
||||
<input type="text" name="mobile" value="<?= $mobile ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="coms-table-bd">
|
||||
<div class="fr">共有<?= $pager['totle'] ?>条数据</div>
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width=""><span>订单金额</span></th>
|
||||
<th width=""><span>实付金额</span></th>
|
||||
<th width=""><span>收款公司</span></th>
|
||||
<th width=""><span>描述</span></th>
|
||||
<th width=""><span>订单类型</span></th>
|
||||
<th width=""><span>支付状态</span></th>
|
||||
<th width="">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<?foreach($lists as $key=>$val){?>
|
||||
<table class="am-table am-table-bordered" style="margin-top:10px">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="7" class="align-l">
|
||||
时间:<?=$val['c_time']?> 订单号:<?=$val['sid']?> <a href="javascript:;" data-open="/receiver/orders/get?id=<?=$val['o_id']?>">购车订单</a>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?foreach($val['sub_lists'] as $item){?>
|
||||
<tr>
|
||||
<td width=""><?=$item['total_price']?></td>
|
||||
<td width=""><?=$item['pay_price']?></td>
|
||||
<td width=""><?=$item['company']?></td>
|
||||
<td width=""><?=$item['descrip']?></td>
|
||||
<td width=""><?=$item['type_cn']?></td>
|
||||
<td width=""><?=$item['status'] ? '已支付':'未支付'?></td>
|
||||
<td width="">
|
||||
<?if(!$item['status']){?>
|
||||
<button class="am-btn am-btn-primary am-btn-sm fl ml10" data-ajax="post" data-action="/app/liche/order/edit_pay" data-params-id="<?=$item['id']?>">确认线下收款</button>
|
||||
<?}?>
|
||||
</td>
|
||||
</tr>
|
||||
<?}?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?}?>
|
||||
</div>
|
||||
<div class="coms-table-ft clearfix">
|
||||
|
||||
<div class="coms-pagination fr mr20">
|
||||
<?php page_view($pager) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
</script>
|
||||
@@ -7,4 +7,11 @@ class Welcome extends CI_Controller {
|
||||
{
|
||||
$this->load->view('welcome_message');
|
||||
}
|
||||
|
||||
public function test(){
|
||||
$this->load->library('TcOrc');
|
||||
$img = '';
|
||||
$result = $this->tcorc->BizLicense($img);
|
||||
print_r($result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -444,7 +444,7 @@ class Cusorder extends Wxapp{
|
||||
$car_data['委托人手机号'] = $info_json['entrust_mobile'] ? $info_json['entrust_mobile'] : '';
|
||||
$car_data['委托人身份证'] = $info_json['entrust_idcard'] ? $info_json['entrust_idcard'] : '';
|
||||
}
|
||||
if($row['ifentrust'] && $row['main_type']){
|
||||
if($row['main_type']){
|
||||
$car_data['购车主体'] = '公司';
|
||||
}
|
||||
}
|
||||
@@ -476,6 +476,8 @@ class Cusorder extends Wxapp{
|
||||
'carid_a_path' => $bill['cardidA'] ? $bill['cardidA'] : '',
|
||||
'carid_b' => $bill['cardidB'] ? build_qiniu_image_url($bill['cardidB']) : '',
|
||||
'carid_b_path' => $bill['cardidB'] ? $bill['cardidB'] : '',
|
||||
'business_licence' => $bill['business_licence'] ? build_qiniu_image_url($bill['business_licence']) : '',
|
||||
'business_licence_path' => $bill['business_licence'] ? $bill['business_licence'] : '',
|
||||
'bill_img' => $bill['file'] ? build_qiniu_image_url($bill['file']) : ''
|
||||
];
|
||||
}
|
||||
@@ -526,7 +528,8 @@ class Cusorder extends Wxapp{
|
||||
'status' => $row['status'],
|
||||
'my_img' => $orders_entity::API_CREATE_PAY_IMG,
|
||||
'if_fine' => $jsondata['if_fine'] ? 1 : 0,
|
||||
'disc_fine_money' => $money_json['price_fine_discount'] ? $money_json['price_fine_discount'] : 0
|
||||
'disc_fine_money' => $money_json['price_fine_discount'] ? $money_json['price_fine_discount'] : 0,
|
||||
'main_type' => intval($row['main_type']),
|
||||
];
|
||||
$inten_money && $data['inten_money'] = $inten_money;
|
||||
return $data;
|
||||
|
||||
@@ -21,48 +21,82 @@ class Idcard extends Wxapp{
|
||||
$this->load->model('receiver/order/receiver_order_loans_model','order_loans_model');
|
||||
$this->load->model('receiver/order/receiver_orders_model','orders_model');
|
||||
$this->load->model('receiver/order/receiver_order_bills_model','order_bills_model');
|
||||
|
||||
$this->load->library('TcOrc');
|
||||
$this->load->library('receiver/orders_entity');
|
||||
}
|
||||
|
||||
protected function put(){
|
||||
$id = $this->input_param('id');
|
||||
$cardidA = $this->input_param('cardidA');
|
||||
$cardidB = $this->input_param('cardidB');
|
||||
$business_licence = $this->input_param('business_licence');
|
||||
$row = $this->order_bills_model->get(['id'=>$id]);
|
||||
if(!$row || !$cardidA || !$cardidB){
|
||||
$order = $this->orders_model->get(['id'=>$row['o_id']]);
|
||||
if(!$row){
|
||||
throw new Exception('参数错误', ERR_PARAMS_ERROR);
|
||||
}
|
||||
$full_cardidA = build_qiniu_image_url($cardidA);
|
||||
$jsondata = json_decode($row['jsondata'],true);
|
||||
$this->load->library('TcOrc');
|
||||
$result = $this->tcorc->IdentityCard($full_cardidA);
|
||||
if(!$result['code']){
|
||||
$res_data['code'] = API_CODE_ORC_FAIL;
|
||||
$res_data['data'] = [
|
||||
['caridA' => false,'errmsg'=>$result['msg']],
|
||||
['caridB' => true,'errmsg'=>''],
|
||||
if($order['main_type']){ //购车主体公司
|
||||
if(!$business_licence){
|
||||
throw new Exception('参数错误', ERR_PARAMS_ERROR);
|
||||
}
|
||||
$full_business_licence = build_qiniu_image_url($business_licence);
|
||||
$result = $this->tcorc->BizLicense($full_business_licence);
|
||||
if(!$result['code']){
|
||||
$res_data['code'] = API_CODE_ORC_FAIL;
|
||||
$res_data['data'] = [
|
||||
['business_licence' => false,'errmsg'=>$result['msg']],
|
||||
];
|
||||
return $res_data;
|
||||
}
|
||||
$jsondata['business_licence']['data'] = $result['data'];
|
||||
$update = [
|
||||
'business_licence' => $business_licence,
|
||||
'status' => 1
|
||||
];
|
||||
|
||||
}else{ //购车主体个人
|
||||
if(!$cardidA || !$cardidB){
|
||||
throw new Exception('参数错误', ERR_PARAMS_ERROR);
|
||||
}
|
||||
$full_cardidA = build_qiniu_image_url($cardidA);
|
||||
$this->load->library('TcOrc');
|
||||
$result = $this->tcorc->IdentityCard($full_cardidA);
|
||||
if(!$result['code']){
|
||||
$res_data['code'] = API_CODE_ORC_FAIL;
|
||||
$res_data['data'] = [
|
||||
['caridA' => false,'errmsg'=>$result['msg']],
|
||||
['caridB' => true,'errmsg'=>''],
|
||||
];
|
||||
return $res_data;
|
||||
}
|
||||
|
||||
$userinfo = $result['data'];
|
||||
|
||||
//校验订单客户和身份证姓名
|
||||
$row_order = $this->orders_model->get(['id' => $row['o_id']]);
|
||||
if($userinfo['Name'] != $row_order['name']){
|
||||
throw new Exception('身份证姓名与客户不一致', ERR_PARAMS_ERROR);
|
||||
}
|
||||
$jsondata['cardidA']['data'] = $userinfo;
|
||||
$update = [
|
||||
'cardidA' => $cardidA,
|
||||
'cardidB' => $cardidB,
|
||||
'status' => 1
|
||||
];
|
||||
return $res_data;
|
||||
}
|
||||
|
||||
$userinfo = $result['data'];
|
||||
|
||||
//校验订单客户和身份证姓名
|
||||
$row_order = $this->orders_model->get(['id' => $row['o_id']]);
|
||||
if($userinfo['Name'] != $row_order['name']){
|
||||
throw new Exception('身份证姓名与客户不一致', ERR_PARAMS_ERROR);
|
||||
}
|
||||
|
||||
$jsondata['cardidA']['data'] = $userinfo;
|
||||
$update = [
|
||||
'cardidA' => $cardidA,
|
||||
'cardidB' => $cardidB,
|
||||
'status' => 1
|
||||
];
|
||||
$jsondata && $update['jsondata'] = json_encode($jsondata,JSON_UNESCAPED_UNICODE);
|
||||
$result = $this->order_bills_model->update($update,['id'=>$row['id']]);
|
||||
if($result){
|
||||
$this->load->library('receiver/orders_entity');
|
||||
$this->orders_entity->up_info($row['o_id'],$userinfo);
|
||||
if($order['main_type']){
|
||||
$order_jsondata = json_decode($order['info_json'],true);
|
||||
$order_jsondata['c_credit'] = $jsondata['business_licence']['data']['RegNum'];
|
||||
$this->orders_model->update(['info_json'=>json_encode($order_jsondata,JSON_UNESCAPED_UNICODE)],['id'=>$row['o_id']]);
|
||||
}else{
|
||||
$this->orders_entity->up_info($row['o_id'],$userinfo);
|
||||
}
|
||||
throw new Exception('修改成功', API_CODE_SUCCESS);
|
||||
}else{
|
||||
throw new Exception('修改失败', ERR_PARAMS_ERROR);
|
||||
@@ -73,45 +107,74 @@ class Idcard extends Wxapp{
|
||||
$oid = $this->input_param('oid');
|
||||
$cardidA = $this->input_param('cardidA');
|
||||
$cardidB = $this->input_param('cardidB');
|
||||
$business_licence = $this->input_param('business_licence');
|
||||
$bill = $this->order_bills_model->count(['o_id'=>$oid]);
|
||||
if($bill){
|
||||
throw new Exception('创建失败', ERR_PARAMS_ERROR);
|
||||
}
|
||||
$row = $this->orders_model->get(['id'=>$oid]);
|
||||
if(!$row || !$cardidA || !$cardidB){
|
||||
if(!$row){
|
||||
throw new Exception('参数错误', ERR_PARAMS_ERROR);
|
||||
}
|
||||
$full_cardidA = build_qiniu_image_url($cardidA);
|
||||
$jsondata = json_decode($row['jsondata'],true);
|
||||
$this->load->library('TcOrc');
|
||||
$result = $this->tcorc->IdentityCard($full_cardidA);
|
||||
if(!$result['code']){
|
||||
$res_data['code'] = API_CODE_ORC_FAIL;
|
||||
$res_data['data'] = [
|
||||
['caridA' => false,'errmsg'=>$result['msg']],
|
||||
['caridB' => true,'errmsg'=>''],
|
||||
if($row['main_type']){
|
||||
if(!$business_licence){
|
||||
throw new Exception('参数错误', ERR_PARAMS_ERROR);
|
||||
}
|
||||
$full_business_licence = build_qiniu_image_url($business_licence);
|
||||
$result = $this->tcorc->BizLicense($full_business_licence);
|
||||
if(!$result['code']){
|
||||
$res_data['code'] = API_CODE_ORC_FAIL;
|
||||
$res_data['data'] = [
|
||||
['business_licence' => false,'errmsg'=>$result['msg']],
|
||||
];
|
||||
return $res_data;
|
||||
}
|
||||
$jsondata['business_licence']['data'] = $result['data'];
|
||||
$add_data = [
|
||||
'o_id' => $oid,
|
||||
'business_licence' => $business_licence,
|
||||
'c_time' => time(),
|
||||
'status' => 1
|
||||
];
|
||||
return $res_data;
|
||||
}
|
||||
$userinfo = $result['data'];
|
||||
//校验订单客户和身份证姓名
|
||||
if($userinfo['Name'] != $row['name']){
|
||||
throw new Exception('身份证姓名与客户不一致', ERR_PARAMS_ERROR);
|
||||
}
|
||||
}else{
|
||||
if(!$cardidA || !$cardidB){
|
||||
throw new Exception('参数错误', ERR_PARAMS_ERROR);
|
||||
}
|
||||
$full_cardidA = build_qiniu_image_url($cardidA);
|
||||
$result = $this->tcorc->IdentityCard($full_cardidA);
|
||||
if(!$result['code']){
|
||||
$res_data['code'] = API_CODE_ORC_FAIL;
|
||||
$res_data['data'] = [
|
||||
['caridA' => false,'errmsg'=>$result['msg']],
|
||||
['caridB' => true,'errmsg'=>''],
|
||||
];
|
||||
return $res_data;
|
||||
}
|
||||
$userinfo = $result['data'];
|
||||
//校验订单客户和身份证姓名
|
||||
if($userinfo['Name'] != $row['name']){
|
||||
throw new Exception('身份证姓名与客户不一致', ERR_PARAMS_ERROR);
|
||||
}
|
||||
|
||||
$jsondata['cardidA']['data'] = $userinfo;
|
||||
$add_data = [
|
||||
'o_id' => $oid,
|
||||
'cardidA' => $cardidA,
|
||||
'cardidB' => $cardidB,
|
||||
'c_time' => time(),
|
||||
'status' => 1
|
||||
];
|
||||
$jsondata && $update['jsondata'] = json_encode($jsondata,JSON_UNESCAPED_UNICODE);
|
||||
$jsondata['cardidA']['data'] = $userinfo;
|
||||
$add_data = [
|
||||
'o_id' => $oid,
|
||||
'cardidA' => $cardidA,
|
||||
'cardidB' => $cardidB,
|
||||
'c_time' => time(),
|
||||
'status' => 1
|
||||
];
|
||||
}
|
||||
$jsondata && $add_data['jsondata'] = json_encode($jsondata,JSON_UNESCAPED_UNICODE);
|
||||
$l_id = $this->order_bills_model->add($add_data);
|
||||
if($l_id){
|
||||
$this->load->library('receiver/orders_entity');
|
||||
$this->orders_entity->up_info($oid,$userinfo);
|
||||
if($row['main_type']){
|
||||
$order_jsondata = json_decode($row['info_json'],true);
|
||||
$order_jsondata['c_credit'] = $jsondata['business_licence']['data']['RegNum'];
|
||||
$this->orders_model->update(['info_json'=>json_encode($order_jsondata,JSON_UNESCAPED_UNICODE)],['id'=>$row['id']]);
|
||||
}else{
|
||||
$this->orders_entity->up_info($oid,$userinfo);
|
||||
}
|
||||
$data = [
|
||||
'id' => $l_id,
|
||||
];
|
||||
|
||||
+66
-10
@@ -14,6 +14,7 @@ use TencentCloud\Common\Profile\HttpProfile;
|
||||
use TencentCloud\Common\Exception\TencentCloudSDKException;
|
||||
use TencentCloud\Ocr\V20181119\OcrClient;
|
||||
use TencentCloud\Ocr\V20181119\Models\IDCardOCRRequest;
|
||||
use TencentCloud\Ocr\V20181119\Models\BizLicenseOCRRequest;
|
||||
class TcOrc{
|
||||
|
||||
private $accessKeyId;
|
||||
@@ -21,6 +22,8 @@ class TcOrc{
|
||||
private $ci;
|
||||
private $dir;
|
||||
private $log_file = 'error.log';
|
||||
private $is_dev = false;
|
||||
|
||||
public function __construct($accessKeyId='',$accessKeySecret=''){
|
||||
if($accessKeyId && $accessKeySecret){
|
||||
$this->accessKeyId = $accessKeyId;
|
||||
@@ -29,6 +32,9 @@ class TcOrc{
|
||||
$this->accessKeyId = 'AKIDMXS7WhbEdlcCWZMs75mDNHuIPHsCF2Yn';
|
||||
$this->accessKeySecret = 'zh8JDpAF3bOvCCvNYS5RXLs87pGQKxJO';
|
||||
}
|
||||
if (false !== strpos($_SERVER['HTTP_HOST'], 'dev')) {//dev
|
||||
$this->is_dev = true;
|
||||
}
|
||||
$this->ci = & get_instance();
|
||||
$this->dir = 'tcorc';
|
||||
}
|
||||
@@ -41,16 +47,17 @@ class TcOrc{
|
||||
* @param return array 返回值参考官方文档
|
||||
*/
|
||||
public function IdentityCard($imageUrl,$CardSide='FRONT'){
|
||||
//dev测试
|
||||
//$this->ci->load->library('mycurl');
|
||||
//$debug_url = 'http://104.194.86.23:8889/index.php';
|
||||
//$params = [
|
||||
// 'ImageUrl' => $imageUrl,
|
||||
// 'CardSide' => $CardSide
|
||||
//];
|
||||
//$result = $this->ci->mycurl->httpGet($debug_url,$params);
|
||||
//$result = json_decode($result,true);
|
||||
//return $result;
|
||||
if($this->is_dev){
|
||||
$this->ci->load->library('mycurl');
|
||||
$debug_url = 'http://104.194.86.23:8889/index.php';
|
||||
$params = [
|
||||
'ImageUrl' => $imageUrl,
|
||||
'CardSide' => $CardSide
|
||||
];
|
||||
$result = $this->ci->mycurl->httpGet($debug_url,$params);
|
||||
$result = json_decode($result,true);
|
||||
return $result;
|
||||
}
|
||||
try {
|
||||
$cred = new Credential($this->accessKeyId, $this->accessKeySecret);
|
||||
$httpProfile = new HttpProfile();
|
||||
@@ -83,4 +90,53 @@ class TcOrc{
|
||||
return ['code'=>0,'msg'=>'识别失败'];
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 营业执照
|
||||
* Desc: 腾讯官方地址:https://cloud.tencent.com/document/product/866/36215
|
||||
* @param $imageUrl string 营业执照图片url
|
||||
* @param return array 返回值参考官方文档
|
||||
*/
|
||||
public function BizLicense($imageUrl){
|
||||
//dev测试
|
||||
if($this->is_dev){
|
||||
$this->ci->load->library('mycurl');
|
||||
$debug_url = 'http://104.194.86.23:8889/biz.php';
|
||||
$params = [
|
||||
'ImageUrl' => $imageUrl,
|
||||
];
|
||||
$result = $this->ci->mycurl->httpGet($debug_url,$params);
|
||||
$result = json_decode($result,true);
|
||||
return $result;
|
||||
}
|
||||
try {
|
||||
$cred = new Credential($this->accessKeyId, $this->accessKeySecret);
|
||||
$httpProfile = new HttpProfile();
|
||||
$httpProfile->setEndpoint("ocr.tencentcloudapi.com");
|
||||
|
||||
$clientProfile = new ClientProfile();
|
||||
$clientProfile->setHttpProfile($httpProfile);
|
||||
$client = new OcrClient($cred, "ap-guangzhou", $clientProfile);
|
||||
|
||||
$req = new BizLicenseOCRRequest();
|
||||
|
||||
$params = array(
|
||||
"ImageUrl" => $imageUrl,
|
||||
);
|
||||
$req->fromJsonString(json_encode($params));
|
||||
|
||||
$resp = $client->BizLicenseOCR($req);
|
||||
|
||||
debug_log($resp->toJsonString(),'success.log',$this->dir);
|
||||
$result = json_decode($resp->toJsonString(),true);
|
||||
if($result['Error']){
|
||||
return ['code'=>0,'msg'=>$result['Error']['Message']];
|
||||
}else{
|
||||
return ['code'=>1,'msg'=>'识别成功','data'=>$result];
|
||||
}
|
||||
}
|
||||
catch(TencentCloudSDKException $e) {
|
||||
debug_log($e,$this->log_file,$this->dir);
|
||||
return ['code'=>0,'msg'=>'识别失败'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,8 +129,9 @@ class Payment_service extends HD_Service{
|
||||
* 支付后逻辑
|
||||
* @param string $sid
|
||||
* @param float $pay_price 订单真实支付金额
|
||||
* @param string $descrip 订单描述
|
||||
*/
|
||||
public function after_pay_liche($sid,$pay_price = ''){
|
||||
public function after_pay_liche($sid,$pay_price = '',$descrip=''){
|
||||
if($sid){
|
||||
debug_log("[start] ". __FUNCTION__ . ": sid:".$sid, $this->log_file);
|
||||
$order = $this->app_liche_orders_model->get(array('sid'=>$sid));
|
||||
@@ -146,6 +147,7 @@ class Payment_service extends HD_Service{
|
||||
case 1: //定金
|
||||
$upd = array('status'=>1,'pay_time'=>date('Y-m-d H:i:s'));
|
||||
$pay_price && $upd['pay_price'] = $pay_price;
|
||||
$descrip && $upd['descrip'] = $descrip;
|
||||
$res = $this->app_liche_orders_model->update($upd,array('id'=>$order['id']));
|
||||
if($res) {
|
||||
//更新订单状态
|
||||
@@ -181,6 +183,7 @@ class Payment_service extends HD_Service{
|
||||
case 2: //服务费
|
||||
$upd = array('status'=>1,'pay_time'=>date('Y-m-d H:i:s'));
|
||||
$pay_price && $upd['pay_price'] = $pay_price;
|
||||
$descrip && $upd['descrip'] = $descrip;
|
||||
$res = $this->app_liche_orders_model->update($upd,array('id'=>$order['id']));
|
||||
if($res){
|
||||
return array('code'=>1,'msg'=>'操作成功');
|
||||
@@ -191,6 +194,7 @@ class Payment_service extends HD_Service{
|
||||
case 3: //尾款
|
||||
$upd = array('status'=>1,'pay_time'=>date('Y-m-d H:i:s'));
|
||||
$pay_price && $upd['pay_price'] = $pay_price;
|
||||
$descrip && $upd['descrip'] = $descrip;
|
||||
$res = $this->app_liche_orders_model->update($upd,array('id'=>$order['id']));
|
||||
if($res){
|
||||
//判断是否尾款支付完成
|
||||
@@ -216,6 +220,7 @@ class Payment_service extends HD_Service{
|
||||
case 4: //意向金
|
||||
$upd = array('status'=>1,'pay_time'=>date('Y-m-d H:i:s'));
|
||||
$pay_price && $upd['pay_price'] = $pay_price;
|
||||
$descrip && $upd['descrip'] = $descrip;
|
||||
$res = $this->app_liche_orders_model->update($upd,array('id'=>$order['id']));
|
||||
if($res) {
|
||||
//更新订单下定时间
|
||||
|
||||
Reference in New Issue
Block a user