diff --git a/api/controllers/plan/Test.php b/api/controllers/plan/Test.php index 28aeaad1..0461c577 100644 --- a/api/controllers/plan/Test.php +++ b/api/controllers/plan/Test.php @@ -37,4 +37,37 @@ class Test extends HD_Controller } } + + public function inten(){ + $this->load->model('app/liche/app_liche_orders_model'); + $this->load->model('receiver/order/receiver_orders_model'); + $page = $this->input->get('page'); + $size = $this->input->get('size'); + !$page && $page = 1; + !$size && $size = 20; + $where = [ + 'type' => 4 + ]; + $rows = $this->app_liche_orders_model->select($where,'id desc',$page,$size); + if($rows){ + foreach($rows as $key=>$val){ + $last_id = $val['id']; + $order = $this->receiver_orders_model->get(['id'=>$val['o_id']]); + if($order){ + $money_json = json_decode($order['money_json'],true); + $money_json['price_intention'] = $val['total_price'] ? $val['total_price'] : 0; + $this->receiver_orders_model->update(['money_json'=>json_encode($money_json,JSON_UNESCAPED_UNICODE)],['id'=>$order['id']]); + } + } + $where = [ + 'type' => 4, + 'id<' => $last_id + ]; + $left = $this->app_liche_orders_model->count($where); + $ids = implode(',',array_column($rows,'o_id')); + echo "do:{$ids} left:{$left}"; + }else{ + echo 'finish'; + } + } } diff --git a/api/controllers/wxapp/liche/Contract.php b/api/controllers/wxapp/liche/Contract.php index 971d93f6..f5eedeac 100644 --- a/api/controllers/wxapp/liche/Contract.php +++ b/api/controllers/wxapp/liche/Contract.php @@ -59,29 +59,19 @@ class Contract extends Wxapp{ } $cid = create_contract_no(350200,$con_id,$type); $this->contracts_model->update(['cid'=>$cid],['id'=>$con_id]); - //html转pdf - $save_path = 'data/contracts/'.date('Ymd'); - $filename = $cid.'.pdf'; - $c_res = $this->pdf->html2pdf($pdf2img_url,FCPATH.$save_path,$filename); - $update = [ - 'file' => $save_path.'/'.$filename, - 'cid' => $cid - ]; - $this->contracts_model->update($update,['id'=>$con_id]); }else{ - if(!$contract['status'] && date('Ymd')!=date('Ymd',$contract['c_time'])){ //更新合同文件日期 - //html转pdf - @unlink(FCPATH.$contract['file']); - $save_path = 'data/contracts/'.date('Ymd'); - $filename = $contract['cid'].'.pdf'; - $c_res = $this->pdf->html2pdf($pdf2img_url,FCPATH.$save_path,$filename); - $update = [ - 'file' => $save_path.'/'.$filename, - 'c_time' => time() - ]; - $this->contracts_model->update($update,['id'=>$contract['id']]); - } + $con_id = $contract['id']; + $cid = $contract['cid']; } + //html转pdf + $save_path = 'data/contracts/'.date('Ymd'); + $filename = $cid.'.pdf'; + $c_res = $this->pdf->html2pdf($pdf2img_url,FCPATH.$save_path,$filename); + $update = [ + 'file' => $save_path.'/'.$filename, + 'c_time' => time() + ]; + $this->contracts_model->update($update,['id'=>$con_id]); $next_path = ''; //下一步合同 switch($type){ case 0: //整车 diff --git a/api/controllers/wxapp/licheb/Cusorder.php b/api/controllers/wxapp/licheb/Cusorder.php index 0649c727..45fdb4b8 100644 --- a/api/controllers/wxapp/licheb/Cusorder.php +++ b/api/controllers/wxapp/licheb/Cusorder.php @@ -188,7 +188,8 @@ class Cusorder extends Wxapp{ 'price_book' => $car_row['price_book'], 'price_insure' => $car_row['price_insure'], 'price_fine' => $car_row['price_fine'], - 'price_discount' =>$disc_money ? $disc_money : 0 + 'price_discount' =>$disc_money ? $disc_money : 0, + 'price_intention' => $inten_money ? $inten_money : 0 ]; if(!$payway){ $orders_entity = new Orders_entity(); @@ -306,7 +307,7 @@ class Cusorder extends Wxapp{ }else{ strlen($status) && $where['status'] = $status; } - $fileds = 'id,name,mobile,brand_id,s_id,v_id,cor_id,incor_id,deposit,payway,status,c_time'; + $fileds = 'id,name,mobile,brand_id,s_id,v_id,cor_id,incor_id,deposit,payway,status,c_time,money_json,srv_ids'; $count = $this->orders_model->count($where); $lists = []; if($count){ @@ -326,19 +327,29 @@ class Cusorder extends Wxapp{ $status_arr = $this->orders_model->get_status(); foreach($rows as $key=>$val){ + $money_json = json_decode($val['money_json'],true); + if($val['brand_id']){ //已选择车型 + $brand_name = isset($brands[$val['brand_id']]) ? $brands[$val['brand_id']][0]['name'] : ''; + $serie_name = isset($series[$val['s_id']]) ? $series[$val['s_id']][0]['name'] : ''; + $color = isset($attrs[$val['cor_id']]) ? $attrs[$val['cor_id']][0]['title'] : ''; + $version = isset($attrs[$val['v_id']]) ? $attrs[$val['v_id']][0]['title'] : ''; + //是否需要代办 + $srv_arr = explode(',',$val['srv_ids']); + $db_title = in_array(2,$srv_arr) ? '需要' : ''; - $brand_name = isset($brands[$val['brand_id']]) ? $brands[$val['brand_id']][0]['name'] : ''; - $serie_name = isset($series[$val['s_id']]) ? $series[$val['s_id']][0]['name'] : ''; - $color = isset($attrs[$val['cor_id']]) ? $attrs[$val['cor_id']][0]['title'] : ''; - $version = isset($attrs[$val['v_id']]) ? $attrs[$val['v_id']][0]['title'] : ''; - - $other_data = [ - '品牌车型' => "{$brand_name}{$serie_name}-{$color}-{$version}", - '付款方式' => $val['payway']?'全款':'分期', - '代办车牌' => '需要', - '定金金额' => $val['deposit'], - '订单日期' => date('Y-m-d',$val['c_time']), - ]; + $other_data = [ + '品牌车型' => "{$brand_name}{$serie_name}-{$color}-{$version}", + '付款方式' => $val['payway']?'全款':'分期', + '代办车牌' => $db_title, + '定金金额' => $val['deposit'], + '订单日期' => date('Y-m-d',$val['c_time']), + ]; + }else{ + $other_data = [ + '意向金' => $money_json['price_intention'] ? $money_json['price_intention'] : '', + '订单日期' => date('Y-m-d',$val['c_time']), + ]; + } $lists[] = [ 'id' => $val['id'], 'name' => $val['name'], diff --git a/api/controllers/wxapp/licheb/Cusorder2.php b/api/controllers/wxapp/licheb/Cusorder2.php index d4987ef3..0cc3fcf6 100644 --- a/api/controllers/wxapp/licheb/Cusorder2.php +++ b/api/controllers/wxapp/licheb/Cusorder2.php @@ -99,6 +99,7 @@ class Cusorder2 extends Wxapp{ $city = $this->sys_city_model->get(['city_id'=>$biz['city_id']],'fee_carno'); $money_json['fee_carno'] = $city['fee_carno']; } + $money_json['price_intention'] = $inten_money ? $inten_money : 0; $data['money_json'] = json_encode($money_json,JSON_UNESCAPED_UNICODE); $row['rid'] && $data['clue_id'] = $row['rid']; diff --git a/sql/receiver/order.sql b/sql/receiver/order.sql index 9a60a221..ef6a67ca 100644 --- a/sql/receiver/order.sql +++ b/sql/receiver/order.sql @@ -157,7 +157,7 @@ create table lc_receiver_order_signs ( -- Author:lcc -- Table:lc_receiver_orders -- info_json entrust_name 代办人姓名 entrust_idcard 代办人身份证 name 姓名 sex 性别 nation 民族 birth 出生日期 address 家庭地址 cardid 身份证 c_address 创建时输入的地址 c_cardid 创建时输入的身份证 --- money_json price_car 裸车价 price_book 定金 price_insure 保险价格 price_fine 精品报价 price_finance 金融报价 price_loan贷款金额 price_discount优惠金额 +-- money_json price_car 裸车价 price_book 定金 price_insure 保险价格 price_fine 精品报价 price_finance 金融报价 price_loan贷款金额 price_discount优惠金额 price_intention意向金 -- --------------------------- drop table if exists lc_receiver_orders; create table lc_receiver_orders (