edit-liche-wxapp

This commit is contained in:
lccsw
2021-07-22 09:56:48 +08:00
parent bcf9e7a6dd
commit 0e30de2572
16 changed files with 161 additions and 148 deletions
+2 -2
View File
@@ -50,8 +50,8 @@
</a>
-->
<div id="layer-photos-demo" class="layer-photos-demo">
<img v-if="info.bill && info.bill.cardidA" :layer-src="info.bill.cardidA" :src="info.bill.cardidA" class="w100" alt="身份证正面" @click="show_carimg">
<img v-if="info.bill && info.bill.cardidB" :layer-src="info.bill.cardidB" :src="info.bill.cardidB" class="w100" alt="身份证反面" @click="show_carimg">
<img v-if="info.bill && info.bill.cardidA" :layer-src="info.bill.cardidA" :src="info.bill.cardidA" class="w100" alt="身份证正面" @click="show_carimg" style="height:50px;">
<img v-if="info.bill && info.bill.cardidB" :layer-src="info.bill.cardidB" :src="info.bill.cardidB" class="w100" alt="身份证反面" @click="show_carimg" style="height:50px">
</div>
</div>
</template>
-76
View File
@@ -1,76 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
use Gregwar\Image\Image;
use TencentCloud\Common\Credential;
use TencentCloud\Common\Profile\ClientProfile;
use TencentCloud\Common\Profile\HttpProfile;
use TencentCloud\Common\Exception\TencentCloudSDKException;
use TencentCloud\Ocr\V20181119\OcrClient;
use TencentCloud\Ocr\V20181119\Models\IDCardOCRRequest;
class Test extends CI_Controller {
public function index(){
$name= 'car_fh';
$url = "https://liche-api-dev.xiaoyu.com/wxapp/licheb/protocol/".$name;
$path = FCPATH.'temp/pdf/';
$filename = $name.'.pdf';
if (!file_exists($path)){
$oldumask = umask(0);
mkdir($path, 0777, true); umask($oldumask);
}
$arrContextOptions=array(
"ssl"=>array(
"verify_peer"=>false,
"verify_peer_name"=>false,
),
);
$html = file_get_contents($url,false,stream_context_create($arrContextOptions));
require_once COMMPATH.'/third_party/TCPDF/tcpdf.php';
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT,true, 'UTF-8', false);
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor("jmcx");
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
$pdf->SetMargins(PDF_MARGIN_LEFT, 5,PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
$pdf->SetFont('stsongstdlight', '', 10); //设置中文显示
$pdf->AddPage();
$pdf->writeHTML($html, true, false, true, false, '');
$pdf->Output($path.$filename,'F');
}
public function pdf2img(){
$pdf = 'http://liche-api-dev.xiaoyu.com/temp/pdf/car_fh.pdf';
$pdf2img_url = 'http://liche-api-dev.xiaoyu.com/jar/pdf2img';
$this->load->library('mycurl');
$url = $pdf2img_url.'?furl='.$pdf;
$res = $this->mycurl->httpGet($url);
var_dump($res);
}
public function save_img(){
$img = 'https://liche-api-dev.xiaoyu.com/pdf2img/2021-07-07/1889917037729102438059_0.png';
//if(!$_FILES['file']){
// echo '参数错误';exit;
//}
$this->load->library('receiver/sign_entity');
//$res = $this->sign_entity->merge($img,$_FILES['file'],1050,1550,300); //协议
$res = $this->sign_entity->test($img,$_FILES['file']=222,1050,1550,300); //协议
//$res = $this->sign_entity->test($img,$base64_img,1050,200,300); //整车
//$res = $this->sign_entity->test($img,$base64_img,1050,400,300); //确认单
//$res = $this->sign_entity->test($img,$base64_img,300,1400,'','',false); //车辆交接信息
echo $res;
}
}
+15 -19
View File
@@ -111,39 +111,35 @@ class Aptinfo extends Wxapp{
$this->load->model('receiver/receiver_clues_model','clues_model');
$this->load->model('auto/auto_series_model');
$uid = $this->session['uid'];
$biz_id = $this->input_param('biz_id');
$series_id = $this->input_param('car_id');//车系id
$city_code = $this->input_param('city_id');
$series_row = $this->auto_series_model->get(['id'=>$series_id]);
if($this->clues_model->count(['cf_id'=>$cf_id,'cf_uid'=>$uid,'app_id'=>$this->app_id,'status'=>0])){
throw new Exception('您已预约', API_CODE_SUCCESS);
}
$jsondata['info'] = [
'biz_id' => $biz_id ? $biz_id : '',
'city_code' => $city_code
];
$cf_platform = 'wxapp';
$where = [
'cf_id' => $cf_id,
$add_data = [
'name' => $this->session['nickname'],
'mobile' => $this->session['mobile'],
'cf_uid' => $this->session['uid'],
'cf_id' => $cf_id,
'app_id' => $this->app_id,
'if_driver' => 1,
'cf_platform' => $cf_platform,
'jsondata' => json_encode($jsondata,JSON_UNESCAPED_UNICODE),
'c_time' => time()
];
$row = $this->clues_model->get($where);
if(!$row){
$add_data = [
'name' => $this->session['nickname'],
'mobile' => $this->session['mobile'],
'cf_uid' => $this->session['uid'],
'cf_id' => $cf_id,
'app_id' => $this->app_id,
'if_driver' => 1,
'cf_platform' => $cf_platform,
'jsondata' => json_encode($jsondata,JSON_UNESCAPED_UNICODE),
'c_time' => time()
];
$series_row['brand_id'] && $add_data['brand_id'] = $series_row['brand_id'];
$series_row['id'] && $add_data['s_id'] = $series_row['id'];
$this->clues_model->add($add_data);
}
$series_row['brand_id'] && $add_data['brand_id'] = $series_row['brand_id'];
$series_row['id'] && $add_data['s_id'] = $series_row['id'];
$this->clues_model->add($add_data);
throw new Exception('预约成功', API_CODE_SUCCESS);
}
}
+10 -5
View File
@@ -45,7 +45,7 @@ class Car extends Wxapp{
$version[] = [
'id' => $val['id'],
'title' => $val['title'],
'v' => $jsondata['v'],
'v' => number_format($jsondata['v']).'元起',
];
}else{ //颜色
$color[] = [
@@ -62,7 +62,7 @@ class Car extends Wxapp{
'title' => $row['series'].' '.$row['title'],
'color' => $color,
'version' => $version,
'btn' => '支付¥9.9定金购车'
'btn' => '支付¥5000定金购车'
];
return $data;
}
@@ -72,10 +72,15 @@ class Car extends Wxapp{
$this->load->model('receiver/receiver_clues_model','clues_model');
$this->load->model('apporder/order_purchase_model');
$cf_id = 2;
$uid = $this->session['uid'];
$s_id = $this->input_param('id'); //车系id
$c_id = intval($this->input_param('c_id')); //颜色属性id
$v_id = intval($this->input_param('v_id')); //车型属性id
if($this->clues_model->count(['cf_id'=>$cf_id,'cf_uid'=>$uid,'status'=>0])){
throw new Exception('您已订购', API_CODE_INVILD_PARAM);
}
$row = $this->auto_series_model-> get(['id'=>$s_id]);
if(!$row){
throw new Exception('参数错误', API_CODE_INVILD_PARAM);
@@ -104,8 +109,8 @@ class Car extends Wxapp{
's_id' => $row['id'],
'name' => $this->session['nickname'],
'mobile' => $this->session['mobile'],
'cf_uid' => $this->session['uid'],
'cf_id' => 2,
'cf_uid' => $uid,
'cf_id' => $cf_id,
'app_id' => $this->app_id,
'cf_platform' => $cf_platform,
'jsondata' => json_encode($jsondata,JSON_UNESCAPED_UNICODE),
@@ -116,7 +121,7 @@ class Car extends Wxapp{
throw new Exception('提交失败', API_CODE_INVILD_PARAM);
}
$order_id = '';
$price = 9.9;
$price = 5000;
$sid = create_order_no(350200, $this->app_key);
if($color['jsondata']['img']){
$jsondata['cover'] = $color['jsondata']['img'];
+1 -1
View File
@@ -178,7 +178,7 @@ class Contract extends Wxapp{
break;
case 3: //车辆交接
$sign_img = array_pop($imgs);
$res = $this->sign_entity->merge($sign_img,$img,300,1400,'','',false);
$res = $this->sign_entity->merge($sign_img,$img,400,1400,'','',false);
if(!$res){
throw new Exception('签名失败', API_CODE_INVILD_PARAM);
}
+15 -2
View File
@@ -297,7 +297,7 @@ class User extends Wxapp{
if($ckcar_row['status']){
if($val['id']==5){
$state = 2;
$progressOpt = ['title'=> '合同签订','url'=>'/pages/mine/signContract/queRen?id='.$row['id']];
$progressOpt = ['title'=> '确认车辆','url'=>'/pages/mine/signContract/queRen?id='.$row['id']];
}else{
$state = 1;
}
@@ -310,7 +310,7 @@ class User extends Wxapp{
if($delivery_row['status']){
$imgs = $this->orders_entity->get_sign_imgs($row['id'],[3]);
}else{
$progressOpt = ['title'=> '合同签订','url'=>'/pages/mine/signContract/jiaoJie?id='.$row['id']];
$progressOpt = ['title'=> '交接车辆','url'=>'/pages/mine/signContract/jiaoJie?id='.$row['id']];
}
break;
default:
@@ -417,4 +417,17 @@ class User extends Wxapp{
];
return $data;
}
//判断用户报名
protected function get_ck(){
$this->load->model('receiver/receiver_clues_model','clues_model');
$uid = $this->session['uid'];
$apt_count = $this->clues_model->count(['cf_uid'=>$uid,'cf_id'=>1,'status'=>0]);//预约试驾
$dg_count = $this->clues_model->count(['cf_uid'=>$uid,'cf_id'=>2,'status'=>0]);//订购
$data = [
'apt' => $apt_count ? 1 : 0,
'dg' => $dg_count ? 1 : 0
];
return $data;
}
}
+2 -2
View File
@@ -169,11 +169,11 @@ class Cusorder extends Wxapp{
];
if($group_id==1){ //销售
$where ["admin_id = {$uid} or admin_id=0"] = null;
$where ["admin_id"] = $uid;
}
if($keyword){
$where["(name={$keyword}) or (mobile={$keyword})"] = null;
$where["(name='{$keyword}' or mobile='{$keyword}')"] = null;
}
strlen($status) && $where['status'] = $status;
$fileds = 'id,name,mobile,car_json,brand_id,s_id,deposit,payway,status,c_time';
+38 -15
View File
@@ -257,6 +257,7 @@ class Customers extends Wxapp{
$size = $this->input_param('size');
$istop = $this->input_param('istop');
$iscall = $this->input_param('iscall');
$unuse = $this->input_param('unuse'); //未派客户
!$page && $page = 1;
!$size && $size = 10;
@@ -274,12 +275,14 @@ class Customers extends Wxapp{
];
if($group_id==1){ //销售
$where ["admin_id = {$uid} or admin_id=0"] = null;
$where ["admin_id=$uid or admin_id=0"] = null;
}
if($s_time && $e_time){
$where['c_time >='] = strtotime($s_time);
$where['c_time <='] = strtotime(date('Y-m-d 23:59:59',strtotime($e_time)));
}
$unuse && $where['admin_id'] = 0;
strlen($istop) && $where['is_top'] = $istop;
strlen($if_driver) && $where['if_driver'] = 1;
strlen($status) && $where['status'] = $status;
@@ -301,24 +304,13 @@ class Customers extends Wxapp{
];
$admins = $this->app_user_model->map('id','',$where,'','','','id,uname');
}
//品牌车型
$brand_arr = array_unique(array_column($rows,'brand_id'));
$brand_ids = implode(',',$brand_arr);
if($brand_ids){
$where = [
"id in ({$brand_ids})" => null
];
$brands = $this->auto_brand_model->map('id','',$where,'','','','id,name');
}
$brands = $this->auto_brand_model->get_map_by_ids($brand_arr,'id,name');
//车系车型
$series_arr = array_unique(array_column($rows,'s_id'));
$series_ids = implode(',',$series_arr);
if($series_ids){
$where = [
"id in ({$series_ids})" => null
];
$series = $this->auto_series_model->map('id','',$where,'','','','id,name');
}
$series = $this->auto_series_model->get_map_by_ids($series_arr,'id,name');
foreach($rows as $key => $val){
$car_json = json_decode($val['car_json'],true);
@@ -352,4 +344,35 @@ class Customers extends Wxapp{
];
return $data;
}
//派单给店员
protected function put_admins(){
$uname = $this->session['uname'];
$uid = $this->session['uid'];
$id_arr = $this->input_param('ids');
$admin_id = $this->input_param('admin_id');
$admin = $this->app_user_model->get(['id'=>$admin_id,'status'=>1]);
if (!$ids || !$admin) {
throw new Hd_exception('参数错误', API_CODE_INVILD_PARAM);
}
$ids = implode(',', $id_arr);
$ret = $this->customers_model->update(['admin_id' => $admin_id], ["id in ({$ids})" => null]);
if (is_bool($ret)) {
debug_log("[error]# " . $this->orders_model->db->last_query(), __FUNCTION__, $this->log_dir);
throw new Exception('分派失败', API_CODE_FAIL);
}
//写日志
$this->load->model('receiver/receiver_clues_model','clues_model');
$this->load->library('receiver/customers_entity');
$customers = $this->customers_model->get_map_by_ids ($id_arr,'id,rid');
foreach($id_arr as $val){
if($customers[$val]['rid']){ //更新线索跟进人
$this->clues_model->update(['admin_id'=>$admin_id,'status'=>2],['id'=>$customers[$val]['rid']]);
}
$log = "$uname】分配客户";
$this->customers_entity->add_log($val,$uid,$uname,$log);
}
throw new Exception('分配成功', API_CODE_SUCCESS);
}
}
+20 -4
View File
@@ -20,10 +20,26 @@ class Employees extends Wxapp{
}
public function get(){
$where = [
'pid' => $this->session['uid'],
'status>-1' => null
];
$ifconf = $this->input_param('ifconf');
$page = $this->input_param('page');
$size = $this->input_param('size');
!$page && $page = 1;
!$size && $size = 10;
$uid = $this->session['uid'];
if($ifconf){
$where = [
"(pid=$uid or id=$uid)" => null,
'status' => 1
];
}else{
$where = [
'pid' => $this->session['uid'],
'status>' => -1
];
}
$count = $this->app_user_model->count($where);
$lists = [];
if($count){
+12 -4
View File
@@ -13,6 +13,9 @@ class Protocol extends CI_Controller{
parent::__construct($inputs, $app_key);
$this->load->model('receiver/order/receiver_orders_model','orders_model');
$this->load->model('receiver/order/receiver_order_contracts_model','contracts_model');
$this->load->model('receiver/order/receiver_order_agents_model','agents_model');
$this->load->model('receiver/order/receiver_order_loans_model','loans_model');
$this->load->model('receiver/order/receiver_order_ckcars_model','ckcars_model');
$this->load->model('auto/auto_series_model');
$this->load->model('auto/auto_brand_model');
$this->load->model("items/items_model");
@@ -54,7 +57,6 @@ class Protocol extends CI_Controller{
//车辆信息确认单
public function car_ck(){
$wxapp = $this->input->get('wxapp');
$this->load->model('receiver/order/receiver_order_ckcars_model','ckcars_model');
$id = $this->input->get('id');
$row = $this->orders_model->get(['id'=>$id]);
if($row){
@@ -74,12 +76,12 @@ class Protocol extends CI_Controller{
}
//车辆交接信息
public function car_fh(){
$this->load->model('app/licheb/app_licheb_users_model');
$wxapp = $this->input->get('wxapp');
$id = $this->input->get('id');
$row = $this->orders_model->get(['id'=>$id]);
$this->load->model('receiver/order/receiver_order_agents_model','agents_model');
$this->load->model('receiver/order/receiver_order_loans_model','loans_model');
$row['agent'] = $this->agents_model->get(['o_id'=>$id]);
$agent = $this->agents_model->get(['o_id'=>$id]);
$contract = $this->contracts_model->get(['o_id'=>$id,'type'=>3]);
$items = $this->items_model->get(['id'=>$row['item_id']],'vin');
if($row){
@@ -90,11 +92,17 @@ class Protocol extends CI_Controller{
$brand = $this->auto_brand_model->get(['id'=>$row['brand_id']],'name');
$series = $this->auto_series_model->get(['id'=>$row['s_id']],'name');
$car_json = json_decode($row['car_json'],true);
$info_json = json_decode($row['info_json'],true);
$color = isset($car_json['color']) ? $car_json['color']['title'] : '';
$version = isset($car_json['version']) ? $car_json['version']['title'] : '';
$row['brand_name'] = $brand['name'].$series['name'].' '.$version;
$row['color'] = $color;
$row['cardid'] = $info_json['cardid'];
//获取销售
$admin = $this->app_licheb_users_model->get(['id'=>$row['admin_id']],'uname');
$row['uname'] = $admin['uname'];
}
$row['agent'] = $agent;
$row['day'] = $contract ? date('Y年m月d日',$contract['c_time']):date('Y年m月d日');
$row['cid'] = $contract['cid'];
$row['vin'] = $items['vin'];
+11 -3
View File
@@ -81,12 +81,16 @@ class User extends Wxapp{
$uid = $this->session['uid'];
$user = $this->app_user_model->get(array('id' => $uid));
//获取所属店铺字段
$this->load->model("biz/biz_model");
$biz = $this->biz_model->get(['id'=>$this->session['biz_id']],'biz_name');
$data = array(
'uid' => $uid,
'uname' => $user['uname'],
'mobile' => $user['mobile'],
'group_id' => $user['group_id']
'group_id' => $user['group_id'],
'biz_name' => $biz['biz_name'] ? $biz['biz_name'] : ''
);
return $data;
@@ -97,17 +101,21 @@ class User extends Wxapp{
*/
protected function get_cal(){
$uid = $this->session['uid'];
$biz_id = $this->session['biz_id'];
$this->load->model('receiver/receiver_customers_model','customers_model');
$this->load->model('receiver/order/receiver_orders_model','orders_model');
$wl_count = $this->customers_model->count(['status'=>0,'admin_id'=>$uid]);
$gz_count = $this->customers_model->count(['status>-1'=>null,'is_top'=>1,'admin_id'=>$uid]);
$sign_count = $this->orders_model->count(['status'=>0,'admin_id'=>$uid]);
$loan_count = $this->orders_model->count(['status'=>1,'admin_id'=>$uid]);
//未派单客户
$unuse_count = $this->customers_model->count(['admin_id'=>0,'biz_id'=>$biz_id]);
$data = [
'wl_count' => $wl_count,
'gz_count' => $gz_count,
'sign_count' => $sign_count,
'loan_count' => $loan_count
'loan_count' => $loan_count,
'unuse_count' => $unuse_count
];
return $data;
}
+2 -2
View File
@@ -15,7 +15,7 @@
<table style="width:100%;">
<tr>
<td style="width:50%;">
身份证:
身份证:<?=$cardid?>
</td>
<td style="width:50%;">
联系电话:<?=$mobile?>
@@ -124,7 +124,7 @@
</div>
<div style="margin-top:50px;">
<div>销售顾问:</div>
<div>销售顾问:<?=$uname?></div>
<div>日期:<?=$day?></div>
</div>
</div>
+2 -2
View File
@@ -19,7 +19,7 @@
<table style="width:100%;">
<tr>
<td style="width:50%;">
身份证:
身份证:<?=$cardid?>
</td>
<td style="width:50%;">
联系电话:<?=$mobile?>
@@ -128,7 +128,7 @@
</div>
<div class="mt50">
<div>销售顾问:</div>
<div>销售顾问:<?=$uname?></div>
<div>日期:<?=$day?></div>
</div>
</div>
+9 -9
View File
@@ -42,15 +42,15 @@ class TcOrc{
*/
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;
//$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();
+2 -2
View File
@@ -42,7 +42,7 @@ class Sign_entity{
!$s_path && $s_path = FCPATH.'temp/'.md5('sign'.$file_name).'.jpg';
$yhdata = file_get_contents($user_file,false,stream_context_create($arrContextOptions));
$yh_image = Image::fromData($yhdata)->cropResize(150,150);
$yh_image = Image::fromData($yhdata)->cropResize(150,150)->rotate(-90);
//原始签名文件
@@ -98,7 +98,7 @@ class Sign_entity{
if(!$res){
return false;
}
$yh_image = Image::open($imgPath)->cropResize(150,150);
$yh_image = Image::open($imgPath)->cropResize(150,150)->rotate(-90);
//原始签名文件
@@ -17,6 +17,26 @@ class Receiver_customers_model extends HD_Model
{
parent::__construct($this->table_name, 'default');
}
/**
* Notes:根据id获取数据
* @param $ids array() id 数组
* @param string $fileds
* @return array
*/
public function get_map_by_ids($ids, $fileds = '')
{
$rows = [];
if ($ids) {
$ids = array_filter($ids);
$cf_ids = implode(',', $ids);
$where = [
"id in ($cf_ids)" => null
];
$rows = $this->map('id', '', $where, '', '', '', $fileds);
}
return $rows;
}
public function get_status(){
return $this->status_arr;