add-wxapp-liche2

This commit is contained in:
lccsw
2021-07-15 20:30:15 +08:00
parent 0f2c66163c
commit 54fda74296
464 changed files with 70142 additions and 223 deletions
+3 -3
View File
@@ -7,7 +7,7 @@ $config['bucket'] = 'img-haodian';
$config['region'] = '华东';
$config['is_https'] = 'https';
$config['domain'] = 'qimg.haodian.cn';
$config['attch'] = 'hdi/';
$config['attch'] = 'liche/';
$config['img']['access_key'] = 'f9o5jg_SZQA6IZtru4YZ8eJ-lWfPM6jdTP4lrmTu';
$config['img']['secret_key'] = 'qh76Nn02FjiXXVxF4k6RqVt6keFNfXuVFWaVJAGW';
@@ -15,7 +15,7 @@ $config['img']['bucket'] = 'img-haodian';
$config['img']['region'] = '华东';
$config['img']['is_https'] = 'https';
$config['img']['domain'] = 'qimg.haodian.cn';
$config['img']['attch'] = 'hdi/';
$config['img']['attch'] = 'liche/';
$config['video']['access_key'] = 'f9o5jg_SZQA6IZtru4YZ8eJ-lWfPM6jdTP4lrmTu';
$config['video']['secret_key'] = 'qh76Nn02FjiXXVxF4k6RqVt6keFNfXuVFWaVJAGW';
@@ -23,4 +23,4 @@ $config['video']['bucket'] = 'video-haodian';
$config['video']['region'] = '华南';
$config['video']['is_https'] = 'https';
$config['video']['domain'] = 'qv.haodian.cn';
$config['video']['attch'] = 'hdi/';
$config['video']['attch'] = 'liche/';
+54
View File
@@ -1321,6 +1321,60 @@ class Common extends CI_Controller
$lists[] = array('id' => $value['id'], 'name' => $value['name']);
}
$this->data = $lists;
$hasNext = ceil($count / $size) > $page ? 1 : 0;
$this->data['page'] = array('page' => $page, 'pageLimit' => $size, 'pageCount' => $count, 'hasNext' => $hasNext);
return $this->show_json(SYS_CODE_SUCCESS);
}
/**
* Notes:获取商品列表
*/
public function items()
{
$page = $this->input->post('page') ? intval($this->input->post('page')) : 1;
$size = $this->input->post('size') ? intval($this->input->post('size')) : 10;
$where = [
'status' => 1
];
$count = 0;
$list = array();
$this->load->model("items/items_model");
$this->load->model('auto/auto_series_model');
$this->load->model('auto/auto_brand_model');
$this->load->model('auto/auto_attr_model');
$count = $this->items_model->count($where);
if ($count) {
$rows = $this->items_model->select($where, "id desc", $page, $size,'id,brand_id,s_id,v_id,cor_id,incor_id,vin');
//品牌车型
$brand_arr = array_unique(array_column($rows,'brand_id'));
$brands = $this->auto_brand_model->get_map_by_ids($brand_arr,'id,name');
//车系车型
$series_arr = array_unique(array_column($rows,'s_id'));
$series = $this->auto_series_model->get_map_by_ids($series_arr,'id,name');
//获取属性
$v_arr = array_unique(array_column($rows,'v_id'));
$cor_arr = array_unique(array_column($rows,'cor_id'));
$incor_arr = array_unique(array_column($rows,'incor_id'));
$attr_arr = array_merge($v_arr,$cor_arr,$incor_arr);
$attr = $this->auto_attr_model->get_map_by_ids($attr_arr,'id,title');
foreach($rows as $key=>$val){
$setval = [
'id' => $val['id'],
'vin' => $val['vin']
];
$setval['brand_name'] = isset($brands[$val['brand_id']]) ? $brands[$val['brand_id']][0]['name'] : '';
$setval['series_name'] = isset($series[$val['s_id']]) ? $series[$val['s_id']][0]['name'] : '';
$setval['v_name'] = isset($attr[$val['v_id']]) ? $attr[$val['v_id']][0]['title'] : '';
$setval['cor_name'] = isset($attr[$val['cor_id']]) ? $attr[$val['cor_id']][0]['title'] : '';
$setval['incor_name'] = isset($attr[$val['incor_id']]) ? $attr[$val['incor_id']][0]['title'] : '';
$list[] = $setval;
}
}
$this->data['list'] = $list;
$hasNext = ceil($count / $size) > $page ? 1 : 0;
$this->data['page'] = array('page' => $page, 'pageLimit' => $size, 'pageCount' => $count, 'hasNext' => $hasNext);
return $this->show_json(SYS_CODE_SUCCESS);
}
}
+8 -2
View File
@@ -62,13 +62,14 @@ class Cms extends HD_Controller
$id = $this->input->get('id');
if($id){
$row = $this->liche_cms_model->get(array('id' => $id));
$json = json_decode($row['jsondata'],true);
$arr = $row['cover'] ? explode(',', $row['cover']) : array();
$covers = array();
foreach($arr as $val){
$covers[] = build_qiniu_image_url($val);
}
$row['btn_type'] = $json['btn_type'] ? $json['btn_type'] : 1;
$row['link'] = $row['url'];
$row['s_time'] = date('Y-m-d H:i:s', $row['s_time']);
$row['e_time'] = date('Y-m-d H:i:s', $row['e_time']);
@@ -76,7 +77,7 @@ class Cms extends HD_Controller
$title = "编辑{$row['title']}";
} else {
$row = array('position' => '', 'type' => 1);
$row = array('position' => '', 'type' => 1,'btn_type'=>1);
$opration = 'add';
$title = '添加推送信息';
$covers = array();
@@ -120,6 +121,7 @@ class Cms extends HD_Controller
];
$json = array();
$input['btn_type'] = $json['btn_type'] = $input['btn_type'];
if($json){
$insert['jsondata'] = json_encode($json, JSON_UNESCAPED_UNICODE);
}
@@ -134,6 +136,8 @@ class Cms extends HD_Controller
public function edit()
{
$input = $this->input->post('info');
$row = $this->liche_cms_model->get(['id'=>$input['id']]);
$json = json_decode($row['jsondata'],true);
if (empty($input['title'])) {
return $this->show_json(SYS_CODE_FAIL, '标题不能为空!');
}
@@ -146,6 +150,7 @@ class Cms extends HD_Controller
$cover = !empty($input['cover']) ? str_replace('https://qimg.haodian.cn/', '', $input['cover']) : $input['cover'];
$input['link'] = $input['link'] . trim($input['param']);
$input['btn_type'] = $json['btn_type'] = $input['btn_type'];
$upd = [
'title' => $input['title'] ? $input['title'] : '',
'url' => $input['link'] ? $input['link'] : '',
@@ -157,6 +162,7 @@ class Cms extends HD_Controller
's_time' => strtotime($input['s_time']),
'e_time' => strtotime($input['e_time']),
'sort' => intval($input['sort']),
'jsondata' => json_encode($json,JSON_UNESCAPED_UNICODE)
];
$this->liche_cms_model->update($upd, ['id' => $input['id']]);
return $this->show_json(SYS_CODE_SUCCESS, '修改成功!');
+13 -4
View File
@@ -10,6 +10,7 @@ class Member extends HD_Controller{
{
parent::__construct();
$this->load->model('app/licheb/App_licheb_users_model', 'userM');
$this->load->model("biz/biz_model");
}
//首页信息
@@ -38,9 +39,10 @@ class Member extends HD_Controller{
$count = $this->userM->count($where);
$lists = $this->userM->select($where,'id desc',$page,$size);
foreach($lists as $key=>$val){
$biz = $this->biz_model->get(['id'=>$val['biz_id']],'biz_name');
$lists[$key]['biz_name'] = $biz['biz_name'];
$lists[$key]['group_name'] = $this->groups[$val['group_id']];
}
$this->data['lists'] = $lists;
$this->data['_title'] = '用户列表';
$this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count);
@@ -52,7 +54,10 @@ class Member extends HD_Controller{
//展示单条数据
public function get()
{
$row = [];
$id = $this->input->get('id');
$row = $this->userM->get(['id'=>$id]);
$bizs = $this->biz_model->select(['status>='=>0],'id desc','','','id,biz_name');
$this->data['bizs'] = $bizs;
$this->data['row'] = $row;
$this->data['groups'] = $this->groups;
$this->data['_title'] = $row ? '编辑用户' : '添加用户';
@@ -65,6 +70,7 @@ class Member extends HD_Controller{
$uname = $this->input->post('uname');
$mobile = $this->input->post('mobile');
$group_id = $this->input->post('group_id');
$biz_id = $this->input->post('biz_id');
if (!mobile_valid($mobile)) {
return $this->show_json(SYS_CODE_FAIL, '输入正确手机号');
@@ -85,6 +91,7 @@ class Member extends HD_Controller{
'c_time' => time(),
);
$group_id && $add['group_id'] = $group_id;
$biz_id && $add['biz_id'] = $biz_id;
$id = $this->userM->add($add);
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
@@ -97,6 +104,7 @@ class Member extends HD_Controller{
$nickname = $this->input->post('nickname');
$mobile = $this->input->post('mobile');
$group_id = $this->input->post('group_id');
$biz_id = $this->input->post('biz_id');
if (!mobile_valid($mobile)) {
return $this->show_json(SYS_CODE_FAIL, '输入正确手机号');
@@ -111,8 +119,9 @@ class Member extends HD_Controller{
'mobile' => $mobile,
);
$group_id && $add['group_id'] = $group_id;
$nickname && $add['nickname'] = $nickname;
$group_id && $upd['group_id'] = $group_id;
$biz_id && $upd['biz_id'] = $biz_id;
$nickname && $upd['nickname'] = $nickname;
$this->userM->update($upd, array('id' => $id));
+18 -17
View File
@@ -13,9 +13,9 @@ class Clues extends HD_Controller{
$this->load->model('receiver/receiver_clues_model','clues_model');
$this->load->model('receiver/receiver_clues_cfrom_model','clues_cfrom_model');
$this->load->model('receiver/receiver_status_model','status_model');
$this->load->model('receiver/receiver_customers_model','customers_model');
$this->load->model('app/licheb/app_licheb_users_model');
$this->load->model("biz/biz_model");
}
//首页信息
@@ -24,6 +24,7 @@ class Clues extends HD_Controller{
}
public function lists($where = array()){
$status_arr = $this->clues_model->get_status();
$params = $this->input->get();
$page = $params['page'] = $params['page'] ? intval($params['page']) : 1;
@@ -44,24 +45,22 @@ class Clues extends HD_Controller{
$where_yx["c.c_time <="] = strtotime($c_time[1] . ' 23:59:59');
}
}
strlen($params['status']) && $where["status"] = $params['status'];
$count = $this->clues_model->count($where);
$lists = [];
if($count){
$fileds = 'id,name,mobile,cf_id,status_id,c_time,admin_id';
$fileds = 'id,name,mobile,cf_id,status_id,c_time,admin_id,status';
$rows = $this->clues_model->select($where,'id desc',$page,$size,$fileds);
//获取来源
$cf_id_arr = array_unique(array_column($rows,'cf_id'));
$cf_rows = $this->clues_cfrom_model->get_map_by_ids($cf_id_arr,'id,title');
//获取状态
$status_id_arr = array_unique(array_column($rows,'status_id'));
$status_rows = $this->status_model->get_map_by_ids($status_id_arr,'id,name');
//获取销售员
$admin_id_arr = array_unique(array_column($rows,'admin_id'));
$admin_rows = $this->app_licheb_users_model->get_map_by_ids($admin_id_arr,'id,uname');
foreach($rows as $key => $val){
$val['cf_title'] = isset($cf_rows[$val['cf_id']]) ? $cf_rows[$val['cf_id']][0]['title'] : '';
$val['status_name'] = isset($status_rows[$val['status_id']]) ? $status_rows[$val['status_id']][0]['name'] : '';
$val['status_name'] = $status_arr[$val['status']];
$val['admin_name'] = isset($admin_rows[$val['admin_id']]) ? $admin_rows[$val['admin_id']][0]['uname'] : '';
$lists[] = $val;
}
@@ -70,6 +69,7 @@ class Clues extends HD_Controller{
$this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count);
$this->data['searchTpAry'] = $this->searchTpAry;
$this->data['params'] = $params;
$this->data['status_arr'] = $status_arr;
$this->data['_title'] = '线索池列表';
return $this->show_view('receiver/clues/lists', true);
}
@@ -202,23 +202,22 @@ class Clues extends HD_Controller{
{
$ids = $this->input->get('ids');
$where = [
'status>' => -1,
'group_id' => 1
'status' => 1,
];
$adminList = $this->app_licheb_users_model->select($where,'','','','id,uname,mobile');
$this->data['adminList'] = $adminList;
$bizList = $this->biz_model->select($where,'','','','id,biz_name');
$this->data['bizList'] = $bizList;
$this->data['ids'] = $ids;
return $this->show_view('receiver/clues/get_adviser');
}
public function edit_adviser()
{
$admin_id = $this->input->post('admin_id');
$biz_id = $this->input->post('biz_id');
$ids = $this->input->post('ids');
$ids_arr = explode(',',$ids);
$user = $this->app_licheb_users_model->get(['id'=>$admin_id]);
if (!$user) {
return $this->show_json(SYS_CODE_FAIL, '请选择分配销售');
$biz = $this->biz_model->get(['id'=>$biz_id]);
if (!$biz) {
return $this->show_json(SYS_CODE_FAIL, '请选择分配门店');
}
if (!is_array($ids_arr)) {
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
@@ -237,10 +236,10 @@ class Clues extends HD_Controller{
'rid' => $val,
'name' => $clues_row['name'],
'mobile' => $clues_row['mobile'],
'biz_id' => $biz_id,
'brand_id' => $clues_row['brand_id'],
's_id' => $clues_row['s_id'],
'if_driver' => $clues_row['if_driver'],
'admin_id' => $admin_id,
'cf_title' => '后台分配',
'p_time' => date('Y-m-d H:i:s'),
'c_time' => time()
@@ -253,9 +252,11 @@ class Clues extends HD_Controller{
$jsondata && $add_data['jsondata'] = json_encode($jsondata,JSON_UNESCAPED_UNICODE);
$customers_id = $this->customers_model->add($add_data);
if($customers_id){
$this->clues_model->update(['admin_id'=>$admin_id],['id'=>$val]);
$this->clues_model->update(['status'=>1],['id'=>$val]);
$this->load->library('receiver/clues_entity');
$this->clues_entity->add_log($val,$this->uid,$this->username,"分配给【{$user['uname']}用户");
$this->clues_entity->add_log($val,$this->uid,$this->username,"分配给【{$biz['biz_name']}商家");
$this->load->library('receiver/customers_entity');
$this->customers_entity->add_log($customers_id,$this->uid,$this->username,"后台分配",0,'admin');
}
}
}
+375
View File
@@ -0,0 +1,375 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Orders extends HD_Controller{
public function __construct(){
parent::__construct();
$this->load->model('receiver/order/receiver_orders_model','orders_model');
$this->load->model('receiver/order/receiver_order_signs_model','order_signs_model');
$this->load->model('receiver/order/receiver_order_loans_model','order_loans_model');
$this->load->model('receiver/order/receiver_order_ckcars_model','order_ckcars_model');
$this->load->model('receiver/order/receiver_order_bills_model','order_bills_model');
$this->load->model('receiver/order/receiver_order_agents_model','order_agents_model');
$this->load->model('receiver/order/receiver_order_deliverys_model','order_deliverys_model');
$this->load->model('receiver/order/receiver_order_contracts_model','order_contracts_model');
$this->load->model('receiver/receiver_customers_model','customers_model');
$this->load->model('auto/auto_series_model');
$this->load->model('auto/auto_brand_model');
$this->load->model('auto/auto_attr_model');
}
public function index(){
}
public function lists(){
}
public function get(){
$status_arr = $this->order_signs_model->get_status();
$id = $this->input->get('id');
$row = $this->orders_model->get(['id'=>$id]);
$sign = $this->order_signs_model->get(['o_id'=>$row['id']],'status');
$customers = $this->customers_model->get(['id'=>$row['rid']],'cf_title');
if(!$row){
return $this->show_json(SYS_CODE_FAIL, '订单不存在!');
}
$row['info_json'] = json_decode($row['info_json'],true);
$row['status'] = intval($row['status']);
$row['price'] = number_format($row['price'],2);
$row['deposit'] = number_format($row['deposit'],2);
$row['c_time'] = date('Y-m-d',$row['c_time']);
$row['sign_status_name'] = $status_arr[$sign['status']];
$row['cf_title'] = $customers['cf_title'];
$row['payway'] = intval($row['payway']);
$row['item_id'] = intval($row['item_id']);
//获取车信息
$brand = $this->auto_brand_model->get(['id'=>$row['brand_id']],'name');
$serie = $this->auto_series_model->get(['id'=>$row['s_id']],'name');
$row['brand_name'] = $brand['name'];
$row['s_name'] = $serie['name'];
$attr_arr = [$row['v_id'],$row['cor_id'],$row['incor_id']];
$attr = $this->auto_attr_model->get_map_by_ids($attr_arr,'id,title');
$row['v_name'] = isset($attr[$row['v_id']]) ? $attr[$row['v_id']][0]['title']:'';
$row['cor_name'] = isset($attr[$row['cor_id']]) ? $attr[$row['cor_id']][0]['title']:'';
$row['incor_name'] = isset($attr[$row['incor_id']]) ? $attr[$row['incor_id']][0]['title']:'';
//获取贷款信息
if(!$row['payway'] && $row['status']>0){
$loan = $this->order_loans_model->get(['o_id'=>$row['id']]);
$loan['status'] = intval($loan['status']);
$loan['first_price'] = number_format($loan['first_price'],2);
$loan['notify_file'] = $loan['notify_file'] ? build_qiniu_image_url($loan['notify_file']) : '';
$row['loan_info'] = $loan;
}
//获取开票
$bill = $this->order_bills_model->get(['o_id'=>$row['id']],'status,file,cardidA,cardidB');
$bill['file'] = $bill['file'] ? build_qiniu_image_url($bill['file']) : '';
$bill['cardidA'] = $bill['cardidA'] ? build_qiniu_image_url($bill['cardidA']) : '';
$bill['cardidB'] = $bill['cardidB'] ? build_qiniu_image_url($bill['cardidB']) : '';
$bill['status'] = intval($bill['status']);
$row['bill'] = $bill;
//获取合同文件
$contracts = $this->order_contracts_model->select(['o_id'=>$row['id'],'status'=>1],'','','','type,file,status');
$contract_data = [];
if($contracts){
foreach($contracts as $key=>$val){
$contract_data[$val['type']] = [
'type' => $val['type'],
'status_name' => $val['status']?'已签约':'未签约'
];
}
}
$row['contract_data'] = $contract_data;
//获取代办信息
$agent = $this->order_agents_model->get(['o_id'=>$row['id']]);
$imgs = [];
if($agent){
$agent['if_ins'] = intval($agent['if_ins']);
$agent['ins_time'] = $agent['ins_time'] != '0000-00-00 00:00:00' ? date('Y-m-d',strtotime($agent['ins_time'])):'';
$agent['car_img_src'] = $agent['car_img']?build_qiniu_image_url($agent['car_img']):'';
if($agent['ins_img']){
$ins_img = json_decode($agent['ins_img']);
foreach($ins_img as $val){
$imgs[] = [
'src' => build_qiniu_image_url($val),
'value' => $val
];
}
}
}else{
$agent['if_ins'] = 0;
$agent['car_img_src'] = '';
$agent['car_img'] = '';
}
$row['agent'] = $agent;
$row['bx_imgs'] = $imgs;
$info = $row;
$this->data['info'] = $info;
$this->data['_title'] = '订单详情';
return $this->show_view('receiver/orders/get', true);
}
//添加单条数据
public function add(){
}
//编辑单条数据
public function edit(){
}
//删除单条数据
public function del(){
}
//批量操作(默认修改状态)
public function batch(){
}
//导出数据列表
public function export(){
}
//修改分期
public function edit_loan(){
$params = $this->input->post();
$file = $_FILES['file'];
$row = $this->order_loans_model->get(['o_id'=>$params['id']]);
if(!$row){
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
}
$update = [];
if($file){ //上传按揭通知函
$path = FCPATH.'temp/';
if (!file_exists($path)){
$oldumask = umask(0);
mkdir($path, 0777, true);
umask($oldumask);
}
$file_name = md5($file['name'] . uniqid()) . '.'.end(explode('.',$file['name']));
$tmp = $path.$file_name;
move_uploaded_file($file['tmp_name'], $tmp);
if (!filesize($tmp)) {
return $this->show_json(SYS_CODE_FAIL, '上传文件失败!');
}
$this->load->library('qiniu');
$res= $this->qiniu->save($file_name, file_get_contents($tmp));
unlink($tmp);
if (!$res) {
return $this->show_json(SYS_CODE_FAIL, '上传文件失败!');
}
$size = getimagesize($res['url']);
$update['notify_file'] = $res['file'];
$this->data['file_url'] = build_qiniu_image_url($res['file']);
}
strlen($params['status']) && $update['status'] = $params['status'];
$result = $this->order_loans_model->update($update,['id'=>$row['id']]);
if($result && $params['status']==1){ //设置完成按揭
$this->orders_model->update(['status'=>2],['id'=>$row['o_id']]);
$ckcar = $this->order_ckcars_model->get(['o_id'=>$row['o_id']]);
$replace = [
'o_id' => $row['o_id'],
'status' => 0,
'c_time' => time()
];
$ckcar && $replace['id'] = $ckcar['id'];
$this->order_ckcars_model->replace($replace);
}
return $result ? $this->show_json(SYS_CODE_SUCCESS,'保存成功') : $this->show_json(SYS_CODE_FAIL,'保存失败');
}
public function edit_item(){
$this->load->model("items/items_model");
$id = $this->input->post('id');
$item_id = $this->input->post('item_id');
$row = $this->orders_model->get(['id'=>$id]);
$ckcars = $this->order_ckcars_model->get(['o_id'=>$id]);
if(!$row){
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
}
if(!$item_id) return $this->show_json(SYS_CODE_FAIL, '请选择车辆!');
if($row['status']>=3){
return $this->show_json(SYS_CODE_FAIL, '用户已确,不能修改!');
}
$res = $this->orders_model->update(['item_id'=>$item_id],['id'=>$id]);
if(!$res){
return $this->show_json(SYS_CODE_FAIL,'保存失败');
}
if($row['item_id'] && $row['item_id']!=$item_id){
$this->items_model->update(['status'=>1],['id'=>$row['item_id']]);
}
$this->items_model->update(['status'=>2],['id'=>$item_id]);
if(!$ckcars){
$add_data = [
'o_id' => $id,
'status' => 1,
'c_time' => time()
];
$result = $this->order_ckcars_model->add($add_data);
}else{
$result = $this->order_ckcars_model->update(['status'=>1],['id'=>$ckcars['id']]);
}
if($result){
return $this->show_json(SYS_CODE_SUCCESS,'保存成功');
}else{
return $this->show_json(SYS_CODE_FAIL,'保存失败');
}
}
//查看发票信息
public function get_bill(){
$oid = $this->input->get('oid');
$row = $this->orders_model->get(['id'=>$oid]);
$bill = $this->order_bills_model->get(['o_id'=>$oid]);
if(!$row){
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
}
if(!$bill){
$add_data = [
'o_id' => $row['id'],
'c_time' => time()
];
$bill['id'] = $this->order_bills_model->add($add_data);
}
$bill['file'] = $bill['file'] ? build_qiniu_image_url($bill['file']):'';
$this->data['bill'] = $bill;
return $this->show_view('receiver/orders/get_bill');
}
//编辑发表信息
public function edit_bill(){
$id = $this->input->post('id');
$money = $this->input->post('money');
$file = $_FILES['file'];
if($file){ //上传文件
$path = FCPATH.'temp/';
if (!file_exists($path)){
$oldumask = umask(0);
mkdir($path, 0777, true);
umask($oldumask);
}
$file_name = md5($file['name'] . uniqid()) . '.'.end(explode('.',$file['name']));
$tmp = $path.$file_name;
move_uploaded_file($file['tmp_name'], $tmp);
if (!filesize($tmp)) {
return $this->show_json(SYS_CODE_FAIL, '上传文件失败!');
}
$this->load->library('qiniu');
$res= $this->qiniu->save($file_name, file_get_contents($tmp));
unlink($tmp);
if (!$res) {
return $this->show_json(SYS_CODE_FAIL, '上传文件失败!');
}
$size = getimagesize($res['url']);
$update['file'] = $res['file'];
}
$money && $update['money'] = $money;
$result = $this->order_bills_model->update($update,['id'=>$id]);
if($result){
return $this->show_json(SYS_CODE_SUCCESS,'保存成功');
}else{
return $this->show_json(SYS_CODE_FAIL,'保存失败');
}
}
//确定交款
public function edit_jk(){
$oid = $this->input->post('oid');
$row = $this->orders_model->get(['id'=>$oid]);
if(!$row){
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
}
if($row['status']!=3){
return $this->show_json(SYS_CODE_FAIL,'修改失败,该订单不处于开票阶段');
}
$bill = $this->order_bills_model->get(['o_id'=>$oid]);
if(!$bill['file'] || !$bill['money']){
return $this->show_json(SYS_CODE_FAIL, '未上传开票文件或未填写到账金额!');
}
$result = $this->order_bills_model->update(['status'=>1],['o_id'=>$oid]);
$this->orders_model->update(['status'=>4],['id'=>$bill['o_id']]);
if(!$this->order_agents_model->get(['o_id'=>$oid])){
$this->order_agents_model->add(['o_id'=>$oid,'c_time'=>time]);
}
return $this->show_json(SYS_CODE_SUCCESS,'保存成功');
}
//保存代办服务
public function edit_agent(){
$params = $this->input->post();
$row = $this->orders_model->get(['id'=>$params['oid']]);
if(!$row){
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
}
$agent = $this->order_agents_model->get(['o_id'=>$row['id']]);
$update = [];
$params['car_num'] && $update['car_num'] = $params['car_num'];
$params['e_time'] && $update['ins_time'] = date('Y-m-d H:i:s',strtotime($params['e_time']));
$params['car_img'] && $update['car_img'] = $params['car_img'];
$update['if_ins'] = $params['if_ins'] ? 1:0;
if($params['bx_imgs']){
$imgs = explode(',',$params['bx_imgs']);
$update['ins_img'] = json_encode($imgs,JSON_UNESCAPED_UNICODE);
}
if($agent){
$result = $this->order_agents_model->update($update,['id'=>$agent['id']]);
}else{
$update['o_id'] = $row['id'];
$update['c_time'] = time();
$result = $this->order_agents_model->add($update);
}
if($result){
return $this->show_json(SYS_CODE_SUCCESS,'保存成功');
}else{
return $this->show_json(SYS_CODE_FAIL,'保存失败');
}
}
//确定代办
public function edit_agentfh(){
$oid = $this->input->post('oid');
$row = $this->orders_model->get(['id'=>$oid]);
if(!$row){
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
}
if($row['status']!=4){
return $this->show_json(SYS_CODE_FAIL,'修改失败,该订单不处于代办阶段');
}
$this->order_agents_model->update(['status'=>1],['o_id'=>$oid]);
$this->orders_model->update(['status'=>5],['id'=>$oid]);
if(!$this->order_deliverys_model->count(['o_id'=>$oid])){
$this->order_deliverys_model->add(['o_id'=>$oid,'c_time'=>time]);
}
return $this->show_json(SYS_CODE_SUCCESS,'保存成功');
}
//获取合同图片
public function get_cimgs(){
$type = $this->input->get('type');
$oid = $this->input->get('oid');
$row = $this->order_contracts_model->get(['type'=>$type,'o_id'=>$oid]);
$info['title'] = '相册标题';
$info['id'] = '222';
$info['start'] = 0;
$data = [];
if($row){
$imgs = json_decode($row['imgs'],true);
foreach($imgs as $key => $val){
$data[] = [
'alt' => '图片名',
'pid' => $key,
'src' => build_qiniu_image_url($val),
'thumb' => build_qiniu_image_url($val)
];
}
}
$info['data'] = $data;
$this->data['info'] = $info;
return $this->show_json(SYS_CODE_SUCCESS,'保存成功');
}
}
+112
View File
@@ -0,0 +1,112 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Agent extends HD_Controller{
private $searchTpAry = array('mobile' => '客户手机号', 'name' => '客户姓名','sid' => '订单号');
public function __construct(){
parent::__construct();
$this->load->model('receiver/order/receiver_order_agents_model','order_agents_model');
$this->load->model('auto/auto_series_model');
$this->load->model('auto/auto_brand_model');
$this->load->model('auto/auto_attr_model');
}
public function index(){
$this->lists();
}
public function lists(){
$status_arr = $this->order_agents_model->get_status();
$params = $this->input->get();
$page = $params['page'] = $params['page'] ? intval($params['page']) : 1;
$size = $params['size'] = $params['size'] ? intval($params['size']) : 20;
$t1 = 'lc_receiver_order_agents';
$t2 = 'lc_receiver_orders';
$where = [
];
strlen($params['status']) && $where["$t1.status"] = $params['status'];
if ($params['title']) {
$where["{$t2}.{$params['search_tp']} like '%{$params['title']}%'"] = null;
}
//创建时间
if ($params['c_time']) {
$c_time = explode(' ~ ', $params['c_time']);
if ($c_time[0]) {
$where["{$t1}.c_time >="] = strtotime($c_time[0] . ' 00:00:00');
}
if ($c_time[1]) {
$where["{$t1}.c_time <="] = strtotime($c_time[1] . ' 23:59:59');
}
}
$count = $this->order_agents_model->count_order($where,$t2);
$lists = [];
if($count){
$fileds = "$t1.o_id,$t1.status,$t1.c_time,";
$fileds.= "$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";
$rows = $this->order_agents_model->select_order($where,"$t1.id desc",$page,$size,$fileds);
//品牌车型
$brand_arr = array_unique(array_column($rows,'brand_id'));
$brands = $this->auto_brand_model->get_map_by_ids($brand_arr,'id,name');
//车系车型
$series_arr = array_unique(array_column($rows,'s_id'));
$series = $this->auto_series_model->get_map_by_ids($series_arr,'id,name');
//获取属性
$v_arr = array_unique(array_column($rows,'v_id'));
$cor_arr = array_unique(array_column($rows,'cor_id'));
$incor_arr = array_unique(array_column($rows,'incor_id'));
$attr_arr = array_merge($v_arr,$cor_arr,$incor_arr);
$attr = $this->auto_attr_model->get_map_by_ids($attr_arr,'id,title');
foreach($rows as $key=>$val){
$val['brand_name'] = isset($brands[$val['brand_id']]) ? $brands[$val['brand_id']][0]['name'] : '';
$val['series_name'] = isset($series[$val['s_id']]) ? $series[$val['s_id']][0]['name'] : '';
$val['v_name'] = isset($attr[$val['v_id']]) ? $attr[$val['v_id']][0]['title'] : '';
$val['cor_name'] = isset($attr[$val['cor_id']]) ? $attr[$val['cor_id']][0]['title'] : '';
$val['incor_name'] = isset($attr[$val['incor_id']]) ? $attr[$val['incor_id']][0]['title'] : '';
$val['status_name'] = $status_arr[$val['status']];
$lists[] = $val;
}
}
$this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count);
$this->data['lists'] = $lists;
$this->data['params'] = $params;
$this->data['searchTpAry'] = $this->searchTpAry;
$this->data['status_arr'] = $status_arr;
$this->data['_title'] = '合同签订列表';
return $this->show_view('receiver/order/agent/lists', true);
}
public function get(){
}
//添加单条数据
public function add(){
}
//编辑单条数据
public function edit(){
}
//删除单条数据
public function del(){
}
//批量操作(默认修改状态)
public function batch(){
}
//导出数据列表
public function export(){
}
}
+112
View File
@@ -0,0 +1,112 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Bill extends HD_Controller{
private $searchTpAry = array('mobile' => '客户手机号', 'name' => '客户姓名','sid' => '订单号');
public function __construct(){
parent::__construct();
$this->load->model('receiver/order/receiver_order_bills_model','order_bills_model');
$this->load->model('auto/auto_series_model');
$this->load->model('auto/auto_brand_model');
$this->load->model('auto/auto_attr_model');
}
public function index(){
$this->lists();
}
public function lists(){
$status_arr = $this->order_bills_model->get_status();
$params = $this->input->get();
$page = $params['page'] = $params['page'] ? intval($params['page']) : 1;
$size = $params['size'] = $params['size'] ? intval($params['size']) : 20;
$t1 = 'lc_receiver_order_bills';
$t2 = 'lc_receiver_orders';
$where = [
];
strlen($params['status']) && $where["$t1.status"] = $params['status'];
if ($params['title']) {
$where["{$t2}.{$params['search_tp']} like '%{$params['title']}%'"] = null;
}
//创建时间
if ($params['c_time']) {
$c_time = explode(' ~ ', $params['c_time']);
if ($c_time[0]) {
$where["{$t1}.c_time >="] = strtotime($c_time[0] . ' 00:00:00');
}
if ($c_time[1]) {
$where["{$t1}.c_time <="] = strtotime($c_time[1] . ' 23:59:59');
}
}
$count = $this->order_bills_model->count_order($where,$t2);
$lists = [];
if($count){
$fileds = "$t1.o_id,$t1.status,$t1.c_time,";
$fileds.= "$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";
$rows = $this->order_bills_model->select_order($where,"$t1.id desc",$page,$size,$fileds);
//品牌车型
$brand_arr = array_unique(array_column($rows,'brand_id'));
$brands = $this->auto_brand_model->get_map_by_ids($brand_arr,'id,name');
//车系车型
$series_arr = array_unique(array_column($rows,'s_id'));
$series = $this->auto_series_model->get_map_by_ids($series_arr,'id,name');
//获取属性
$v_arr = array_unique(array_column($rows,'v_id'));
$cor_arr = array_unique(array_column($rows,'cor_id'));
$incor_arr = array_unique(array_column($rows,'incor_id'));
$attr_arr = array_merge($v_arr,$cor_arr,$incor_arr);
$attr = $this->auto_attr_model->get_map_by_ids($attr_arr,'id,title');
foreach($rows as $key=>$val){
$val['brand_name'] = isset($brands[$val['brand_id']]) ? $brands[$val['brand_id']][0]['name'] : '';
$val['series_name'] = isset($series[$val['s_id']]) ? $series[$val['s_id']][0]['name'] : '';
$val['v_name'] = isset($attr[$val['v_id']]) ? $attr[$val['v_id']][0]['title'] : '';
$val['cor_name'] = isset($attr[$val['cor_id']]) ? $attr[$val['cor_id']][0]['title'] : '';
$val['incor_name'] = isset($attr[$val['incor_id']]) ? $attr[$val['incor_id']][0]['title'] : '';
$val['status_name'] = $status_arr[$val['status']];
$lists[] = $val;
}
}
$this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count);
$this->data['lists'] = $lists;
$this->data['params'] = $params;
$this->data['searchTpAry'] = $this->searchTpAry;
$this->data['status_arr'] = $status_arr;
$this->data['_title'] = '合同签订列表';
return $this->show_view('receiver/order/bill/lists', true);
}
public function get(){
}
//添加单条数据
public function add(){
}
//编辑单条数据
public function edit(){
}
//删除单条数据
public function del(){
}
//批量操作(默认修改状态)
public function batch(){
}
//导出数据列表
public function export(){
}
}
+112
View File
@@ -0,0 +1,112 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Ckcar extends HD_Controller{
private $searchTpAry = array('mobile' => '客户手机号', 'name' => '客户姓名','sid' => '订单号');
public function __construct(){
parent::__construct();
$this->load->model('receiver/order/receiver_order_ckcars_model','order_ckcars_model');
$this->load->model('auto/auto_series_model');
$this->load->model('auto/auto_brand_model');
$this->load->model('auto/auto_attr_model');
}
public function index(){
$this->lists();
}
public function lists(){
$status_arr = $this->order_ckcars_model->get_status();
$params = $this->input->get();
$page = $params['page'] = $params['page'] ? intval($params['page']) : 1;
$size = $params['size'] = $params['size'] ? intval($params['size']) : 20;
$t1 = 'lc_receiver_order_ckcars';
$t2 = 'lc_receiver_orders';
$where = [
];
strlen($params['status']) && $where["$t1.status"] = $params['status'];
if ($params['title']) {
$where["{$t2}.{$params['search_tp']} like '%{$params['title']}%'"] = null;
}
//创建时间
if ($params['c_time']) {
$c_time = explode(' ~ ', $params['c_time']);
if ($c_time[0]) {
$where["{$t1}.c_time >="] = strtotime($c_time[0] . ' 00:00:00');
}
if ($c_time[1]) {
$where["{$t1}.c_time <="] = strtotime($c_time[1] . ' 23:59:59');
}
}
$count = $this->order_ckcars_model->count_order($where,$t2);
$lists = [];
if($count){
$fileds = "$t1.o_id,$t1.status,$t1.c_time,";
$fileds.= "$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";
$rows = $this->order_ckcars_model->select_order($where,"$t1.id desc",$page,$size,$fileds);
//品牌车型
$brand_arr = array_unique(array_column($rows,'brand_id'));
$brands = $this->auto_brand_model->get_map_by_ids($brand_arr,'id,name');
//车系车型
$series_arr = array_unique(array_column($rows,'s_id'));
$series = $this->auto_series_model->get_map_by_ids($series_arr,'id,name');
//获取属性
$v_arr = array_unique(array_column($rows,'v_id'));
$cor_arr = array_unique(array_column($rows,'cor_id'));
$incor_arr = array_unique(array_column($rows,'incor_id'));
$attr_arr = array_merge($v_arr,$cor_arr,$incor_arr);
$attr = $this->auto_attr_model->get_map_by_ids($attr_arr,'id,title');
foreach($rows as $key=>$val){
$val['brand_name'] = isset($brands[$val['brand_id']]) ? $brands[$val['brand_id']][0]['name'] : '';
$val['series_name'] = isset($series[$val['s_id']]) ? $series[$val['s_id']][0]['name'] : '';
$val['v_name'] = isset($attr[$val['v_id']]) ? $attr[$val['v_id']][0]['title'] : '';
$val['cor_name'] = isset($attr[$val['cor_id']]) ? $attr[$val['cor_id']][0]['title'] : '';
$val['incor_name'] = isset($attr[$val['incor_id']]) ? $attr[$val['incor_id']][0]['title'] : '';
$val['status_name'] = $status_arr[$val['status']];
$lists[] = $val;
}
}
$this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count);
$this->data['lists'] = $lists;
$this->data['params'] = $params;
$this->data['searchTpAry'] = $this->searchTpAry;
$this->data['status_arr'] = $status_arr;
$this->data['_title'] = '合同签订列表';
return $this->show_view('receiver/order/ckcar/lists', true);
}
public function get(){
}
//添加单条数据
public function add(){
}
//编辑单条数据
public function edit(){
}
//删除单条数据
public function del(){
}
//批量操作(默认修改状态)
public function batch(){
}
//导出数据列表
public function export(){
}
}
@@ -0,0 +1,112 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Delivery extends HD_Controller{
private $searchTpAry = array('mobile' => '客户手机号', 'name' => '客户姓名','sid' => '订单号');
public function __construct(){
parent::__construct();
$this->load->model('receiver/order/receiver_order_deliverys_model','order_deliverys_model');
$this->load->model('auto/auto_series_model');
$this->load->model('auto/auto_brand_model');
$this->load->model('auto/auto_attr_model');
}
public function index(){
$this->lists();
}
public function lists(){
$status_arr = $this->order_deliverys_model->get_status();
$params = $this->input->get();
$page = $params['page'] = $params['page'] ? intval($params['page']) : 1;
$size = $params['size'] = $params['size'] ? intval($params['size']) : 20;
$t1 = 'lc_receiver_order_deliverys';
$t2 = 'lc_receiver_orders';
$where = [
];
strlen($params['status']) && $where["$t1.status"] = $params['status'];
if ($params['title']) {
$where["{$t2}.{$params['search_tp']} like '%{$params['title']}%'"] = null;
}
//创建时间
if ($params['c_time']) {
$c_time = explode(' ~ ', $params['c_time']);
if ($c_time[0]) {
$where["{$t1}.c_time >="] = strtotime($c_time[0] . ' 00:00:00');
}
if ($c_time[1]) {
$where["{$t1}.c_time <="] = strtotime($c_time[1] . ' 23:59:59');
}
}
$count = $this->order_deliverys_model->count_order($where,$t2);
$lists = [];
if($count){
$fileds = "$t1.o_id,$t1.status,$t1.c_time,";
$fileds.= "$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";
$rows = $this->order_deliverys_model->select_order($where,"$t1.id desc",$page,$size,$fileds);
//品牌车型
$brand_arr = array_unique(array_column($rows,'brand_id'));
$brands = $this->auto_brand_model->get_map_by_ids($brand_arr,'id,name');
//车系车型
$series_arr = array_unique(array_column($rows,'s_id'));
$series = $this->auto_series_model->get_map_by_ids($series_arr,'id,name');
//获取属性
$v_arr = array_unique(array_column($rows,'v_id'));
$cor_arr = array_unique(array_column($rows,'cor_id'));
$incor_arr = array_unique(array_column($rows,'incor_id'));
$attr_arr = array_merge($v_arr,$cor_arr,$incor_arr);
$attr = $this->auto_attr_model->get_map_by_ids($attr_arr,'id,title');
foreach($rows as $key=>$val){
$val['brand_name'] = isset($brands[$val['brand_id']]) ? $brands[$val['brand_id']][0]['name'] : '';
$val['series_name'] = isset($series[$val['s_id']]) ? $series[$val['s_id']][0]['name'] : '';
$val['v_name'] = isset($attr[$val['v_id']]) ? $attr[$val['v_id']][0]['title'] : '';
$val['cor_name'] = isset($attr[$val['cor_id']]) ? $attr[$val['cor_id']][0]['title'] : '';
$val['incor_name'] = isset($attr[$val['incor_id']]) ? $attr[$val['incor_id']][0]['title'] : '';
$val['status_name'] = $status_arr[$val['status']];
$lists[] = $val;
}
}
$this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count);
$this->data['lists'] = $lists;
$this->data['params'] = $params;
$this->data['searchTpAry'] = $this->searchTpAry;
$this->data['status_arr'] = $status_arr;
$this->data['_title'] = '合同签订列表';
return $this->show_view('receiver/order/delivery/lists', true);
}
public function get(){
}
//添加单条数据
public function add(){
}
//编辑单条数据
public function edit(){
}
//删除单条数据
public function del(){
}
//批量操作(默认修改状态)
public function batch(){
}
//导出数据列表
public function export(){
}
}
+91
View File
@@ -0,0 +1,91 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Loan extends HD_Controller{
private $searchTpAry = array('mobile' => '客户手机号', 'name' => '客户姓名','sid' => '订单号');
public function __construct(){
parent::__construct();
$this->load->model('receiver/order/receiver_order_loans_model','order_loans_model');
}
public function index(){
$this->lists();
}
public function lists(){
$status_arr = $this->order_loans_model->get_status();
$params = $this->input->get();
$page = $params['page'] = $params['page'] ? intval($params['page']) : 1;
$size = $params['size'] = $params['size'] ? intval($params['size']) : 20;
$t1 = 'lc_receiver_order_loans';
$t2 = 'lc_receiver_orders';
$where = [
];
strlen($params['status']) && $where["$t1.status"] = $params['status'];
if ($params['title']) {
$where["{$t2}.{$params['search_tp']} like '%{$params['title']}%'"] = null;
}
//创建时间
if ($params['c_time']) {
$c_time = explode(' ~ ', $params['c_time']);
if ($c_time[0]) {
$where["{$t1}.c_time >="] = strtotime($c_time[0] . ' 00:00:00');
}
if ($c_time[1]) {
$where["{$t1}.c_time <="] = strtotime($c_time[1] . ' 23:59:59');
}
}
$count = $this->order_loans_model->count_order($where,$t2);
$lists = [];
if($count){
$fileds = "$t1.o_id,$t1.title,$t1.year,$t1.first_price,$t1.status,$t1.c_time,";
$fileds .= "$t2.id,$t2.name,$t2.mobile,$t2.sid";
$rows = $this->order_loans_model->select_order($where,"$t1.id desc",$page,$size,$fileds);
foreach($rows as $key=>$val){
$val['status_name'] = $status_arr[$val['status']];
$lists[] = $val;
}
}
$this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count);
$this->data['lists'] = $lists;
$this->data['params'] = $params;
$this->data['searchTpAry'] = $this->searchTpAry;
$this->data['status_arr'] = $status_arr;
$this->data['_title'] = '合同签订列表';
return $this->show_view('receiver/order/loan/lists', true);
}
public function get(){
}
//添加单条数据
public function add(){
}
//编辑单条数据
public function edit(){
}
//删除单条数据
public function del(){
}
//批量操作(默认修改状态)
public function batch(){
}
//导出数据列表
public function export(){
}
}
+113
View File
@@ -0,0 +1,113 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Sign extends HD_Controller{
private $searchTpAry = array('mobile' => '客户手机号', 'name' => '客户姓名','sid' => '订单号');
public function __construct(){
parent::__construct();
$this->load->model('receiver/order/receiver_order_signs_model','order_signs_model');
$this->load->model('auto/auto_series_model');
$this->load->model('auto/auto_brand_model');
$this->load->model('auto/auto_attr_model');
}
public function index(){
$this->lists();
}
public function lists(){
$status_arr = $this->order_signs_model->get_status();
$params = $this->input->get();
$page = $params['page'] = $params['page'] ? intval($params['page']) : 1;
$size = $params['size'] = $params['size'] ? intval($params['size']) : 20;
$where = [];
$t1 = 'lc_receiver_order_signs';
$t2 = 'lc_receiver_orders';
strlen($params['status']) && $where["$t1.status"] = $params['status'];
if ($params['title']) {
$where["{$t2}.{$params['search_tp']} like '%{$params['title']}%'"] = null;
}
//创建时间
if ($params['c_time']) {
$c_time = explode(' ~ ', $params['c_time']);
if ($c_time[0]) {
$where["{$t2}.c_time >="] = strtotime($c_time[0] . ' 00:00:00');
}
if ($c_time[1]) {
$where["{$t2}.c_time <="] = strtotime($c_time[1] . ' 23:59:59');
}
}
$count = $this->order_signs_model->count_order($where);
$lists = [];
if($count){
$fileds = "$t1.id,$t1.o_id,$t1.status,";
$fileds.= "$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";
$rows = $this->order_signs_model->select_order($where,"$t1.id desc",$page,$size,$fileds);
//品牌车型
$brand_arr = array_unique(array_column($rows,'brand_id'));
$brands = $this->auto_brand_model->get_map_by_ids($brand_arr,'id,name');
//车系车型
$series_arr = array_unique(array_column($rows,'s_id'));
$series = $this->auto_series_model->get_map_by_ids($series_arr,'id,name');
//获取属性
$v_arr = array_unique(array_column($rows,'v_id'));
$cor_arr = array_unique(array_column($rows,'cor_id'));
$incor_arr = array_unique(array_column($rows,'incor_id'));
$attr_arr = array_merge($v_arr,$cor_arr,$incor_arr);
$attr = $this->auto_attr_model->get_map_by_ids($attr_arr,'id,title');
foreach($rows as $key=>$val){
$val['brand_name'] = isset($brands[$val['brand_id']]) ? $brands[$val['brand_id']][0]['name'] : '';
$val['series_name'] = isset($series[$val['s_id']]) ? $series[$val['s_id']][0]['name'] : '';
$val['v_name'] = isset($attr[$val['v_id']]) ? $attr[$val['v_id']][0]['title'] : '';
$val['cor_name'] = isset($attr[$val['cor_id']]) ? $attr[$val['cor_id']][0]['title'] : '';
$val['incor_name'] = isset($attr[$val['incor_id']]) ? $attr[$val['incor_id']][0]['title'] : '';
$val['status_name'] = $status_arr[$val['status']];
$lists[] = $val;
}
}
$this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count);
$this->data['lists'] = $lists;
$this->data['params'] = $params;
$this->data['searchTpAry'] = $this->searchTpAry;
$this->data['status_arr'] = $status_arr;
$this->data['_title'] = '合同签订列表';
return $this->show_view('receiver/order/sign/lists', true);
}
public function get(){
}
//添加单条数据
public function add(){
}
//编辑单条数据
public function edit(){
}
//删除单条数据
public function del(){
}
//批量操作(默认修改状态)
public function batch(){
}
//导出数据列表
public function export(){
}
}
+8 -11
View File
@@ -43,19 +43,20 @@
</select>
</div>
</div>
<div class="am-form-group" v-if="info.position==2">
<label class="am-para-label">类型:</label>
<div class="am-para-input" style="margin-top: 5px;">
<span class="mr10">车型<input type="radio" name="type" v-model='info.type' value="2" @change="change_type"/></span>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">链接:</label>
<div class="am-para-input wp60">
<input type="text" placeholder="输入链接" v-model="info.link" name="link"/>
</div>
</div>
<div v-if="info.type == 2">
<div class="am-form-group" v-if="info.position == 2">
<label class="am-para-label">按钮颜色:</label>
<div class="am-para-input pt5">
<input type="radio" name="btn_type" v-model="info.btn_type" value="1"/>深色
<input type="radio" name="btn_type" v-model="info.btn_type" value="2"/>浅色
</div>
</div>
<div v-if="info.position == 2">
<v-cars-select :target_id.sync="info.target_id" :app_id="app_id"></v-cars-select>
</div>
<div class="am-form-group">
@@ -333,10 +334,6 @@
that.app_id = <?=$app_id?>;
},
methods: {
change_type: function () {
var vm = this;
vm.info.target_id = 0;
},
saveEdit: function () {
if (loading) {
return;
+11 -1
View File
@@ -1,5 +1,5 @@
<form id="vue-app" class="am-form am-form-horizontal" action="/app/licheb/member/<?=$row['id'] ? 'edit' : 'add'?>" data-auto="true" method="post" style="width: 90%;padding-top: 10px">
<input type="hidden" name="id" v-model="info.id"/>
<input type="hidden" name="id" value="<?=$row['id']?>"/>
<div class="am-form-group">
<label class="am-para-label">姓名:</label>
<div class="am-para-input w300">
@@ -22,6 +22,16 @@
</select>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">门店:</label>
<div class="am-para-input w300">
<select name="biz_id">
<?foreach($bizs as $key=>$val){?>
<option value="<?=$val['id']?>" <?=$val['id']==$row['biz_id']?'selected':''?>><?=$val['biz_name']?></option>
<?}?>
</select>
</div>
</div>
<div class="am-form-group" style="margin-bottom: 2rem">
<div class="am-para-input"><button class="am-btn am-btn-success" type="submit">提交</button></div>
+7 -2
View File
@@ -27,10 +27,10 @@
<thead>
<tr>
<th width="10%"><span>ID</span></th>
<th width="20%"><span>昵称</span></th>
<th width="20%"><span>姓名</span></th>
<th width="20%"><span>手机号码</span></th>
<th width="20%"><span>角色</span></th>
<th width="20%"><span>门店</span></th>
<th width="20%"><span>创建时间</span></th>
</tr>
</thead>
@@ -38,12 +38,17 @@
<?php foreach ($lists as $v) { ?>
<tr>
<td><?= $v['id'] ?></td>
<td><?= $v['nickname'] ?></td>
<td><?= $v['uname'] ?></td>
<td><?= $v['mobile'] ?></td>
<td><?= $v['group_name']?></td>
<td><?= $v['biz_name']?></td>
<td><?= date('Y-m-d H:i:s',$v['c_time']) ?></td>
</tr>
<tr>
<td colspan="6" class="align-r">
<a data-modal="/app/licheb/member/get?id=<?=$v['id']?>" class="am-btn am-btn-primary am-btn-xs">修改</a>
</td>
</tr>
<?php } ?>
</tbody>
</table>
+5 -5
View File
@@ -1,12 +1,12 @@
<form class="am-form am-form-horizontal ptb20 pr20 mt10" data-auto="true" method="post" style="padding-top: 10px;padding-bottom: 10px;"
action="/receiver/clues/edit_adviser" id="edit-form">
<div class="am-form-group">
<label class="am-para-label">销售</label>
<label class="am-para-label">门店</label>
<div class="am-para-input w300">
<select name="admin_id">
<option value="">请选择销售</option>
<?php foreach ($adminList as $key => $value) { ?>
<option value="<?= $value['id'] ?>"><?= $value['uname'] ?></option>
<select name="biz_id">
<option value="">请选择门店</option>
<?php foreach ($bizList as $key => $value) { ?>
<option value="<?= $value['id'] ?>"><?= $value['biz_name'] ?></option>
<? } ?>
</select>
</div>
+8 -1
View File
@@ -1,9 +1,16 @@
<link rel="stylesheet" type="text/css" href="/static/css/font-awesome.min.css?v=1581252500">
<div class="bs-example bs-example-tabs" data-example-id="togglable-tabs" style="font-size:15px;">
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="<?= $params['status_pid'] == -99 ? 'active' : '' ?>">
<li role="presentation" class="<?=!strlen($params['status'])?'active':'' ?>">
<a href="javascript:void (0);" data-open="/receiver/clues">全部</a>
</li>
<?foreach($status_arr as $key=>$val){?>
<li role="presentation" class="<?=strlen($params['status']) && $params['status']==$key?'active':''?>">
<a href="javascript:void (0);" data-open="/receiver/clues?status=<?=$key?>">
<?=$val?>
</a>
</li>
<?}?>
</ul>
</div>
+149
View File
@@ -0,0 +1,149 @@
<link rel="stylesheet" type="text/css" href="/static/css/font-awesome.min.css?v=1581252500">
<div class="bs-example bs-example-tabs" data-example-id="togglable-tabs" style="font-size:15px;">
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="<?=!strlen($params['status'])?'active':'' ?>">
<a href="javascript:void (0);" data-open="/receiver/order/agent">全部</a>
</li>
<?foreach($status_arr as $key=>$val){?>
<li role="presentation" class="<?=strlen($params['status']) && $params['status']==$key?'active':''?>">
<a href="javascript:void (0);" data-open="/receiver/order/agent?status=<?=$key?>">
<?=$val?>
</a>
</li>
<?}?>
</ul>
</div>
<div class="coms-table-wrap mt10">
<form class="form-search coms-table-hd clearfix no-border" onsubmit="return false"
action="/receiver/order/agent">
<input type="hidden" name="status_pid" value="<?= $params['status_pid'] != -99 ? $params['status_pid'] : '' ?>">
<input type="hidden" name="status_id" value="<?= $params['status_id'] ?>">
<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 w100">
<select name="search_tp">
<?php foreach ($searchTpAry as $key => $value) { ?>
<option value="<?= $key ?>"
<?= $key == $params['search_tp'] ? 'selected' : '' ?>><?= $value ?></option>
<? } ?>
</select>
</div>
</div>
<div class="am-form-group fl">
<div class="am-para-inline w260">
<input id="title" name="title" type="text" value="<?= $params['title'] ?>"/>
</div>
</div>
<div class="am-form-group fl">
<div class="am-form-group" style="margin-bottom: 0px;"></div>
<label class="am-para-label w100">创建时间:</label>
<div class="am-form-group fl">
<div class="am-para-inline w300">
<input id="id-create-time" name="c_time" type="text" value="<?= $params['c_time'] ?>"
placeholder="创建时间范围" autocomplete="off"/>
</div>
<div class="am-para-inline" style="padding-top: 5px;">
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="today">今天</a>
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="yesterday">昨日</a>
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="7day">最近7天</a>
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="30day">最近30天</a>
</div>
</div>
</div>
<div class="am-form-group" style="margin-bottom: 0px;"></div>
<div class="am-form-group fl" style="margin-bottom: 0px;">
<div class="am-form-group fl ml10">
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
</div>
</div>
</div>
</form>
<div class="coms-table-bd">
<div class="am-form-group fr mr10">
<span>共<?= intval($pager['totle']) ?>个客户</span>
</div>
<table class="am-table am-table-bordered">
<thead>
<tr>
<th width="5%"><span>客户姓名</span></th>
<th width="9%"><span>客户电话</span></th>
<th width="5%"><span>品牌</span></th>
<th width="5%"><span>车型</span></th>
<th width="5%"><span>车身颜色</span></th>
<th width="5%"><span>内饰颜色</span></th>
<th width="5%"><span>车辆指导价</span></th>
<th width="5%"><span>定金</span></th>
<th width="5%"><span>付款方式</span></th>
<th width="5%"><span>状态</span></th>
</tr>
</thead>
<tbody>
<?php if ($lists) {
foreach ($lists as $v) { ?>
<tr>
<td colspan="10" align="left">
订单号:<?=$v['sid']?>
</td>
</tr>
<tr>
<td><?= $v['name'] ?></td>
<td><?= $v['mobile'] ?></td>
<td><?= $v['brand_name'].$v['series_name'] ?></td>
<td><?= $v['v_name'] ?></td>
<td><?= $v['cor_name'] ?></td>
<td><?= $v['incor_name'] ?></td>
<td><?= number_format($v['price'],2) ?></td>
<td><?= number_format($v['deposit'],2) ?></td>
<td><?= $v['payway']?'全款':'贷款' ?></td>
<td><?= $v['status_name'] ?></td>
</tr>
<tr>
<td colspan="10" align="right">
<a href="javascript:;" data-open="/receiver/orders/get?id=<?=$v['o_id']?>" class="am-btn am-btn-primary am-btn-xs">查看详情</a>
</td>
</tr>
<?php }
} ?>
</tbody>
</table>
</div>
<div class="coms-table-ft clearfix">
<div class="hander am-form">
</div>
<div class="coms-pagination fr mr20">
<?php page_view($pager) ?>
</div>
</div>
</div>
<script>
require(['laydate', 'autocomplete'], function (laydate) {
laydate.render({
elem: '#id-create-time', range: '~'
});
$('.id-day-btn').click(function () {
var type = $(this).data('date'), date = '', d_obj = new Date();
switch (type) {
case 'today':
date = d_obj.Format('yyyy-MM-dd');
date = date + ' ~ ' + date;
break;
case 'yesterday':
date = (new Date(d_obj.getTime() - 86400000)).Format('yyyy-MM-dd');
date = date + ' ~ ' + date;
break;
case '7day':
date = (new Date(d_obj.getTime() - 86400000 * 7)).Format('yyyy-MM-dd') + ' ~ ' + d_obj.Format('yyyy-MM-dd');
break;
case '30day':
date = (new Date(d_obj.getTime() - 86400000 * 30)).Format('yyyy-MM-dd') + ' ~ ' + d_obj.Format('yyyy-MM-dd');
break;
}
$('#id-create-time').val(date);
});
});
</script>
+149
View File
@@ -0,0 +1,149 @@
<link rel="stylesheet" type="text/css" href="/static/css/font-awesome.min.css?v=1581252500">
<div class="bs-example bs-example-tabs" data-example-id="togglable-tabs" style="font-size:15px;">
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="<?=!strlen($params['status'])?'active':'' ?>">
<a href="javascript:void (0);" data-open="/receiver/order/bill">全部</a>
</li>
<?foreach($status_arr as $key=>$val){?>
<li role="presentation" class="<?=strlen($params['status']) && $params['status']==$key?'active':''?>">
<a href="javascript:void (0);" data-open="/receiver/order/bill?status=<?=$key?>">
<?=$val?>
</a>
</li>
<?}?>
</ul>
</div>
<div class="coms-table-wrap mt10">
<form class="form-search coms-table-hd clearfix no-border" onsubmit="return false"
action="/receiver/order/bill">
<input type="hidden" name="status_pid" value="<?= $params['status_pid'] != -99 ? $params['status_pid'] : '' ?>">
<input type="hidden" name="status_id" value="<?= $params['status_id'] ?>">
<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 w100">
<select name="search_tp">
<?php foreach ($searchTpAry as $key => $value) { ?>
<option value="<?= $key ?>"
<?= $key == $params['search_tp'] ? 'selected' : '' ?>><?= $value ?></option>
<? } ?>
</select>
</div>
</div>
<div class="am-form-group fl">
<div class="am-para-inline w260">
<input id="title" name="title" type="text" value="<?= $params['title'] ?>"/>
</div>
</div>
<div class="am-form-group fl">
<div class="am-form-group" style="margin-bottom: 0px;"></div>
<label class="am-para-label w100">创建时间:</label>
<div class="am-form-group fl">
<div class="am-para-inline w300">
<input id="id-create-time" name="c_time" type="text" value="<?= $params['c_time'] ?>"
placeholder="创建时间范围" autocomplete="off"/>
</div>
<div class="am-para-inline" style="padding-top: 5px;">
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="today">今天</a>
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="yesterday">昨日</a>
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="7day">最近7天</a>
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="30day">最近30天</a>
</div>
</div>
</div>
<div class="am-form-group" style="margin-bottom: 0px;"></div>
<div class="am-form-group fl" style="margin-bottom: 0px;">
<div class="am-form-group fl ml10">
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
</div>
</div>
</div>
</form>
<div class="coms-table-bd">
<div class="am-form-group fr mr10">
<span>共<?= intval($pager['totle']) ?>个客户</span>
</div>
<table class="am-table am-table-bordered">
<thead>
<tr>
<th width="5%"><span>客户姓名</span></th>
<th width="9%"><span>客户电话</span></th>
<th width="5%"><span>品牌</span></th>
<th width="5%"><span>车型</span></th>
<th width="5%"><span>车身颜色</span></th>
<th width="5%"><span>内饰颜色</span></th>
<th width="5%"><span>车辆指导价</span></th>
<th width="5%"><span>定金</span></th>
<th width="5%"><span>付款方式</span></th>
<th width="5%"><span>状态</span></th>
</tr>
</thead>
<tbody>
<?php if ($lists) {
foreach ($lists as $v) { ?>
<tr>
<td colspan="10" align="left">
订单号:<?=$v['sid']?>
</td>
</tr>
<tr>
<td><?= $v['name'] ?></td>
<td><?= $v['mobile'] ?></td>
<td><?= $v['brand_name'].$v['series_name'] ?></td>
<td><?= $v['v_name'] ?></td>
<td><?= $v['cor_name'] ?></td>
<td><?= $v['incor_name'] ?></td>
<td><?= number_format($v['price'],2) ?></td>
<td><?= number_format($v['deposit'],2) ?></td>
<td><?= $v['payway']?'全款':'贷款' ?></td>
<td><?= $v['status_name'] ?></td>
</tr>
<tr>
<td colspan="10" align="right">
<a href="javascript:;" data-open="/receiver/orders/get?id=<?=$v['o_id']?>" class="am-btn am-btn-primary am-btn-xs">查看详情</a>
</td>
</tr>
<?php }
} ?>
</tbody>
</table>
</div>
<div class="coms-table-ft clearfix">
<div class="hander am-form">
</div>
<div class="coms-pagination fr mr20">
<?php page_view($pager) ?>
</div>
</div>
</div>
<script>
require(['laydate', 'autocomplete'], function (laydate) {
laydate.render({
elem: '#id-create-time', range: '~'
});
$('.id-day-btn').click(function () {
var type = $(this).data('date'), date = '', d_obj = new Date();
switch (type) {
case 'today':
date = d_obj.Format('yyyy-MM-dd');
date = date + ' ~ ' + date;
break;
case 'yesterday':
date = (new Date(d_obj.getTime() - 86400000)).Format('yyyy-MM-dd');
date = date + ' ~ ' + date;
break;
case '7day':
date = (new Date(d_obj.getTime() - 86400000 * 7)).Format('yyyy-MM-dd') + ' ~ ' + d_obj.Format('yyyy-MM-dd');
break;
case '30day':
date = (new Date(d_obj.getTime() - 86400000 * 30)).Format('yyyy-MM-dd') + ' ~ ' + d_obj.Format('yyyy-MM-dd');
break;
}
$('#id-create-time').val(date);
});
});
</script>
+149
View File
@@ -0,0 +1,149 @@
<link rel="stylesheet" type="text/css" href="/static/css/font-awesome.min.css?v=1581252500">
<div class="bs-example bs-example-tabs" data-example-id="togglable-tabs" style="font-size:15px;">
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="<?=!strlen($params['status'])?'active':'' ?>">
<a href="javascript:void (0);" data-open="/receiver/order/ckcar">全部</a>
</li>
<?foreach($status_arr as $key=>$val){?>
<li role="presentation" class="<?=strlen($params['status']) && $params['status']==$key?'active':''?>">
<a href="javascript:void (0);" data-open="/receiver/order/ckcar?status=<?=$key?>">
<?=$val?>
</a>
</li>
<?}?>
</ul>
</div>
<div class="coms-table-wrap mt10">
<form class="form-search coms-table-hd clearfix no-border" onsubmit="return false"
action="/receiver/order/ckcar">
<input type="hidden" name="status_pid" value="<?= $params['status_pid'] != -99 ? $params['status_pid'] : '' ?>">
<input type="hidden" name="status_id" value="<?= $params['status_id'] ?>">
<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 w100">
<select name="search_tp">
<?php foreach ($searchTpAry as $key => $value) { ?>
<option value="<?= $key ?>"
<?= $key == $params['search_tp'] ? 'selected' : '' ?>><?= $value ?></option>
<? } ?>
</select>
</div>
</div>
<div class="am-form-group fl">
<div class="am-para-inline w260">
<input id="title" name="title" type="text" value="<?= $params['title'] ?>"/>
</div>
</div>
<div class="am-form-group fl">
<div class="am-form-group" style="margin-bottom: 0px;"></div>
<label class="am-para-label w100">创建时间:</label>
<div class="am-form-group fl">
<div class="am-para-inline w300">
<input id="id-create-time" name="c_time" type="text" value="<?= $params['c_time'] ?>"
placeholder="创建时间范围" autocomplete="off"/>
</div>
<div class="am-para-inline" style="padding-top: 5px;">
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="today">今天</a>
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="yesterday">昨日</a>
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="7day">最近7天</a>
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="30day">最近30天</a>
</div>
</div>
</div>
<div class="am-form-group" style="margin-bottom: 0px;"></div>
<div class="am-form-group fl" style="margin-bottom: 0px;">
<div class="am-form-group fl ml10">
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
</div>
</div>
</div>
</form>
<div class="coms-table-bd">
<div class="am-form-group fr mr10">
<span>共<?= intval($pager['totle']) ?>个客户</span>
</div>
<table class="am-table am-table-bordered">
<thead>
<tr>
<th width="5%"><span>客户姓名</span></th>
<th width="9%"><span>客户电话</span></th>
<th width="5%"><span>品牌</span></th>
<th width="5%"><span>车型</span></th>
<th width="5%"><span>车身颜色</span></th>
<th width="5%"><span>内饰颜色</span></th>
<th width="5%"><span>车辆指导价</span></th>
<th width="5%"><span>定金</span></th>
<th width="5%"><span>付款方式</span></th>
<th width="5%"><span>状态</span></th>
</tr>
</thead>
<tbody>
<?php if ($lists) {
foreach ($lists as $v) { ?>
<tr>
<td colspan="10" align="left">
订单号:<?=$v['sid']?>
</td>
</tr>
<tr>
<td><?= $v['name'] ?></td>
<td><?= $v['mobile'] ?></td>
<td><?= $v['brand_name'].$v['series_name'] ?></td>
<td><?= $v['v_name'] ?></td>
<td><?= $v['cor_name'] ?></td>
<td><?= $v['incor_name'] ?></td>
<td><?= number_format($v['price'],2) ?></td>
<td><?= number_format($v['deposit'],2) ?></td>
<td><?= $v['payway']?'全款':'贷款' ?></td>
<td><?= $v['status_name'] ?></td>
</tr>
<tr>
<td colspan="10" align="right">
<a href="javascript:;" data-open="/receiver/orders/get?id=<?=$v['o_id']?>" class="am-btn am-btn-primary am-btn-xs">查看详情</a>
</td>
</tr>
<?php }
} ?>
</tbody>
</table>
</div>
<div class="coms-table-ft clearfix">
<div class="hander am-form">
</div>
<div class="coms-pagination fr mr20">
<?php page_view($pager) ?>
</div>
</div>
</div>
<script>
require(['laydate', 'autocomplete'], function (laydate) {
laydate.render({
elem: '#id-create-time', range: '~'
});
$('.id-day-btn').click(function () {
var type = $(this).data('date'), date = '', d_obj = new Date();
switch (type) {
case 'today':
date = d_obj.Format('yyyy-MM-dd');
date = date + ' ~ ' + date;
break;
case 'yesterday':
date = (new Date(d_obj.getTime() - 86400000)).Format('yyyy-MM-dd');
date = date + ' ~ ' + date;
break;
case '7day':
date = (new Date(d_obj.getTime() - 86400000 * 7)).Format('yyyy-MM-dd') + ' ~ ' + d_obj.Format('yyyy-MM-dd');
break;
case '30day':
date = (new Date(d_obj.getTime() - 86400000 * 30)).Format('yyyy-MM-dd') + ' ~ ' + d_obj.Format('yyyy-MM-dd');
break;
}
$('#id-create-time').val(date);
});
});
</script>
@@ -0,0 +1,149 @@
<link rel="stylesheet" type="text/css" href="/static/css/font-awesome.min.css?v=1581252500">
<div class="bs-example bs-example-tabs" data-example-id="togglable-tabs" style="font-size:15px;">
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="<?=!strlen($params['status'])?'active':'' ?>">
<a href="javascript:void (0);" data-open="/receiver/order/delivery">全部</a>
</li>
<?foreach($status_arr as $key=>$val){?>
<li role="presentation" class="<?=strlen($params['status']) && $params['status']==$key?'active':''?>">
<a href="javascript:void (0);" data-open="/receiver/order/delivery?status=<?=$key?>">
<?=$val?>
</a>
</li>
<?}?>
</ul>
</div>
<div class="coms-table-wrap mt10">
<form class="form-search coms-table-hd clearfix no-border" onsubmit="return false"
action="/receiver/order/delivery">
<input type="hidden" name="status_pid" value="<?= $params['status_pid'] != -99 ? $params['status_pid'] : '' ?>">
<input type="hidden" name="status_id" value="<?= $params['status_id'] ?>">
<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 w100">
<select name="search_tp">
<?php foreach ($searchTpAry as $key => $value) { ?>
<option value="<?= $key ?>"
<?= $key == $params['search_tp'] ? 'selected' : '' ?>><?= $value ?></option>
<? } ?>
</select>
</div>
</div>
<div class="am-form-group fl">
<div class="am-para-inline w260">
<input id="title" name="title" type="text" value="<?= $params['title'] ?>"/>
</div>
</div>
<div class="am-form-group fl">
<div class="am-form-group" style="margin-bottom: 0px;"></div>
<label class="am-para-label w100">创建时间:</label>
<div class="am-form-group fl">
<div class="am-para-inline w300">
<input id="id-create-time" name="c_time" type="text" value="<?= $params['c_time'] ?>"
placeholder="创建时间范围" autocomplete="off"/>
</div>
<div class="am-para-inline" style="padding-top: 5px;">
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="today">今天</a>
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="yesterday">昨日</a>
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="7day">最近7天</a>
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="30day">最近30天</a>
</div>
</div>
</div>
<div class="am-form-group" style="margin-bottom: 0px;"></div>
<div class="am-form-group fl" style="margin-bottom: 0px;">
<div class="am-form-group fl ml10">
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
</div>
</div>
</div>
</form>
<div class="coms-table-bd">
<div class="am-form-group fr mr10">
<span>共<?= intval($pager['totle']) ?>个客户</span>
</div>
<table class="am-table am-table-bordered">
<thead>
<tr>
<th width="5%"><span>客户姓名</span></th>
<th width="9%"><span>客户电话</span></th>
<th width="5%"><span>品牌</span></th>
<th width="5%"><span>车型</span></th>
<th width="5%"><span>车身颜色</span></th>
<th width="5%"><span>内饰颜色</span></th>
<th width="5%"><span>车辆指导价</span></th>
<th width="5%"><span>定金</span></th>
<th width="5%"><span>付款方式</span></th>
<th width="5%"><span>状态</span></th>
</tr>
</thead>
<tbody>
<?php if ($lists) {
foreach ($lists as $v) { ?>
<tr>
<td colspan="10" align="left">
订单号:<?=$v['sid']?>
</td>
</tr>
<tr>
<td><?= $v['name'] ?></td>
<td><?= $v['mobile'] ?></td>
<td><?= $v['brand_name'].$v['series_name'] ?></td>
<td><?= $v['v_name'] ?></td>
<td><?= $v['cor_name'] ?></td>
<td><?= $v['incor_name'] ?></td>
<td><?= number_format($v['price'],2) ?></td>
<td><?= number_format($v['deposit'],2) ?></td>
<td><?= $v['payway']?'全款':'贷款' ?></td>
<td><?= $v['status_name'] ?></td>
</tr>
<tr>
<td colspan="10" align="right">
<a href="javascript:;" data-open="/receiver/orders/get?id=<?=$v['o_id']?>" class="am-btn am-btn-primary am-btn-xs">查看详情</a>
</td>
</tr>
<?php }
} ?>
</tbody>
</table>
</div>
<div class="coms-table-ft clearfix">
<div class="hander am-form">
</div>
<div class="coms-pagination fr mr20">
<?php page_view($pager) ?>
</div>
</div>
</div>
<script>
require(['laydate', 'autocomplete'], function (laydate) {
laydate.render({
elem: '#id-create-time', range: '~'
});
$('.id-day-btn').click(function () {
var type = $(this).data('date'), date = '', d_obj = new Date();
switch (type) {
case 'today':
date = d_obj.Format('yyyy-MM-dd');
date = date + ' ~ ' + date;
break;
case 'yesterday':
date = (new Date(d_obj.getTime() - 86400000)).Format('yyyy-MM-dd');
date = date + ' ~ ' + date;
break;
case '7day':
date = (new Date(d_obj.getTime() - 86400000 * 7)).Format('yyyy-MM-dd') + ' ~ ' + d_obj.Format('yyyy-MM-dd');
break;
case '30day':
date = (new Date(d_obj.getTime() - 86400000 * 30)).Format('yyyy-MM-dd') + ' ~ ' + d_obj.Format('yyyy-MM-dd');
break;
}
$('#id-create-time').val(date);
});
});
</script>
+143
View File
@@ -0,0 +1,143 @@
<link rel="stylesheet" type="text/css" href="/static/css/font-awesome.min.css?v=1581252500">
<div class="bs-example bs-example-tabs" data-example-id="togglable-tabs" style="font-size:15px;">
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="<?=!strlen($params['status'])?'active':'' ?>">
<a href="javascript:void (0);" data-open="/receiver/order/loan">全部</a>
</li>
<?foreach($status_arr as $key=>$val){?>
<li role="presentation" class="<?=strlen($params['status']) && $params['status']==$key?'active':''?>">
<a href="javascript:void (0);" data-open="/receiver/order/loan?status=<?=$key?>">
<?=$val?>
</a>
</li>
<?}?>
</ul>
</div>
<div class="coms-table-wrap mt10">
<form class="form-search coms-table-hd clearfix no-border" onsubmit="return false"
action="/receiver/order/loan">
<input type="hidden" name="status_pid" value="<?= $params['status_pid'] != -99 ? $params['status_pid'] : '' ?>">
<input type="hidden" name="status_id" value="<?= $params['status_id'] ?>">
<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 w100">
<select name="search_tp">
<?php foreach ($searchTpAry as $key => $value) { ?>
<option value="<?= $key ?>"
<?= $key == $params['search_tp'] ? 'selected' : '' ?>><?= $value ?></option>
<? } ?>
</select>
</div>
</div>
<div class="am-form-group fl">
<div class="am-para-inline w260">
<input id="title" name="title" type="text" value="<?= $params['title'] ?>"/>
</div>
</div>
<div class="am-form-group fl">
<div class="am-form-group" style="margin-bottom: 0px;"></div>
<label class="am-para-label w100">创建时间:</label>
<div class="am-form-group fl">
<div class="am-para-inline w300">
<input id="id-create-time" name="c_time" type="text" value="<?= $params['c_time'] ?>"
placeholder="创建时间范围" autocomplete="off"/>
</div>
<div class="am-para-inline" style="padding-top: 5px;">
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="today">今天</a>
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="yesterday">昨日</a>
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="7day">最近7天</a>
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="30day">最近30天</a>
</div>
</div>
</div>
<div class="am-form-group" style="margin-bottom: 0px;"></div>
<div class="am-form-group fl" style="margin-bottom: 0px;">
<div class="am-form-group fl ml10">
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
</div>
</div>
</div>
</form>
<div class="coms-table-bd">
<div class="am-form-group fr mr10">
<span>共<?= intval($pager['totle']) ?>个客户</span>
</div>
<table class="am-table am-table-bordered">
<thead>
<tr>
<th width="5%"><span>客户姓名</span></th>
<th width="9%"><span>客户电话</span></th>
<th width="5%"><span>分期产品</span></th>
<th width="5%"><span>年限</span></th>
<th width="5%"><span>首付金额</span></th>
<th width="9%"><span>分期时间</span></th>
<th width="5%"><span>状态</span></th>
</tr>
</thead>
<tbody>
<?php if ($lists) {
foreach ($lists as $v) { ?>
<tr>
<td colspan="7" align="left">
订单号:<?=$v['sid']?>
</td>
</tr>
<tr>
<td><?= $v['name'] ?></td>
<td><?= $v['mobile'] ?></td>
<td><?= $v['title'] ?></td>
<td><?= $v['year'] ?></td>
<td><?= number_format($v['first_price'],2) ?></td>
<td><?= date('Y-m-d H:i:s',$v['c_time']) ?></td>
<td><?= $v['status_name'] ?></td>
</tr>
<tr>
<td colspan="7" align="right">
<a href="javascript:;" data-open="/receiver/orders/get?id=<?=$v['o_id']?>" class="am-btn am-btn-primary am-btn-xs">查看详情</a>
</td>
</tr>
<?php }
} ?>
</tbody>
</table>
</div>
<div class="coms-table-ft clearfix">
<div class="hander am-form">
</div>
<div class="coms-pagination fr mr20">
<?php page_view($pager) ?>
</div>
</div>
</div>
<script>
require(['laydate', 'autocomplete'], function (laydate) {
laydate.render({
elem: '#id-create-time', range: '~'
});
$('.id-day-btn').click(function () {
var type = $(this).data('date'), date = '', d_obj = new Date();
switch (type) {
case 'today':
date = d_obj.Format('yyyy-MM-dd');
date = date + ' ~ ' + date;
break;
case 'yesterday':
date = (new Date(d_obj.getTime() - 86400000)).Format('yyyy-MM-dd');
date = date + ' ~ ' + date;
break;
case '7day':
date = (new Date(d_obj.getTime() - 86400000 * 7)).Format('yyyy-MM-dd') + ' ~ ' + d_obj.Format('yyyy-MM-dd');
break;
case '30day':
date = (new Date(d_obj.getTime() - 86400000 * 30)).Format('yyyy-MM-dd') + ' ~ ' + d_obj.Format('yyyy-MM-dd');
break;
}
$('#id-create-time').val(date);
});
});
</script>
+151
View File
@@ -0,0 +1,151 @@
<link rel="stylesheet" type="text/css" href="/static/css/font-awesome.min.css?v=1581252500">
<div class="bs-example bs-example-tabs" data-example-id="togglable-tabs" style="font-size:15px;">
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="<?=!strlen($params['status'])?'active':'' ?>">
<a href="javascript:void (0);" data-open="/receiver/order/sign">全部</a>
</li>
<?foreach($status_arr as $key=>$val){?>
<li role="presentation" class="<?=strlen($params['status']) && $params['status']==$key?'active':''?>">
<a href="javascript:void (0);" data-open="/receiver/order/sign?status=<?=$key?>">
<?=$val?>
</a>
</li>
<?}?>
</ul>
</div>
<div class="coms-table-wrap mt10">
<form class="form-search coms-table-hd clearfix no-border" onsubmit="return false"
action="/receiver/order/sign">
<input type="hidden" name="status_pid" value="<?= $params['status_pid'] != -99 ? $params['status_pid'] : '' ?>">
<input type="hidden" name="status_id" value="<?= $params['status_id'] ?>">
<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 w100">
<select name="search_tp">
<?php foreach ($searchTpAry as $key => $value) { ?>
<option value="<?= $key ?>"
<?= $key == $params['search_tp'] ? 'selected' : '' ?>><?= $value ?></option>
<? } ?>
</select>
</div>
</div>
<div class="am-form-group fl">
<div class="am-para-inline w260">
<input id="title" name="title" type="text" value="<?= $params['title'] ?>"/>
</div>
</div>
<div class="am-form-group fl">
<div class="am-form-group" style="margin-bottom: 0px;"></div>
<label class="am-para-label w100">创建时间:</label>
<div class="am-form-group fl">
<div class="am-para-inline w300">
<input id="id-create-time" name="c_time" type="text" value="<?= $params['c_time'] ?>"
placeholder="创建时间范围" autocomplete="off"/>
</div>
<div class="am-para-inline" style="padding-top: 5px;">
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="today">今天</a>
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="yesterday">昨日</a>
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="7day">最近7天</a>
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="30day">最近30天</a>
</div>
</div>
</div>
<div class="am-form-group" style="margin-bottom: 0px;"></div>
<div class="am-form-group fl" style="margin-bottom: 0px;">
<div class="am-form-group fl ml10">
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
</div>
</div>
</div>
</form>
<div class="coms-table-bd">
<div class="am-form-group fr mr10">
<span>共<?= intval($pager['totle']) ?>个客户</span>
</div>
<table class="am-table am-table-bordered">
<thead>
<tr>
<th width="5%"><span>客户姓名</span></th>
<th width="9%"><span>客户电话</span></th>
<th width="5%"><span>品牌</span></th>
<th width="5%"><span>车型</span></th>
<th width="5%"><span>车身颜色</span></th>
<th width="5%"><span>内饰颜色</span></th>
<th width="5%"><span>车辆指导价</span></th>
<th width="5%"><span>定金</span></th>
<th width="5%"><span>付款方式</span></th>
<th width="9%"><span>合同状态</span></th>
<th width="9%"><span>订单时间</span></th>
</tr>
</thead>
<tbody>
<?php if ($lists) {
foreach ($lists as $v) { ?>
<tr>
<td colspan="11" align="left">
订单号:<?=$v['sid']?>
</td>
</tr>
<tr>
<td><?= $v['name'] ?></td>
<td><?= $v['mobile'] ?></td>
<td><?= $v['brand_name'].$v['series_name'] ?></td>
<td><?= $v['v_name'] ?></td>
<td><?= $v['cor_name'] ?></td>
<td><?= $v['incor_name'] ?></td>
<td><?= number_format($v['price'],2) ?></td>
<td><?= number_format($v['deposit'],2) ?></td>
<td><?= $v['payway']?'全款':'贷款' ?></td>
<td><?= $v['status_name'] ?></td>
<td><?= date('Y-m-d H:i:s',$v['c_time']) ?></td>
</tr>
<tr>
<td colspan="11" align="right">
<a href="javascript:;" data-open="/receiver/orders/get?id=<?=$v['o_id']?>" class="am-btn am-btn-primary am-btn-xs">查看详情</a>
</td>
</tr>
<?php }
} ?>
</tbody>
</table>
</div>
<div class="coms-table-ft clearfix">
<div class="hander am-form">
</div>
<div class="coms-pagination fr mr20">
<?php page_view($pager) ?>
</div>
</div>
</div>
<script>
require(['laydate', 'autocomplete'], function (laydate) {
laydate.render({
elem: '#id-create-time', range: '~'
});
$('.id-day-btn').click(function () {
var type = $(this).data('date'), date = '', d_obj = new Date();
switch (type) {
case 'today':
date = d_obj.Format('yyyy-MM-dd');
date = date + ' ~ ' + date;
break;
case 'yesterday':
date = (new Date(d_obj.getTime() - 86400000)).Format('yyyy-MM-dd');
date = date + ' ~ ' + date;
break;
case '7day':
date = (new Date(d_obj.getTime() - 86400000 * 7)).Format('yyyy-MM-dd') + ' ~ ' + d_obj.Format('yyyy-MM-dd');
break;
case '30day':
date = (new Date(d_obj.getTime() - 86400000 * 30)).Format('yyyy-MM-dd') + ' ~ ' + d_obj.Format('yyyy-MM-dd');
break;
}
$('#id-create-time').val(date);
});
});
</script>
+93
View File
@@ -0,0 +1,93 @@
<div class="am-panel am-panel-default" v-if="info.status>=4">
<div class="am-panel-hd">
<span style="font-size: 20px">代办服务</span>
<span style="float:right;margin-top:5px">
</span>
</div>
<div class="am-panel-bd am-g" style="margin-top: 10px;margin-bottom: 10px;">
<form id="agent_form">
<div class="am-form-inline am-u-lg-12">
<div class="am-form-group am-u-lg-3">
<label class="am-para-label label-width">车牌号:</label>
<div class="am-para-input">
<input name="car_num" v-model="info.agent.car_num">
</div>
</div>
<div class="am-form-group am-u-lg-3">
<label class="am-para-label label-width">交通强制责任险:</label>
<div class="am-para-input">
<input type="checkbox" name="if_ins" value="1" v-if="info.agent.if_ins" checked class="mui-switch mui-switch-anim">
<input type="checkbox" name="if_ins" value="1" v-else class="mui-switch mui-switch-anim">
</div>
</div>
<div class="am-form-group am-u-lg-6">
<div class="admin-content">
<label class="am-para-label">行驶证:</label>
<div class="am-para-input">
<div class="am-form-group am-form-file">
<button type="button" class="am-btn am-btn-default am-btn-sm"
data-file="1" data-type="jpg,png,gif,png,jpeg"
data-uptype="qiniu" data-field="car_img">
<i class="am-icon-cloud-upload"></i> 选择要上传的文件
</button>
<input type="hidden" name="car_img" v-model="info.agent.car_img" class="layui-input">
<img data-tips-image style="height:auto;max-height:32px;max-width:32px" :src="info.agent.car_img_src"/>
</div>
</div>
</div>
</div>
</div>
<div class="am-form-inline am-u-lg-12">
<div class="am-form-group am-u-lg-3">
<label class="am-para-label label-width">保险到期时间:</label>
<div class="am-para-input">
<input name="e_time" id="bx_time" readonly v-model="info.agent.ins_time">
</div>
</div>
<div class="am-form-group am-u-lg-6">
</div>
</div>
<div class="am-form-inline am-u-lg-12">
<label class="am-para-label label-width">保险单图片:</label>
<div class="am-para-input">
<div class="am-form-group am-form-file">
<button type="button" class="am-btn am-btn-default am-btn-sm"
data-file="5" data-type="jpg,png,gif,png,jpeg"
data-field="img_rheight" data-params-source="vue_obj.bx_imgs">
<i class="am-icon-cloud-upload"></i> 选择要上传的文件
</button>
<div class="photo-upload mt10">
<div class="photo-upload-item" v-for="(v,i) in bx_imgs">
<img :src="v.src" class="img-thumbnail" :data-value="v.value" data-tips-image style="width:100px;height:100px;">
<span class="photo-upload-item-remove">
<i class="fa fa-remove" data-rm-vue="vue_obj.bx_imgs" :data-index="i"></i>
</span>
</div>
</div>
</div>
</div>
</div>
<div class="am-form-inline am-u-lg-12">
<div class="am-form-group am-u-lg-3">
</div>
<div class="am-form-group am-u-lg-3">
</div>
<div class="am-form-group am-u-lg-6 align-r">
<a href='javascript:;' class='am-btn am-btn-primary am-btn-xs' @click="save_agent">
保存
</a>
<a class='am-btn am-btn-primary am-btn-xs' v-if="info.status==4" data-ajax="post" data-action="/receiver/orders/edit_agentfh" :data-params-oid="info.id">
完成代办
</a>
<a class='am-btn am-btn-default am-btn-xs' v-else>
已完成代办
</a>
</div>
</div>
</form>
</div>
</div>
+301
View File
@@ -0,0 +1,301 @@
<div id="vue-edit" class="am-form am-form-horizontal" style="width: 98%;padding-top: 10px">
<div class="am-u-lg-12">
<div class="am-panel am-panel-default">
<div class="am-panel-hd">
<span style="font-size: 20px">基本信息</span>
<span style="float:right;margin-top:5px">
</span>
</div>
<div class="am-panel-bd am-g" style="margin-top: 10px;margin-bottom: 10px;">
<div class="am-form-inline am-u-lg-12">
<div class="am-form-group am-u-lg-3">
<label class="am-para-label label-width">订单编号:</label>
<div class="am-para-input">
<label class="am-para-label align-l">{{info.sid}}</label>
</div>
</div>
<div class="am-form-group am-u-lg-3">
<label class="am-para-label label-width">订单创建时间:</label>
<div class="am-para-input">
<label class="am-para-label align-l">{{info.c_time}}</label>
</div>
</div>
<div class="am-form-group am-u-lg-6">
<label class="am-para-label label-width">身份证号码:</label>
<div class="am-para-input">
<label class="am-para-label align-l" v-if="info.info_json && info.info_json.cardid">{{info.info_json.cardid}}</label>
</div>
</div>
</div>
<div class="am-form-inline am-u-lg-12">
<div class="am-form-group am-u-lg-3">
<label class="am-para-label label-width">客户姓名:</label>
<div class="am-para-input">
<label class="am-para-label align-l">{{info.name}}</label>
</div>
</div>
<div class="am-form-group am-u-lg-3">
<label class="am-para-label label-width">客户手机号:</label>
<div class="am-para-input">
<label class="am-para-label align-l">{{info.mobile}}</label>
</div>
</div>
<div class="am-form-group am-u-lg-6">
<template v-if="info.bill && (info.bill.cardidA || info.bill.cardidB)">
<label class="am-para-label label-width">身份证图片:</label>
<div class="am-para-input">
<!--
<a href="javascript:;" class="am-btn am-btn-default am-btn-sm" @click="show_carimg">
查看图片&nbsp;<i class="am-icon-search-plus"></i>
</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">
</div>
</div>
</template>
</div>
</div>
<div class="am-form-inline am-u-lg-12">
<div class="am-form-group am-u-lg-3">
<label class="am-para-label label-width">合同状态:</label>
<div class="am-para-input">
<label class="am-para-label align-l">{{info.sign_status_name}}</label>
</div>
</div>
<div class="am-form-group am-u-lg-3">
<label class="am-para-label label-width">渠道来源:</label>
<div class="am-para-input">
<label class="am-para-label align-l">{{info.cf_title}}</label>
</div>
</div>
<div class="am-form-group am-u-lg-6 align-r">
<a class='am-btn am-btn-primary am-btn-xs'>短信</a>
<a class='am-btn am-btn-primary am-btn-xs'>拨打电话</a>
</div>
</div>
</div>
</div>
<!--订单明细-->
<?require_once "oinfo.php"?>
<!--贷款明细-->
<?require_once "loaninfo.php"?>
<!--代办-->
<?require_once "agentinfo.php"?>
</div>
</div>
<script>
require(['laydate'], function (laydate) {
//日期范围
laydate.render({
elem: '#bx_time'
, type: 'date'
});
});
var vue_obj;
$(document).ready(function () {
vue_obj = new Vue({
el: '#vue-edit',
data: {
info: [],
carslist: [],
page: [],
bx_imgs:[],
},
mounted() {
var that = this;
that.info = <?=json_encode($info,JSON_UNESCAPED_UNICODE)?>;
that.bx_imgs = <?=json_encode($info['bx_imgs'])?>;
},
computed: {},
created: function () {
},
methods: {
carModal: function () {
var that = this
that.getCars(1);
layer.open({
type: 1,
area: ['50%', '80%'], //宽高
content: $('#car-modal'),
title: '选择车辆',
shade: false,
btn: ['保存'],
yes: function (index) {
$.post("/receiver/orders/edit_item",{'id':that.info.id,'item_id':that.info.item_id}, function(data) {
if(data.code){
layer.msg(data.msg, {time: 2000,icon:1 }, function () {
$.form.reload();
});
}else{
layer.msg(data.msg,{icon:2});
}
},'json');
}
});
},
getCars: function (page) {
var vm = this;
$.ajax({
url: '/common/items',
type: 'post',
dataType: 'json',
data: {
page: page,
select_id:vm.info.item_id
},
success: function (re) {
var carslist = re.data.list;
vm.page = re.data.page;
carslist.map(function (_item, _index) {
if (vm.info.item_id == _item.id) {
carslist[_index].selected = 1;
} else {
carslist[_index].selected = 0;
}
});
vm.carslist = carslist;
console.dir(carslist)
}
});
},
setCars: function (cars, checked) {
var vm = this;
var carslist = vm.carslist;
carslist.map(function (_item, _index) {
carslist[_index].selected = 0;
});
vm.carslist = carslist;
if (checked) {
vm.info.item_id = cars.id;
cars.selected = 1;
} else {
vm.info.item_id = 0;
}
},
beforeUsersPage: function () {
var vm = this;
if (vm.page.page == 1) {
layer.msg('已经是第一页了');
return;
}
vm.page.page--;
vm.getCars(vm.page.page);
},
afterUsersPage: function () {
var vm = this;
vm.page.page++;
vm.getCars(vm.page.page);
},
finish_loan: function(){
var that = this;
$.post("/receiver/orders/edit_loan",{'id':this.info.id,'status':1}, function(data) {
console.dir(data);
layer.msg(data.msg);
if(data.code){
that.info.loan_info.status=1
}
},'json');
},
upTz: function(index){
var that = this;
var formData = new FormData();
formData.append("file",$("#tz_file").get(0).files[0]); //上传一个files对象
formData.append('id',this.info.id);
$.ajax({//jQuery方法,此处可以换成其它请求方式
url: '/receiver/orders/edit_loan',
dataType: "json",
type: "post",
data: formData,
processData: false,//不去处理发送的数据
contentType: false,//不去设置Content-Type请求头
error: function (res) {
layer.msg('上传失败')
return;
},
success: function (res) {
console.dir(res)
layer.msg(res.msg);
if(res.code){
that.info.loan_info.notify_file = res.data.file_url;
}
return;
}
})
},
save_agent:function(){ //保存代办信息
var post_data = $('#agent_form').serialize();
post_data += "&oid="+this.info.id;
imgs = '';
if(this.bx_imgs){
jQuery.each(this.bx_imgs, function(i, val) {
console.dir(val)
if(imgs){
imgs += ","+val['value'];
}else{
imgs += val['value'];
}
});
}
post_data += "&bx_imgs="+imgs;
$.post("/receiver/orders/edit_agent",post_data, function(data) {
if(data.code){
layer.msg(data.msg, {time: 2000,icon:1}, function () {
$.form.reload();
});
}else{
layer.msg(data.msg,{icon:2});
}
},'json');
},
show_imgs:function(type){ //显示图片
$.getJSON('/receiver/orders/get_cimgs',{'oid':this.info.id,'type':type}, function(result){
console.dir(result.data.info);
var json = result.data.info;
layer.photos({
photos: json
,anim: 5
});
});
},
show_carimg:function(){
layer.photos({
photos: '#layer-photos-demo'
,anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数)
});
}
}
});
})
</script>
<style type="text/css">
.label-width {
width: 150px
}
.input-left {
margin-left: 150px;
}
.group-width {
width: 45%;
height: 56px;
}
.my-ul ul li {
padding: 10px;
}
.my-panel {
padding: 10px;
border: 1px solid #ddd;
height: 90px;
}
.btn-group .disabled {
background-color: #eee;
opacity: 1;
}
</style>
+89
View File
@@ -0,0 +1,89 @@
<form class="am-form am-form-horizontal" action="/receiver/orders/edit_bill" data-auto="true" method="post"
style="width: 90%;padding-top: 10px" enctype="multipart/form-data">
<input type="hidden" name="id" value="<?= $bill['id'] ?>">
<div class="am-form-group">
<label class="am-para-label">到账金额:</label>
<div class="am-para-input w150">
<input type="number" id="fp_money" name="money" value="<?=$bill['money']?>"/>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">pdf文件:</label>
<div class="input-group">
<label class="input-group-btn">
<span class="am-btn am-btn-default am-btn-sm">
<i class="am-icon-cloud-upload"></i> 选择文件
<input type="file" id="fp_file" style="display: none;" accept=".pdf" onchange="getfilename()">
</span>
</label>
<span class="ml10 mt5 absolute">
<span style="" id="temp_filename"></span>
<?if($bill['file']){?>
<a href="<?=$bill['file']?>" target="_blank" class="ml10" >查看文件</a>
<?}?>
</span>
</div>
</div>
<div class="am-form-group" style="margin-bottom: 2rem">
<div class="am-para-input">
<span class="am-btn am-btn-secondary" id="bc">保存</span>
</div>
</div>
</form>
<script>
$("#fp_file").on("change",function(){
var filePath=$(this).val();
if(filePath){
var arr=filePath.split('\\');
var fileName=arr[arr.length-1];
$("#temp_filename").html(fileName);
}else{
$("#temp_filename").html("您未上传文件,或者您上传文件类型有误!");
return false
}
});
$("#bc").click(function(){
var that = this;
var formData = new FormData();
formData.append('id',<?=$bill['id']?>);
file = $("#fp_file").get(0).files[0];
money = $("#fp_money").val();
if(file){
formData.append("file",file);
}
if(money){
formData.append('money',money);
}
$.ajax({
url: '/receiver/orders/edit_bill',
dataType: "json",
type: "post",
data: formData,
processData: false,//不去处理发送的数据
contentType: false,//不去设置Content-Type请求头
error: function (res) {
layer.msg('保存失败')
return;
},
success: function (res) {
console.dir(res)
if(res.code){
layer.msg(res.msg, {
time: 2000,
icon:1
}, function () {
layer.closeAll();
$.form.reload();
});
}else{
layer.msg(res.msg,{icon:2});
}
return;
}
})
})
</script>
+55
View File
@@ -0,0 +1,55 @@
<div class="am-panel am-panel-default" v-if="!info.payway && info.status>0">
<div class="am-panel-hd">
<span style="font-size: 20px">分期明细</span>
<span style="float:right;margin-top:5px">
</span>
</div>
<div class="am-panel-bd am-g" style="margin-top: 10px;margin-bottom: 10px;">
<div class="am-form-inline am-u-lg-12">
<div class="am-form-group am-u-lg-3">
<label class="am-para-label label-width">分期产品:</label>
<div class="am-para-input">
<label class="am-para-label align-l">{{info.loan_info.title}}</label>
</div>
</div>
<div class="am-form-group am-u-lg-3">
<label class="am-para-label label-width">分期年限:</label>
<div class="am-para-input">
<label class="am-para-label align-l">{{info.loan_info.year}}</label>
</div>
</div>
<div class="am-form-group am-u-lg-6">
</div>
</div>
<div class="am-form-inline am-u-lg-12">
<div class="am-form-group am-u-lg-3">
<label class="am-para-label label-width">首付金额:</label>
<div class="am-para-input">
<label class="am-para-label align-l">{{info.loan_info.first_price}}</label>
</div>
</div>
<div class="am-form-group am-u-lg-3">
<label class="am-para-label label-width">按揭通知函:</label>
<div class="input-group">
<label class="input-group-btn">
<span class="am-btn am-btn-default am-btn-sm">
<i class="am-icon-cloud-upload"></i> 选择文件
<input type="file" style="display: none;" accept=".pdf" @change="upTz" id="tz_file">
</span>
</label>
<a :href="info.loan_info.notify_file" target="_blank" v-if="info.loan_info.notify_file" class="ml10 mt5 absolute" style="">查看文件</a>
</div>
</div>
<div class="am-form-group am-u-lg-6">
</div>
</div>
<div class="am-form-inline am-u-lg-12 align-r">
<a href='javascript:;' @click="finish_loan()" v-if="!info.loan_info.status" class='am-btn am-btn-primary am-btn-xs'>
确认交款
</a>
<a href='javascript:;' v-else class='am-btn am-btn-default am-btn-xs'>
已完成按揭
</a>
</div>
</div>
</div>
+171
View File
@@ -0,0 +1,171 @@
<div class="am-panel am-panel-default">
<div class="am-panel-hd">
<span style="font-size: 20px">订单明细</span>
<span style="float:right;margin-top:5px">
</span>
</div>
<div class="am-panel-bd am-g" style="margin-top: 10px;margin-bottom: 10px;">
<div class="am-form-inline am-u-lg-12">
<div class="am-form-group am-u-lg-3">
<label class="am-para-label label-width">品牌车型:</label>
<div class="am-para-input">
<label class="am-para-label align-l">{{info.brand_name}}{{info.s_name}}</label>
</div>
</div>
<div class="am-form-group am-u-lg-3">
<label class="am-para-label label-width">车辆级别:</label>
<div class="am-para-input">
<label class="am-para-label align-l">{{info.v_name}}</label>
</div>
</div>
<div class="am-form-group am-u-lg-6">
<label class="am-para-label label-width">合同信息:</label>
<div class="am-form am-form-inline" v-if="info.contract_data">
<div class="am-form-group" v-if="info.contract_data[0]">
<a href="javascript:;" class="am-btn am-btn-default am-btn-sm" @click="show_imgs(info.contract_data[0]['type'])">
整车销售合同&nbsp;<i class="am-icon-search-plus"></i>
</a><br>
<span class="ml30">{{info.contract_data[0]['status_name']}}</span>
</div>
<div class="am-form-group" v-if="info.contract_data[1]">
<a href="javascript:;" class="am-btn am-btn-default am-btn-sm" @click="show_imgs(info.contract_data[1]['type'])">
委托服务协议&nbsp;<i class="am-icon-search-plus"></i>
</a><br>
<span class="ml30">{{info.contract_data[1]['status_name']}}</span>
</div>
<div class="am-form-group" v-if="info.contract_data[2]">
<a href="javascript:;" class="am-btn am-btn-default am-btn-sm" @click="show_imgs(info.contract_data[2]['type'])">
车辆确定&nbsp;<i class="am-icon-search-plus"></i>
</a><br>
<span class="ml30">{{info.contract_data[2]['status_name']}}</span>
</div>
<div class="am-form-group" v-if="info.contract_data[3]">
<a href="javascript:;" class="am-btn am-btn-default am-btn-sm" @click="show_imgs(info.contract_data[3]['type'])">
车辆交接&nbsp;<i class="am-icon-search-plus"></i>
</a><br>
<span class="ml30">{{info.contract_data[3]['status_name']}}</span>
</div>
</div>
</div>
</div>
<div class="am-form-inline am-u-lg-12">
<div class="am-form-group am-u-lg-3">
<label class="am-para-label label-width">车辆指导价:</label>
<div class="am-para-input">
<label class="am-para-label align-l">{{info.price}}</label>
</div>
</div>
<div class="am-form-group am-u-lg-3">
<label class="am-para-label label-width">车身颜色:</label>
<div class="am-para-input">
<label class="am-para-label align-l">{{info.cor_name}}</label>
</div>
</div>
<div class="am-form-group am-u-lg-6">
</div>
</div>
<div class="am-form-inline am-u-lg-12">
<div class="am-form-group am-u-lg-3">
<label class="am-para-label label-width">定金金额:</label>
<div class="am-para-input">
<label class="am-para-label align-l">{{info.deposit}}</label>
</div>
</div>
<div class="am-form-group am-u-lg-3">
<label class="am-para-label label-width">内饰颜色:</label>
<div class="am-para-input">
<label class="am-para-label align-l">{{info.incor_name}}</label>
</div>
</div>
<div class="am-form-group am-u-lg-6">
<label class="am-para-label label-width">发票:</label>
<div class="input-group">
<label class="input-group-btn">
<a href="javascript:;" :data-modal="'/receiver/orders/get_bill?oid='+info.id" data-title="编辑发票信息" class="am-btn am-btn-default am-btn-sm">
上传文件
</a>
</label>
<a :href="info.bill.file" v-if="info.bill && info.bill.file" target="_blank" class="ml10 mt5 absolute">查看文件</a>
</div>
</div>
</div>
<div class="am-form-inline am-u-lg-12">
<div class="am-form-group am-u-lg-3">
<label class="am-para-label label-width">付款方式:</label>
<div class="am-para-input">
<label class="am-para-label align-l">
<span v-if="info.payway">全款</span>
<span v-else>贷款</span>
</label>
</div>
</div>
<div class="am-form-group am-u-lg-3">
<label class="am-para-label label-width">车辆信息:</label>
<div class="am-para-input">
<label class="am-para-label align-l">
<span v-if="info.item_id">已选择</span>
<span v-else>未选择</span>
</label>
</div>
</div>
<div class="am-form-group am-u-lg-6 align-r">
<template v-if="info.status>=3">
<a class='am-btn am-btn-primary am-btn-xs' v-if="info.status==3" data-ajax="post" data-action="/receiver/orders/edit_jk" :data-params-oid="info.id">
交款确定
</a>
<span class='am-btn am-btn-default am-btn-xs' v-else >已确认开票</span>
</template>
<a @click="carModal" class='am-btn am-btn-primary am-btn-xs'>车辆匹配</a>
</div>
</div>
</div>
</div>
<div id="car-modal" style="display: none;">
<div class="modal-body">
<table class="am-table">
<thead>
<tr>
<th>品牌车型</th>
<th>车型</th>
<th>车身颜色</th>
<th>内饰颜色</th>
<th>车架号</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr v-for="(v,i) in carslist">
<td>{{v.brand_name}}{{v.series_name}}</td>
<td>{{v.v_name}}</td>
<td>{{v.cor_name}}</td>
<td>{{v.incor_name}}</td>
<td>{{v.vin}}</td>
<td>
<a v-if="v.selected==0" href="javascript:void(0);" @click="setCars(v,1)"
class="btn btn-primary btn-sm">选择</a>
<a v-else-if="v.selected==1" href="javascript:void(0);" @click="setCars(v,0)"
class="btn btn-default btn-sm">移除</a>
</td>
</tr>
</tbody>
</table>
<div class="clearfix">
<span class="pull-left text-muted">{{page.page}}(每页{{page.pageLimit}},{{page.pageCount}})</span>
<nav class="pull-right" aria-label="Page navigation">
<ul class="pagination pagination-sm">
<li>
<a href="javascript:void(0);" @click="beforeUsersPage();" aria-label="上一页">
<span class="glyphicon glyphicon-menu-left"></span>
</a>
</li>
<li v-if="page.hasNext">
<a href="javascript:void(0);" @click="afterUsersPage();" aria-label="下一页">
<span class="glyphicon glyphicon-menu-right"></span>
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
+1
View File
@@ -106,3 +106,4 @@ defined('API_CODE_NONE') OR define('API_CODE_NONE', 404);//页面不
defined('API_CODE_LOGOUT') OR define('API_CODE_LOGOUT', 408);//未登录
defined('API_CODE_INVILD_PARAM') OR define('API_CODE_INVILD_PARAM', 401);//非法参数
defined('API_CODE_USER_FULL') OR define('API_CODE_USER_FULL', 417);//完善用户资料
defined('API_CODE_ORC_FAIL') OR define('API_CODE_ORC_FAIL', 418);//图片识别失败
+3 -3
View File
@@ -7,7 +7,7 @@ $config['bucket'] = 'img-haodian';
$config['region'] = '华东';
$config['is_https'] = 'https';
$config['domain'] = 'qimg.haodian.cn';
$config['attch'] = 'hdi/';
$config['attch'] = 'liche/';
$config['img']['access_key'] = 'f9o5jg_SZQA6IZtru4YZ8eJ-lWfPM6jdTP4lrmTu';
$config['img']['secret_key'] = 'qh76Nn02FjiXXVxF4k6RqVt6keFNfXuVFWaVJAGW';
@@ -15,7 +15,7 @@ $config['img']['bucket'] = 'img-haodian';
$config['img']['region'] = '华东';
$config['img']['is_https'] = 'https';
$config['img']['domain'] = 'qimg.haodian.cn';
$config['img']['attch'] = 'hdi/';
$config['img']['attch'] = 'liche/';
$config['video']['access_key'] = 'f9o5jg_SZQA6IZtru4YZ8eJ-lWfPM6jdTP4lrmTu';
$config['video']['secret_key'] = 'qh76Nn02FjiXXVxF4k6RqVt6keFNfXuVFWaVJAGW';
@@ -23,4 +23,4 @@ $config['video']['bucket'] = 'video-haodian';
$config['video']['region'] = '华东';
$config['video']['is_https'] = 'https';
$config['video']['domain'] = 'qv.haodian.cn';
$config['video']['attch'] = 'hdi/';
$config['video']['attch'] = 'liche/';
-1
View File
@@ -286,7 +286,6 @@ class Hd extends CI_Controller {
private function print_return($data = array(), $ifgzip = false){
if(!isset($data['code'])){
// $data = _clean($data);//车亿宝列表需要list空数组判断
$msg = $data['msg'] ? $data['msg'] : '';
$data = array('code' => 200, 'data' => $data, 'msg' => $msg);
}
+14 -20
View File
@@ -2,6 +2,13 @@
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(){
@@ -11,8 +18,7 @@ class Test extends CI_Controller {
$filename = $name.'.pdf';
if (!file_exists($path)){
$oldumask = umask(0);
mkdir($path, 0777, true);
umask($oldumask);
mkdir($path, 0777, true); umask($oldumask);
}
$arrContextOptions=array(
"ssl"=>array(
@@ -55,28 +61,16 @@ class Test extends CI_Controller {
public function save_img(){
$img = 'https://liche-api-dev.xiaoyu.com/pdf2img/2021-07-07/1889917037729102438059_0.png';
if(!$_FILES['file']){
echo '参数错误';exit;
}
//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->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;
}
public function img(){
//签名文件
$img = 'https://liche-api-dev.xiaoyu.com/pdf2img/2021-07-07/1889917037729102438059_0.png'; //协议
//$img = 'https://liche-api-dev.xiaoyu.com/pdf2img/2021-07-08/1964010084089102318048_2.png'; //整车
//$img = 'https://liche-api-dev.xiaoyu.com/pdf2img/2021-07-08/1964942930570102661389_0.png'; //确认单
//$img = 'https://liche-api-dev.xiaoyu.com/pdf2img/2021-07-08/1965121467553102596576_0.png'; //车辆交接信息
//用户签名
$base64_img = "iVBORw0KGgoAAAANSUhEUgAAAXcAAAKdCAMAAADvKdm1AAAAAXNSR0IB2cksfwAAAFFQTFRFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAXKkVQgAAABt0Uk5TADCA/99A78/Q8CAQwKBwv+BQkLBgr59/P2+PuKEyZQAAC7pJREFUeJzt3ely6zYMhuHKuy0v8ZJz2t7/hdaCvCTxJskkPvXgff51ppPSGJUEQVD66y8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA+J8oCvUIQhoMh6OxehABTYbD4VQ9iIBmx7jP1YMIqHreB+pBxLM4hn1YqkcRz/gY9qV6EAEd05nhSj2IgFZM7xLLY9xJ392V1bK6UI8inhXZu0JRPe5r9Sji2RzD/qEeRDzbIauqwohNk8KAZEahrEpiO/Uo4qke9zklMW8lFWAJHncJHncNHncJHncNHncJHncNHncJHncNHncNHneJMY+7xI6mGYnqvGOrHkQ8BT2REutj2PfqQQQ0Pcb9oB5EPAuOVSUOx7DP1IMIaE+PmIK1onJ30t2W3jyJFV0zClYCpifSHR3vEnS8a9DxLnGg412hHFESU6DjXcIqYpyruvusFlUOPLxVx9kU3v1xjUxiTSFSwQozdG+0keRVgwealVqyrLtXRiG6bybqMN+aRAj8TB3lOyK8crJczdVhvkFDQjPVcUeq3H07G35EmGcSsMoMsXJXpUQcd7izPROVGXfsmTSqihh1d3f2HjGOmdxVTQRUxNxZzwwFYHcp90xobHHa2scoIvbHpYw8Ya5xtLiWkUek8H4+v1QRN+rBxGG5e9UAXF2O58KBl/LavFF92oAijZPdNXcvP1hbvViL2LkyU1THVhEO6PSm3+ruB6Z4H5a6f7lmsOfYycPiZ4tYPcWTxWe2uTnuKMji8zvcmVUGXxda5GCHqjd1yCVF4czshvDNKVM5p1CT1fjBjGKFg0//8QRhBYK73XQ76gUZDR7P41Wf64Rj7iyKJ1tTqxeQTGZh7yF4tHquz7VhJLZ+XhBYMtNkYan7k/cQLJhpsvh81Q/JTJPD+HVUmWkyeJi6XzHTpPckdb9ipklt0exUiZkmsduq+13MNGltm57lMdOkdL/qfhczTUK75nc7FvR1JFO0Ocdbc+iXyveGmVf2HPqlsf7RMPMCh35p2CzT5r2cVlH4lW08QVifUrv7wTs6yN5WTtufnJYzOsje9dklPaGD7F02ZbS/Hsy29T3WlTfrMGPQQfYOmy86vXODbesb6lSm21O75TpCV11SmatVu90WLjqlMhdcR+ioYypzMaZXtYvOqczFgF7V9or25YEbM5LJtqzjumMqc2HJJJeK29gkmSNsrpqytjaW6n0PNsWzfWrKntMkb7FaUYtvztbURN8GmnHc2lSSNfXyx2Zkkw2lWVPP7AIOHTWvpX6HUsHa2kS6NfXbX2SKfy7lmnq2pzT5StI19fJHP+ioeSHtmnpGafKFXO8lpDT5VPo19Yxr9E/kWFNPOOd+LMuaekYy+VCeNfWMZPKBzO/6JZm8L9+aekIyeY9FJe934UkmbxVvtIY1xjn3T/X3C3I/i5xz//BeR15ztoawtp7VYff4CNaaBoMvfnmF/XTOTVJjLOxe31je02Bwsn67EbKN+pybKzj1Wuf4HVXbt5LG12H3zO2swSB6Gm9hdw6CNRjETuPrsHv/Tx8+jdeEPXwarwp78DReF/bQabwy7IHT+MKlBPlQ1DTeDrGVvztoGp/3ELuJkGl8Hz5YG/DWWfZD7EbC3To75D/EbiTYrTP/WtgjoW6dSRP37yLdOutR2CPdOutV2MO8em877VfYT7XJ3+pR5DbqW9hPr96b/uGdwj2silgX2TGd1Ke1GW1nw3nf3tx7qAM/+f1HR76HSts/HSP/h082/TO2PH44Uo8jnvW8fytPCCWB19j2L8WNwXbSvGHVH3dcRQZRimQ9U/JZRQ2+TyGyDHbi2hdVkWyuHkREh+GcKg0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBmfxfqEYS04+t6CvZlePUgAqq+VL9UDyIe+9QYnwByNzmGfa8eRDzjY9jnfDvV3TGZGa7UgwhodIz7Vj2IeBbVqso0427Nqiqx5Hu1CmU1zfBhbHfVl+Bn6kEEtDrGfaceRDxltVmlCOyummb4Kra/atM0UA8ingObJokNtRmFMcm7xJ4agcKCgyaJFeeqClaaoX/D3eAY9g/1IOKxEgGPu7sD59kSlAgk2DNpUCKQYM+kwZ5JgiRSgz2TBkmkBHsmDZJICfZMGiSREuyZNEgiNdgzSZBEakxpAVYoSCIlVjQrKVglknuT7tYkkRJUIiXGdLxLrKhEKlCa0aA0ozGiNKOwpTQjwfmehK2q3M52t+N8T4EmMY0VLyNQsMI7r1Zyt2HPpHCgRKBQjkhmFAYcqyosJpx3KHxSmVEY8y4CiSmviVQgh5Swwgz1X3dVHXJODunNyu7kkO6sMEMO6c1ySDoi3VGYkRhwqKqwIIeUoDAjseVwT4HTDo0di6rCmJ2qxJQWAoUB5V8FUneNDam7woF6mIIdMpG6u1txyKRA6i5hBQI6N9xRdZewOwa8VMkdR9kSa1J3BSsQTP/meXdWlSErIx55T4Ph2YRH3o/tmPbLIRsnV7ZjmpeL1YwH3tOv82FHOeeB97O97piqeX5CZcyFpZCnuow98J/a8USx+VqXYfvkZf29PaxaWkcsrdlZOWz5458pj+VWTn+eZNMv5mF3M5+XH1WlRjWeIGyj+qNfhn7g7KyB4KbovqdnLLPPu3P5okriJ0zx2awf1MGsfYnA52Ip490GAgv8lCw+C6sPPGhTWhH4XCxzf/iCGQv8xnVAQXw+P+SwQ5BfjuMJYncnc/+qnBH4DGzlnD2bwOvA86KrpCyVeXHBoJgT+MTqVOZVgl6wf0rreSpzZdUbivHJvEhlrg5kkwm9SmV+/qucgiTxOpX5Ysnamki9pjadtO0UhLU1gU2TVObKkhrW1rcN2p4msbamYBumdt9sZm1N4KZ9oAHW1rfdtg80YGsrgX/DvfaBBqjUvMf63Lvc2bO1lcB3delzb43Av2H7RmJC4Dsrv/S5t0fgu7rfpNQYge/mUZNSYwS+i+L9dykR+Pbqq5Jv3hgj8K1tkkSMwLeUqrZF4FuxcCV5UV4deC78NVLcvV7QDT3ajdVraqpQEfim0qypFwS+meTnRXXgOXJ9Lt2aesGthNfsqCP1e/II/CtFow7U1gj8c9aklGOfY3dceWHKA00bfzv8Za6DPFaHPc9nIwj8Y7/yhZ3AP2Zhz/di8ZLujrvWbfqtu6Ct5h7bL+X9Ng2Bv9Xs6tibCPyNb2/Jy2bLOch3P96Slw0HUN8s3L7EROC/2iToHmiIwF95zTKGwJ9lKLm//M8R+FPm7vhWawJfEUSBwItiQOBFEYgeeNnvjx144a+PHHjpb48bePEvjxr4f9S/O2TgFxv9rw4X+O35u4bi3xwt8KM66nP5L64D/696GF7sjRnDZQ++NFYH/jNIC992dnzY+/FNjoOduU578AgEUx92T/hAiLe6kyzQ6toXpbVp08Pnzw4ah5sgq2uPbG2SH3H7zFthqe2EG8beyvoz6f+oxxHPaXVlkvdW7125fuZuXG+hWF29LWwLNWEL5a3cxypQ9seOSV7jwCSvUW+hyOTdnbZQZPLuBkMOQyTqOhnlGndFfRjyWz2OcE6HIVFOvHukPgyhJu/uVK6hauCtZJIXoSYvQk1epODEW+NUk2cL5e1UriGtcUc/mciBfjKNLd3aGqd+MtIab3Rri5wKlATe3YC0RuNA4DXqyjD5pLu6WkOZzF197joln/RW55Mk8u7qMhn3Xf2RyIusmGo0DmQ1Ggc2UBorpngJSyeZ4v3ZzpUp3h9TvAhTvAZTvIhN8SOmeHc2xW/Uowgo+TfY0cyStVWi/GBtlWD7JML2SYTtk0a9fVKPIiCb4lla/VXvaOrHy71jqS5279WDCKhggteoMhr1GCIi7hrEXYO4axB3DeKu8TEcztRjiGg7++C1EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoLf+A6jRZVspl5i5AAAAAElFTkSuQmCC";
$this->load->library('receiver/sign_entity');
$res = $this->sign_entity->test($img,$base64_img,1050,1550,300); //协议
var_dump($res);exit;
}
}
@@ -52,9 +52,10 @@ class Sub_cms extends Wxapp{
$total = $this->cms_model->count($where);
$lists = array();
if($total){
$select = 'id, title, cover, url, position,e_time,target_id';
$select = 'id, title, cover, url, position,e_time,target_id,jsondata';
$rows = $this->cms_model->select($where, 'sort DESC', $page, $size, $select);
foreach($rows as $item){
$jsondata =json_decode($item['jsondata'],true);
$lists[] = array(
'id' => $item['id'],
'title' => $item['title'],
@@ -63,6 +64,7 @@ class Sub_cms extends Wxapp{
'e_time' => date('Y-m-d H:i:s',$item['e_time']),
'target_id' => $item['target_id'],
'status' => $item['e_time']<time() ? 0 : 1,
'btn_type' => $jsondata['btn_type'] ? $jsondata['btn_type'] : 1,
);
}
}
+31 -10
View File
@@ -20,6 +20,9 @@ class Contract extends Wxapp{
$this->load->model('receiver/order/receiver_orders_model','orders_model');
$this->load->model('receiver/order/receiver_order_signs_model','signs_model');
$this->load->model('receiver/order/receiver_order_contracts_model','contracts_model');
$this->load->model('receiver/order/receiver_order_ckcars_model','ckcars_model');
$this->load->model('receiver/order/receiver_order_bills_model','bills_model');
$this->load->model('receiver/order/receiver_order_deliverys_model','deliverys_model');
}
protected function get(){
@@ -37,7 +40,8 @@ class Contract extends Wxapp{
$this->load->library('receiver/orders_entity');
$this->load->library('pdf');
$h5_url = $this->orders_entity->get_contract_h5($id,$type,1);
list($h5_url,$title) = $this->orders_entity->get_contract_h5($id,$type,1);
list($pdf2img_url,$title) = $this->orders_entity->get_contract_h5($id,$type);
if(!$contract){
$cid = create_order_no(350200,$this->app_key,2);
$add_data = [
@@ -53,7 +57,7 @@ class Contract extends Wxapp{
//html转pdf
$save_path = 'data/contracts/'.date('Ymd');
$filename = $cid.'.pdf';
$c_res = $this->pdf->html2pdf($h5_url,FCPATH.$save_path,$filename);
$c_res = $this->pdf->html2pdf($pdf2img_url,FCPATH.$save_path,$filename);
$update = [
'file' => $save_path.'/'.$filename
];
@@ -72,9 +76,11 @@ class Contract extends Wxapp{
$this->contracts_model->update($update,['id'=>$contract['id']]);
}
}
$data = [
'title' => $title,
'url' => $h5_url,
'img' => 'https://qs.haodian.cn/wechat_app/liche/mine/he-demo-1.jpg',
'img' => 'https://qs.haodian.cn/wechat_app/liche/mine/he-demo-2.jpg',
];
return $data;
}
@@ -85,9 +91,6 @@ class Contract extends Wxapp{
$img = $this->input_param('img');
$row = $this->contracts_model->get(['type'=>$type,'o_id'=>$id]);
if($type==2){
$img = 'https://qimg.haodian.cn/hdi/liche/202107/p_2ded4e70664dc34e8ac5fa8e399c3212.png';
}
if(!$row['file'] || !$img){
throw new Exception('参数错误', API_CODE_INVILD_PARAM);
@@ -109,7 +112,6 @@ class Contract extends Wxapp{
case 0: //整车
$sign_img = array_pop($imgs);
$res = $this->sign_entity->merge($sign_img,$img,1050,200,300);
//$res = $this->sign_entity->test($sign_img,$base64_img=555,1050,200,300);
if(!$res){
throw new Exception('签名失败', API_CODE_INVILD_PARAM);
}
@@ -130,7 +132,6 @@ class Contract extends Wxapp{
case 1: //协议
$sign_img = array_pop($imgs);
$res = $this->sign_entity->merge($sign_img,$img,1050,1550,300);
//$res = $this->sign_entity->test($sign_img,$base64_img=555,1050,1550,300);
if(!$res){
throw new Exception('签名失败', API_CODE_INVILD_PARAM);
}
@@ -155,7 +156,6 @@ class Contract extends Wxapp{
case 2: //确认信息
$sign_img = array_pop($imgs);
$res = $this->sign_entity->merge($sign_img,$img,1050,400,300);
//$res = $this->sign_entity->test($sign_img,$base64_img=555,1050,400,300); //确认单
if(!$res){
throw new Exception('签名失败', API_CODE_INVILD_PARAM);
}
@@ -168,13 +168,34 @@ class Contract extends Wxapp{
];
$result = $this->contracts_model->update($update,['id'=>$row['id']]);
if($result){
$this->ckcars_model->update(['status'=>2],['o_id'=>$id]);
$this->orders_model->update(['status'=>3],['id'=>$id]);
$this->bills_model->add(['o_id'=>$id,'c_time'=>time()]);
throw new Exception('签名成功', API_CODE_SUCCESS);
}else{
throw new Exception('签名失败', API_CODE_INVILD_PARAM);
}
break;
case 3: //交接信息
case 3: //车辆交接
$sign_img = array_pop($imgs);
$res = $this->sign_entity->merge($sign_img,$img,300,1400,'','',false);
if(!$res){
throw new Exception('签名失败', API_CODE_INVILD_PARAM);
}
$imgs[] = http_host_com('api').'/'.$res;
$imgs = $this->up_qiniu($imgs,$res);
$update = [
'imgs' => json_encode($imgs,JSON_UNESCAPED_UNICODE),
'sign_time' => date('Y-m-d H:i:s'),
'status' => 1
];
$result = $this->contracts_model->update($update,['id'=>$row['id']]);
if($result){
$this->deliverys_model->update(['status'=>1],['o_id'=>$id]);
throw new Exception('签名成功', API_CODE_SUCCESS);
}else{
throw new Exception('签名失败', API_CODE_INVILD_PARAM);
}
break;
default:
throw new Exception('未知签名类型', API_CODE_INVILD_PARAM);
+115 -13
View File
@@ -18,6 +18,9 @@ class User extends Wxapp{
$this->check_status = array();//用户状态校验
$this->check_mobile = array();//需要手机号
$this->check_headimg =array();//授权微信信息
$this->load->model('auto/auto_series_model');
$this->load->model('auto/auto_brand_model');
$this->load->model('auto/auto_attr_model');
}
@@ -178,7 +181,12 @@ class User extends Wxapp{
protected function get_my(){
$mobile = $this->session['mobile'];
$this->load->model('receiver/order/receiver_orders_model','orders_model');
$row = $this->orders_model->get(['mobile'=>$mobile,'status>-1'=>null]);
$this->load->model('receiver/order/receiver_order_signs_model');
$this->load->model('receiver/order/receiver_order_contracts_model');
$this->load->model('receiver/order/receiver_order_loans_model');
$this->load->model('receiver/order/receiver_order_ckcars_model');
$this->load->model('receiver/order/receiver_order_deliverys_model');
$row = $this->orders_model->get_step($mobile);
$progressOpt = $progress = [];
if($row){
$progressOpt = [];
@@ -244,14 +252,19 @@ class User extends Wxapp{
unset($progress_arr[2]);
}
$progress = [];
$this->load->model('receiver/order/receiver_order_signs_model');
$this->load->model('receiver/order/receiver_order_contracts_model');
$this->load->model('receiver/order/receiver_order_loans_model');
$this->load->model('receiver/order/receiver_order_ckcars_model');
$sign_row = $this->receiver_order_signs_model->get(['o_id'=>$row['id']],'status');
$ckcar_row = $this->receiver_order_ckcars_model->get(['o_id'=>$row['id']],'status');
$delivery_row = $this->receiver_order_deliverys_model->get(['o_id'=>$row['id']],'status');
$this->load->library('receiver/orders_entity');
foreach($progress_arr as $key=>$val){
$imgs = [];
if($row['status']>$val['key']){
if($val['key']==0 && $val['id']==1){
$imgs = $this->orders_entity->get_sign_imgs($row['id'],[0,1]);
}
if($val['key']==2 && $val['id']==5){
$imgs = $this->orders_entity->get_sign_imgs($row['id'],[2]);
}
$state = 1;
}elseif($row['status']==$val['key']){
switch($val['key']){
@@ -266,15 +279,21 @@ class User extends Wxapp{
}
$progressOpt = ['title'=> '合同签订','url'=>$url];
$val['id']== 1 && $state = 2;
}elseif($sign_row['status']==1){ //未交定金
$val['id']==1 && $state = 1;
$val['id']==2 && $state = 2;
$progressOpt = ['title'=> '交定金','url'=>'/pages/order/index?typeId=1'];
}else{ //已交定金
$state = 1;
}else{ //已签约
if($sign_row['status']==1){//未交定金
if($val['id']==1){
$imgs = $this->orders_entity->get_sign_imgs($row['id'],['0,1']);
$state = 1;
}else{
$state = 2;
}
$progressOpt = ['title'=> '交定金','url'=>'/pages/order/index?typeId=1'];
}else{ //已交定金
$state = 1;
}
}
break;
case 2:
case 2: //车辆确认
if($ckcar_row['status']){
if($val['id']==5){
$state = 2;
@@ -286,6 +305,14 @@ class User extends Wxapp{
$state = $val['id'] == 4 ? 2:0;
}
break;
case 5: //交付确认
$state = 2;
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']];
}
break;
default:
$state = 2;
}
@@ -295,7 +322,8 @@ class User extends Wxapp{
$progress[] = [
'title' => $val['title'],
'icon' => $val['icon'],
'state' => $state
'state' => $state,
'imgs' => $imgs
];
}
}
@@ -315,4 +343,78 @@ class User extends Wxapp{
];
return $data;
}
//我的爱车
protected function get_mycar(){
$this->load->model('receiver/order/receiver_orders_model','orders_model');
$page = $this->input_param('page');
$size = $this->input_param('size');
!$page && $page = 1;
!$size && $size = 10;
$count = $this->orders_model->get_finsh($this->session['mobile'],'','',1);
$lists = [];
if($count){
$this->load->model("items/items_model");
$this->load->model('receiver/order/receiver_order_agents_model','agents_model');
$rows = $this->orders_model->get_finsh($this->session['mobile'],$page,$size);
//品牌车型
$brand_arr = array_unique(array_column($rows,'brand_id'));
$brands = $this->auto_brand_model->get_map_by_ids($brand_arr,'id,name');
//车系车型
$series_arr = array_unique(array_column($rows,'s_id'));
$series = $this->auto_series_model->get_map_by_ids($series_arr,'id,name');
foreach($rows as $key=>$val){
$item = $this->items_model->get(['id'=>$val['item_id']],'vin');
$agent = $this->agents_model->get(['o_id'=>$val['id']]);
$agent['ins_time'] = $agent['ins_time'] ? date('Y.m.d',strtotime($agent['ins_time'])):'';
$car_json = json_decode($val['car_json'],true);
$color = isset($car_json['color']) ? $car_json['color'] : '';
$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'] : '';
$car_img = [];
if($agent['car_img']){
$car_img[] = build_qiniu_image_url($agent['car_img']);
}
$ins_img = [];
if($agent['ins_img']){
$ins_imgs = json_decode($agent['ins_img']);
foreach($ins_imgs as $key =>$val){
$ins_img[] = build_qiniu_image_url($val);
}
}
$other[] = [
'icon'=>'icon-hangshizheng',
'title'=>'行驶证',
'img'=> $car_img
];
$other[] = [
'icon'=>'icon-baodan',
'title'=>'保单',
'img'=> $ins_img
];
$lists[] = [
'title' => "{$brand_name}{$serie_name}",
'model' => [
'title' => $color['title'],
'img' => $color['jsondata']['img']? build_qiniu_image_url($color['jsondata']['img']):'',
'color' => $color['jsondata']['code']
],
'vincode' => "车架号 {$item['vin']}",
'platenumber' => $agent['car_num'],
'insure' => "{$agent['ins_time']}到期",
'other' => $other
];
}
}
$data = [
'list' => $lists,
'total' => $count
];
return $data;
}
}
+80 -38
View File
@@ -21,6 +21,8 @@ class Cusorder extends Wxapp{
$this->load->model('receiver/receiver_customers_model','customers_model');
$this->load->model('receiver/order/receiver_orders_model','orders_model');
$this->load->model('receiver/order/receiver_order_signs_model','order_signs_model');
$this->load->model('receiver/order/receiver_order_bills_model','order_bills_model');
$this->load->model('receiver/order/receiver_order_deliverys_model','order_deliverys_model');
$this->load->model('auto/auto_series_model');
$this->load->model('auto/auto_brand_model');
$this->load->model('auto/auto_attr_model');
@@ -40,37 +42,39 @@ class Cusorder extends Wxapp{
$cus_id = $this->input_param('cus_id');
$car_id = $this->input_param('car_id');
$color_id = $this->input_param('color_id');
$incolor_id = $this->input_param('incolor_id');
$v_id = $this->input_param('v_id');
$price = $this->input_param('price');
$deposit = $this->input_param('deposit');
$payway = $this->input_param('payway');
$order = $this->orders_model->get(['rid'=>$cus_id]);
if($order){
throw new Exception('该客户订单已存在', ERR_PARAMS_ERROR);
}
$row = $this->customers_model->get(['id'=>$cus_id]);
$series_row = $this->auto_series_model->get(['id'=>$car_id]);
if(!$row || !$series_row){
throw new Exception('参数错误', ERR_PARAMS_ERROR);
}
$where = [
"id in ($v_id,$color_id)" => null
"id in ($v_id,$color_id,$incolor_id)" => null
];
$attr_row = $this->auto_attr_model->map('id','',$where);
if($attr_row[$color_id]){
$color_row = $attr_row[$color_id][0];
$color_row['jsondata'] = json_decode($color_row['jsondata'],true);
}
if($attr_row[$incolor_id]){
$incolor_row = $attr_row[$incolor_id][0];
$incolor_row['jsondata'] = json_decode($incolor_row['jsondata'],true);
}
if($attr_row[$v_id]){
$version_row = $attr_row[$v_id][0];
$version_row['jsondata'] = json_decode($version_row['jsondata'],true);
}
$car_json = [
'c_id' => $color_id,
'inc_id' => $incolor_id,
'v_id' => $v_id,
'color' => isset($color_row) ? $color_row : '',
'incolor' => isset($incolor_row) ? $incolor_row : '',
'version' => isset($version_row) ? $version_row : ''
];
@@ -79,9 +83,12 @@ class Cusorder extends Wxapp{
'sid' => create_order_no(350200,$this->app_key),
'name' => $row['name'],
'mobile' => $row['mobile'],
'biz_id' => $this->session['biz_id'],
'brand_id' => $series_row['brand_id'],
's_id' => $series_row['id'],
'v_id' => $v_id,
'cor_id' => $color_id,
'incor_id' => $incolor_id,
'admin_id' => $this->session['uid'],
'car_json' => json_encode($car_json,JSON_UNESCAPED_UNICODE),
'price' => $price,
@@ -153,30 +160,23 @@ class Cusorder extends Wxapp{
private function lists(){
$group_id = $this->session['group_id'];
$uid = $this->session['uid'];
$biz_id = $this->session['biz_id'];
$keyword = $this->input_param('keyword');
$status = $this->input_param('status');
if($group_id==3){ //掌柜
$where = [];
}elseif($group_id==2){ //店长
$sub_user = $this->app_user_model->select(['pid'=>$uid],'','','','id');
$ids_arr = array_column($sub_user,'id');
$ids_arr[] = $uid;
$ids = implode(',',$ids_arr);
$where = [
"admin_id in ($ids)" => null
];
}else{ //销售
$where = [
'admin_id' => $uid
];
$where = [
'biz_id' => $biz_id
];
if($group_id==1){ //销售
$where ["admin_id = {$uid} or admin_id=0"] = null;
}
if($keyword){
$where["(name={$keyword}) or (mobile={$keyword})"] = null;
}
strlen($status) && $where['status'] = $status;
$fileds = 'id,name,mobile,car_json,brand_id,s_id,deposit,payway,if_cnum,status,c_time';
$fileds = 'id,name,mobile,car_json,brand_id,s_id,deposit,payway,status,c_time';
$count = $this->orders_model->count($where);
$lists = [];
if($count){
@@ -184,22 +184,11 @@ class Cusorder extends Wxapp{
//品牌车型
$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');
$status_arr = $this->orders_model->get_status();
foreach($rows as $key=>$val){
@@ -213,7 +202,7 @@ class Cusorder extends Wxapp{
$other_data = [
'品牌车型' => "{$brand_name}{$serie_name}-{$color}-{$version}",
'付款方式' => $val['payway']?'全款':'分期',
'代办车牌' => $val['if_cnum']?'需要':'不需要',
'代办车牌' => '需要',
'定金金额' => $val['deposit'],
'订单日期' => date('Y-m-d',$val['c_time']),
];
@@ -245,10 +234,21 @@ class Cusorder extends Wxapp{
$color = isset($car_json['color']) ? $car_json['color']['title'] : '';
$version = isset($car_json['version']) ? $car_json['version']['title'] : '';
//贷款信息
$loan_data = [];
if($row['payway'] && $row['status']>=1){
$loan_status = 0;
if(!$row['payway'] && $row['status']>=1){
$this->load->model('receiver/order/receiver_order_loans_model','order_loans_model');
$loan = $this->order_loans_model->get(['o_id'=>$row['id']]);
if($loan){
$loan_data = [
'id' => $loan['id'],
'bank' => $loan['title'],
'year' => $loan['year'],
'money' => $loan['first_price']
];
}
$loan_status = $loan['status']>0 ? 2 : 1;
}
$car_data = [
@@ -258,14 +258,56 @@ class Cusorder extends Wxapp{
'车辆指导价格' => $row['price'],
'定金' => $row['deposit']
];
//开票信息
$bill_status = 0;
$bill_data = [];
if($row['status']>=3){
$bill = $this->order_bills_model->get(['o_id'=>$row['id']]);
if($bill){
$bill_data = [
'id' => $bill['id'],
'carid_a' => $bill['cardidA'] ? build_qiniu_image_url($bill['cardidA']) : '',
'carid_a_path' => $bill['cardidA'] ? $bill['cardidA'] : '',
'carid_b' => $bill['cardidB'] ? build_qiniu_image_url($bill['cardidB']) : '',
'carid_b_path' => $bill['cardidB'] ? $bill['cardidB'] : '',
];
}
$bill_status = $bill['status'] ? 2 : 1;
}
//确认车辆状态
$delivery = $this->order_deliverys_model->get(['o_id'=>$row['id']],'status');
$ckcar_status = 0;
if($row['status']==5&&$delivery['status']==1){
$ckcar_status = 1;
}
$data = [
'id' => $id,
'name' => $row['name'],
'mobile' => mobile_asterisk($row['mobile']),
'admin_img' => 'https://qimg.haodian.cn/liche/2021/07/a6665d32b5dca522/7bc424442bcb05f7.png',
'payway' => $row['payway'],
'car_data' => $car_data,
'loan_data' => $loan_data
'loan_status' => $loan_status,
'loan_data' => $loan_data,
'bill_status' => $bill_status,
'bill_data' => $bill_data,
'ckcar_status' => $ckcar_status
];
return $data;
}
//确认交付
protected function put_ckcar(){
$id = $this->input_param('id');
$row = $this->order_deliverys_model->get(['o_id'=>$id]);
if($row['status']!=1){
throw new Exception('当前不可修改', ERR_PARAMS_ERROR);
}
$result = $this->order_deliverys_model->update(['status'=>2],['id'=>$row['id']]);
if($result){
$this->orders_model->update(['status'=>6],['id'=>$row['o_id']]);
throw new Exception('修改成功', API_CODE_SUCCESS);
}else{
throw new Exception('修改失败', ERR_PARAMS_ERROR);
}
}
}
@@ -31,7 +31,6 @@ class Customerlogs extends Wxapp{
!$size && $size = 20;
$where = [
'uid' => $uid,
'customer_id' => $id
];
$count = $this->customer_oplogs_model->count($where);
@@ -50,7 +49,7 @@ class Customerlogs extends Wxapp{
'total' => $count
];
if($page == 1){ //获取统计数据
$row = $this->customers_model->get(['id'=>$id,'admin_id'=>$uid]);
$row = $this->customers_model->get(['id'=>$id]);
$statistics = [
[
'name' => '去电',
+30 -16
View File
@@ -85,6 +85,7 @@ class Customers extends Wxapp{
}
//创建客户
protected function post(){
$biz_id = $this->session['biz_id'];
$this->load->model('auto/auto_series_model');
$this->load->model('auto/auto_attr_model');
@@ -126,6 +127,7 @@ class Customers extends Wxapp{
$add_data = [
'name' => $name,
'mobile' => $mobile,
'biz_id' => $biz_id,
'brand_id' => $row['brand_id'],
's_id' => $row['id'],
'v_id' => $v_id,
@@ -138,6 +140,9 @@ class Customers extends Wxapp{
$buy_time && $add_data['buy_time'] = date('Y-m-d H:i:s',strtotime($buy_time));
$result = $this->customers_model->add($add_data);
if($result){
$uname = $this->session['uname'];
$this->load->library('receiver/customers_entity');
$this->customers_entity->add_log($result,$this->session['uid'],$uname,"{$uname}】创建客户");
throw new Exception('创建成功', API_CODE_SUCCESS);
}else{
throw new Exception('创建失败', ERR_PARAMS_ERROR);
@@ -153,11 +158,24 @@ class Customers extends Wxapp{
$a_num = $this->input_param('a_num');
$is_top = $this->input_param('is_top');
$row = $this->customers_model->get(['id'=>$id,'admin_id'=>$uid]);
$row = $this->customers_model->get(['id'=>$id]);
if(!$row){
throw new Exception('数据不存在', ERR_PARAMS_ERROR);
}
$up_data = [];
//变成到店
if(!$row['admin_id'] && $status==1){
$res = $this->customers_model->update(['admin_id'=>$uid],['id'=>$id]);
if($res){
$row['admin_id'] = $uid;
//更新线索跟进人
$this->load->model('receiver/receiver_clues_model','clues_model');
$this->clues_model->update(['admin_id'=>$uid,'status'=>2],['id'=>$row['rid']]);
}
}
if($row['admin_id']!=$uid){
throw new Exception('无法操作该客户', ERR_PARAMS_ERROR);
}
strlen($status) && $up_data['status'] = $status;
strlen($is_top) && $up_data['is_top'] = $is_top;
@@ -224,6 +242,7 @@ class Customers extends Wxapp{
private function lists(){
$uid = $this->session['uid'];
$group_id = $this->session['group_id'];
$biz_id = $this->session['biz_id'];
$s_time = $this->input_param('s_time');
$e_time = $this->input_param('e_time');
@@ -236,6 +255,8 @@ class Customers extends Wxapp{
$o_type = $this->input_param('o_type'); //排序
$page = $this->input_param('page');
$size = $this->input_param('size');
$istop = $this->input_param('istop');
$iscall = $this->input_param('iscall');
!$page && $page = 1;
!$size && $size = 10;
@@ -248,31 +269,24 @@ class Customers extends Wxapp{
$orderby = 'is_top desc,id desc';
}
if($group_id==3){ //掌柜
$where = [];
}elseif($group_id==2){ //店长
$sub_user = $this->app_user_model->select(['pid'=>$uid],'','','','id');
$ids_arr = array_column($sub_user,'id');
$ids_arr[] = $uid;
$ids = implode(',',$ids_arr);
$where = [
"admin_id in ($ids)" => null
];
}else{ //销售
$where = [
'admin_id' => $uid
];
$where = [
'biz_id' => $biz_id
];
if($group_id==1){ //销售
$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)));
}
strlen($istop) && $where['is_top'] = $istop;
strlen($if_driver) && $where['if_driver'] = 1;
strlen($status) && $where['status'] = $status;
$level && $where['level'] = $level;
$cfrom && $where['cf_title'] = $cfrom;
$count = $this->customers_model->count($where);
$lists = [];
if($count){
$fileds = 'id,name,admin_id,mobile,level,car_json,is_top,cf_title,brand_id,s_id,c_time';
@@ -60,6 +60,7 @@ class Employees extends Wxapp{
'mobile' => $mobile,
'uname' => $name,
'group_id' => 1,
'biz_id' => $this->session['biz_id'],
'c_time' => time()
];
$result = $this->app_user_model->add($data);
+110
View File
@@ -0,0 +1,110 @@
<?php
defined('WXAPP_APP') OR exit('No direct script access allowed');
/**
* Created by Vim
* Desc: 身份证图片识别
* User: lcc
* Date: 2021/07/16
* Time: 14:08
*/
require_once APPPATH.'controllers/wxapp/Wxapp.php';
class Idcard extends Wxapp{
public function __construct($inputs, $app_key){
parent::__construct($inputs, $app_key);
$this->login_white = array();//登录白名单
$this->check_status = array();//用户状态校验
$this->check_mobile = array();//需要手机号
$this->check_headimg =array();//授权微信信息
$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');
}
protected function put(){
$id = $this->input_param('id');
$cardidA = $this->input_param('cardidA');
$cardidB = $this->input_param('cardidB');
$row = $this->order_bills_model->get(['id'=>$id]);
if(!$row || !$cardidA || !$cardidB){
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'=>''],
];
return $res_data;
}
$userinfo = $result['data'];
$jsondata['cardidA']['data'] = $userinfo;
$update = [
'cardidA' => $cardidA,
'cardidB' => $cardidB,
'c_time' => time()
];
$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);
throw new Exception('修改成功', API_CODE_SUCCESS);
}else{
throw new Exception('修改失败', ERR_PARAMS_ERROR);
}
}
protected function post(){
$oid = $this->input_param('oid');
$cardidA = $this->input_param('cardidA');
$cardidB = $this->input_param('cardidB');
$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){
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'=>''],
];
return $res_data;
}
$userinfo = $result['data'];
$jsondata['cardidA']['data'] = $userinfo;
$add_data = [
'o_id' => $oid,
'cardidA' => $cardidA,
'cardidB' => $cardidB,
'c_time' => time()
];
$jsondata && $update['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);
$data = [
'id' => $l_id,
];
return $data;
}else{
throw new Exception('创建失败', ERR_PARAMS_ERROR);
}
}
}
+63 -3
View File
@@ -1,5 +1,5 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
defined('WXAPP_APP') OR exit('No direct script access allowed');
/**
* Created by Vim
@@ -7,7 +7,8 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* Date: 2021/07/13
* Time: 14:08
*/
class Loan extends CI_Controller{
require_once APPPATH.'controllers/wxapp/Wxapp.php';
class Loan extends Wxapp{
public function __construct($inputs, $app_key){
parent::__construct($inputs, $app_key);
@@ -16,9 +17,11 @@ class Loan extends CI_Controller{
$this->check_status = array();//用户状态校验
$this->check_mobile = array();//需要手机号
$this->check_headimg =array();//授权微信信息
$this->load->model('receiver/order/receiver_order_loans_model','order_loans_model');
$this->load->model('receiver/order/receiver_orders_model','orders_model');
}
public function get(){
protected function get(){
$banks = [
'中国农行'
];
@@ -31,4 +34,61 @@ class Loan extends CI_Controller{
];
return $data;
}
protected function post(){
$oid = $this->input_param('oid');
$bank = $this->input_param('bank');
$year = $this->input_param('year');
$money = $this->input_param('money');
$loan = $this->order_loans_model->count(['o_id'=>$oid]);
if($loan){
throw new Exception('创建失败', ERR_PARAMS_ERROR);
}
$row = $this->orders_model->get(['id'=>$oid]);
if(!$row || !$bank || !$year || !$money){
throw new Exception('参数错误', ERR_PARAMS_ERROR);
}
$add_data = [
'o_id' => $oid,
'title' => $bank,
'year' => $year,
'first_price' => $money
];
$l_id = $this->order_loans_model->add($add_data);
if($l_id){
$data = [
'id' => $l_id,
'bank' => $bank,
'year' => $year,
'money' => $money
];
return $data;
}else{
throw new Exception('创建失败', ERR_PARAMS_ERROR);
}
}
protected function put(){
$id = $this->input_param('id');
$bank = $this->input_param('bank');
$year = $this->input_param('year');
$money = $this->input_param('money');
$row = $this->order_loans_model->get(['id'=>$id]);
if(!$row){
throw new Exception('数据不存在', ERR_PARAMS_ERROR);
}
$update = [
'title' => $bank,
'year' => $year,
'first_price' => $money
];
$result = $this->order_loans_model->update($update,['id'=>$id]);
if($result){
throw new Exception('修改成功', API_CODE_SUCCESS);
}else{
throw new Exception('修改失败', ERR_PARAMS_ERROR);
}
}
}
+16 -6
View File
@@ -15,6 +15,7 @@ class Protocol extends CI_Controller{
$this->load->model('receiver/order/receiver_order_contracts_model','contracts_model');
$this->load->model('auto/auto_series_model');
$this->load->model('auto/auto_brand_model');
$this->load->model("items/items_model");
}
//整车合同
@@ -35,7 +36,7 @@ class Protocol extends CI_Controller{
$row['day'] = $contract ? date('Y年m月d日',$contract['c_time']):date('Y年m月d日');
$row['price_rmb'] = num_to_rmb($row['price']);
$row['cid'] = $contract['cid'];
$folder = $wxapp ? 'protocol' : 'pdf2img';
$folder = $wxapp ? 'protocol' : 'html2pdf';
$this->load->view("wxapp/licheb/{$folder}/car",$row);
}
@@ -47,7 +48,7 @@ class Protocol extends CI_Controller{
$contract = $this->contracts_model->get(['o_id'=>$id,'type'=>1]);
$row['day'] = $contract ? date('Y年m月d日',$contract['c_time']):date('Y年m月d日');
$row['cid'] = $contract['cid'];
$folder = $wxapp ? 'protocol' : 'pdf2img';
$folder = $wxapp ? 'protocol' : 'html2pdf';
$this->load->view("wxapp/licheb/{$folder}/agent",$row);
}
//车辆信息确认单
@@ -64,11 +65,11 @@ class Protocol extends CI_Controller{
$row['brand_name'] = $brand['name'].$series['name'].' '.$version;
}
$contract = $this->contracts_model->get(['o_id'=>$id,'type'=>2]);
$ck_row = $this->ckcars_model->get(['o_id'=>$id],'vin');
$items = $this->items_model->get(['id'=>$row['item_id']],'vin');
$row['day'] = $contract ? date('Y年m月d日',$contract['c_time']):date('Y年m月d日');
$row['cid'] = $contract['cid'];
$row['vin'] = $ck_row['vin'];
$folder = $wxapp ? 'protocol' : 'pdf2img';
$row['vin'] = $items['vin'];
$folder = $wxapp ? 'protocol' : 'html2pdf';
$this->load->view("wxapp/licheb/{$folder}/car_ck",$row);
}
//车辆交接信息
@@ -76,8 +77,16 @@ class Protocol extends CI_Controller{
$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]);
$contract = $this->contracts_model->get(['o_id'=>$id,'type'=>3]);
$items = $this->items_model->get(['id'=>$row['item_id']],'vin');
if($row){
//贷款
if(!$row['payway']){
$row['loan'] = $this->loans_model->get(['o_id'=>$id]);
}
$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);
@@ -88,7 +97,8 @@ class Protocol extends CI_Controller{
}
$row['day'] = $contract ? date('Y年m月d日',$contract['c_time']):date('Y年m月d日');
$row['cid'] = $contract['cid'];
$folder = $wxapp ? 'protocol' : 'pdf2img';
$row['vin'] = $items['vin'];
$folder = $wxapp ? 'protocol' : 'html2pdf';
$this->load->view("wxapp/licheb/{$folder}/car_fh",$row);
}
}
+24 -1
View File
@@ -54,10 +54,13 @@ class Sms extends Wxapp{
$id = $this->input_param('id');
$content = $this->input_param('content');
$row = $this->customers_model->get(['id'=>$id,'admin_id'=>$uid]);
$row = $this->customers_model->get(['id'=>$id]);
if(!$row || !$content){
throw new Exception('参数错误', ERR_PARAMS_ERROR);
}
if($row['admin_id']!=$uid){
throw new Exception('该客户不可操作', ERR_PARAMS_ERROR);
}
$mobile = $row['mobile'];
$content = '【狸车】'.$content;
b2m_send_sms($mobile,$content);
@@ -66,4 +69,24 @@ class Sms extends Wxapp{
$this->customers_entity->add_log($id,$uid,$this->session['uname'],$log,1);
throw new Exception('短信发送成功', API_CODE_SUCCESS);
}
//通过订单发短信
protected function post_cusorder(){
$this->load->model('receiver/order/receiver_orders_model','orders_model');
$uid = $this->session['uid'];
$id = $this->input_param('id');
$content = $this->input_param('content');
$row = $this->orders_model->get(['id'=>$id,'admin_id'=>$uid]);
if(!$row || !$content){
throw new Exception('参数错误', ERR_PARAMS_ERROR);
}
$mobile = $row['mobile'];
$content = '【狸车】'.$content;
b2m_send_sms($mobile,$content);
$this->load->library('receiver/orders_entity');
$log = '发送短信+1';
$this->orders_entity->add_log($id,$uid,$this->session['uname'],$log,1);
throw new Exception('短信发送成功', API_CODE_SUCCESS);
}
}
+20
View File
@@ -92,4 +92,24 @@ class User extends Wxapp{
return $data;
}
/**
* 统计数据
*/
protected function get_cal(){
$uid = $this->session['uid'];
$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]);
$data = [
'wl_count' => $wl_count,
'gz_count' => $gz_count,
'sign_count' => $sign_count,
'loan_count' => $loan_count
];
return $data;
}
}
+1 -1
View File
@@ -55,7 +55,7 @@
<div>日期:<?=$day?></div>
</td>
<td style="width:40%;">
<div>乙方(盖章</div>
<div>乙方(签名</div>
<div>日期:<?=$day?></div>
</td>
</tr>
+1 -1
View File
@@ -85,7 +85,7 @@
<div>日期:<?=$day?></div>
</td>
<td style="width:40%;">
<div>乙方(盖章</div>
<div>乙方(签名</div>
<div>日期:<?=$day?></div>
</td>
</tr>
+1 -1
View File
@@ -19,7 +19,7 @@
<div>日期:<?=$day?></div>
</td>
<td style="width:40%;">
<div>乙方(盖章</div>
<div>乙方(签名</div>
<div>日期:<?=$day?></div>
</td>
</tr>
+5 -5
View File
@@ -15,7 +15,7 @@
<table style="width:100%;">
<tr>
<td style="width:50%;">
身份证:350XXXXXXXXXXXXX
身份证:
</td>
<td style="width:50%;">
联系电话:<?=$mobile?>
@@ -36,10 +36,10 @@
</tr>
<tr>
<td style="width:50%;">
车身号:
车身号:<?=$vin?>
</td>
<td style="width:50%;">
车牌号:
车牌号:<?=$agent['car_num']?>
</td>
</tr>
</table>
@@ -58,10 +58,10 @@
<?if(!$payway){?>
<tr>
<td style="width:50%;">
按揭银行:农业银行
按揭银行:<?=$loan['title']?>
</td>
<td style="width:50%;">
贷款期数:36
贷款期数:<?=$loan['year']*12?>
</td>
</tr>
<?}?>
+1 -1
View File
@@ -36,7 +36,7 @@
<div>日期:<?=$day?></div>
</td>
<td style="width:50%;">
<div>乙方(盖章</div>
<div>乙方(签名</div>
<div>日期:<?=$day?></div>
</td>
</tr>
+1 -1
View File
@@ -89,7 +89,7 @@
<div>日期:<?=$day?></div>
</td>
<td style="width:50%;">
<div>乙方(盖章</div>
<div>乙方(签名</div>
<div>日期:<?=$day?></div>
</td>
</tr>
+1 -1
View File
@@ -23,7 +23,7 @@
<div>日期:<?=$day?></div>
</td>
<td style="width:50%;">
<div>乙方(盖章</div>
<div>乙方(签名</div>
<div>日期:<?=$day?></div>
</td>
</tr>
+5 -5
View File
@@ -19,7 +19,7 @@
<table style="width:100%;">
<tr>
<td style="width:50%;">
身份证:350XXXXXXXXXXXXX
身份证:
</td>
<td style="width:50%;">
联系电话:<?=$mobile?>
@@ -40,10 +40,10 @@
</tr>
<tr>
<td style="width:50%;">
车身号:
车身号:<?=$vin?>
</td>
<td style="width:50%;">
车牌号:
车牌号:<?=$agent['car_num']?>
</td>
</tr>
</table>
@@ -62,10 +62,10 @@
<?if(!$payway){?>
<tr>
<td style="width:50%;">
按揭银行:农业银行
按揭银行:<?=$loan['title']?>
</td>
<td style="width:50%;">
贷款期数:36
贷款期数:<?=$loan['year']*12?>
</td>
</tr>
<?}?>
+2 -1
View File
@@ -1,5 +1,6 @@
{
"require": {
"gregwar/image": "^2.1"
"gregwar/image": "^2.1",
"tencentcloud/ocr": "^3.0"
}
}
+797 -1
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "5399d8ff7664d8e39081f1096a99aeef",
"content-hash": "6f7afccbfb645077ee3dcb371ebf6039",
"packages": [
{
"name": "gregwar/cache",
@@ -112,6 +112,802 @@
"image"
],
"time": "2021-02-17T16:00:53+00:00"
},
{
"name": "guzzlehttp/guzzle",
"version": "6.5.5",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
"reference": "9d4290de1cfd701f38099ef7e183b64b4b7b0c5e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/9d4290de1cfd701f38099ef7e183b64b4b7b0c5e",
"reference": "9d4290de1cfd701f38099ef7e183b64b4b7b0c5e",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"ext-json": "*",
"guzzlehttp/promises": "^1.0",
"guzzlehttp/psr7": "^1.6.1",
"php": ">=5.5",
"symfony/polyfill-intl-idn": "^1.17.0"
},
"require-dev": {
"ext-curl": "*",
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0",
"psr/log": "^1.1"
},
"suggest": {
"psr/log": "Required for using the Log middleware"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "6.5-dev"
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\": "src/"
},
"files": [
"src/functions_include.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
}
],
"description": "Guzzle is a PHP HTTP client library",
"homepage": "http://guzzlephp.org/",
"keywords": [
"client",
"curl",
"framework",
"http",
"http client",
"rest",
"web service"
],
"time": "2020-06-16T21:01:06+00:00"
},
{
"name": "guzzlehttp/promises",
"version": "1.4.1",
"source": {
"type": "git",
"url": "https://github.com/guzzle/promises.git",
"reference": "8e7d04f1f6450fef59366c399cfad4b9383aa30d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/promises/zipball/8e7d04f1f6450fef59366c399cfad4b9383aa30d",
"reference": "8e7d04f1f6450fef59366c399cfad4b9383aa30d",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=5.5"
},
"require-dev": {
"symfony/phpunit-bridge": "^4.4 || ^5.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4-dev"
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\Promise\\": "src/"
},
"files": [
"src/functions_include.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
}
],
"description": "Guzzle promises library",
"keywords": [
"promise"
],
"time": "2021-03-07T09:25:29+00:00"
},
{
"name": "guzzlehttp/psr7",
"version": "1.8.2",
"source": {
"type": "git",
"url": "https://github.com/guzzle/psr7.git",
"reference": "dc960a912984efb74d0a90222870c72c87f10c91"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/dc960a912984efb74d0a90222870c72c87f10c91",
"reference": "dc960a912984efb74d0a90222870c72c87f10c91",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=5.4.0",
"psr/http-message": "~1.0",
"ralouphie/getallheaders": "^2.0.5 || ^3.0.0"
},
"provide": {
"psr/http-message-implementation": "1.0"
},
"require-dev": {
"ext-zlib": "*",
"phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.10"
},
"suggest": {
"laminas/laminas-httphandlerrunner": "Emit PSR-7 responses"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.7-dev"
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\Psr7\\": "src/"
},
"files": [
"src/functions_include.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
{
"name": "Tobias Schultze",
"homepage": "https://github.com/Tobion"
}
],
"description": "PSR-7 message implementation that also provides common utility methods",
"keywords": [
"http",
"message",
"psr-7",
"request",
"response",
"stream",
"uri",
"url"
],
"time": "2021-04-26T09:17:50+00:00"
},
{
"name": "paragonie/random_compat",
"version": "v2.0.20",
"source": {
"type": "git",
"url": "https://github.com/paragonie/random_compat.git",
"reference": "0f1f60250fccffeaf5dda91eea1c018aed1adc2a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/0f1f60250fccffeaf5dda91eea1c018aed1adc2a",
"reference": "0f1f60250fccffeaf5dda91eea1c018aed1adc2a",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=5.2.0"
},
"require-dev": {
"phpunit/phpunit": "4.*|5.*"
},
"suggest": {
"ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
},
"type": "library",
"autoload": {
"files": [
"lib/random.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Paragon Initiative Enterprises",
"email": "security@paragonie.com",
"homepage": "https://paragonie.com"
}
],
"description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
"keywords": [
"csprng",
"polyfill",
"pseudorandom",
"random"
],
"time": "2021-04-17T09:33:01+00:00"
},
{
"name": "psr/http-message",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-message.git",
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for HTTP messages",
"homepage": "https://github.com/php-fig/http-message",
"keywords": [
"http",
"http-message",
"psr",
"psr-7",
"request",
"response"
],
"time": "2016-08-06T14:39:51+00:00"
},
{
"name": "ralouphie/getallheaders",
"version": "3.0.3",
"source": {
"type": "git",
"url": "https://github.com/ralouphie/getallheaders.git",
"reference": "120b605dfeb996808c31b6477290a714d356e822"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822",
"reference": "120b605dfeb996808c31b6477290a714d356e822",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=5.6"
},
"require-dev": {
"php-coveralls/php-coveralls": "^2.1",
"phpunit/phpunit": "^5 || ^6.5"
},
"type": "library",
"autoload": {
"files": [
"src/getallheaders.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ralph Khattar",
"email": "ralph.khattar@gmail.com"
}
],
"description": "A polyfill for getallheaders.",
"time": "2019-03-08T08:55:37+00:00"
},
{
"name": "symfony/polyfill-intl-idn",
"version": "v1.19.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-idn.git",
"reference": "4ad5115c0f5d5172a9fe8147675ec6de266d8826"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/4ad5115c0f5d5172a9fe8147675ec6de266d8826",
"reference": "4ad5115c0f5d5172a9fe8147675ec6de266d8826",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=5.3.3",
"symfony/polyfill-intl-normalizer": "^1.10",
"symfony/polyfill-php70": "^1.10",
"symfony/polyfill-php72": "^1.10"
},
"suggest": {
"ext-intl": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.19-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Intl\\Idn\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Laurent Bassin",
"email": "laurent@bassin.info"
},
{
"name": "Trevor Rowbotham",
"email": "trevor.rowbotham@pm.me"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"idn",
"intl",
"polyfill",
"portable",
"shim"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-10-21T09:57:48+00:00"
},
{
"name": "symfony/polyfill-intl-normalizer",
"version": "v1.19.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-normalizer.git",
"reference": "8db0ae7936b42feb370840cf24de1a144fb0ef27"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8db0ae7936b42feb370840cf24de1a144fb0ef27",
"reference": "8db0ae7936b42feb370840cf24de1a144fb0ef27",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=5.3.3"
},
"suggest": {
"ext-intl": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.19-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Intl\\Normalizer\\": ""
},
"files": [
"bootstrap.php"
],
"classmap": [
"Resources/stubs"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for intl's Normalizer class and related functions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"intl",
"normalizer",
"polyfill",
"portable",
"shim"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-10-23T09:01:57+00:00"
},
{
"name": "symfony/polyfill-php70",
"version": "v1.19.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php70.git",
"reference": "3fe414077251a81a1b15b1c709faf5c2fbae3d4e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/3fe414077251a81a1b15b1c709faf5c2fbae3d4e",
"reference": "3fe414077251a81a1b15b1c709faf5c2fbae3d4e",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"paragonie/random_compat": "~1.0|~2.0|~9.99",
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.19-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Php70\\": ""
},
"files": [
"bootstrap.php"
],
"classmap": [
"Resources/stubs"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"polyfill",
"portable",
"shim"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-10-23T09:01:57+00:00"
},
{
"name": "symfony/polyfill-php72",
"version": "v1.19.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php72.git",
"reference": "beecef6b463b06954638f02378f52496cb84bacc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/beecef6b463b06954638f02378f52496cb84bacc",
"reference": "beecef6b463b06954638f02378f52496cb84bacc",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.19-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Php72\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"polyfill",
"portable",
"shim"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-10-23T09:01:57+00:00"
},
{
"name": "tencentcloud/common",
"version": "3.0.436",
"source": {
"type": "git",
"url": "https://github.com/tencentcloud-sdk-php/common.git",
"reference": "8e1742f06287accfd173141a919d3460d097ac03"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/tencentcloud-sdk-php/common/zipball/8e1742f06287accfd173141a919d3460d097ac03",
"reference": "8e1742f06287accfd173141a919d3460d097ac03",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"guzzlehttp/guzzle": "^6.3||^7.0",
"guzzlehttp/psr7": "^1.4",
"php": ">=5.6.0"
},
"type": "library",
"autoload": {
"psr-4": {
"TencentCloud\\": "./src/TencentCloud"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "tencentcloudapi",
"email": "tencentcloudapi@tencent.com",
"homepage": "https://cloud.tencent.com/document/sdk/PHP",
"role": "Developer"
}
],
"description": "TencentCloudApi php sdk",
"homepage": "https://github.com/tencentcloud-sdk-php/common",
"time": "2021-07-16T01:04:49+00:00"
},
{
"name": "tencentcloud/ocr",
"version": "3.0.436",
"source": {
"type": "git",
"url": "https://github.com/tencentcloud-sdk-php/ocr.git",
"reference": "3158bf1b0d4c89ca0623d0c4eda76a4a8eba656b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/tencentcloud-sdk-php/ocr/zipball/3158bf1b0d4c89ca0623d0c4eda76a4a8eba656b",
"reference": "3158bf1b0d4c89ca0623d0c4eda76a4a8eba656b",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"tencentcloud/common": "3.0.436"
},
"type": "library",
"autoload": {
"psr-4": {
"TencentCloud\\": "./src/TencentCloud"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "tencentcloudapi",
"email": "tencentcloudapi@tencent.com",
"homepage": "https://github.com/tencentcloud-sdk-php/ocr",
"role": "Developer"
}
],
"description": "TencentCloudApi php sdk ocr",
"homepage": "https://github.com/tencentcloud-sdk-php/ocr",
"time": "2021-07-16T01:13:52+00:00"
}
],
"packages-dev": [],
+83
View File
@@ -0,0 +1,83 @@
<?php
/**
* Created by Vim
* User: lcc
* Desc: 阿里云图片识别
* Date: 2021-07-16
* Time: 16:49
*/
defined('BASEPATH') OR exit('No direct script access allowed');
use AlibabaCloud\Client\AlibabaCloud;
use AlibabaCloud\Client\Exception\ClientException;
use AlibabaCloud\Client\Exception\ServerException;
class AliOrc{
private $accessKeyId;
private $accessKeySecret;
private $ci;
private $dir;
private $log_file = 'error.log';
public function __construct($accessKeyId='',$accessKeySecret=''){
if($accessKeyId && $accessKeySecret){
$this->accessKeyId = $accessKeyId;
$this->accessKeySecret = $accessKeySecret;
}else{
$this->accessKeyId = 'LTAI5t9utLGSVTtVTCw8Ts2k';
$this->accessKeySecret = 'U1dwYSkV1X42APP3IwqggyhemMfPtu';
}
$this->ci = & get_instance();
$this->dir = 'aliorc';
}
/**
* 身份证识别
* Desc: 阿里云官方地址:https://help.aliyun.com/document_detail/151899.htm?spm=a2c4g.11186623.2.7.31e276d9S794pF&accounttraceid=08df74bec8b54e9d8c4c3f8728cc714bppvo#doc-api-ocr-RecognizeIdentityCard
* @param $imageUrl string 身份证图片地址
* @param $side string 省份证正反面 (face 正面 back 反面)
* @param return array 返回值参考官方文档
*/
public function IdentityCard($imageUrl,$side='face'){
//dev测试
$this->ci->load->library('mycurl');
$debug_url = 'http://104.194.86.23:8888';
$params = [
'imageUrl' => $imageUrl,
'side' => $side
];
$result = $this->ci->mycurl->httpGet($debug_url,$params);
$result = json_decode($result,true);
return $result;
//end dev测试
AlibabaCloud::accessKeyClient($this->accessKeyId, $this->accessKeySecret)
->regionId('cn-shanghai')
->asDefaultClient();
try {
$options = [
'query' => [
'ImageURL'=> $imageUrl,
'Side' => $side
]
];
$result = AlibabaCloud::rpc()
->product('ocr')
->scheme('http')
->version('2019-12-30')
->action('RecognizeIdentityCard')
->method('POST')
->host('ocr.cn-shanghai.aliyuncs.com')
->options($options)
->request();
$data = $result->toArray();
debug_log(json_encode($data,JSON_UNESCAPED_UNICODE),'success.log',$this->dir);
return ['code'=>1,'data'=>$data['Data']];
} catch (ClientException $e) {
debug_log($e->getErrorMessage,$this->log_file,$this->dir);
return ['code'=>0,'msg'=>$e->getErrorMessage];
} catch (ServerException $e) {
debug_log($e->getErrorMessage,$this->log_file,$this->dir);
return ['code'=>0,'msg'=>$e->getErrorMessage];
}
}
}
+86
View File
@@ -0,0 +1,86 @@
<?php
/**
* Created by Vim
* User: lcc
* Desc: 腾讯云图片识别
* Date: 2021-07-20
* Time: 16:49
*/
defined('BASEPATH') OR exit('No direct script access allowed');
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 TcOrc{
private $accessKeyId;
private $accessKeySecret;
private $ci;
private $dir;
private $log_file = 'error.log';
public function __construct($accessKeyId='',$accessKeySecret=''){
if($accessKeyId && $accessKeySecret){
$this->accessKeyId = $accessKeyId;
$this->accessKeySecret = $accessKeySecret;
}else{
$this->accessKeyId = 'AKIDMXS7WhbEdlcCWZMs75mDNHuIPHsCF2Yn';
$this->accessKeySecret = 'zh8JDpAF3bOvCCvNYS5RXLs87pGQKxJO';
}
$this->ci = & get_instance();
$this->dir = 'tcorc';
}
/**
* 身份证识别
* Desc: 腾讯官方地址:https://cloud.tencent.com/document/product/866/33524
* @param $imageUrl string 身份证图片地址
* @param $CardSide string 省份证正反面 (FRONT 正面 BACK 反面)
* @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;
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 IDCardOCRRequest();
$params = array(
"ImageUrl" => $imageUrl,
"CardSide" => $CardSide
);
$req->fromJsonString(json_encode($params));
$resp = $client->IDCardOCR($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'=>'识别失败'];
}
}
}
@@ -19,8 +19,9 @@ class Customers_entity{
* @param $uname int 操作用户名
* @param $content string 日志内容
* @param $type int 操作类型 (0普通日志 1短信 2拨打电话)
* @param $cf_platform string 来源 (wxapp小程序 admin后台)
*/
public function add_log($customer_id,$uid,$uname,$content,$type=''){
public function add_log($customer_id,$uid,$uname,$content,$type='',$cf_platform='wxapp'){
$this->ci->load->model('receiver/receiver_customer_oplogs_model','customer_oplogs_model');
$add_data = [
'customer_id' => $customer_id,
+57 -2
View File
@@ -22,22 +22,26 @@ class Orders_entity{
switch($type){
case 0;
$path = '/wxapp/licheb/protocol/car';
$title = '车辆整车合同';
break;
case 1:
$path = '/wxapp/licheb/protocol/agent';
$title = '委托代理服务协议';
break;
case 2:
$path = '/wxapp/licheb/protocol/car_ck';
$title = '车辆信息确认单';
break;
case 3:
$path = '/wxapp/licheb/protocol/car_fn';
$path = '/wxapp/licheb/protocol/car_fh';
$title = '车辆交接信息';
break;
default:
}
if($path){
$res = $url.$path.'?id='.$id.'&wxapp='.$wxapp;
}
return $res;
return [$res,$title];
}
/**
@@ -86,6 +90,57 @@ class Orders_entity{
$result = $this->ci->order_purchase_model->add($add_data);
return $result;
}
/*
* 获取签名图片
* @param $oid int 订单id
* @param $type array 类型
*/
public function get_sign_imgs($oid,$type){
$this->ci->load->model('receiver/order/receiver_order_contracts_model');
$where = [
'o_id' => $oid,
'status' => 1
];
$types = implode(',',$type);
if($types){
$where["type in ($types)"] = null;
}
$contracts = $this->ci->receiver_order_contracts_model->select($where,'type asc','','','imgs');
$data = [];
if($contracts){
foreach($contracts as $key => $val){
$imgs = json_decode($val['imgs'],true);
foreach($imgs as $item){
$data[] = build_qiniu_image_url($item);
}
}
}
return $data;
}
/**
* 更新订单用户信息
* @param $oid int 订单id
* @param $info array() 腾讯云识别返回参数
*/
public function up_info($oid,$info){
$this->ci->load->model('receiver/order/receiver_orders_model','orders_model');
$row = $this->ci->orders_model->get(['id'=>$oid]);
if(!$row){
return false;
}
$info_json = json_decode($row['info_json'],true);
$info['Name'] && $info_json['name'] = $info['Name'];
$info['Sex'] && $info_json['sex'] = $info['Sex'];
$info['Nation'] && $info_json['nation'] = $info['Nation'];
$info['Birth'] && $info_json['birth'] = date('Y-m-d',strtotime($info['Birth']));
$info['Address'] && $info_json['address'] = $info['Address'];
$info['IdNum'] && $info_json['cardid'] = $info['IdNum'];
$update = [
'info_json' => json_encode($info_json,JSON_UNESCAPED_UNICODE)
];
$result = $this->ci->orders_model->update($update,['id'=>$row['id']]);
return $result;
}
}
?>
+1
View File
@@ -26,6 +26,7 @@ class Auto_attr_model extends HD_Model{
{
$rows = [];
if ($ids) {
$ids = array_filter($ids);
$cf_ids = implode(',', $ids);
$where = [
"id in ($cf_ids)" => null
+1
View File
@@ -28,6 +28,7 @@ class Auto_brand_model extends HD_Model
{
$rows = [];
if ($ids) {
$ids = array_filter($ids);
$cf_ids = implode(',', $ids);
$where = [
"id in ($cf_ids)" => null
+2 -1
View File
@@ -26,6 +26,7 @@ class Auto_series_model extends HD_Model{
{
$rows = [];
if ($ids) {
$ids = array_filter($ids);
$cf_ids = implode(',', $ids);
$where = [
"id in ($cf_ids)" => null
@@ -61,6 +62,6 @@ class Auto_series_model extends HD_Model{
}
$this->db->limit($limit, $offset);
return $this->db->get()->result_array();
}
}
@@ -24,6 +24,7 @@ class Receiver_clues_cfrom_model extends HD_Model
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
@@ -12,9 +12,14 @@ class Receiver_clues_model extends HD_Model
{
private $table_name = 'lc_receiver_clues';
private $status_arr = [ 0 => '待处理',1 => '已处理',2 => '跟进中',3 => '无效线索'];
public function __construct()
{
parent::__construct($this->table_name, 'default');
}
public function get_status(){
return $this->status_arr;
}
}
@@ -1,35 +0,0 @@
<?php
/**
* Created by Vim
* User: lcc
* Date: 2021/06/29
* Time: 13:47
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Receiver_status_model extends HD_Model
{
private $table_name = 'lc_receiver_status';
public function __construct()
{
parent::__construct($this->table_name, 'default');
}
/**
* 根据id获取数据
* @param array() $ids
*/
public function get_map_by_ids($ids,$fileds=''){
$rows = [];
if($ids){
$cf_ids = implode(',',$ids);
$where = [
"id in ($cf_ids)" => null
];
$rows = $this->map('id','',$where,'','','',$fileds);
}
return $rows;
}
}
@@ -0,0 +1,54 @@
<?php
/**
* Created by Vim
* User: lcc
* Date: 2021/07/14
* Time: 10:47
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Receiver_order_agents_model extends HD_Model
{
private $table_name = 'lc_receiver_order_agents';
private $status_arr = [ 0 => '代办中', 1 => '已完成代办'];
public function __construct()
{
parent::__construct($this->table_name, 'default');
}
public function count_order($where){
return $this->select_order($where,'','','','',1);
}
public function select_order($where = array(), $order = '', $page = 0, $page_size = 20 , $fileds = '', $count = 0){
!$fileds && $fileds = 'lc_receiver_orders.*';
$this->db->select($fileds);
$this->db->from('lc_receiver_order_agents');
$this->db->join('lc_receiver_orders', 'lc_receiver_orders.id = lc_receiver_order_agents.o_id','left');
if ($where) {
$this->db->where($where);
}
if ($count) {
return $this->db->count_all_results();
}
if ($order) {
$this->db->order_by($order);
}
if ($page) {
$offset = ($page - 1) * $page_size;
$limit = $page_size;
} else {
$offset = null;
$limit = null;
}
$this->db->limit($limit, $offset);
return $this->db->get()->result_array();
}
//获取状态
public function get_status(){
return $this->status_arr;
}
}
@@ -0,0 +1,54 @@
<?php
/**
* Created by Vim
* User: lcc
* Date: 2021/07/14
* Time: 10:47
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Receiver_order_bills_model extends HD_Model
{
private $table_name = 'lc_receiver_order_bills';
private $status_arr = [ 0 => '未开票', 1 => '已开票'];
public function __construct()
{
parent::__construct($this->table_name, 'default');
}
public function count_order($where){
return $this->select_order($where,'','','','',1);
}
public function select_order($where = array(), $order = '', $page = 0, $page_size = 20 , $fileds = '', $count = 0){
!$fileds && $fileds = 'lc_receiver_orders.*';
$this->db->select($fileds);
$this->db->from('lc_receiver_order_bills');
$this->db->join('lc_receiver_orders', 'lc_receiver_orders.id = lc_receiver_order_bills.o_id','left');
if ($where) {
$this->db->where($where);
}
if ($count) {
return $this->db->count_all_results();
}
if ($order) {
$this->db->order_by($order);
}
if ($page) {
$offset = ($page - 1) * $page_size;
$limit = $page_size;
} else {
$offset = null;
$limit = null;
}
$this->db->limit($limit, $offset);
return $this->db->get()->result_array();
}
//获取状态
public function get_status(){
return $this->status_arr;
}
}
@@ -11,10 +11,44 @@ defined('BASEPATH') OR exit('No direct script access allowed');
class Receiver_order_ckcars_model extends HD_Model
{
private $table_name = 'lc_receiver_order_ckcars';
private $status_arr = [ 0 => '车辆确认中',1 => '用户未签名',2=>'已确认'];
public function __construct()
{
parent::__construct($this->table_name, 'default');
}
public function count_order($where){
return $this->select_order($where,'','','','',1);
}
public function select_order($where = array(), $order = '', $page = 0, $page_size = 20 , $fileds = '', $count = 0){
!$fileds && $fileds = 'lc_receiver_orders.*';
$this->db->select($fileds);
$this->db->from('lc_receiver_order_ckcars');
$this->db->join('lc_receiver_orders', 'lc_receiver_orders.id = lc_receiver_order_ckcars.o_id','left');
if ($where) {
$this->db->where($where);
}
if ($count) {
return $this->db->count_all_results();
}
if ($order) {
$this->db->order_by($order);
}
if ($page) {
$offset = ($page - 1) * $page_size;
$limit = $page_size;
} else {
$offset = null;
$limit = null;
}
$this->db->limit($limit, $offset);
return $this->db->get()->result_array();
}
//获取状态
public function get_status(){
return $this->status_arr;
}
}
@@ -0,0 +1,54 @@
<?php
/**
* Created by Vim
* User: lcc
* Date: 2021/07/14
* Time: 10:47
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Receiver_order_deliverys_model extends HD_Model
{
private $table_name = 'lc_receiver_order_deliverys';
private $status_arr = [ 0 => '待用户确认', 1 => '用户已确认',2=> '销售已确认'];
public function __construct()
{
parent::__construct($this->table_name, 'default');
}
public function count_order($where){
return $this->select_order($where,'','','','',1);
}
public function select_order($where = array(), $order = '', $page = 0, $page_size = 20 , $fileds = '', $count = 0){
!$fileds && $fileds = 'lc_receiver_orders.*';
$this->db->select($fileds);
$this->db->from('lc_receiver_order_deliverys');
$this->db->join('lc_receiver_orders', 'lc_receiver_orders.id = lc_receiver_order_deliverys.o_id','left');
if ($where) {
$this->db->where($where);
}
if ($count) {
return $this->db->count_all_results();
}
if ($order) {
$this->db->order_by($order);
}
if ($page) {
$offset = ($page - 1) * $page_size;
$limit = $page_size;
} else {
$offset = null;
$limit = null;
}
$this->db->limit($limit, $offset);
return $this->db->get()->result_array();
}
//获取状态
public function get_status(){
return $this->status_arr;
}
}
@@ -11,10 +11,44 @@ defined('BASEPATH') OR exit('No direct script access allowed');
class Receiver_order_loans_model extends HD_Model
{
private $table_name = 'lc_receiver_order_loans';
private $status_arr = [ 0 => '审核中',1 => '已放款'];
public function __construct()
{
parent::__construct($this->table_name, 'default');
}
public function count_order($where){
return $this->select_order($where,'','','','',1);
}
public function select_order($where = array(), $order = '', $page = 0, $page_size = 20 , $fileds = '', $count = 0){
!$fileds && $fileds = 'lc_receiver_orders.*';
$this->db->select($fileds);
$this->db->from('lc_receiver_order_loans');
$this->db->join('lc_receiver_orders', 'lc_receiver_orders.id = lc_receiver_order_loans.o_id','left');
if ($where) {
$this->db->where($where);
}
if ($count) {
return $this->db->count_all_results();
}
if ($order) {
$this->db->order_by($order);
}
if ($page) {
$offset = ($page - 1) * $page_size;
$limit = $page_size;
} else {
$offset = null;
$limit = null;
}
$this->db->limit($limit, $offset);
return $this->db->get()->result_array();
}
//获取状态
public function get_status(){
return $this->status_arr;
}
}
@@ -0,0 +1,20 @@
<?php
/**
* Created by Vim
* User: lcc
* Date: 2021/06/29
* Time: 13:47
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Receiver_order_oplogs_model extends HD_Model
{
private $table_name = 'lc_receiver_order_oplogs';
public function __construct()
{
parent::__construct($this->table_name, 'default');
}
}
@@ -11,10 +11,44 @@ defined('BASEPATH') OR exit('No direct script access allowed');
class Receiver_order_signs_model extends HD_Model
{
private $table_name = 'lc_receiver_order_signs';
private $status_arr = [ 0 => '未签合同',1 => '已签合同',2 => '已预交款'];
public function __construct()
{
parent::__construct($this->table_name, 'default');
}
public function count_order($where){
return $this->select_order($where,'','','','',1);
}
public function select_order($where = array(), $order = '', $page = 0, $page_size = 20 , $fileds = '', $count = 0){
!$fileds && $fileds = 'lc_receiver_orders.*';
$this->db->select($fileds);
$this->db->from('lc_receiver_order_signs');
$this->db->join('lc_receiver_orders', 'lc_receiver_orders.id = lc_receiver_order_signs.o_id','left');
if ($where) {
$this->db->where($where);
}
if ($count) {
return $this->db->count_all_results();
}
if ($order) {
$this->db->order_by($order);
}
if ($page) {
$offset = ($page - 1) * $page_size;
$limit = $page_size;
} else {
$offset = null;
$limit = null;
}
$this->db->limit($limit, $offset);
return $this->db->get()->result_array();
}
//获取状态
public function get_status(){
return $this->status_arr;
}
}
@@ -12,13 +12,66 @@ class Receiver_orders_model extends HD_Model
{
private $table_name = 'lc_receiver_orders';
private $status_arr = [ 0 => '合同签订',1 => '办理分期',2 => '申请开票',3 => '交付确认', 4 => '申请退款'];
private $status_arr = [ 0 => '合同签订',1 => '办理分期',2 => '车辆确认',3 => '申请开票',4=>'代理服务',5 => '交付确认', 6 => '完成交付', 7 => '申请退款'];
public function __construct()
{
parent::__construct($this->table_name, 'default');
}
public function get_step($mobile){
$t1 = 'lc_receiver_orders';
//$t2 = 'lc_receiver_order_contracts';
$this->db->select("$t1.*");
$this->db->from($t1);
//$this->db->join($t2, "$t2.o_id = $t1.id and $t2.type=3",'left');
//$where = [
// "$t1.mobile" => $mobile,
// "($t2.status<1 or $t2.status is null)" => null
//];
$where = [
"$t1.mobile" => $mobile,
"$t1.status<" => 6
];
$this->db->where($where);
$this->db->order_by("$t1.id desc");
$this->db->limit(1);
$row = $this->db->get()->row_array();
return $row;
}
//获取交车列表
public function get_finsh($mobile,$page,$size,$count){
$t1 = 'lc_receiver_orders';
//$t2 = 'lc_receiver_order_contracts';
$this->db->select("$t1.*");
$this->db->from($t1);
//$this->db->join($t2, "$t2.o_id = $t1.id and $t2.type=3",'left');
//$where = [
// "$t1.mobile" => $mobile,
// "$t2.status" => 1,
//];
$where = [
"$t1.mobile" => $mobile,
"$t1.status" => 6,
];
$this->db->where($where);
if($count){
return $this->db->count_all_results();
}
$this->db->order_by("$t1.id desc");
if ($page) {
$offset = ($page - 1) * $page_size;
$limit = $page_size;
} else {
$offset = null;
$limit = null;
}
$this->db->limit($limit, $offset);
return $this->db->get()->result_array();
}
public function get_status(){
return $this->status_arr;
}
@@ -56,6 +56,7 @@ class Payment_service extends HD_Service{
if($res){
//更新订单状态
$this->load->model('receiver/order/receiver_orders_model','orders_model');
$this->load->model('receiver/order/receiver_order_signs_model','order_signs_model');
$row = $this->orders_model->get(['id'=>$order['item_id']]);
if($row){
if($row['payway']){//全款
@@ -66,6 +67,7 @@ class Payment_service extends HD_Service{
$this->load->model('receiver/order/receiver_order_loans_model','next_model');
}
$res = $this->orders_model->update(['status'=>$status],['id'=>$row['id']]);
$this->order_signs_model->update(['status'=>2],['o_id'=>$row['id']]);
if($res){
$add_data = [
'o_id' => $row['id'],
+8
View File
@@ -6,4 +6,12 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'ArithmeticError' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/ArithmeticError.php',
'AssertionError' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/AssertionError.php',
'DivisionByZeroError' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/DivisionByZeroError.php',
'Error' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/Error.php',
'Normalizer' => $vendorDir . '/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php',
'ParseError' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/ParseError.php',
'SessionUpdateTimestampHandlerInterface' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/SessionUpdateTimestampHandlerInterface.php',
'TypeError' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/TypeError.php',
);
+18
View File
@@ -0,0 +1,18 @@
<?php
// autoload_files.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php',
'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php',
'5255c38a0faeba867671b61dfda6d864' => $vendorDir . '/paragonie/random_compat/lib/random.php',
'e69f7f6ee287b969198c3c9d6777bd38' => $vendorDir . '/symfony/polyfill-intl-normalizer/bootstrap.php',
'023d27dca8066ef29e6739335ea73bad' => $vendorDir . '/symfony/polyfill-php70/bootstrap.php',
'25072dd6e2470089de65ae7bf11d3109' => $vendorDir . '/symfony/polyfill-php72/bootstrap.php',
'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php',
'f598d06aa772fa33d905e87be6398fb1' => $vendorDir . '/symfony/polyfill-intl-idn/bootstrap.php',
'37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
);
+9
View File
@@ -6,4 +6,13 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'TencentCloud\\' => array($vendorDir . '/tencentcloud/common/src/TencentCloud', $vendorDir . '/tencentcloud/ocr/src/TencentCloud'),
'Symfony\\Polyfill\\Php72\\' => array($vendorDir . '/symfony/polyfill-php72'),
'Symfony\\Polyfill\\Php70\\' => array($vendorDir . '/symfony/polyfill-php70'),
'Symfony\\Polyfill\\Intl\\Normalizer\\' => array($vendorDir . '/symfony/polyfill-intl-normalizer'),
'Symfony\\Polyfill\\Intl\\Idn\\' => array($vendorDir . '/symfony/polyfill-intl-idn'),
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'),
'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'),
'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'),
'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'),
);
+18
View File
@@ -50,6 +50,24 @@ class ComposerAutoloaderInitd0872984a1db7aa104ae1184a3170d3e
$loader->register(true);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInitd0872984a1db7aa104ae1184a3170d3e::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequired0872984a1db7aa104ae1184a3170d3e($fileIdentifier, $file);
}
return $loader;
}
}
function composerRequired0872984a1db7aa104ae1184a3170d3e($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
}
}
+90
View File
@@ -6,6 +6,82 @@ namespace Composer\Autoload;
class ComposerStaticInitd0872984a1db7aa104ae1184a3170d3e
{
public static $files = array (
'7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php',
'5255c38a0faeba867671b61dfda6d864' => __DIR__ . '/..' . '/paragonie/random_compat/lib/random.php',
'e69f7f6ee287b969198c3c9d6777bd38' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/bootstrap.php',
'023d27dca8066ef29e6739335ea73bad' => __DIR__ . '/..' . '/symfony/polyfill-php70/bootstrap.php',
'25072dd6e2470089de65ae7bf11d3109' => __DIR__ . '/..' . '/symfony/polyfill-php72/bootstrap.php',
'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php',
'f598d06aa772fa33d905e87be6398fb1' => __DIR__ . '/..' . '/symfony/polyfill-intl-idn/bootstrap.php',
'37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php',
);
public static $prefixLengthsPsr4 = array (
'T' =>
array (
'TencentCloud\\' => 13,
),
'S' =>
array (
'Symfony\\Polyfill\\Php72\\' => 23,
'Symfony\\Polyfill\\Php70\\' => 23,
'Symfony\\Polyfill\\Intl\\Normalizer\\' => 33,
'Symfony\\Polyfill\\Intl\\Idn\\' => 26,
),
'P' =>
array (
'Psr\\Http\\Message\\' => 17,
),
'G' =>
array (
'GuzzleHttp\\Psr7\\' => 16,
'GuzzleHttp\\Promise\\' => 19,
'GuzzleHttp\\' => 11,
),
);
public static $prefixDirsPsr4 = array (
'TencentCloud\\' =>
array (
0 => __DIR__ . '/..' . '/tencentcloud/common/src/TencentCloud',
1 => __DIR__ . '/..' . '/tencentcloud/ocr/src/TencentCloud',
),
'Symfony\\Polyfill\\Php72\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-php72',
),
'Symfony\\Polyfill\\Php70\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-php70',
),
'Symfony\\Polyfill\\Intl\\Normalizer\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer',
),
'Symfony\\Polyfill\\Intl\\Idn\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-intl-idn',
),
'Psr\\Http\\Message\\' =>
array (
0 => __DIR__ . '/..' . '/psr/http-message/src',
),
'GuzzleHttp\\Psr7\\' =>
array (
0 => __DIR__ . '/..' . '/guzzlehttp/psr7/src',
),
'GuzzleHttp\\Promise\\' =>
array (
0 => __DIR__ . '/..' . '/guzzlehttp/promises/src',
),
'GuzzleHttp\\' =>
array (
0 => __DIR__ . '/..' . '/guzzlehttp/guzzle/src',
),
);
public static $prefixesPsr0 = array (
'G' =>
array (
@@ -20,10 +96,24 @@ class ComposerStaticInitd0872984a1db7aa104ae1184a3170d3e
),
);
public static $classMap = array (
'ArithmeticError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/ArithmeticError.php',
'AssertionError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/AssertionError.php',
'DivisionByZeroError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/DivisionByZeroError.php',
'Error' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/Error.php',
'Normalizer' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php',
'ParseError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/ParseError.php',
'SessionUpdateTimestampHandlerInterface' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/SessionUpdateTimestampHandlerInterface.php',
'TypeError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/TypeError.php',
);
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitd0872984a1db7aa104ae1184a3170d3e::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitd0872984a1db7aa104ae1184a3170d3e::$prefixDirsPsr4;
$loader->prefixesPsr0 = ComposerStaticInitd0872984a1db7aa104ae1184a3170d3e::$prefixesPsr0;
$loader->classMap = ComposerStaticInitd0872984a1db7aa104ae1184a3170d3e::$classMap;
}, null, ClassLoader::class);
}
+820
View File
@@ -109,5 +109,825 @@
"gd",
"image"
]
},
{
"name": "guzzlehttp/guzzle",
"version": "6.5.5",
"version_normalized": "6.5.5.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
"reference": "9d4290de1cfd701f38099ef7e183b64b4b7b0c5e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/9d4290de1cfd701f38099ef7e183b64b4b7b0c5e",
"reference": "9d4290de1cfd701f38099ef7e183b64b4b7b0c5e",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"ext-json": "*",
"guzzlehttp/promises": "^1.0",
"guzzlehttp/psr7": "^1.6.1",
"php": ">=5.5",
"symfony/polyfill-intl-idn": "^1.17.0"
},
"require-dev": {
"ext-curl": "*",
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0",
"psr/log": "^1.1"
},
"suggest": {
"psr/log": "Required for using the Log middleware"
},
"time": "2020-06-16T21:01:06+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "6.5-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"GuzzleHttp\\": "src/"
},
"files": [
"src/functions_include.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
}
],
"description": "Guzzle is a PHP HTTP client library",
"homepage": "http://guzzlephp.org/",
"keywords": [
"client",
"curl",
"framework",
"http",
"http client",
"rest",
"web service"
]
},
{
"name": "guzzlehttp/promises",
"version": "1.4.1",
"version_normalized": "1.4.1.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/promises.git",
"reference": "8e7d04f1f6450fef59366c399cfad4b9383aa30d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/promises/zipball/8e7d04f1f6450fef59366c399cfad4b9383aa30d",
"reference": "8e7d04f1f6450fef59366c399cfad4b9383aa30d",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=5.5"
},
"require-dev": {
"symfony/phpunit-bridge": "^4.4 || ^5.1"
},
"time": "2021-03-07T09:25:29+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"GuzzleHttp\\Promise\\": "src/"
},
"files": [
"src/functions_include.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
}
],
"description": "Guzzle promises library",
"keywords": [
"promise"
]
},
{
"name": "guzzlehttp/psr7",
"version": "1.8.2",
"version_normalized": "1.8.2.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/psr7.git",
"reference": "dc960a912984efb74d0a90222870c72c87f10c91"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/dc960a912984efb74d0a90222870c72c87f10c91",
"reference": "dc960a912984efb74d0a90222870c72c87f10c91",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=5.4.0",
"psr/http-message": "~1.0",
"ralouphie/getallheaders": "^2.0.5 || ^3.0.0"
},
"provide": {
"psr/http-message-implementation": "1.0"
},
"require-dev": {
"ext-zlib": "*",
"phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.10"
},
"suggest": {
"laminas/laminas-httphandlerrunner": "Emit PSR-7 responses"
},
"time": "2021-04-26T09:17:50+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.7-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"GuzzleHttp\\Psr7\\": "src/"
},
"files": [
"src/functions_include.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
{
"name": "Tobias Schultze",
"homepage": "https://github.com/Tobion"
}
],
"description": "PSR-7 message implementation that also provides common utility methods",
"keywords": [
"http",
"message",
"psr-7",
"request",
"response",
"stream",
"uri",
"url"
]
},
{
"name": "paragonie/random_compat",
"version": "v2.0.20",
"version_normalized": "2.0.20.0",
"source": {
"type": "git",
"url": "https://github.com/paragonie/random_compat.git",
"reference": "0f1f60250fccffeaf5dda91eea1c018aed1adc2a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/0f1f60250fccffeaf5dda91eea1c018aed1adc2a",
"reference": "0f1f60250fccffeaf5dda91eea1c018aed1adc2a",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=5.2.0"
},
"require-dev": {
"phpunit/phpunit": "4.*|5.*"
},
"suggest": {
"ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
},
"time": "2021-04-17T09:33:01+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"files": [
"lib/random.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Paragon Initiative Enterprises",
"email": "security@paragonie.com",
"homepage": "https://paragonie.com"
}
],
"description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
"keywords": [
"csprng",
"polyfill",
"pseudorandom",
"random"
]
},
{
"name": "psr/http-message",
"version": "1.0.1",
"version_normalized": "1.0.1.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-message.git",
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=5.3.0"
},
"time": "2016-08-06T14:39:51+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Psr\\Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for HTTP messages",
"homepage": "https://github.com/php-fig/http-message",
"keywords": [
"http",
"http-message",
"psr",
"psr-7",
"request",
"response"
]
},
{
"name": "ralouphie/getallheaders",
"version": "3.0.3",
"version_normalized": "3.0.3.0",
"source": {
"type": "git",
"url": "https://github.com/ralouphie/getallheaders.git",
"reference": "120b605dfeb996808c31b6477290a714d356e822"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822",
"reference": "120b605dfeb996808c31b6477290a714d356e822",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=5.6"
},
"require-dev": {
"php-coveralls/php-coveralls": "^2.1",
"phpunit/phpunit": "^5 || ^6.5"
},
"time": "2019-03-08T08:55:37+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"files": [
"src/getallheaders.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ralph Khattar",
"email": "ralph.khattar@gmail.com"
}
],
"description": "A polyfill for getallheaders."
},
{
"name": "symfony/polyfill-intl-idn",
"version": "v1.19.0",
"version_normalized": "1.19.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-idn.git",
"reference": "4ad5115c0f5d5172a9fe8147675ec6de266d8826"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/4ad5115c0f5d5172a9fe8147675ec6de266d8826",
"reference": "4ad5115c0f5d5172a9fe8147675ec6de266d8826",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=5.3.3",
"symfony/polyfill-intl-normalizer": "^1.10",
"symfony/polyfill-php70": "^1.10",
"symfony/polyfill-php72": "^1.10"
},
"suggest": {
"ext-intl": "For best performance"
},
"time": "2020-10-21T09:57:48+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.19-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Intl\\Idn\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Laurent Bassin",
"email": "laurent@bassin.info"
},
{
"name": "Trevor Rowbotham",
"email": "trevor.rowbotham@pm.me"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"idn",
"intl",
"polyfill",
"portable",
"shim"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
]
},
{
"name": "symfony/polyfill-intl-normalizer",
"version": "v1.19.0",
"version_normalized": "1.19.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-normalizer.git",
"reference": "8db0ae7936b42feb370840cf24de1a144fb0ef27"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8db0ae7936b42feb370840cf24de1a144fb0ef27",
"reference": "8db0ae7936b42feb370840cf24de1a144fb0ef27",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=5.3.3"
},
"suggest": {
"ext-intl": "For best performance"
},
"time": "2020-10-23T09:01:57+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.19-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Intl\\Normalizer\\": ""
},
"files": [
"bootstrap.php"
],
"classmap": [
"Resources/stubs"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for intl's Normalizer class and related functions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"intl",
"normalizer",
"polyfill",
"portable",
"shim"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
]
},
{
"name": "symfony/polyfill-php70",
"version": "v1.19.0",
"version_normalized": "1.19.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php70.git",
"reference": "3fe414077251a81a1b15b1c709faf5c2fbae3d4e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/3fe414077251a81a1b15b1c709faf5c2fbae3d4e",
"reference": "3fe414077251a81a1b15b1c709faf5c2fbae3d4e",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"paragonie/random_compat": "~1.0|~2.0|~9.99",
"php": ">=5.3.3"
},
"time": "2020-10-23T09:01:57+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.19-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Php70\\": ""
},
"files": [
"bootstrap.php"
],
"classmap": [
"Resources/stubs"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"polyfill",
"portable",
"shim"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
]
},
{
"name": "symfony/polyfill-php72",
"version": "v1.19.0",
"version_normalized": "1.19.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php72.git",
"reference": "beecef6b463b06954638f02378f52496cb84bacc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/beecef6b463b06954638f02378f52496cb84bacc",
"reference": "beecef6b463b06954638f02378f52496cb84bacc",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=5.3.3"
},
"time": "2020-10-23T09:01:57+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.19-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Php72\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"polyfill",
"portable",
"shim"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
]
},
{
"name": "tencentcloud/common",
"version": "3.0.436",
"version_normalized": "3.0.436.0",
"source": {
"type": "git",
"url": "https://github.com/tencentcloud-sdk-php/common.git",
"reference": "8e1742f06287accfd173141a919d3460d097ac03"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/tencentcloud-sdk-php/common/zipball/8e1742f06287accfd173141a919d3460d097ac03",
"reference": "8e1742f06287accfd173141a919d3460d097ac03",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"guzzlehttp/guzzle": "^6.3||^7.0",
"guzzlehttp/psr7": "^1.4",
"php": ">=5.6.0"
},
"time": "2021-07-16T01:04:49+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"TencentCloud\\": "./src/TencentCloud"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "tencentcloudapi",
"email": "tencentcloudapi@tencent.com",
"homepage": "https://cloud.tencent.com/document/sdk/PHP",
"role": "Developer"
}
],
"description": "TencentCloudApi php sdk",
"homepage": "https://github.com/tencentcloud-sdk-php/common"
},
{
"name": "tencentcloud/ocr",
"version": "3.0.436",
"version_normalized": "3.0.436.0",
"source": {
"type": "git",
"url": "https://github.com/tencentcloud-sdk-php/ocr.git",
"reference": "3158bf1b0d4c89ca0623d0c4eda76a4a8eba656b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/tencentcloud-sdk-php/ocr/zipball/3158bf1b0d4c89ca0623d0c4eda76a4a8eba656b",
"reference": "3158bf1b0d4c89ca0623d0c4eda76a4a8eba656b",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"tencentcloud/common": "3.0.436"
},
"time": "2021-07-16T01:13:52+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"TencentCloud\\": "./src/TencentCloud"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "tencentcloudapi",
"email": "tencentcloudapi@tencent.com",
"homepage": "https://github.com/tencentcloud-sdk-php/ocr",
"role": "Developer"
}
],
"description": "TencentCloudApi php sdk ocr",
"homepage": "https://github.com/tencentcloud-sdk-php/ocr"
}
]
+23
View File
@@ -0,0 +1,23 @@
<?php
$config = PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'declare_strict_types' => false,
'concat_space' => ['spacing'=>'one'],
'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
'ordered_imports' => true,
// 'phpdoc_align' => ['align'=>'vertical'],
// 'native_function_invocation' => true,
])
->setFinder(
PhpCsFixer\Finder::create()
->in(__DIR__.'/src')
->in(__DIR__.'/tests')
->name('*.php')
)
;
return $config;
File diff suppressed because it is too large Load Diff
+18
View File
@@ -0,0 +1,18 @@
FROM composer:latest as setup
RUN mkdir /guzzle
WORKDIR /guzzle
RUN set -xe \
&& composer init --name=guzzlehttp/test --description="Simple project for testing Guzzle scripts" --author="Márk Sági-Kazár <mark.sagikazar@gmail.com>" --no-interaction \
&& composer require guzzlehttp/guzzle
FROM php:7.3
RUN mkdir /guzzle
WORKDIR /guzzle
COPY --from=setup /guzzle /guzzle
+19
View File
@@ -0,0 +1,19 @@
Copyright (c) 2011-2018 Michael Dowling, https://github.com/mtdowling <mtdowling@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
+90
View File
@@ -0,0 +1,90 @@
Guzzle, PHP HTTP client
=======================
[![Latest Version](https://img.shields.io/github/release/guzzle/guzzle.svg?style=flat-square)](https://github.com/guzzle/guzzle/releases)
[![Build Status](https://img.shields.io/travis/guzzle/guzzle.svg?style=flat-square)](https://travis-ci.org/guzzle/guzzle)
[![Total Downloads](https://img.shields.io/packagist/dt/guzzlehttp/guzzle.svg?style=flat-square)](https://packagist.org/packages/guzzlehttp/guzzle)
Guzzle is a PHP HTTP client that makes it easy to send HTTP requests and
trivial to integrate with web services.
- Simple interface for building query strings, POST requests, streaming large
uploads, streaming large downloads, using HTTP cookies, uploading JSON data,
etc...
- Can send both synchronous and asynchronous requests using the same interface.
- Uses PSR-7 interfaces for requests, responses, and streams. This allows you
to utilize other PSR-7 compatible libraries with Guzzle.
- Abstracts away the underlying HTTP transport, allowing you to write
environment and transport agnostic code; i.e., no hard dependency on cURL,
PHP streams, sockets, or non-blocking event loops.
- Middleware system allows you to augment and compose client behavior.
```php
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://api.github.com/repos/guzzle/guzzle');
echo $response->getStatusCode(); # 200
echo $response->getHeaderLine('content-type'); # 'application/json; charset=utf8'
echo $response->getBody(); # '{"id": 1420053, "name": "guzzle", ...}'
# Send an asynchronous request.
$request = new \GuzzleHttp\Psr7\Request('GET', 'http://httpbin.org');
$promise = $client->sendAsync($request)->then(function ($response) {
echo 'I completed! ' . $response->getBody();
});
$promise->wait();
```
## Help and docs
- [Documentation](http://guzzlephp.org/)
- [Stack Overflow](http://stackoverflow.com/questions/tagged/guzzle)
- [Gitter](https://gitter.im/guzzle/guzzle)
## Installing Guzzle
The recommended way to install Guzzle is through
[Composer](http://getcomposer.org).
```bash
# Install Composer
curl -sS https://getcomposer.org/installer | php
```
Next, run the Composer command to install the latest stable version of Guzzle:
```bash
composer require guzzlehttp/guzzle
```
After installing, you need to require Composer's autoloader:
```php
require 'vendor/autoload.php';
```
You can then later update Guzzle using composer:
```bash
composer update
```
## Version Guidance
| Version | Status | Packagist | Namespace | Repo | Docs | PSR-7 | PHP Version |
|---------|------------|---------------------|--------------|---------------------|---------------------|-------|-------------|
| 3.x | EOL | `guzzle/guzzle` | `Guzzle` | [v3][guzzle-3-repo] | [v3][guzzle-3-docs] | No | >= 5.3.3 |
| 4.x | EOL | `guzzlehttp/guzzle` | `GuzzleHttp` | [v4][guzzle-4-repo] | N/A | No | >= 5.4 |
| 5.x | EOL | `guzzlehttp/guzzle` | `GuzzleHttp` | [v5][guzzle-5-repo] | [v5][guzzle-5-docs] | No | >= 5.4 |
| 6.x | Latest | `guzzlehttp/guzzle` | `GuzzleHttp` | [v6][guzzle-6-repo] | [v6][guzzle-6-docs] | Yes | >= 5.5 |
[guzzle-3-repo]: https://github.com/guzzle/guzzle3
[guzzle-4-repo]: https://github.com/guzzle/guzzle/tree/4.x
[guzzle-5-repo]: https://github.com/guzzle/guzzle/tree/5.3
[guzzle-6-repo]: https://github.com/guzzle/guzzle
[guzzle-3-docs]: http://guzzle3.readthedocs.org
[guzzle-5-docs]: http://guzzle.readthedocs.org/en/5.3/
[guzzle-6-docs]: http://guzzle.readthedocs.org/en/latest/
File diff suppressed because it is too large Load Diff
+59
View File
@@ -0,0 +1,59 @@
{
"name": "guzzlehttp/guzzle",
"type": "library",
"description": "Guzzle is a PHP HTTP client library",
"keywords": [
"framework",
"http",
"rest",
"web service",
"curl",
"client",
"HTTP client"
],
"homepage": "http://guzzlephp.org/",
"license": "MIT",
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
}
],
"require": {
"php": ">=5.5",
"ext-json": "*",
"symfony/polyfill-intl-idn": "^1.17.0",
"guzzlehttp/promises": "^1.0",
"guzzlehttp/psr7": "^1.6.1"
},
"require-dev": {
"ext-curl": "*",
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0",
"psr/log": "^1.1"
},
"suggest": {
"psr/log": "Required for using the Log middleware"
},
"config": {
"sort-packages": true
},
"extra": {
"branch-alias": {
"dev-master": "6.5-dev"
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\": "src/"
},
"files": [
"src/functions_include.php"
]
},
"autoload-dev": {
"psr-4": {
"GuzzleHttp\\Tests\\": "tests/"
}
}
}
+501
View File
@@ -0,0 +1,501 @@
<?php
namespace GuzzleHttp;
use GuzzleHttp\Cookie\CookieJar;
use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\Promise;
use GuzzleHttp\Psr7;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\UriInterface;
/**
* @method ResponseInterface get(string|UriInterface $uri, array $options = [])
* @method ResponseInterface head(string|UriInterface $uri, array $options = [])
* @method ResponseInterface put(string|UriInterface $uri, array $options = [])
* @method ResponseInterface post(string|UriInterface $uri, array $options = [])
* @method ResponseInterface patch(string|UriInterface $uri, array $options = [])
* @method ResponseInterface delete(string|UriInterface $uri, array $options = [])
* @method Promise\PromiseInterface getAsync(string|UriInterface $uri, array $options = [])
* @method Promise\PromiseInterface headAsync(string|UriInterface $uri, array $options = [])
* @method Promise\PromiseInterface putAsync(string|UriInterface $uri, array $options = [])
* @method Promise\PromiseInterface postAsync(string|UriInterface $uri, array $options = [])
* @method Promise\PromiseInterface patchAsync(string|UriInterface $uri, array $options = [])
* @method Promise\PromiseInterface deleteAsync(string|UriInterface $uri, array $options = [])
*/
class Client implements ClientInterface
{
/** @var array Default request options */
private $config;
/**
* Clients accept an array of constructor parameters.
*
* Here's an example of creating a client using a base_uri and an array of
* default request options to apply to each request:
*
* $client = new Client([
* 'base_uri' => 'http://www.foo.com/1.0/',
* 'timeout' => 0,
* 'allow_redirects' => false,
* 'proxy' => '192.168.16.1:10'
* ]);
*
* Client configuration settings include the following options:
*
* - handler: (callable) Function that transfers HTTP requests over the
* wire. The function is called with a Psr7\Http\Message\RequestInterface
* and array of transfer options, and must return a
* GuzzleHttp\Promise\PromiseInterface that is fulfilled with a
* Psr7\Http\Message\ResponseInterface on success.
* If no handler is provided, a default handler will be created
* that enables all of the request options below by attaching all of the
* default middleware to the handler.
* - base_uri: (string|UriInterface) Base URI of the client that is merged
* into relative URIs. Can be a string or instance of UriInterface.
* - **: any request option
*
* @param array $config Client configuration settings.
*
* @see \GuzzleHttp\RequestOptions for a list of available request options.
*/
public function __construct(array $config = [])
{
if (!isset($config['handler'])) {
$config['handler'] = HandlerStack::create();
} elseif (!is_callable($config['handler'])) {
throw new \InvalidArgumentException('handler must be a callable');
}
// Convert the base_uri to a UriInterface
if (isset($config['base_uri'])) {
$config['base_uri'] = Psr7\uri_for($config['base_uri']);
}
$this->configureDefaults($config);
}
/**
* @param string $method
* @param array $args
*
* @return Promise\PromiseInterface
*/
public function __call($method, $args)
{
if (count($args) < 1) {
throw new \InvalidArgumentException('Magic request methods require a URI and optional options array');
}
$uri = $args[0];
$opts = isset($args[1]) ? $args[1] : [];
return substr($method, -5) === 'Async'
? $this->requestAsync(substr($method, 0, -5), $uri, $opts)
: $this->request($method, $uri, $opts);
}
/**
* Asynchronously send an HTTP request.
*
* @param array $options Request options to apply to the given
* request and to the transfer. See \GuzzleHttp\RequestOptions.
*
* @return Promise\PromiseInterface
*/
public function sendAsync(RequestInterface $request, array $options = [])
{
// Merge the base URI into the request URI if needed.
$options = $this->prepareDefaults($options);
return $this->transfer(
$request->withUri($this->buildUri($request->getUri(), $options), $request->hasHeader('Host')),
$options
);
}
/**
* Send an HTTP request.
*
* @param array $options Request options to apply to the given
* request and to the transfer. See \GuzzleHttp\RequestOptions.
*
* @return ResponseInterface
* @throws GuzzleException
*/
public function send(RequestInterface $request, array $options = [])
{
$options[RequestOptions::SYNCHRONOUS] = true;
return $this->sendAsync($request, $options)->wait();
}
/**
* Create and send an asynchronous HTTP request.
*
* Use an absolute path to override the base path of the client, or a
* relative path to append to the base path of the client. The URL can
* contain the query string as well. Use an array to provide a URL
* template and additional variables to use in the URL template expansion.
*
* @param string $method HTTP method
* @param string|UriInterface $uri URI object or string.
* @param array $options Request options to apply. See \GuzzleHttp\RequestOptions.
*
* @return Promise\PromiseInterface
*/
public function requestAsync($method, $uri = '', array $options = [])
{
$options = $this->prepareDefaults($options);
// Remove request modifying parameter because it can be done up-front.
$headers = isset($options['headers']) ? $options['headers'] : [];
$body = isset($options['body']) ? $options['body'] : null;
$version = isset($options['version']) ? $options['version'] : '1.1';
// Merge the URI into the base URI.
$uri = $this->buildUri($uri, $options);
if (is_array($body)) {
$this->invalidBody();
}
$request = new Psr7\Request($method, $uri, $headers, $body, $version);
// Remove the option so that they are not doubly-applied.
unset($options['headers'], $options['body'], $options['version']);
return $this->transfer($request, $options);
}
/**
* Create and send an HTTP request.
*
* Use an absolute path to override the base path of the client, or a
* relative path to append to the base path of the client. The URL can
* contain the query string as well.
*
* @param string $method HTTP method.
* @param string|UriInterface $uri URI object or string.
* @param array $options Request options to apply. See \GuzzleHttp\RequestOptions.
*
* @return ResponseInterface
* @throws GuzzleException
*/
public function request($method, $uri = '', array $options = [])
{
$options[RequestOptions::SYNCHRONOUS] = true;
return $this->requestAsync($method, $uri, $options)->wait();
}
/**
* Get a client configuration option.
*
* These options include default request options of the client, a "handler"
* (if utilized by the concrete client), and a "base_uri" if utilized by
* the concrete client.
*
* @param string|null $option The config option to retrieve.
*
* @return mixed
*/
public function getConfig($option = null)
{
return $option === null
? $this->config
: (isset($this->config[$option]) ? $this->config[$option] : null);
}
/**
* @param string|null $uri
*
* @return UriInterface
*/
private function buildUri($uri, array $config)
{
// for BC we accept null which would otherwise fail in uri_for
$uri = Psr7\uri_for($uri === null ? '' : $uri);
if (isset($config['base_uri'])) {
$uri = Psr7\UriResolver::resolve(Psr7\uri_for($config['base_uri']), $uri);
}
if (isset($config['idn_conversion']) && ($config['idn_conversion'] !== false)) {
$idnOptions = ($config['idn_conversion'] === true) ? IDNA_DEFAULT : $config['idn_conversion'];
$uri = Utils::idnUriConvert($uri, $idnOptions);
}
return $uri->getScheme() === '' && $uri->getHost() !== '' ? $uri->withScheme('http') : $uri;
}
/**
* Configures the default options for a client.
*
* @param array $config
* @return void
*/
private function configureDefaults(array $config)
{
$defaults = [
'allow_redirects' => RedirectMiddleware::$defaultSettings,
'http_errors' => true,
'decode_content' => true,
'verify' => true,
'cookies' => false,
'idn_conversion' => true,
];
// Use the standard Linux HTTP_PROXY and HTTPS_PROXY if set.
// We can only trust the HTTP_PROXY environment variable in a CLI
// process due to the fact that PHP has no reliable mechanism to
// get environment variables that start with "HTTP_".
if (php_sapi_name() === 'cli' && getenv('HTTP_PROXY')) {
$defaults['proxy']['http'] = getenv('HTTP_PROXY');
}
if ($proxy = getenv('HTTPS_PROXY')) {
$defaults['proxy']['https'] = $proxy;
}
if ($noProxy = getenv('NO_PROXY')) {
$cleanedNoProxy = str_replace(' ', '', $noProxy);
$defaults['proxy']['no'] = explode(',', $cleanedNoProxy);
}
$this->config = $config + $defaults;
if (!empty($config['cookies']) && $config['cookies'] === true) {
$this->config['cookies'] = new CookieJar();
}
// Add the default user-agent header.
if (!isset($this->config['headers'])) {
$this->config['headers'] = ['User-Agent' => default_user_agent()];
} else {
// Add the User-Agent header if one was not already set.
foreach (array_keys($this->config['headers']) as $name) {
if (strtolower($name) === 'user-agent') {
return;
}
}
$this->config['headers']['User-Agent'] = default_user_agent();
}
}
/**
* Merges default options into the array.
*
* @param array $options Options to modify by reference
*
* @return array
*/
private function prepareDefaults(array $options)
{
$defaults = $this->config;
if (!empty($defaults['headers'])) {
// Default headers are only added if they are not present.
$defaults['_conditional'] = $defaults['headers'];
unset($defaults['headers']);
}
// Special handling for headers is required as they are added as
// conditional headers and as headers passed to a request ctor.
if (array_key_exists('headers', $options)) {
// Allows default headers to be unset.
if ($options['headers'] === null) {
$defaults['_conditional'] = [];
unset($options['headers']);
} elseif (!is_array($options['headers'])) {
throw new \InvalidArgumentException('headers must be an array');
}
}
// Shallow merge defaults underneath options.
$result = $options + $defaults;
// Remove null values.
foreach ($result as $k => $v) {
if ($v === null) {
unset($result[$k]);
}
}
return $result;
}
/**
* Transfers the given request and applies request options.
*
* The URI of the request is not modified and the request options are used
* as-is without merging in default options.
*
* @param array $options See \GuzzleHttp\RequestOptions.
*
* @return Promise\PromiseInterface
*/
private function transfer(RequestInterface $request, array $options)
{
// save_to -> sink
if (isset($options['save_to'])) {
$options['sink'] = $options['save_to'];
unset($options['save_to']);
}
// exceptions -> http_errors
if (isset($options['exceptions'])) {
$options['http_errors'] = $options['exceptions'];
unset($options['exceptions']);
}
$request = $this->applyOptions($request, $options);
/** @var HandlerStack $handler */
$handler = $options['handler'];
try {
return Promise\promise_for($handler($request, $options));
} catch (\Exception $e) {
return Promise\rejection_for($e);
}
}
/**
* Applies the array of request options to a request.
*
* @param RequestInterface $request
* @param array $options
*
* @return RequestInterface
*/
private function applyOptions(RequestInterface $request, array &$options)
{
$modify = [
'set_headers' => [],
];
if (isset($options['headers'])) {
$modify['set_headers'] = $options['headers'];
unset($options['headers']);
}
if (isset($options['form_params'])) {
if (isset($options['multipart'])) {
throw new \InvalidArgumentException('You cannot use '
. 'form_params and multipart at the same time. Use the '
. 'form_params option if you want to send application/'
. 'x-www-form-urlencoded requests, and the multipart '
. 'option to send multipart/form-data requests.');
}
$options['body'] = http_build_query($options['form_params'], '', '&');
unset($options['form_params']);
// Ensure that we don't have the header in different case and set the new value.
$options['_conditional'] = Psr7\_caseless_remove(['Content-Type'], $options['_conditional']);
$options['_conditional']['Content-Type'] = 'application/x-www-form-urlencoded';
}
if (isset($options['multipart'])) {
$options['body'] = new Psr7\MultipartStream($options['multipart']);
unset($options['multipart']);
}
if (isset($options['json'])) {
$options['body'] = \GuzzleHttp\json_encode($options['json']);
unset($options['json']);
// Ensure that we don't have the header in different case and set the new value.
$options['_conditional'] = Psr7\_caseless_remove(['Content-Type'], $options['_conditional']);
$options['_conditional']['Content-Type'] = 'application/json';
}
if (!empty($options['decode_content'])
&& $options['decode_content'] !== true
) {
// Ensure that we don't have the header in different case and set the new value.
$options['_conditional'] = Psr7\_caseless_remove(['Accept-Encoding'], $options['_conditional']);
$modify['set_headers']['Accept-Encoding'] = $options['decode_content'];
}
if (isset($options['body'])) {
if (is_array($options['body'])) {
$this->invalidBody();
}
$modify['body'] = Psr7\stream_for($options['body']);
unset($options['body']);
}
if (!empty($options['auth']) && is_array($options['auth'])) {
$value = $options['auth'];
$type = isset($value[2]) ? strtolower($value[2]) : 'basic';
switch ($type) {
case 'basic':
// Ensure that we don't have the header in different case and set the new value.
$modify['set_headers'] = Psr7\_caseless_remove(['Authorization'], $modify['set_headers']);
$modify['set_headers']['Authorization'] = 'Basic '
. base64_encode("$value[0]:$value[1]");
break;
case 'digest':
// @todo: Do not rely on curl
$options['curl'][CURLOPT_HTTPAUTH] = CURLAUTH_DIGEST;
$options['curl'][CURLOPT_USERPWD] = "$value[0]:$value[1]";
break;
case 'ntlm':
$options['curl'][CURLOPT_HTTPAUTH] = CURLAUTH_NTLM;
$options['curl'][CURLOPT_USERPWD] = "$value[0]:$value[1]";
break;
}
}
if (isset($options['query'])) {
$value = $options['query'];
if (is_array($value)) {
$value = http_build_query($value, null, '&', PHP_QUERY_RFC3986);
}
if (!is_string($value)) {
throw new \InvalidArgumentException('query must be a string or array');
}
$modify['query'] = $value;
unset($options['query']);
}
// Ensure that sink is not an invalid value.
if (isset($options['sink'])) {
// TODO: Add more sink validation?
if (is_bool($options['sink'])) {
throw new \InvalidArgumentException('sink must not be a boolean');
}
}
$request = Psr7\modify_request($request, $modify);
if ($request->getBody() instanceof Psr7\MultipartStream) {
// Use a multipart/form-data POST if a Content-Type is not set.
// Ensure that we don't have the header in different case and set the new value.
$options['_conditional'] = Psr7\_caseless_remove(['Content-Type'], $options['_conditional']);
$options['_conditional']['Content-Type'] = 'multipart/form-data; boundary='
. $request->getBody()->getBoundary();
}
// Merge in conditional headers if they are not present.
if (isset($options['_conditional'])) {
// Build up the changes so it's in a single clone of the message.
$modify = [];
foreach ($options['_conditional'] as $k => $v) {
if (!$request->hasHeader($k)) {
$modify['set_headers'][$k] = $v;
}
}
$request = Psr7\modify_request($request, $modify);
// Don't pass this internal value along to middleware/handlers.
unset($options['_conditional']);
}
return $request;
}
/**
* Throw Exception with pre-set message.
* @return void
* @throws \InvalidArgumentException Invalid body.
*/
private function invalidBody()
{
throw new \InvalidArgumentException('Passing in the "body" request '
. 'option as an array to send a POST request has been deprecated. '
. 'Please use the "form_params" request option to send a '
. 'application/x-www-form-urlencoded request, or the "multipart" '
. 'request option to send a multipart/form-data request.');
}
}
+87
View File
@@ -0,0 +1,87 @@
<?php
namespace GuzzleHttp;
use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\Promise\PromiseInterface;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\UriInterface;
/**
* Client interface for sending HTTP requests.
*/
interface ClientInterface
{
/**
* @deprecated Will be removed in Guzzle 7.0.0
*/
const VERSION = '6.5.5';
/**
* Send an HTTP request.
*
* @param RequestInterface $request Request to send
* @param array $options Request options to apply to the given
* request and to the transfer.
*
* @return ResponseInterface
* @throws GuzzleException
*/
public function send(RequestInterface $request, array $options = []);
/**
* Asynchronously send an HTTP request.
*
* @param RequestInterface $request Request to send
* @param array $options Request options to apply to the given
* request and to the transfer.
*
* @return PromiseInterface
*/
public function sendAsync(RequestInterface $request, array $options = []);
/**
* Create and send an HTTP request.
*
* Use an absolute path to override the base path of the client, or a
* relative path to append to the base path of the client. The URL can
* contain the query string as well.
*
* @param string $method HTTP method.
* @param string|UriInterface $uri URI object or string.
* @param array $options Request options to apply.
*
* @return ResponseInterface
* @throws GuzzleException
*/
public function request($method, $uri, array $options = []);
/**
* Create and send an asynchronous HTTP request.
*
* Use an absolute path to override the base path of the client, or a
* relative path to append to the base path of the client. The URL can
* contain the query string as well. Use an array to provide a URL
* template and additional variables to use in the URL template expansion.
*
* @param string $method HTTP method
* @param string|UriInterface $uri URI object or string.
* @param array $options Request options to apply.
*
* @return PromiseInterface
*/
public function requestAsync($method, $uri, array $options = []);
/**
* Get a client configuration option.
*
* These options include default request options of the client, a "handler"
* (if utilized by the concrete client), and a "base_uri" if utilized by
* the concrete client.
*
* @param string|null $option The config option to retrieve.
*
* @return mixed
*/
public function getConfig($option = null);
}
+316
View File
@@ -0,0 +1,316 @@
<?php
namespace GuzzleHttp\Cookie;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
/**
* Cookie jar that stores cookies as an array
*/
class CookieJar implements CookieJarInterface
{
/** @var SetCookie[] Loaded cookie data */
private $cookies = [];
/** @var bool */
private $strictMode;
/**
* @param bool $strictMode Set to true to throw exceptions when invalid
* cookies are added to the cookie jar.
* @param array $cookieArray Array of SetCookie objects or a hash of
* arrays that can be used with the SetCookie
* constructor
*/
public function __construct($strictMode = false, $cookieArray = [])
{
$this->strictMode = $strictMode;
foreach ($cookieArray as $cookie) {
if (!($cookie instanceof SetCookie)) {
$cookie = new SetCookie($cookie);
}
$this->setCookie($cookie);
}
}
/**
* Create a new Cookie jar from an associative array and domain.
*
* @param array $cookies Cookies to create the jar from
* @param string $domain Domain to set the cookies to
*
* @return self
*/
public static function fromArray(array $cookies, $domain)
{
$cookieJar = new self();
foreach ($cookies as $name => $value) {
$cookieJar->setCookie(new SetCookie([
'Domain' => $domain,
'Name' => $name,
'Value' => $value,
'Discard' => true
]));
}
return $cookieJar;
}
/**
* @deprecated
*/
public static function getCookieValue($value)
{
return $value;
}
/**
* Evaluate if this cookie should be persisted to storage
* that survives between requests.
*
* @param SetCookie $cookie Being evaluated.
* @param bool $allowSessionCookies If we should persist session cookies
* @return bool
*/
public static function shouldPersist(
SetCookie $cookie,
$allowSessionCookies = false
) {
if ($cookie->getExpires() || $allowSessionCookies) {
if (!$cookie->getDiscard()) {
return true;
}
}
return false;
}
/**
* Finds and returns the cookie based on the name
*
* @param string $name cookie name to search for
* @return SetCookie|null cookie that was found or null if not found
*/
public function getCookieByName($name)
{
// don't allow a non string name
if ($name === null || !is_scalar($name)) {
return null;
}
foreach ($this->cookies as $cookie) {
if ($cookie->getName() !== null && strcasecmp($cookie->getName(), $name) === 0) {
return $cookie;
}
}
return null;
}
public function toArray()
{
return array_map(function (SetCookie $cookie) {
return $cookie->toArray();
}, $this->getIterator()->getArrayCopy());
}
public function clear($domain = null, $path = null, $name = null)
{
if (!$domain) {
$this->cookies = [];
return;
} elseif (!$path) {
$this->cookies = array_filter(
$this->cookies,
function (SetCookie $cookie) use ($domain) {
return !$cookie->matchesDomain($domain);
}
);
} elseif (!$name) {
$this->cookies = array_filter(
$this->cookies,
function (SetCookie $cookie) use ($path, $domain) {
return !($cookie->matchesPath($path) &&
$cookie->matchesDomain($domain));
}
);
} else {
$this->cookies = array_filter(
$this->cookies,
function (SetCookie $cookie) use ($path, $domain, $name) {
return !($cookie->getName() == $name &&
$cookie->matchesPath($path) &&
$cookie->matchesDomain($domain));
}
);
}
}
public function clearSessionCookies()
{
$this->cookies = array_filter(
$this->cookies,
function (SetCookie $cookie) {
return !$cookie->getDiscard() && $cookie->getExpires();
}
);
}
public function setCookie(SetCookie $cookie)
{
// If the name string is empty (but not 0), ignore the set-cookie
// string entirely.
$name = $cookie->getName();
if (!$name && $name !== '0') {
return false;
}
// Only allow cookies with set and valid domain, name, value
$result = $cookie->validate();
if ($result !== true) {
if ($this->strictMode) {
throw new \RuntimeException('Invalid cookie: ' . $result);
} else {
$this->removeCookieIfEmpty($cookie);
return false;
}
}
// Resolve conflicts with previously set cookies
foreach ($this->cookies as $i => $c) {
// Two cookies are identical, when their path, and domain are
// identical.
if ($c->getPath() != $cookie->getPath() ||
$c->getDomain() != $cookie->getDomain() ||
$c->getName() != $cookie->getName()
) {
continue;
}
// The previously set cookie is a discard cookie and this one is
// not so allow the new cookie to be set
if (!$cookie->getDiscard() && $c->getDiscard()) {
unset($this->cookies[$i]);
continue;
}
// If the new cookie's expiration is further into the future, then
// replace the old cookie
if ($cookie->getExpires() > $c->getExpires()) {
unset($this->cookies[$i]);
continue;
}
// If the value has changed, we better change it
if ($cookie->getValue() !== $c->getValue()) {
unset($this->cookies[$i]);
continue;
}
// The cookie exists, so no need to continue
return false;
}
$this->cookies[] = $cookie;
return true;
}
public function count()
{
return count($this->cookies);
}
public function getIterator()
{
return new \ArrayIterator(array_values($this->cookies));
}
public function extractCookies(
RequestInterface $request,
ResponseInterface $response
) {
if ($cookieHeader = $response->getHeader('Set-Cookie')) {
foreach ($cookieHeader as $cookie) {
$sc = SetCookie::fromString($cookie);
if (!$sc->getDomain()) {
$sc->setDomain($request->getUri()->getHost());
}
if (0 !== strpos($sc->getPath(), '/')) {
$sc->setPath($this->getCookiePathFromRequest($request));
}
$this->setCookie($sc);
}
}
}
/**
* Computes cookie path following RFC 6265 section 5.1.4
*
* @link https://tools.ietf.org/html/rfc6265#section-5.1.4
*
* @param RequestInterface $request
* @return string
*/
private function getCookiePathFromRequest(RequestInterface $request)
{
$uriPath = $request->getUri()->getPath();
if ('' === $uriPath) {
return '/';
}
if (0 !== strpos($uriPath, '/')) {
return '/';
}
if ('/' === $uriPath) {
return '/';
}
if (0 === $lastSlashPos = strrpos($uriPath, '/')) {
return '/';
}
return substr($uriPath, 0, $lastSlashPos);
}
public function withCookieHeader(RequestInterface $request)
{
$values = [];
$uri = $request->getUri();
$scheme = $uri->getScheme();
$host = $uri->getHost();
$path = $uri->getPath() ?: '/';
foreach ($this->cookies as $cookie) {
if ($cookie->matchesPath($path) &&
$cookie->matchesDomain($host) &&
!$cookie->isExpired() &&
(!$cookie->getSecure() || $scheme === 'https')
) {
$values[] = $cookie->getName() . '='
. $cookie->getValue();
}
}
return $values
? $request->withHeader('Cookie', implode('; ', $values))
: $request;
}
/**
* If a cookie already exists and the server asks to set it again with a
* null value, the cookie must be deleted.
*
* @param SetCookie $cookie
*/
private function removeCookieIfEmpty(SetCookie $cookie)
{
$cookieValue = $cookie->getValue();
if ($cookieValue === null || $cookieValue === '') {
$this->clear(
$cookie->getDomain(),
$cookie->getPath(),
$cookie->getName()
);
}
}
}
@@ -0,0 +1,84 @@
<?php
namespace GuzzleHttp\Cookie;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
/**
* Stores HTTP cookies.
*
* It extracts cookies from HTTP requests, and returns them in HTTP responses.
* CookieJarInterface instances automatically expire contained cookies when
* necessary. Subclasses are also responsible for storing and retrieving
* cookies from a file, database, etc.
*
* @link http://docs.python.org/2/library/cookielib.html Inspiration
*/
interface CookieJarInterface extends \Countable, \IteratorAggregate
{
/**
* Create a request with added cookie headers.
*
* If no matching cookies are found in the cookie jar, then no Cookie
* header is added to the request and the same request is returned.
*
* @param RequestInterface $request Request object to modify.
*
* @return RequestInterface returns the modified request.
*/
public function withCookieHeader(RequestInterface $request);
/**
* Extract cookies from an HTTP response and store them in the CookieJar.
*
* @param RequestInterface $request Request that was sent
* @param ResponseInterface $response Response that was received
*/
public function extractCookies(
RequestInterface $request,
ResponseInterface $response
);
/**
* Sets a cookie in the cookie jar.
*
* @param SetCookie $cookie Cookie to set.
*
* @return bool Returns true on success or false on failure
*/
public function setCookie(SetCookie $cookie);
/**
* Remove cookies currently held in the cookie jar.
*
* Invoking this method without arguments will empty the whole cookie jar.
* If given a $domain argument only cookies belonging to that domain will
* be removed. If given a $domain and $path argument, cookies belonging to
* the specified path within that domain are removed. If given all three
* arguments, then the cookie with the specified name, path and domain is
* removed.
*
* @param string|null $domain Clears cookies matching a domain
* @param string|null $path Clears cookies matching a domain and path
* @param string|null $name Clears cookies matching a domain, path, and name
*
* @return CookieJarInterface
*/
public function clear($domain = null, $path = null, $name = null);
/**
* Discard all sessions cookies.
*
* Removes cookies that don't have an expire field or a have a discard
* field set to true. To be called when the user agent shuts down according
* to RFC 2965.
*/
public function clearSessionCookies();
/**
* Converts the cookie jar to an array.
*
* @return array
*/
public function toArray();
}
@@ -0,0 +1,91 @@
<?php
namespace GuzzleHttp\Cookie;
/**
* Persists non-session cookies using a JSON formatted file
*/
class FileCookieJar extends CookieJar
{
/** @var string filename */
private $filename;
/** @var bool Control whether to persist session cookies or not. */
private $storeSessionCookies;
/**
* Create a new FileCookieJar object
*
* @param string $cookieFile File to store the cookie data
* @param bool $storeSessionCookies Set to true to store session cookies
* in the cookie jar.
*
* @throws \RuntimeException if the file cannot be found or created
*/
public function __construct($cookieFile, $storeSessionCookies = false)
{
parent::__construct();
$this->filename = $cookieFile;
$this->storeSessionCookies = $storeSessionCookies;
if (file_exists($cookieFile)) {
$this->load($cookieFile);
}
}
/**
* Saves the file when shutting down
*/
public function __destruct()
{
$this->save($this->filename);
}
/**
* Saves the cookies to a file.
*
* @param string $filename File to save
* @throws \RuntimeException if the file cannot be found or created
*/
public function save($filename)
{
$json = [];
foreach ($this as $cookie) {
/** @var SetCookie $cookie */
if (CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) {
$json[] = $cookie->toArray();
}
}
$jsonStr = \GuzzleHttp\json_encode($json);
if (false === file_put_contents($filename, $jsonStr, LOCK_EX)) {
throw new \RuntimeException("Unable to save file {$filename}");
}
}
/**
* Load cookies from a JSON formatted file.
*
* Old cookies are kept unless overwritten by newly loaded ones.
*
* @param string $filename Cookie file to load.
* @throws \RuntimeException if the file cannot be loaded.
*/
public function load($filename)
{
$json = file_get_contents($filename);
if (false === $json) {
throw new \RuntimeException("Unable to load file {$filename}");
} elseif ($json === '') {
return;
}
$data = \GuzzleHttp\json_decode($json, true);
if (is_array($data)) {
foreach (json_decode($json, true) as $cookie) {
$this->setCookie(new SetCookie($cookie));
}
} elseif (strlen($data)) {
throw new \RuntimeException("Invalid cookie file: {$filename}");
}
}
}
@@ -0,0 +1,72 @@
<?php
namespace GuzzleHttp\Cookie;
/**
* Persists cookies in the client session
*/
class SessionCookieJar extends CookieJar
{
/** @var string session key */
private $sessionKey;
/** @var bool Control whether to persist session cookies or not. */
private $storeSessionCookies;
/**
* Create a new SessionCookieJar object
*
* @param string $sessionKey Session key name to store the cookie
* data in session
* @param bool $storeSessionCookies Set to true to store session cookies
* in the cookie jar.
*/
public function __construct($sessionKey, $storeSessionCookies = false)
{
parent::__construct();
$this->sessionKey = $sessionKey;
$this->storeSessionCookies = $storeSessionCookies;
$this->load();
}
/**
* Saves cookies to session when shutting down
*/
public function __destruct()
{
$this->save();
}
/**
* Save cookies to the client session
*/
public function save()
{
$json = [];
foreach ($this as $cookie) {
/** @var SetCookie $cookie */
if (CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) {
$json[] = $cookie->toArray();
}
}
$_SESSION[$this->sessionKey] = json_encode($json);
}
/**
* Load the contents of the client session into the data array
*/
protected function load()
{
if (!isset($_SESSION[$this->sessionKey])) {
return;
}
$data = json_decode($_SESSION[$this->sessionKey], true);
if (is_array($data)) {
foreach ($data as $cookie) {
$this->setCookie(new SetCookie($cookie));
}
} elseif (strlen($data)) {
throw new \RuntimeException("Invalid cookie data");
}
}
}
+403
View File
@@ -0,0 +1,403 @@
<?php
namespace GuzzleHttp\Cookie;
/**
* Set-Cookie object
*/
class SetCookie
{
/** @var array */
private static $defaults = [
'Name' => null,
'Value' => null,
'Domain' => null,
'Path' => '/',
'Max-Age' => null,
'Expires' => null,
'Secure' => false,
'Discard' => false,
'HttpOnly' => false
];
/** @var array Cookie data */
private $data;
/**
* Create a new SetCookie object from a string
*
* @param string $cookie Set-Cookie header string
*
* @return self
*/
public static function fromString($cookie)
{
// Create the default return array
$data = self::$defaults;
// Explode the cookie string using a series of semicolons
$pieces = array_filter(array_map('trim', explode(';', $cookie)));
// The name of the cookie (first kvp) must exist and include an equal sign.
if (empty($pieces[0]) || !strpos($pieces[0], '=')) {
return new self($data);
}
// Add the cookie pieces into the parsed data array
foreach ($pieces as $part) {
$cookieParts = explode('=', $part, 2);
$key = trim($cookieParts[0]);
$value = isset($cookieParts[1])
? trim($cookieParts[1], " \n\r\t\0\x0B")
: true;
// Only check for non-cookies when cookies have been found
if (empty($data['Name'])) {
$data['Name'] = $key;
$data['Value'] = $value;
} else {
foreach (array_keys(self::$defaults) as $search) {
if (!strcasecmp($search, $key)) {
$data[$search] = $value;
continue 2;
}
}
$data[$key] = $value;
}
}
return new self($data);
}
/**
* @param array $data Array of cookie data provided by a Cookie parser
*/
public function __construct(array $data = [])
{
$this->data = array_replace(self::$defaults, $data);
// Extract the Expires value and turn it into a UNIX timestamp if needed
if (!$this->getExpires() && $this->getMaxAge()) {
// Calculate the Expires date
$this->setExpires(time() + $this->getMaxAge());
} elseif ($this->getExpires() && !is_numeric($this->getExpires())) {
$this->setExpires($this->getExpires());
}
}
public function __toString()
{
$str = $this->data['Name'] . '=' . $this->data['Value'] . '; ';
foreach ($this->data as $k => $v) {
if ($k !== 'Name' && $k !== 'Value' && $v !== null && $v !== false) {
if ($k === 'Expires') {
$str .= 'Expires=' . gmdate('D, d M Y H:i:s \G\M\T', $v) . '; ';
} else {
$str .= ($v === true ? $k : "{$k}={$v}") . '; ';
}
}
}
return rtrim($str, '; ');
}
public function toArray()
{
return $this->data;
}
/**
* Get the cookie name
*
* @return string
*/
public function getName()
{
return $this->data['Name'];
}
/**
* Set the cookie name
*
* @param string $name Cookie name
*/
public function setName($name)
{
$this->data['Name'] = $name;
}
/**
* Get the cookie value
*
* @return string
*/
public function getValue()
{
return $this->data['Value'];
}
/**
* Set the cookie value
*
* @param string $value Cookie value
*/
public function setValue($value)
{
$this->data['Value'] = $value;
}
/**
* Get the domain
*
* @return string|null
*/
public function getDomain()
{
return $this->data['Domain'];
}
/**
* Set the domain of the cookie
*
* @param string $domain
*/
public function setDomain($domain)
{
$this->data['Domain'] = $domain;
}
/**
* Get the path
*
* @return string
*/
public function getPath()
{
return $this->data['Path'];
}
/**
* Set the path of the cookie
*
* @param string $path Path of the cookie
*/
public function setPath($path)
{
$this->data['Path'] = $path;
}
/**
* Maximum lifetime of the cookie in seconds
*
* @return int|null
*/
public function getMaxAge()
{
return $this->data['Max-Age'];
}
/**
* Set the max-age of the cookie
*
* @param int $maxAge Max age of the cookie in seconds
*/
public function setMaxAge($maxAge)
{
$this->data['Max-Age'] = $maxAge;
}
/**
* The UNIX timestamp when the cookie Expires
*
* @return mixed
*/
public function getExpires()
{
return $this->data['Expires'];
}
/**
* Set the unix timestamp for which the cookie will expire
*
* @param int $timestamp Unix timestamp
*/
public function setExpires($timestamp)
{
$this->data['Expires'] = is_numeric($timestamp)
? (int) $timestamp
: strtotime($timestamp);
}
/**
* Get whether or not this is a secure cookie
*
* @return bool|null
*/
public function getSecure()
{
return $this->data['Secure'];
}
/**
* Set whether or not the cookie is secure
*
* @param bool $secure Set to true or false if secure
*/
public function setSecure($secure)
{
$this->data['Secure'] = $secure;
}
/**
* Get whether or not this is a session cookie
*
* @return bool|null
*/
public function getDiscard()
{
return $this->data['Discard'];
}
/**
* Set whether or not this is a session cookie
*
* @param bool $discard Set to true or false if this is a session cookie
*/
public function setDiscard($discard)
{
$this->data['Discard'] = $discard;
}
/**
* Get whether or not this is an HTTP only cookie
*
* @return bool
*/
public function getHttpOnly()
{
return $this->data['HttpOnly'];
}
/**
* Set whether or not this is an HTTP only cookie
*
* @param bool $httpOnly Set to true or false if this is HTTP only
*/
public function setHttpOnly($httpOnly)
{
$this->data['HttpOnly'] = $httpOnly;
}
/**
* Check if the cookie matches a path value.
*
* A request-path path-matches a given cookie-path if at least one of
* the following conditions holds:
*
* - The cookie-path and the request-path are identical.
* - The cookie-path is a prefix of the request-path, and the last
* character of the cookie-path is %x2F ("/").
* - The cookie-path is a prefix of the request-path, and the first
* character of the request-path that is not included in the cookie-
* path is a %x2F ("/") character.
*
* @param string $requestPath Path to check against
*
* @return bool
*/
public function matchesPath($requestPath)
{
$cookiePath = $this->getPath();
// Match on exact matches or when path is the default empty "/"
if ($cookiePath === '/' || $cookiePath == $requestPath) {
return true;
}
// Ensure that the cookie-path is a prefix of the request path.
if (0 !== strpos($requestPath, $cookiePath)) {
return false;
}
// Match if the last character of the cookie-path is "/"
if (substr($cookiePath, -1, 1) === '/') {
return true;
}
// Match if the first character not included in cookie path is "/"
return substr($requestPath, strlen($cookiePath), 1) === '/';
}
/**
* Check if the cookie matches a domain value
*
* @param string $domain Domain to check against
*
* @return bool
*/
public function matchesDomain($domain)
{
// Remove the leading '.' as per spec in RFC 6265.
// http://tools.ietf.org/html/rfc6265#section-5.2.3
$cookieDomain = ltrim($this->getDomain(), '.');
// Domain not set or exact match.
if (!$cookieDomain || !strcasecmp($domain, $cookieDomain)) {
return true;
}
// Matching the subdomain according to RFC 6265.
// http://tools.ietf.org/html/rfc6265#section-5.1.3
if (filter_var($domain, FILTER_VALIDATE_IP)) {
return false;
}
return (bool) preg_match('/\.' . preg_quote($cookieDomain, '/') . '$/', $domain);
}
/**
* Check if the cookie is expired
*
* @return bool
*/
public function isExpired()
{
return $this->getExpires() !== null && time() > $this->getExpires();
}
/**
* Check if the cookie is valid according to RFC 6265
*
* @return bool|string Returns true if valid or an error message if invalid
*/
public function validate()
{
// Names must not be empty, but can be 0
$name = $this->getName();
if (empty($name) && !is_numeric($name)) {
return 'The cookie name must not be empty';
}
// Check if any of the invalid characters are present in the cookie name
if (preg_match(
'/[\x00-\x20\x22\x28-\x29\x2c\x2f\x3a-\x40\x5c\x7b\x7d\x7f]/',
$name
)) {
return 'Cookie name must not contain invalid characters: ASCII '
. 'Control characters (0-31;127), space, tab and the '
. 'following characters: ()<>@,;:\"/?={}';
}
// Value must not be empty, but can be 0
$value = $this->getValue();
if (empty($value) && !is_numeric($value)) {
return 'The cookie value must not be empty';
}
// Domains must not be empty, but can be 0
// A "0" is not a valid internet domain, but may be used as server name
// in a private network.
$domain = $this->getDomain();
if (empty($domain) && !is_numeric($domain)) {
return 'The cookie domain must not be empty';
}
return true;
}
}
@@ -0,0 +1,27 @@
<?php
namespace GuzzleHttp\Exception;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
/**
* Exception when an HTTP error occurs (4xx or 5xx error)
*/
class BadResponseException extends RequestException
{
public function __construct(
$message,
RequestInterface $request,
ResponseInterface $response = null,
\Exception $previous = null,
array $handlerContext = []
) {
if (null === $response) {
@trigger_error(
'Instantiating the ' . __CLASS__ . ' class without a Response is deprecated since version 6.3 and will be removed in 7.0.',
E_USER_DEPRECATED
);
}
parent::__construct($message, $request, $response, $previous, $handlerContext);
}
}
@@ -0,0 +1,9 @@
<?php
namespace GuzzleHttp\Exception;
/**
* Exception when a client error is encountered (4xx codes)
*/
class ClientException extends BadResponseException
{
}
@@ -0,0 +1,37 @@
<?php
namespace GuzzleHttp\Exception;
use Psr\Http\Message\RequestInterface;
/**
* Exception thrown when a connection cannot be established.
*
* Note that no response is present for a ConnectException
*/
class ConnectException extends RequestException
{
public function __construct(
$message,
RequestInterface $request,
\Exception $previous = null,
array $handlerContext = []
) {
parent::__construct($message, $request, null, $previous, $handlerContext);
}
/**
* @return null
*/
public function getResponse()
{
return null;
}
/**
* @return bool
*/
public function hasResponse()
{
return false;
}
}
@@ -0,0 +1,23 @@
<?php
namespace GuzzleHttp\Exception;
use Throwable;
if (interface_exists(Throwable::class)) {
interface GuzzleException extends Throwable
{
}
} else {
/**
* @method string getMessage()
* @method \Throwable|null getPrevious()
* @method mixed getCode()
* @method string getFile()
* @method int getLine()
* @method array getTrace()
* @method string getTraceAsString()
*/
interface GuzzleException
{
}
}
@@ -0,0 +1,7 @@
<?php
namespace GuzzleHttp\Exception;
final class InvalidArgumentException extends \InvalidArgumentException implements GuzzleException
{
}
@@ -0,0 +1,192 @@
<?php
namespace GuzzleHttp\Exception;
use GuzzleHttp\Promise\PromiseInterface;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\UriInterface;
/**
* HTTP Request exception
*/
class RequestException extends TransferException
{
/** @var RequestInterface */
private $request;
/** @var ResponseInterface|null */
private $response;
/** @var array */
private $handlerContext;
public function __construct(
$message,
RequestInterface $request,
ResponseInterface $response = null,
\Exception $previous = null,
array $handlerContext = []
) {
// Set the code of the exception if the response is set and not future.
$code = $response && !($response instanceof PromiseInterface)
? $response->getStatusCode()
: 0;
parent::__construct($message, $code, $previous);
$this->request = $request;
$this->response = $response;
$this->handlerContext = $handlerContext;
}
/**
* Wrap non-RequestExceptions with a RequestException
*
* @param RequestInterface $request
* @param \Exception $e
*
* @return RequestException
*/
public static function wrapException(RequestInterface $request, \Exception $e)
{
return $e instanceof RequestException
? $e
: new RequestException($e->getMessage(), $request, null, $e);
}
/**
* Factory method to create a new exception with a normalized error message
*
* @param RequestInterface $request Request
* @param ResponseInterface $response Response received
* @param \Exception $previous Previous exception
* @param array $ctx Optional handler context.
*
* @return self
*/
public static function create(
RequestInterface $request,
ResponseInterface $response = null,
\Exception $previous = null,
array $ctx = []
) {
if (!$response) {
return new self(
'Error completing request',
$request,
null,
$previous,
$ctx
);
}
$level = (int) floor($response->getStatusCode() / 100);
if ($level === 4) {
$label = 'Client error';
$className = ClientException::class;
} elseif ($level === 5) {
$label = 'Server error';
$className = ServerException::class;
} else {
$label = 'Unsuccessful request';
$className = __CLASS__;
}
$uri = $request->getUri();
$uri = static::obfuscateUri($uri);
// Client Error: `GET /` resulted in a `404 Not Found` response:
// <html> ... (truncated)
$message = sprintf(
'%s: `%s %s` resulted in a `%s %s` response',
$label,
$request->getMethod(),
$uri,
$response->getStatusCode(),
$response->getReasonPhrase()
);
$summary = static::getResponseBodySummary($response);
if ($summary !== null) {
$message .= ":\n{$summary}\n";
}
return new $className($message, $request, $response, $previous, $ctx);
}
/**
* Get a short summary of the response
*
* Will return `null` if the response is not printable.
*
* @param ResponseInterface $response
*
* @return string|null
*/
public static function getResponseBodySummary(ResponseInterface $response)
{
return \GuzzleHttp\Psr7\get_message_body_summary($response);
}
/**
* Obfuscates URI if there is a username and a password present
*
* @param UriInterface $uri
*
* @return UriInterface
*/
private static function obfuscateUri(UriInterface $uri)
{
$userInfo = $uri->getUserInfo();
if (false !== ($pos = strpos($userInfo, ':'))) {
return $uri->withUserInfo(substr($userInfo, 0, $pos), '***');
}
return $uri;
}
/**
* Get the request that caused the exception
*
* @return RequestInterface
*/
public function getRequest()
{
return $this->request;
}
/**
* Get the associated response
*
* @return ResponseInterface|null
*/
public function getResponse()
{
return $this->response;
}
/**
* Check if a response was received
*
* @return bool
*/
public function hasResponse()
{
return $this->response !== null;
}
/**
* Get contextual information about the error from the underlying handler.
*
* The contents of this array will vary depending on which handler you are
* using. It may also be just an empty array. Relying on this data will
* couple you to a specific handler, but can give more debug information
* when needed.
*
* @return array
*/
public function getHandlerContext()
{
return $this->handlerContext;
}
}
@@ -0,0 +1,27 @@
<?php
namespace GuzzleHttp\Exception;
use Psr\Http\Message\StreamInterface;
/**
* Exception thrown when a seek fails on a stream.
*/
class SeekException extends \RuntimeException implements GuzzleException
{
private $stream;
public function __construct(StreamInterface $stream, $pos = 0, $msg = '')
{
$this->stream = $stream;
$msg = $msg ?: 'Could not seek the stream to position ' . $pos;
parent::__construct($msg);
}
/**
* @return StreamInterface
*/
public function getStream()
{
return $this->stream;
}
}

Some files were not shown because too many files have changed in this diff Show More