Your Name 3 anos atrás
pai
commit
3ff95ec0a4

+ 337 - 0
tool/clue/assets/pc/html/index.html

@@ -0,0 +1,337 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>线索列表详情页</title>
+<meta name="renderer" content="webkit">
+<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+<meta name="apple-mobile-web-app-status-bar-style" content="black"> 
+<meta name="apple-mobile-web-app-capable" content="yes">
+<meta name="format-detection" content="telephone=no">
+<link rel="stylesheet" type="text/css" href="../script/lib/layui/css/layui.css" />
+<link rel="stylesheet" type="text/css" href="../script/lib/valid/validationEngine.jquery.css">
+<!-- <link rel="stylesheet" type="text/css" href="../script/lib/layui/admin/style/admin.css?v9" media="all"> -->
+<link rel="stylesheet" type="text/css" href="../script/lib/fancybox/jquery.fancybox.css">
+<link rel="stylesheet" type="text/css" href="../script/lib/datetime/jquery.datetimepicker.css">
+
+
+<link rel="stylesheet" type="text/css" href="../script/lib/color/colpick.css">
+<link rel="stylesheet" type="text/css" href="../script/lib/kindeditor/themes/default/default.css?v1" />
+<link rel="stylesheet" type="text/css" href="../script/lib/valid/validationEngine.jquery.css">
+<link rel="stylesheet" type="text/css" href="../script/lib/highlight/highlight.min.css">
+<link rel="stylesheet" type="text/css" href="../script/lib/ui/ui.min.css">
+<link rel="stylesheet" href="../script/lib/layui/admin/modules/plugin/formselects/formselects.css" media="all" />
+<script src="../script/lib/jquery/jquery.min.js"></script>
+<script src="../script/lib/layui/layui.js"></script>
+<script src="../script/lib/echarts/echarts.common.min.js"></script>
+<script src="../script/lib/miniui/miniui.js"></script>
+<script><{Dever::script()}></script>
+<script src="../script/dever/core.js"></script>
+<script type="text/javascript" src="../script/lib/valid/jquery.validationEngine.min.js?v3"></script>
+<script type="text/javascript" src="../script/lib/layui/upload.js?v226"></script>
+<script type="text/javascript" src="../script/lib/datetime/jquery.datetimepicker.min.js?v2"></script>
+<script type="text/javascript" src="../script/lib/clipboard/clipboard.js?v11"></script>
+<script type="text/javascript" src="../script/lib/highlight/highlight.min.js"></script>
+<script type="text/javascript" src="../script/lib/fancybox/jquery.fancybox.js"></script>
+<script src="../script/lib/manage/main.js?v82"></script>
+
+
+<script type="text/javascript" src="../script/lib/pic/webp.js"></script>
+
+
+<script type="text/javascript" src="../script/lib/color/colpick.js"></script>
+
+<script type="text/javascript" src="../script/lib/kindeditor/kindeditor-all-min.js?v9"></script>
+<script type="text/javascript" src="../script/lib/kindeditor/lang/zh-CN.js?v7"></script>
+
+<script type="text/javascript" src="../script/lib/ui/ui.min.js"></script>
+
+
+<script type="text/javascript" src="../script/lib/qiniu/upload/plupload.full.min.js"></script>
+
+<script type="text/javascript" src="../script/lib/qiniu/qiniu.upload.js"></script>
+<script type="text/javascript" src="../script/lib/oss/aliyun-oss-sdk-6.11.2.min.js"></script>
+<script type="text/javascript" src="../script/lib/tool/md5.js"></script>
+
+<script type="text/javascript" src="../script/lib/layui/upload.js?v226"></script>
+<script type="text/javascript" src="../script/lib/layui/layui.js"></script>
+
+<script type="text/javascript" src="../script/lib/clipboard/clipboard.js"></script>
+
+<script type="text/javascript" src="../script/lib/pic/holder.js"></script>
+
+<script type="text/javascript" src="../script/lib/excel/xlsx.min.js"></script>
+<script type="text/javascript" src="../script/lib/excel/excel.js?v16"></script>
+<style>
+
+body{
+    background:white;
+	/*padding-left: 10px;*/
+	height:100%;
+}
+.layout{
+    width: 100%;
+
+    height: 100%;
+
+    display: flex;
+    justify-content : space-around;
+    font-size:14px;
+
+}
+.layuiadmin-btn-list {
+    display: inline-block;
+    height: 38px;
+    line-height: 38px;
+    padding: 0 18px;
+    background-color: #009688;
+    color: #fff;
+    white-space: nowrap;
+    text-align: center;
+    font-size: 14px;
+    border: none;
+    border-radius: 2px;
+    cursor: pointer;
+}
+.aside{
+
+    flex:1;
+    height: 100%;
+    background: white;
+    margin-top:20px;
+    margin-left: 40px;
+}
+.article{
+    width:230px;
+    height: 100%;
+    background: white;
+}
+.xiansuo{
+    margin-top:20px;
+    /*margin-bottom:-23px;*/
+    /*margin-left:12px;*/
+    /*font-size:14px;*/
+  }
+
+.onebor{
+    width: 700px;
+    padding-left: 25px;
+    padding-bottom: 10px;
+    border: 1px solid #ddd;
+    /*border-left: 1px solid grey;
+    border-right: 1px solid grey;
+    border-bottom: 1px solid grey;*/
+    margin-top: 15px;
+    margin-bottom: 40px;
+    box-shadow: 3px 10px 7px -15px;
+    border-radius: 15px;
+}
+.bianhao{
+	margin-bottom: 10px;
+}
+.chuang{
+	margin-bottom: 10px;
+}
+.desc{
+	margin-top: 10px;
+	margin-bottom:5px;
+}
+
+.gengzong{
+    width: 700px;
+    padding-left: 25px;
+    padding-bottom: 10px;
+    border: 1px solid #ddd;
+    /*border-left: 1px solid grey;
+    border-right: 1px solid grey;
+    border-bottom: 1px solid grey;*/
+    margin-top: 15px;
+    margin-bottom: 40px;
+    box-shadow: 3px 10px 7px -15px;
+    border-radius: 15px;
+}
+.tine{
+	margin-top:10px;
+	margin-bottom:20px;
+}
+.gou{
+	margin-top:10px;
+	margin-bottom:20px;
+}
+.dengji{
+	margin: 0px auto;
+    width: 146px;
+    height: 38px;
+    box-shadow: 2px 10px 7px -12px;
+    border-radius: 160px;
+    background: #efefef;
+    margin-bottom:20px;
+    margin-top: 30px;
+    padding-top: 10px;
+    padding-bottom: 10px;
+}
+.suo{
+	margin: 0px auto;
+    width: 146px;
+    height: 38px;
+    box-shadow: 2px 10px 7px -12px;
+    border-radius: 160px;
+    background: #efefef;
+    margin-bottom:20px;
+    padding-top: 10px;
+    padding-bottom: 10px;
+}
+.jin{
+	margin: 0px auto;
+    width: 146px;
+    height: 38px;
+    box-shadow: 2px 10px 7px -12px;
+    border-radius: 160px;
+    background: #efefef;
+    margin-bottom:20px;
+    padding-top: 10px;
+    padding-bottom: 10px;
+}
+.wei{
+	margin: 0px auto;
+    width: 146px;
+    height: 38px;
+    box-shadow: 2px 10px 7px -12px;
+    border-radius: 160px;
+    background: #efefef;
+    margin-bottom:20px;
+    padding-top: 10px;
+    padding-bottom: 10px;
+}
+.xia{
+	margin: 0px auto;
+    width: 146px;
+    height: 38px;
+    box-shadow: 2px 10px 7px -12px;
+    border-radius: 160px;
+    background: #efefef;
+    margin-bottom:20px;
+    padding-top: 10px;
+    padding-bottom: 10px;
+}
+.ren{
+	margin-bottom:20px;
+	margin: 0px auto;
+    width: 146px;
+    height: 45px;
+    box-shadow: 2px 10px 7px -12px;
+    border-radius: 160px;
+    background: #efefef;
+    padding-top: 10px;
+    padding-bottom: 10px;
+}
+</style>
+</head>
+<body>
+	<div class="layout">
+		<aside class="aside">
+			<div>
+			<button class="btn btn-default layui-btn layuiadmin-btn-list"  " type="button" style="vertical-align: middle;margin-bottom: 2px;" onclick="fastEdit($(this),'<{$xiu}>')">修改线索信息</button>
+            <{if(isset($jichu) && $jichu):}>
+			<button class="btn btn-default layui-btn layuiadmin-btn-list"  " type="button" style="vertical-align: middle;margin-bottom: 2px;" onclick="fastEdit($(this),'<{$jichu}>')">修改基础信息</button>
+            <{endif}>
+            <button class="btn btn-default layui-btn layuiadmin-btn-list" id="quxiao" style="vertical-align: middle;margin-bottom: 2px;" onclick="fastEdit($(this),'<{$ke}>')">客户等级调整</button>
+            <{if($info['status_id']<5):}>
+			<button class="btn btn-default layui-btn layuiadmin-btn-list" id="quxiao" style="vertical-align: middle;margin-bottom: 2px;" onclick="fastEdit($(this),'<{$gen}>')">跟进信息</button>
+		    <button class="btn btn-default layui-btn layuiadmin-btn-list" id="quxiao" style="vertical-align: middle;margin-bottom: 2px;" onclick="fastEdit($(this),'<{$pai}>')">转派跟进人</button>
+             <button class="btn btn-default layui-btn layuiadmin-btn-list" id="huifu" style="vertical-align: middle;margin-bottom: 2px;" onclick="fastEdit($(this),'<{$status}>')">线索状态调整</button>
+             <{endif}>
+		    
+			</div>
+			<div class="xiansuo">
+			<div class="bianhao">线索编号:<{$info['clue_num']}></div>
+			<div class="chuang"><span style="margin-bottom: 10px;">创建人:<{$info['admin_name']}></span><span style=" margin-left: 30px; margin-bottom: 10px">创建时间:<{$info['cdate']}></span></div>
+			</div>
+			<div class="layui-row onebor">
+			<div class="layui-col-bg layui-col-md12 ">
+		      <div class="grid-demo grid-demo-bg desc">姓名:<{$info['name']}></div>
+		    </div>
+		    <div class="layui-col-bg layui-col-md12 ">
+		      <div class="grid-demo grid-demo-bg desc">手机号:<{$info['mobile']}></div>
+		    </div>
+		    <div class="layui-col-bg layui-col-md12 ">
+		      <div class="grid-demo grid-demo-bg desc">QQ:<{$info['qq']}></div>
+		    </div>
+		    <div class="layui-col-bg layui-col-md12 ">
+		      <div class="grid-demo grid-demo-bg desc">微信:<{$info['wechat']}></div>
+		    </div>
+		    <div class="layui-col-bg layui-col-md12 ">
+		      <div class="grid-demo grid-demo-bg desc">来源:<{$info['source_name']}></div>
+		    </div>
+		    <div class="layui-col-bg layui-col-md12 ">
+		      <div class="grid-demo grid-demo-bg desc">年龄:<{$info['age']}></div>
+		    </div>
+		    <div class="layui-col-bg layui-col-md12 ">
+		      <div class="grid-demo grid-demo-bg desc">性别:<{$info['sex_name']}></div>
+		    </div>
+		    <div class="layui-col-bg layui-col-md12 ">
+		      <div class="grid-demo grid-demo-bg desc">所在城市:<{$info['area_name']}></div>
+		    </div>
+		    <div class="layui-col-bg layui-col-md12 ">
+		      <div class="grid-demo grid-demo-bg desc">所属行业:<{$info['trade']}></div>
+		    </div>
+		    <div class="layui-col-bg layui-col-md12 ">
+		      <div class="grid-demo grid-demo-bg desc">竞品了解:<{$info['desc']}></div>
+		    </div>
+		    <div class="layui-col-bg layui-col-md12 ">
+		      <div class="grid-demo grid-demo-bg desc">结论备注:<{$info['status_desc']}></div>
+		    </div>
+			</div>
+			<{if(isset($follow) && $follow):}>
+			<{foreach($follow as $k => $v):}>
+			<div class="layui-row gengzong">
+				<div class="tine"><span>跟进时间:<{$v['cdate']}></span><span style="margin-left: 10px;">跟进人:<{$v['group_name']}></span><span style="margin-left: 10px;">跟进方式:<{$v['type_name']}></span><span style="margin-left: 10px;">计划下次跟进:<{$v['xdate']}></span></div>
+				<div class="gou">沟通结果:<{$v['desc']}></div>
+				<div id="layer-photos_log-<{$v['id']}>" class="layer-photos-demo layui-col-xs5" id="tk">
+      
+		      <{if(isset($v['pic'])):}>
+		      <{foreach($v['pic'] as $k1 => $v1):}>
+		          <img src='<{$v1}>' class="fd show" height='100px'>
+		        <{endforeach}>
+		        <{endif}>
+		      </div>
+			</div>
+			<{endforeach}>
+			<{endif}>
+		</aside>
+		<article class="article" >
+			<div class="dengji" align="center"><{$info['userset_name']}><br/>客户等级</div>
+			<div class="suo" align="center"><{$info['status_name']}><br/>线索状态</div>
+			<div class="jin" align="center"><{$info['follow']}><br/>跟进次数</div>
+			<div class="wei" align="center"><{$info['day']}><br/>未跟进时间</div>
+			<div class="xia" align="center"><{$info['xdate']}><br/>计划下次跟进</div>
+			<div class="ren" align="center"><{$info['people']}><br/>跟进人</div>
+		</article>
+	</div>
+
+<script>
+var form;
+var layer;
+layui.config({
+    base: '../script/lib/layui/admin/' //静态资源所在路径
+    ,version:true
+  }).extend({
+    index: 'lib/index', //主入口模块
+    formSelects: 'plugin/formselects/formselects',
+   
+  }).use([ 'form', 'layer'], function(){
+    form = layui.form; 
+    // var formSelects = layui.formSelects;
+    layer = layui.layer;
+    $('.layer-photos-demo').each(function() {
+      layer.photos({
+        photos: '#' + $(this).attr('id')
+        ,anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数)
+      }); 
+  })
+});
+
+</script>
+</body>
+</html>

+ 202 - 0
tool/clue/database/follow.php

@@ -0,0 +1,202 @@
+<?php
+$type = array
+(
+    1 => '电话',
+    2 => '微信',
+    3 => 'QQ',
+    4 => '短信',
+);
+$status = array
+(
+    1 => '显示',
+    2 => '不显示',
+);
+return array
+(
+    # 表名
+    'name' => 'follow',
+    # 显示给用户看的名称
+    'lang' => '跟进人',
+    # 后台菜单排序
+    'order' => 2,
+    'menu' => false,
+    'end' => array
+    (
+    	'insert' => 'clue/lib/info.updateFollow',
+    	'update' => 'clue/lib/info.updateFollow',
+    ),
+    // 'auto' => 100000,
+    'config_type' => $type,
+    # 数据结构
+    'struct' => array
+    (
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'list'      => true,
+            'order'     => 'desc',
+        ),
+
+        'info_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '线索来源',
+            'default'   => '-1',
+            'desc'      => '线索来源',
+            'match'     => 'option',
+            // 'option'    => $info_id,
+            'update'    => 'hidden',
+            'value'     => Dever::input('search_option_info_id'),
+            'list'      => true,
+        ),
+
+        'follow_admin_id'       => array
+        (
+            'type'      => 'varchar-30',
+            'name'      => '跟进人',
+            'default'   => '',
+            'desc'      => '跟进人',
+            'match'     => 'option',
+            // 'search'    => 'linkage',
+            // 'update'    => 'linkage',
+            // 'option'    => Dever::url('lib/appoint.get?level_total=2', 'work'),
+        ),
+
+        'desc'       => array
+        (
+            'type'      => 'text-255',
+            'name'      => '跟进详情',
+            'default'   => '',
+            'desc'      => '跟进详情',
+            'match'     => 'is_string',
+            'update'    => 'textarea',
+            'list'      => true,
+        ),
+
+        'pic'        => array
+        (
+            'type'      => 'varchar-500',
+            'name'      => '相关截图',
+            'default'   => '',
+            'desc'      => '请选择相关截图',
+            'match'     => 'option',
+            'update'    => 'images',
+            'key'       => '1',
+            //'place'       => '150',
+        ),
+
+        'xdate'         => array
+        (
+            'type'      => 'int-11',
+            'name'      => '计划下次跟进时间',
+            'default'   => '',
+            'match'     => 'is_numeric',
+            // 'search'    => 'date',
+            'desc'      => '',
+            'update'    => 'date',
+            // 'callback'  => 'maketime',
+        ),
+
+        'type'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '跟进方式',
+            'default'   => '1',
+            'desc'      => '跟进方式',
+            'match'     => 'is_string',
+            'option'    => $type,
+            'update'    => 'select',
+            // 'search'    => 'select',
+            // 'list'      => true,
+        ),
+
+        'status'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '是否显示',
+            'default'   => '1',
+            'desc'      => '是否显示',
+            'match'     => 'is_string',
+            'option'    => $status,
+            'update'    => 'hidden',
+            // 'search'    => 'select',
+            // 'list'      => true,
+        ),
+
+        'state'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '状态',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+        
+        'cdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '创建时间',
+            'match'     => array('is_numeric', time()),
+            'desc'      => '',
+            # 只有insert时才生效
+            'insert'    => true,
+            'list'      => 'date("Y-m-d H:i:s", {cdate})',
+        ),
+    ),
+
+    'manage' => array
+    (
+    	//'insert' => false,
+        'delete' => false,
+        // 'edit' => false,
+        
+    ),
+
+    'request' => array
+    (
+        'getAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'info_id' => 'yes',
+                'status' => 1,
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('id' => 'asc'),
+            'col' => '*',
+        ),
+        'getOne' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'info_id' => 'yes',
+                'status' => 1,
+                'state' => 1,
+            ),
+            'type' => 'one',
+            'order' => array('cdate' => 'desc'),
+            'col' => '*',
+        ),
+        'getCount' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'info_id' => 'yes',
+                'status' => 1,
+                'state' => 1,
+            ),
+            'type' => 'count',
+            // 'order' => array('id' => 'asc'),
+            'col' => '*',
+        ),
+    ),
+);

+ 104 - 0
tool/clue/database/import.php

@@ -0,0 +1,104 @@
+<?php
+$source = function()
+{
+    $array = array();
+    $data = Dever::db('clue/source')->state(array('type'=>1));
+    if($data)
+    {
+        $array += $data;
+    }
+    return $array;
+};
+$a = '<a href="'.Dever::url("clue/lib/manage.out_muban").'">下载模板</a>';
+return array
+(
+    # 表名
+    'name' => 'import',
+    # 显示给用户看的名称
+    'lang' => '线索导入',
+    # 后台菜单排序
+    'order' => 2,
+    'menu' => false,
+    // 'auto' => 100000,
+    'start'=>array
+    (
+    	'insert'=>'clue/lib/manage.updateImport',
+    	'update'=>'clue/lib/manage.updateImport',
+
+    ),
+    # 数据结构
+    'struct' => array
+    (
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'list'      => true,
+            'order'     => 'desc',
+        ),
+
+        'source'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '来源',
+            'default'   => '1',
+            'desc'      => '',
+            'match'     => 'is_string',
+            'option'    => $source,
+            'update'    => 'radio',
+            // 'search'    => $search_auth == 1 ? 'select' : false,
+            // 'list'      => true,
+        ),
+
+        'file'        => array
+        (
+            'type'      => 'varchar-500',
+            'name'      => '上传Excel文件或csv文件-'.$a,
+            'default'   => '',
+            'desc'      => '上传Excel文件或csv文件',
+            'match'     => 'is_string',
+            'update'    => 'upload',
+            'key'       => '8',
+            //'place'       => '150',
+        ),
+
+        'state'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '状态',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+        
+        'cdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '创建时间',
+            'match'     => array('is_numeric', time()),
+            'desc'      => '',
+            # 只有insert时才生效
+            'insert'    => true,
+            'list'      => 'date("Y-m-d H:i:s", {cdate})',
+        ),
+    ),
+
+    'manage' => array
+    (
+    	//'insert' => false,
+        // 'delete' => false,
+        // 'edit' => false,
+        # 后台管理不要列表页
+		'list' => 'update',
+    ),
+
+    'request' => array
+    (
+        
+        
+    ),
+);

+ 618 - 0
tool/clue/database/info.php

@@ -0,0 +1,618 @@
+<?php
+$people = function()
+{
+    $array = array();
+    $data = Dever::db('clue/user_set')->state();
+    if($data)
+    {
+    	
+        $array += $data;
+    }
+    return $array;
+};
+
+$source = function()
+{
+    $array = array();
+    $data = Dever::db('clue/source')->state(array('type'=>1));
+    if($data)
+    {
+        $array += $data;
+    }
+    return $array;
+};
+$status = function()
+{
+    $array = array();
+    $data = Dever::db('clue/sale_status')->state();
+    if($data)
+    {
+        $array += $data;
+    }
+    return $array;
+};
+$sex = array
+(
+    1 => '未知',
+    2 => '男',
+    3 => '女',
+);
+$type = array
+(
+    1 => '待分派',
+    2 => '待跟进',
+    3 => '已跟进',
+    4 => '已完成',
+    5 => '已关闭',
+    6 => '未跟进',
+);
+$out_type = array
+(
+    1 => '否',
+    2 => '是',
+);
+$admin = Dever::load("manage/auth.info");
+$admin_id = '';
+if ($admin) {
+    $admin_id = $admin['id'];
+}
+$search_auth = Dever::input('search_option_dever_auth', 1);
+if ($search_auth ==2) {
+	$audit_admin = Dever::setInput('search_option_follow_admin_id', $admin_id);
+	// print_R($audit_admin);die;
+}
+$list_button = array();
+$list_button['location'] = array('查看详情',Dever::url('lib/info.show','clue'));
+$list_button ['fast_add'] = array('转派',Dever::url('project/database/update?project=clue&table=info&where_id={id}&col=follow', 'manage'),'{type}<4');
+
+$excel[] = array('数据导出','线索列表数据导出', 'clue/lib/manage.out_info');
+$button = array();
+$button['线索导入'] = array('fast','','import&project=clue&call=clue/lib/manage.import');
+$col = Dever::input('col');
+return array
+(
+    # 表名
+    'name' => 'info',
+    # 显示给用户看的名称
+    'lang' => '创建新线索',
+    # 后台菜单排序
+    'order' => 100,
+    // 'menu' => false,
+    // 'auto' => 100000,
+    'start' => array
+    (
+    	'insert' => 'clue/lib/info.insertInfo',
+    	// 'update' => 'clue/lib/info.insertInfo',
+    ),
+    'end' => array
+    (
+        'insert' => 'clue/lib/info.updateInfo',
+        'update' => 'clue/lib/info.updateInfo',
+    ),
+    'config_type' => $type,
+    'config_sex'  => $sex,
+    # 数据结构
+    'struct' => array
+    (
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'list'      => true,
+            'order'     => 'desc',
+        ),
+
+        'company_id'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '所属公司',
+            'default'   => '1',
+            'desc'      => '所属公司',
+            'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            //'search'    => $company ? 'select' : false,
+            //'list'      => true,
+        ),
+
+        'day'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '计划下次跟进时间',
+            'default'   => '',
+            'match'     => 'is_numeric',
+            'desc'      => '',
+            'search'    => 'sdate',
+            'search_buttons' => array
+            (
+                // 'sum' => 'buy_num,buy_cash,sell_num,sell_cash,sl_num',
+                'option' => array(
+                    'day' => '按天',
+                    'week' => '按周',
+                    'month' => '按月',
+                ),
+                // 'group' => 'id',
+            ),
+            // 'order'     => 'desc',
+            'list'      =>  'Dever::load("clue/lib/info.getNum#xdate",{id})',
+            // 'Dever::showDay("{day}")',
+            'list_order' => 5,
+        ),
+        'name'      => array
+        (
+            'type'      => 'varchar-32',
+            'name'      => '用户姓名',
+            'default'   => '',
+            'desc'      => '用户姓名',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            // 'search'    => 'fulltext',
+            // 'list'      => true,
+        ),
+
+
+        'mobile'      => array
+        (
+            'type'      => 'bigint-11',
+            'name'      => '手机号',
+            'default'   => '',
+            'desc'      => '请输入手机号',
+            'match'     => Dever::rule('mobile'),
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            // 'value'     => Dever::input('search_option_mobile'),
+            'list_name' => '客户信息',
+            'list'      => 'Dever::load("clue/lib/info.getNum#user",{id})',#true,
+            'list_order' => 2,
+        ),
+
+        'wechat'      => array
+        (
+            'type'      => 'varchar-32',
+            'name'      => '微信号',
+            'default'   => '',
+            'desc'      => '微信号',
+            'match'     => 'option',
+            'update'    => 'text',
+            // 'search'    => 'fulltext',
+            // 'list'      => true,
+        ),
+
+        'qq'      => array
+        (
+            'type'      => 'varchar-32',
+            'name'      => 'QQ号',
+            'default'   => '',
+            'desc'      => 'QQ号',
+            'match'     => 'option',
+            'update'    => 'text',
+            // 'search'    => 'fulltext',
+            // 'list'      => true,
+        ),
+
+        'source'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '来源',
+            'default'   => '1',
+            'desc'      => '来源',
+            'match'     => 'is_string',
+            'option'    => $source,
+            'update'    => 'radio',
+            'search'    => 'select',
+            'list'      => true,
+        ),
+
+        'area'       => array
+        (
+            'type'      => 'varchar-32',
+            'name'      => '所在城市',
+            'default'   => '',
+            'desc'      => '所在城市',
+            'match'     => 'option',
+            'search'    => 'linkage',
+            'update'    => 'linkage',
+            'option'    => Dever::url('api.get?level_total=2', 'area'),
+            'list'      => 'Dever::load("clue/lib/info.getNum#area",{id})',
+        ),
+
+        'clue_num'      => array
+        (
+            'type'      => 'varchar-50',
+            'name'      => '线索编号',
+            'default'   => '',
+            'desc'      => '线索编号',
+            'match'     => 'is_string',
+            'update'    => 'hidden',
+            // 'search'    => 'fulltext',
+            // 'list'      => true,
+        ),
+
+        'sex'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '性别',
+            'default'   => '1',
+            'desc'      => '性别',
+            'match'     => 'is_string',
+            'option'    => $sex,
+            'update'    => 'radio',
+            // 'search'    => 'select',
+            // 'list'      => true,
+        ),
+
+        'age'      => array
+        (
+            'type'      => 'varchar-32',
+            'name'      => '年龄',
+            'default'   => '',
+            'desc'      => '年龄',
+            'match'     => 'option',
+            'update'    => 'text',
+            // 'search'    => 'fulltext',
+            // 'list'      => true,
+        ),
+
+        'trade'      => array
+        (
+            'type'      => 'varchar-50',
+            'name'      => '行业',
+            'default'   => '',
+            'desc'      => '行业',
+            'match'     => 'option',
+            'update'    => 'text',
+            // 'search'    => 'fulltext',
+            // 'list_name' => '计划下次跟进时间',
+            // 'list'      => 'Dever::load("clue/lib/info.getNum#xdate",{id})',
+            // 'list_order' => 5,
+        ),
+        
+        'desc'       => array
+        (
+            'type'      => 'text-100',
+            'name'      => '竞品了解',
+            'default'   => '',
+            'desc'      => '竞品了解',
+            'match'     => 'option',
+            'update'    => 'textarea',
+            // 'list_name' => '跟进次数',
+            // 'list'      => 'Dever::load("clue/lib/info.getNum#num",{id})',
+            // 'list_order' => 4,
+        ),
+
+        'num'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '跟进次数',
+            'default'   => '0',
+            'desc'      => '数量',
+            'match'     => 'option',
+            'update'    => 'hidden',
+            'list'      => 'Dever::load("clue/lib/info.getNum#num",{id})',
+            'list_order' => 4,
+        ),
+
+        'userset_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '客户等级',
+            'default'   => '-1',
+            'desc'      => '客户等级',
+            'match'     => 'is_string',
+            'search'    => 'select',
+            'update'    => 'select',
+            'option'    => $people,
+            'list'      => true,
+            'list_order' => 3,
+        ),
+
+        'status_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '线索状态',
+            'default'   => '1',
+            'desc'      => '线索状态',
+            'match'     => 'is_string',
+            'option'    => $status,
+            'update'    => 'select',
+            // 'search'    => $search_auth == 1 ? 'select' : false,
+            // 'list'      => true,
+            'control'	=> 'status_id',
+        ),
+
+        'out_type'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '是否导入',
+            'default'   => '1',
+            'desc'      => '是否导入',
+            'match'     => 'is_string',
+            'option'    => $out_type,
+            // 'update'    => 'select',
+            // 'search'    => $search_auth == 1 ? 'select' : false,
+            // 'list'      => true,
+            // 'control'	=> 'status_id',
+        ),
+
+        'status_desc'       => array
+        (
+            'type'      => 'text-255',
+            'name'      => '结论备注',
+            'default'   => '',
+            'desc'      => '结论备注',
+            'match'     => 'is_string',
+            'update'    => 'textarea',
+            'update'    => $col ? 'textarea' : false,
+            'show'      => 'status_id=5,6',
+            // 'list'      => true,
+        ),
+
+        'follow_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '跟进人表id',
+            'default'   => '-1',
+            'desc'      => '跟进人',
+            'match'     => 'is_string',
+            // 'option'    => $priority,
+            // 'update'    => 'select',
+            // 'search'    => 'select',
+            // 'list'      => true,
+        ),
+
+        'follow'       => array
+        (
+            'type'      => 'varchar-32',
+            'name'      => $col ? '选择队友' : '分派销售员',
+            'default'   => '',
+            'desc'      => '分派销售员',
+            'match'     => 'option',
+            // 'search'    => 'linkage',
+            'update'    => 'linkage',
+            'option'    => Dever::url('lib/appoint.get?level_total=2', 'work'),
+            'list_name' => '跟进人',
+            'list'      => 'Dever::load("clue/lib/info.getNum#people",{id})',
+        ),
+
+
+        'follow_admin_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '跟进人',
+            'default'   => '-1',
+            'desc'      => '跟进人',
+            'match'     => 'is_string',
+            // 'value'     => $audit_admin,
+            // 'option'    => $priority,
+            // 'update'    => 'select',
+            // 'search'    => 'select',
+            // 'list'      => true,
+        ),
+
+         'follow_group_id'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '部门',
+            'default'   => '',
+            'desc'      => '部门',
+            'match'     => 'option',
+            // 'search'    => 'linkage',
+            'update'    => 'hidden',
+            // 'option'    => Dever::url('lib/appoint.get?level_total=2', 'work'),
+        ),
+
+         'create_group_id'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '创建人部门',
+            'default'   => '',
+            'desc'      => '部门',
+            'match'     => 'option',
+            // 'search'    => 'linkage',
+            'update'    => 'hidden',
+            // 'option'    => Dever::url('lib/appoint.get?level_total=2', 'work'),
+        ),
+        'create_admin_id'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '创建人',
+            'default'   => '',
+            'desc'      => '部门',
+            'match'     => 'option',
+            // 'search'    => 'linkage',
+            'update'    => 'hidden',
+            // 'option'    => Dever::url('lib/appoint.get?level_total=2', 'work'),
+        ),
+
+        'fdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '完成时间',
+            'default'   => '',
+            'match'     => 'is_numeric',
+            // 'search'    => 'date',
+            'list_name' => '创建时间<br/>最近跟进时间',
+            // 'desc'      => '',
+            'list'      => 'Dever::load("clue/lib/info.getNum#time",{id})',
+            'list_order' => 1,
+        ),
+
+        'gdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '跟进时间',
+            'default'   => '',
+            'match'     => 'is_numeric',
+            // 'search'    => 'date',
+        ),
+
+        'type'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '跟进状态',
+            'default'   => '1',
+            'desc'      => '跟进状态',
+            'match'     => 'is_string',
+            'option'    => $type,
+            // 'update'    => 'select',
+            'search'    => 'select',
+            'list'      => true,
+            // 'list_order' => 22,
+        ),
+
+        'audit_admin'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '创建人',
+            'default'   => '',
+            'match'     => 'is_numeric',
+            'desc'      => '创建人',
+            'update'    => 'hidden',
+            'value'     => $admin_id,
+            // 'list'      => 'Dever::load("active/lib/manage.active#admin_name",{id})',
+        ),
+
+         'dever_auth'      => array
+        (
+            'name'      => '搜索',
+            'default'   => '',
+            'desc'      => '类型',
+            'match'     => 'is_string',
+            'search'    => 'hidden',
+        ),
+
+        'remark'       => array
+        (
+            'type'      => 'text-255',
+            'name'      => '备注',
+            'default'   => '',
+            'desc'      => '备注',
+            'match'     => 'option',
+            'update'    => 'textarea',
+            // 'list'      => true,
+        ),
+
+        'reorder'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '排序-数值越大越靠前',
+            'default'   => '1',
+            'desc'      => '请输入排序',
+            'match'     => 'option',
+            // 'update'  => 'text',
+            // 'search'    => 'order',
+            // 'list'      => true,
+            // 'order'     => 'desc',
+            // 'edit'      => true,
+        ),
+
+        'state'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '状态',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+        
+        'cdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '创建时间',
+            'match'     => array('is_numeric', time()),
+            'desc'      => '',
+            # 只有insert时才生效
+            'insert'    => true,
+            'search'    => 'date',
+            // 'order'     => 'desc',
+            // 'list'      => 'date("Y-m-d H:i:s", {cdate})',
+        ),
+    ),
+
+    'manage' => array
+    (
+    	// 'insert' => true,
+        'delete' => false,
+        'edit' => false,
+        'list_button' => $list_button,
+        // 'data' => $data,
+        'button' => $button,
+        'excel'  => $excel,
+        # 设置公司权限
+        'company' => 'company_id',
+    ),
+
+    'request' => array
+    (
+    	'list_option' => array
+        (
+         'col' => 'yes-follow_admin_id',
+         'status' => array('yes', 'in'),
+        ),
+        'list' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'id' => 'yes',
+                'area' => array('yes','like'),
+                'name' => array('yes','like'),
+                'mobile' => 'yes',
+                'source' => 'yes',
+                'userset_id' => 'yes',
+                'type' => 'yes',
+                'out_type' =>'yes',
+                'start_cdate'=>array('yes-cdate','>='),
+                'end_cdate' => array('yes-cdate','<='),
+                'follow_admin_id' => 'yes',
+                // 'area' => array('yes', 'like'),
+                'start_day' => array('yes-day', '>='),
+                'end_day' => array('yes-day', '<='),
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('cdate' => 'desc'),
+            'page' => array(20, 'list'),
+            // 'group' => 'shop_id',
+            'col' => '*',
+        ),
+       	'getAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+            	'start' => array('yes-cdate','>='),
+            	'end'=>array('yes-cdate','<='),
+                'follow_group_id' =>'yes',
+                // 'type' =>array('yes','in'),
+                'state' => 1,
+            ),
+            'type' => 'all',
+            // 'order' => array('reorder' => 'desc', 'id' => 'desc'),
+            // 'page' => array(5,'list'),
+            'col' => '*|follow_admin_id',
+        ),
+
+        'getHAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+            	'start' => array('yes-cdate','>='),
+            	'end'=>array('yes-cdate','<='),
+                'follow_group_id' =>'yes',
+                'gstart' => array('yes-gdate','>='),
+                'gend' => array('yes-gdate','<='),
+                'type' =>array('yes','in'),
+                'state' => 1,
+            ),
+            'type' => 'count',
+            // 'order' => array('reorder' => 'desc', 'id' => 'desc'),
+            // 'page' => array(5,'list'),
+            'col' => '*',
+        ),
+    ),
+);

+ 167 - 0
tool/clue/database/info_log.php

@@ -0,0 +1,167 @@
+<?php
+return array
+(
+    # 表名
+    'name' => 'info_log',
+    # 显示给用户看的名称
+    'lang' => '线索记录',
+    # 后台菜单排序
+    'order' => 2,
+    'menu' => false,
+    # 数据结构
+    'struct' => array
+    (
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'list'      => true,
+            'order'     => 'desc',
+        ),
+
+        'info_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '线索信息',
+            'default'   => '-1',
+            'desc'      => '线索id',
+            'match'     => 'is_string',
+            // 'update'    => 'text',
+            
+        ),
+        'crate_group_admin'      => array
+        (
+            'type'      => 'varchar-30',
+            'name'      => '操作人和部门',
+            'default'   => '-1',
+            'desc'      => '操作人',
+            'match'     => 'is_string',
+            // 'update'    => 'text',
+           
+        ),
+        'crate_group_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '操作人部门',
+            'default'   => '-1',
+            'desc'      => '操作人',
+            'match'     => 'is_string',
+            // 'update'    => 'text',
+           
+        ),
+        'crate_admin_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '操作人',
+            'default'   => '-1',
+            'desc'      => '操作人',
+            'match'     => 'is_string',
+            // 'update'    => 'text',
+           
+        ),
+
+        'follow_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '跟进人表id',
+            'default'   => '-1',
+            'desc'      => '代理商',
+            'match'     => 'is_string',
+            // 'update'    => 'text',
+        ),
+        'follow_group_admin'      => array
+        (
+            'type'      => 'varchar-30',
+            'name'      => '跟进人和部门',
+            'default'   => '-1',
+            'desc'      => '操作人',
+            'match'     => 'is_string',
+            // 'update'    => 'text',
+           
+        ),
+        'follow_group_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '跟进人部门',
+            'default'   => '-1',
+            'desc'      => '操作人',
+            'match'     => 'is_string',
+            // 'update'    => 'text',
+           
+        ),
+        'follow_admin_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '跟进人',
+            'default'   => '-1',
+            'desc'      => '操作人',
+            'match'     => 'is_string',
+            // 'update'    => 'text',
+           
+        ),
+
+        'state'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '状态',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+        
+        'cdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '处理时间',
+            'match'     => array('is_numeric', time()),
+            'desc'      => '',
+            # 只有insert时才生效
+            'insert'    => true,
+            'list'      => 'date("Y-m-d H:i:s", {cdate})',
+        ),
+    ),
+
+    'manage' => array
+    (
+    	'insert' => false,
+        'delete' => false,
+        'edit' => false,
+        'page_list' => 'info_log',
+    ),
+
+    'request' => array
+    (
+        'getAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'info_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('cdate'=> 'desc'),
+            'col' => '*',
+        ),
+        'getCountAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'start' => array('yes-cdate','>='),
+                'end'=>array('yes-cdate','<='),
+                'follow_group_id' =>'yes',
+                // 'type' =>array('yes','in'),
+                'state' => 1,
+            ),
+            'type' => 'all',
+            // 'order' => array('reorder' => 'desc', 'id' => 'desc'),
+            // 'page' => array(5,'list'),
+            'col' => '*|follow_admin_id',
+        ),
+    ),
+);

+ 182 - 0
tool/clue/database/info_stat.php

@@ -0,0 +1,182 @@
+<?php
+return array
+(
+    # 表名
+    'name' => 'info_stat',
+    # 显示给用户看的名称
+    'lang' => '数据统计',
+    # 后台菜单排序
+    'order' => 2,
+    // 'menu' => false,
+    # 数据结构
+    'struct' => array
+    (
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            // 'list'      => true,
+            'order'     => 'desc',
+        ),
+
+
+        'day'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '日期',
+            'default'   => '',
+            'match'     => 'is_numeric',
+            'desc'      => '',
+            // 'search'    => 'day',
+            // 'search_button' => array
+            // (
+            //     'sum' => 'num,yes_num,cash,daili_num,agent_cash,no_num,no_cash',
+            //     'option' => array(
+            //         'day' => '按天',
+            //         'week' => '按周',
+            //         'month' => '按月',
+            //     ),
+            //     'group' => '',
+            // ),
+            // 'order'     => 'desc',
+            // 'list'      => 'Dever::showDay("{day}")',
+        ),
+
+
+        'group_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '部门',
+            'default'   => '-1',
+            'desc'      => '部门',
+            'match'     => 'is_string',
+            'update'    => 'linkage',
+            'search'    => 'linkage',
+            'option'    => Dever::url('lib/appoint.get?level_total=1', 'work'),
+           	'list'      => 'Dever::load("clue/lib/manage.group",{group_id})', 
+        ),
+
+        'group_num'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '跟进成员数',
+            'default'   => '0',
+            'desc'      => '数量',
+            'match'     => 'option',
+            'update'    => 'hidden',
+            'list'      => true,
+        ),
+        'num'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '全部有效线索',
+            'default'   => '0',
+            'desc'      => '数量',
+            'match'     => 'option',
+            'update'    => 'hidden',
+            'list'      => true,
+        ),
+        'd_num'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '待分派',
+            'default'   => '0',
+            'desc'      => '数量',
+            'match'     => 'option',
+            'update'    => 'hidden',
+            'list'      => true,
+        ),
+        'dg_num'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '待跟进',
+            'default'   => '0',
+            'desc'      => '数量',
+            'match'     => 'option',
+            'update'    => 'hidden',
+            'list'      => true,
+        ),
+        'g_num'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '跟进数',
+            'default'   => '0',
+            'desc'      => '数量',
+            'match'     => 'option',
+            'update'    => 'hidden',
+            'list'      => true,
+        ),
+
+        'qx_num'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '取消关闭',
+            'default'   => '0',
+            'desc'      => '数量',
+            'match'     => 'option',
+            'update'    => 'hidden',
+            'list'      => true,
+        ),
+        'f_num'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '成功关闭',
+            'default'   => '0',
+            'desc'      => '数量',
+            'match'     => 'option',
+            'update'    => 'hidden',
+            'list'      => true,
+        ),
+        
+        'state'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '状态',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+        
+        'cdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '日期',
+            'match'     => array('is_numeric', time()),
+            'desc'      => '',
+            # 只有insert时才生效
+            'insert'    => true,
+            'search'    => 'day',
+            'list'      => 'date("Y-m-d", {cdate})',
+            'list_order' => 1,
+        ),
+    ),
+
+    'manage' => array
+    (
+    	'insert' => false,
+        'delete' => false,
+        'edit' => false,
+        'page_list' => 'info_log',
+    ),
+
+    'request' => array
+    (
+        'getAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'info_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('cdate'=> 'desc'),
+            'col' => '*',
+        ),
+        
+    ),
+);

+ 108 - 0
tool/clue/database/sale_status.php

@@ -0,0 +1,108 @@
+<?php
+
+return array
+(
+    # 表名
+    'name' => 'sale_status',
+    # 显示给用户看的名称
+    'lang' => '线索状态设置',
+    # 后台菜单排序
+    'order' => 4,
+    // 'menu' => false,
+    // 'auto' => 100000,
+    # 数据结构
+    'struct' => array
+    (
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            // 'list'      => true,
+            // 'order'     => 'desc',
+        ),
+
+        'name'      => array
+        (
+            'type'      => 'varchar-200',
+            'name'      => '名称',
+            'default'   => '',
+            'desc'      => '名称',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            // 'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'color'      => array
+        (
+            'type'      => 'varchar-10',
+            'name'      => '颜色',
+            'default'   => '',
+            'desc'      => '颜色',
+            'match'     => 'option',
+           	'update'    => 'color',
+        ),
+       	
+        'reorder'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '排序-数值越大越靠前',
+            'default'   => '1',
+            'desc'      => '请输入排序',
+            'match'     => 'option',
+            'update'    => 'text',
+            'search'    => 'order',
+            'list'      => true,
+            'order'     => 'desc',
+            'edit'      => true,
+        ),
+
+        'state'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '状态',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+        
+        'cdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '创建时间',
+            'match'     => array('is_numeric', time()),
+            'desc'      => '',
+            # 只有insert时才生效
+            'insert'    => true,
+            'list'      => 'date("Y-m-d H:i:s", {cdate})',
+        ),
+    ),
+
+    'manage' => array
+    (
+    	//'insert' => false,
+        'delete' => false,
+        // 'edit' => false,
+        
+    ),
+
+    'request' => array
+    (
+        'getAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                // 'id' => array('yes','>'),
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('reorder' => 'desc', 'id' => 'asc'),
+            'col' => '*',
+        ),
+    ),
+);

+ 136 - 0
tool/clue/database/salepeople.php

@@ -0,0 +1,136 @@
+<?php
+return array
+(
+    # 表名
+    'name' => 'salepeople',
+    # 显示给用户看的名称
+    'lang' => '销售员设置',
+    # 后台菜单排序
+    'order' => 1,
+    // 'menu' => false,
+    // 'auto' => 100000,
+    // 'check' => 'group_id',
+    // 'start' => array
+    // (
+    //     'insert' => 'work/lib/appoint.startBranch',
+    //     'update' => 'work/lib/appoint.startBranch',
+    // ),
+    'end' => array
+    (
+        'insert' => 'clue/lib/info.updateSell',
+        'update' => 'clue/lib/info.updateSell',
+    ),
+    # 数据结构
+    'struct' => array
+    (
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'list'      => true,
+            'order'     => 'desc',
+        ),
+
+        'company_id'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '所属公司',
+            'default'   => '1',
+            'desc'      => '所属公司',
+            'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            //'search'    => $company ? 'select' : false,
+            //'list'      => true,
+        ),
+
+        'group'      => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '销售员和部门',
+            'default'   => '-1',
+            'desc'      => '部门名称',
+            'match'     => 'is_string',
+            // 'option'    => $group,
+            'update'    => 'linkage',
+            'option'    => Dever::url('lib/appoint.get?level_total=2', 'work'),
+            'list'      => 'Dever::load("clue/lib/manage.getSale#name",{id})',
+        ),
+
+
+
+        'group_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '部门',
+            'default'   => '-1',
+            'desc'      => '部门id',
+            'match'     => 'is_string',
+            // 'option'    => $cadre,
+            'update'    => 'hidden',
+        ),
+
+        'reorder'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '排序-数值越大越靠前',
+            'default'   => '1',
+            'desc'      => '请输入排序',
+            'match'     => 'option',
+            'update'  => 'text',
+            'search'    => 'order',
+        ),
+
+        'state'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '状态',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+        
+        'cdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '创建时间',
+            'match'     => array('is_numeric', time()),
+            'desc'      => '',
+            # 只有insert时才生效
+            'insert'    => true,
+            'list'      => 'date("Y-m-d H:i:s", {cdate})',
+        ),
+    ),
+
+    'manage' => array
+    (
+    	//'insert' => false,
+        // 'delete' => false,
+        // 'edit' => false,
+        // 'list_button' => array
+        // (
+        //     'list' => array('关联问题列表', '"question&search_option_branch_id={group}&oper_table=info"')
+        // ),
+        # 设置公司权限
+        'company' => 'company_id',
+    ),
+
+    'request' => array
+    (
+        'getAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                // 'id' => array('yes','>'),
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('reorder' => 'desc', 'id' => 'asc'),
+            'col' => '*',
+        ),
+    ),
+);

+ 139 - 0
tool/clue/database/source.php

@@ -0,0 +1,139 @@
+<?php
+$type = array
+(
+    1 => '上架',
+    2 => '下架',
+);
+return array
+(
+    # 表名
+    'name' => 'source',
+    # 显示给用户看的名称
+    'lang' => '线索来源设置',
+    # 后台菜单排序
+    'order' => 3,
+    // 'menu' => false,
+    // 'auto' => 100000,
+    # 数据结构
+    'struct' => array
+    (
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            // 'list'      => true,
+            // 'order'     => 'desc',
+        ),
+
+        'name'      => array
+        (
+            'type'      => 'varchar-200',
+            'name'      => '来源名称',
+            'default'   => '',
+            'desc'      => '来源名称',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            // 'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'desc'       => array
+        (
+            'type'      => 'text-255',
+            'name'      => '来源说明',
+            'default'   => '',
+            'desc'      => '来源说明',
+            'match'     => 'is_string',
+            'update'    => 'textarea',
+            'list'      => true,
+        ),
+
+        'num'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '导入数据量',
+            'default'   => '0',
+            'desc'      => '数量',
+            'match'     => 'option',
+            // 'update'    => 'hidden',
+            'list'      => 'Dever::load("clue/lib/info.source_Num",{id})',
+        ),
+
+        'type'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '状态',
+            'default'   => '1',
+            'desc'      => '状态',
+            'match'     => 'is_string',
+            'option'    => $type,
+            // 'update'    => 'select',
+            'search'    => 'select',
+            'list'      => true,
+            'edit'      => true,
+
+        ),
+
+        'reorder'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '排序-数值越大越靠前',
+            'default'   => '1',
+            'desc'      => '请输入排序',
+            'match'     => 'option',
+            'update'  => 'text',
+            'search'    => 'order',
+            'list'      => true,
+            'order'     => 'desc',
+            'edit'      => true,
+        ),
+
+        'state'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '状态',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+        
+        'cdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '创建时间',
+            'match'     => array('is_numeric', time()),
+            'desc'      => '',
+            # 只有insert时才生效
+            'insert'    => true,
+            'list'      => 'date("Y-m-d H:i:s", {cdate})',
+        ),
+    ),
+
+    'manage' => array
+    (
+    	//'insert' => false,
+        'delete' => false,
+        // 'edit' => false,
+        
+    ),
+
+    'request' => array
+    (
+        'getAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                // 'id' => array('yes','>'),
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('reorder' => 'desc', 'id' => 'asc'),
+            'col' => '*',
+        ),
+    ),
+);

+ 109 - 0
tool/clue/database/user_set.php

@@ -0,0 +1,109 @@
+<?php
+
+return array
+(
+    # 表名
+    'name' => 'user_set',
+    # 显示给用户看的名称
+    'lang' => '客户等级设置',
+    # 后台菜单排序
+    'order' => 4,
+    // 'menu' => false,
+    // 'auto' => 100000,
+    # 数据结构
+    'struct' => array
+    (
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            // 'list'      => true,
+            // 'order'     => 'desc',
+        ),
+
+        'name'      => array
+        (
+            'type'      => 'varchar-200',
+            'name'      => '等级名称',
+            'default'   => '',
+            'desc'      => '等级名称',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            // 'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'desc'       => array
+        (
+            'type'      => 'text-255',
+            'name'      => '等级说明',
+            'default'   => '',
+            'desc'      => '等级说明',
+            'match'     => 'is_string',
+            'update'    => 'textarea',
+            'list'      => true,
+        ),
+
+        'reorder'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '排序-数值越大越靠前',
+            'default'   => '1',
+            'desc'      => '请输入排序',
+            'match'     => 'option',
+            'update'  => 'text',
+            'search'    => 'order',
+            'list'      => true,
+            'order'     => 'desc',
+            'edit'      => true,
+        ),
+
+        'state'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '状态',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+        
+        'cdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '创建时间',
+            'match'     => array('is_numeric', time()),
+            'desc'      => '',
+            # 只有insert时才生效
+            'insert'    => true,
+            'list'      => 'date("Y-m-d H:i:s", {cdate})',
+        ),
+    ),
+
+    'manage' => array
+    (
+    	//'insert' => false,
+        'delete' => false,
+        // 'edit' => false,
+        
+    ),
+
+    'request' => array
+    (
+        'getAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                // 'id' => array('yes','>'),
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('reorder' => 'desc', 'id' => 'asc'),
+            'col' => '*',
+        ),
+    ),
+);

+ 10 - 0
tool/clue/index.php

@@ -0,0 +1,10 @@
+<?php
+
+define('DEVER_APP_NAME', 'clue');
+define('DEVER_APP_LANG', '线索跟进系统');
+define('DEVER_APP_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+define('DEVER_MANAGE_ORDER', 20);
+define('DEVER_MANAGE_ICON', 'glyphicon glyphicon-tower layui-icon-website');
+define('DEVER_GROUP_ORDER', 1);
+define('DEVER_GROUP_NAME', 'CRM系统');
+include(DEVER_APP_PATH . '../boot.php');

+ 51 - 0
tool/clue/lib/Cron.php

@@ -0,0 +1,51 @@
+<?php
+namespace Clue\Lib;
+
+use Dever;
+Class Cron
+{
+	public function stat_api()
+	{
+		$start=mktime(0,0,0,date('m'),date('d'),date('Y'));
+        $end = $start+86400-1;
+        // print_R($start);
+        // print_R($end);die;
+        $data = Dever::db('work/branch')->state();
+        foreach ($data as $k => $v) {
+        	$w['follow_group_id'] = $v['group_id'];
+        	$w['start'] = $start;
+        	$w['end'] = $end;
+        	$where['group_id'] = $v['group_id'];
+        	$where['day'] = $start;
+        	$cy = Dever::db('clue/info_log')->getCountAll($w);
+        	
+        	// echo dever::sql();die;
+        	$where['group_num'] = count($cy);
+        	$w['type'] = '1,2,3,4,5';
+        	$where['num'] = Dever::db('clue/info')->getHAll($w);
+        	$w['type'] = 1;
+        	$where['d_num'] = Dever::db('clue/info')->getHAll($w);
+        	$w['type'] = 2;
+        	$where['dg_num'] = Dever::db('clue/info')->getHAll($w);
+        	$w['type'] = 3;
+        	$w['gstart'] = $start;
+        	$w['gend'] = $end;
+        	$where['g_num'] = Dever::db('clue/info')->getHAll($w);
+        	$w['type'] = 5;
+        	$where['qx_num'] = Dever::db('clue/info')->getHAll($w);
+        	$w['type'] = 4;
+        	$where['f_num'] = Dever::db('clue/info')->getHAll($w);
+        	$res = Dever::db('clue/info_stat')->find(array('group_id'=>$v['group_id'],'day'=>$start,'clear'=>true));
+        	$where['clear'] = true;
+        	if ($res) {
+        		$where['where_id'] = $res['id'];
+        		Dever::db('clue/info_stat')->update($where);
+        	} else{
+        		Dever::db('clue/info_stat')->insert($where);
+        	}
+        	// print_R($where);die;
+        	// $data[''] = Dever::db('clue/info')->
+        }
+		
+	}
+}

+ 339 - 0
tool/clue/lib/Info.php

@@ -0,0 +1,339 @@
+<?php
+namespace Clue\lib;
+use Dever;
+Class Info
+{
+	#更新次数
+	public function getNum($id)
+	{
+		$html = array();
+		$info = Dever::db('clue/info')->find($id);
+		
+		if ($info['gdate']) {
+			$info['gdate'] = '<br/>'.date('Y.m.d H:i',$info['gdate']);
+		} else {
+			$info['gdate'] = '';
+		}
+		if ($info['area']) {
+			$area = Dever::load("area/api.string", $info['area']);
+			if (strpos($area,',')!=false) {
+				$area = str_replace(',', '/', $area);
+			}
+		}
+		if ($info['follow'] ) {
+			$branch = explode(',',$info['follow']);
+			// print_R($branch);die;
+			$html['people'] = $this->group_admin($info['company_id'],$branch[0],$branch[1]);
+		}
+		
+		$html['area'] = $area;
+		$html['time'] = date('Y.m.d H:i',$info['cdate']).$info['gdate'];
+		$html['user'] = $info['name'].'<br/>'.$info['mobile'];
+		$data= Dever::db('clue/follow')->getCount(array('info_id'=>$id));
+		$follow = Dever::db('clue/follow')->find(array('info_id'=>$id,'status'=>1));
+		if ($follow){
+			if ($follow['xdate']) {
+				$html['xdate'] = date('Y.m.d H:i',$follow['xdate']);
+			}
+		}
+		if ($info['num'] && $info['num'] > 0) {
+			$html['num'] = $info['num'];
+		} else {
+			$html['num'] = $data;
+		}
+		return $html;
+
+	}
+	public function insertInfo($id,$name,$data)
+	{
+		$mobile = Dever::param('mobile',$data);
+		$info = Dever::db('clue/info')->find(array('mobile'=>$mobile));
+		if ($info){
+			Dever::alert('手机号已存在,不能重复提交');
+		}
+	}
+	#更新线索表
+	public function updateInfo($id,$name,$data)
+	{
+		Dever::config('base')->hook = true;
+		$status_id = Dever::param('status_id',$data);
+		$follow = Dever::param('follow',$data);
+		$where['wechat'] = Dever::param('wechat',$data);
+		$where['name'] = Dever::param('name',$data);
+		$where['status_id'] = Dever::param('status_id',$data);
+		$where['userset_id'] = Dever::param('userset_id',$data);
+		$info = Dever::db('clue/info')->find($id);
+		$where['where_id'] = $id;
+		if ($follow && $follow[0]>0 ) {
+			$where['follow'] = $follow;
+			if ($info['follow_group_id'] && $info['follow_group_id']!=$follow[0]) {
+				$where['follow_group_id'] = $follow[0];
+			} elseif (!$info['follow_group_id'] || $info['follow_group_id']<=0) {
+				$where['follow_group_id'] = $follow[0];
+			}
+			if ($info['follow_admin_id'] && $info['follow_admin_id']!=$follow[1]) {
+				$where['follow_admin_id'] = $follow[1];
+			} elseif (!$info['follow_group_id'] || $info['follow_admin_id']<=0) {
+				$where['follow_admin_id'] = $follow[1];
+			}
+			if (!$info['create_group_id'] || $info['create_group_id']<=0) {
+				$where['create_group_id'] = $follow[0];
+			} 
+			if (!$info['create_admin_id'] || $info['create_admin_id']<=0) {
+				$where['create_admin_id'] = $follow[1];
+			} 
+			
+		}
+		if ($status_id && ($status_id == 5 || $status_id == 6)) {
+			$where['fdate'] = time();
+		}
+		if ($info) {
+			if ($follow && $follow[0]<0) {
+				$auth = Dever::load("manage/auth.info");
+				$admin_group = Dever::db('manage/admin_group')->all(array('admin_id'=>$auth['id']));
+				foreach ($admin_group as $k => $v) {
+					$admin[$v['group_id']] = $v['group_id'];
+				}
+				foreach ($admin as $k1 =>$v1) {
+					$group = Dever::db('manage/group')->find(array('company_id'=>$info['company_id'],'id'=>$v1));
+					if ($group) {
+						$where['follow'] = $group['id'].','.$auth['id'];
+						if ($info['follow_group_id'] && $info['follow_group_id']!=$group['id']) {
+							$where['follow_group_id'] = $group['id'];
+						} elseif (!$info['follow_group_id'] || $info['follow_group_id'] <=0) {
+							$where['follow_group_id'] =  $group['id'];
+						}
+						if ($info['follow_admin_id'] && $info['follow_admin_id']!=$auth['id']) {
+							$where['follow_admin_id'] = $auth['id'];
+						} elseif (!$info['follow_group_id'] || $info['follow_group_id'] <=0) {
+							$where['follow_admin_id'] =  $auth['id'];
+						}
+						if (!$info['create_group_id'] || $info['create_group_id']<=0) {
+							$where['create_group_id'] = $group['id'];
+						} 
+						if (!$info['create_admin_id'] || $info['create_admin_id']<=0) {
+							$where['create_admin_id'] = $auth['id'];
+						} 
+					}
+				}
+				
+				
+				$w['admin_id'] = $where['follow'];
+				$w['info_id'] = $id;
+				$w['status'] = 2;
+				$ids = Dever::db('clue/follow')->insert($w);
+				if ($ids) {
+					$where['follow_id'] = $ids;
+				} 
+			}
+			
+			if ($where['status_id'] == 1) {
+				$where['type'] = 1;
+			} elseif ($where['status_id'] == 2) {
+				$where['type'] = 2;
+			} elseif ($where['status_id'] > 2 && $where['status_id'] <= 4) {
+				$where['type'] = 3;
+			} else if ($where['status_id'] == 5) {
+				$where['type'] = 4;
+			} else if ($where['status_id'] == 6) {
+				$where['type'] = 5;
+			} else if ($where['status_id'] == 7) {
+				$where['type'] = 6;
+			}
+			if (!$info['clue_num']) {
+				$where['clue_num'] = $this->getClueNum();
+			}
+			Dever::db('clue/info')->update($where);
+		}
+	}
+	#获取线索编号
+	public function getClueNum()
+	{
+	    $where['clue_num'] = Dever::order('X');
+	    $state = Dever::db('clue/info')->one($where);
+	    if (!$state) {
+	        return $where['clue_num'];
+	    } else {
+	        return $this->getClueNum();
+	    }
+	}
+	#通过跟进人信息修改线索表
+	public function updateFollow($id,$name,$data)
+	{
+		Dever::config('base')->hook = true;
+		$follow = Dever::db('clue/follow')->find($id);
+		$info = Dever::db('clue/info')->find($follow['info_id']);
+		if ($info) {
+			$where['where_id'] = $info['id'];
+			$where['follow_id'] = $id;
+			$where['gdate'] = time();
+			$where['day']= $follow['xdate'];
+			$where['num'] = $info['num']+1;
+			Dever::db('clue/info')->update($where);
+			$w['where_id'] = $id;
+			$w['follow_admin_id'] = $info['follow'];
+			Dever::db('clue/follow')->update($w);
+		}
+
+		$auth = Dever::load('manage/auth.info');
+		
+		$admin = Dever::db('manage/admin')->find($auth['id']);
+
+		$group_id = explode(',',$admin['group']);
+		if ($group_id) {
+			foreach($group_id as $k => $v) {
+				$group = Dever::db('manage/group')->find(array('company_id'=>$info['company_id'],'id'=>$v));
+			}
+		}
+		$branch_id = explode(',',$info['follow']);
+		$i['crate_admin_id'] = $admin['id'];
+		$i['crate_group_id'] = $group['id'];
+		$i['crate_group_admin'] = $admin['id'].','.$group['id'];
+		$i['follow_id'] = $id;
+		$i['follow_group_admin'] = $info['follow'];
+		$i['follow_group_id'] = $branch_id[0];
+		$i['follow_admin_id'] = $branch_id[1];
+		$i['info_id'] = $info['id'];
+		Dever::db('clue/info_log')->insert($i);
+	}
+	#线索详情页
+	public function show_api()
+	{
+		$id = Dever::input('id');
+		$data['info'] = Dever::db('clue/info')->find($id);
+		$admin = Dever::db('manage/admin')->find($data['info']['audit_admin']);
+		$data['info']['admin_name'] = '';
+		if ($admin) {
+			$data['info']['admin_name'] = $admin['username'];
+		}
+		
+		$data['info']['source_name'] = '';
+		if ($data['info']['source']) {
+			$source = Dever::db('clue/source')->find($data['info']['source']);
+			if ($source) {
+				$data['info']['source_name'] = $source['name'];
+			}
+		}
+		$sex = Dever::db('clue/info')->config['config_sex'];
+		$data['info']['sex_name'] = Dever::status($sex,$data['info']['sex']);
+		$data['info']['area_name'] = '';
+		if ($data['info']['area']) {
+			$area = Dever::load("area/api.string", $data['info']['area']);
+			if ($area) {
+				$area = explode(',',$area);
+				if (isset($area[1]) && $area[1]) {
+					$data['info']['area_name'] = $area[0].'/'.$area[1];
+				} else {
+					$data['info']['area_name'] = $area[0];
+				}
+			}
+		}
+		// guanli.uat.churenyiliao.com/package/manage/?l=project/database/list&project=work&table=info&menu=work&search_option_state=1&search_option_dever_auth=2&menu_id=347
+		$data['info']['status_name'] = '';
+		if($data['info']['status_id']) {
+			$status = Dever::db('clue/sale_status')->find($data['info']['status_id']);
+			if ($status) {
+				$data['info']['status_name'] = $status['name'];
+			}
+		}
+		$userset = Dever::db('clue/user_set')->find($data['info']['userset_id']);
+		if ($userset) {
+			$data['info']['userset_name'] = $userset['name'];
+		}
+		$data['follow'] = Dever::db('clue/follow')->getAll(array('info_id'=>$id));
+		$config_type = Dever::db('clue/follow')->config['config_type'];
+		$people = array();
+		foreach ($data['follow'] as $k => $v) {
+			$admin_id = explode(',',$v['follow_admin_id']);
+			$data['follow'][$k]['group_name'] = '';
+			if (isset($admin_id[0]) && $admin_id[0]) {
+				$group = Dever::db('manage/group')->find(array('id'=>$admin_id[0],'company_id'=>$data['info']['company_id']));
+				if ($group) {
+					$data['follow'][$k]['group_name'] = $group['name'];
+				}
+			}
+			$data['follow'][$k]['admin_name'] = '';
+			if (isset($admin_id[1]) && $admin_id[1]) {
+				$admin = Dever::db('manage/admin')->find(array('id'=>$admin_id[1]));
+				if ($admin) {
+					$data['follow'][$k]['admin_name'] = $admin['username'];
+				}
+			}
+			if ($data['follow'][$k]['admin_name']) {
+				$data['follow'][$k]['group_name'] = $data['follow'][$k]['group_name'].' / '.$data['follow'][$k]['admin_name'];
+			}
+			$data['follow'][$k]['type_name'] = Dever::status($config_type,$v['type']);
+			$data['follow'][$k]['cdate'] = date('Y-m-d H:i:s',$v['cdate']);
+			$data['follow'][$k]['xdate'] = date('Y-m-d',$v['xdate']);
+			$data['follow'][$k]['pic'] = explode(',',$v['pic']);
+			if (!$v['desc']) {
+				unset($data['follow'][$k]);
+			}
+		}
+		
+		$data['info']['people'] = '';
+		$branch = explode(',',$data['info']['follow']);
+		$data['info']['people'] = $this->group_admin($data['info']['company_id'],$branch[0],$branch[1]);
+		
+		$follow = '';
+		$follow = Dever::db('clue/follow')->getCount(array('info_id'=>$id));
+		if ($data['info']['num'] && $data['info']['num']>0) {
+			$data['info']['follow'] = $data['info']['num'].'次'; 
+		} else {
+			if ($follow) {
+				$data['info']['follow'] = $follow.'次';
+			}
+		}
+		
+		$f = Dever::db('clue/follow')->getOne(array('info_id'=>$id));
+		if ($f) {
+			$data['info']['xdate'] = date('Y-m-d',$f['xdate']);
+			$data['info']['day'] = floor((time()-$f['cdate'])/86400).'天';
+		} else {
+			$data['info']['xdate'] = '';
+			$data['info']['day'] = floor((time()-$data['info']['cdate'])/86400).'天';
+		}
+		$data['info']['cdate'] = date('Y-m-d H:i',$data['info']['cdate']);
+
+		$data['xiu'] =  Dever::url('project/database/update?project=clue&table=info&where_id='.$id.'&col=wechat,qq,area,sex,age,trade,desc,remark', 'manage');
+		if (Dever::load('manage/auth')->checkFunc('clue.info', 'infojichu', '基础信息修改')) {
+			$data['jichu'] =  Dever::url('project/database/update?project=clue&table=info&where_id='.$id.'&col=name,mobile,source', 'manage');
+		}
+		
+		$data['gen'] =  Dever::url('project/database/update?project=clue&table=follow&search_option_info_id='.$id, 'manage');
+		$data['pai'] =  Dever::url('project/database/update?project=clue&table=info&where_id='.$id.'&col=follow', 'manage');
+		$data['ke'] =  Dever::url('project/database/update?project=clue&table=info&where_id='.$id.'&col=userset_id', 'manage');
+		$data['status'] =  Dever::url('project/database/update?project=clue&table=info&where_id='.$id.'&col=status_id,status_desc', 'manage');
+		return Dever::render('index', $data);
+	}
+
+	public function group_admin($company_id,$group_id,$admin_id)
+	{
+		$group = Dever::db('manage/group')->find(array('company_id'=>$company_id,'id'=>$group_id));
+		$admin = Dever::db('manage/admin')->find($admin_id);
+		return $group['name'].' / '.$admin['username'];
+	}
+	public function source_Num($id)
+	{
+		$data = Dever::db('clue/info')->state(array('source'=>$id,'out_type'=>2));
+		$html = array();
+		$string = '';
+		
+		$url = Dever::url('project/database/list?project=clue&table=info&search_option_source='.$id.'&search_option_out_type=2&[refer]', 'manage');
+        if (count($data) > 0) {
+            $string = '<a href="'.$url.'">(查看)</a>';
+        }
+		return count($data).$string;
+	}
+	public function updateSell($id,$name,$data)
+	{
+		$group = Dever::param('group',$data);
+		if ($group) {
+			if (isset($group[0]) && $group[0]) {
+				$w['where_id'] = $id;
+				$w['group_id'] = $group[0];
+				Dever::db('clue/salePeople')->update($w);
+			}
+		}
+	}
+}

+ 192 - 0
tool/clue/lib/Manage.php

@@ -0,0 +1,192 @@
+<?php
+namespace Clue\Lib;
+
+use Dever;
+Class Manage 
+{
+	#销售员
+	public function getSale($id)
+	{
+		$data = Dever::db('clue/salepeople')->find($id);
+		if ($data) {
+			$data['group'] = explode(',',$data['group']);
+			$group = Dever::db('manage/group')->find($data['group'][0]);
+			$admin = Dever::db('manage/admin')->find($data['group'][1]);
+			$html = array();
+			$html['name'] = $admin['username'].'<br/>'.$admin['email'].'<br/>'.$group['name'];
+			return $html;
+		}
+	}
+
+	#线索列表导出
+	public function out_info($data)
+	{
+		$header = array('客户姓名','手机号','客户等级','跟进次数','所在城市','跟进人','跟进状态','最近跟进时间');
+		$body = array();
+		$config_type = Dever::db('clue/info')->config['config_type'];
+		foreach ($data as $k => $v) {
+			$user_set = Dever::db('clue/user_set')->find($v['userset_id']);
+			$userset_name = '';
+			if ($user_set) {
+				$userset_name = $user_set['name'];
+			}
+			$num = '';
+			if ($v['num'] && $v['num'] > 0) {
+				$num = $v['num'];
+			} else {
+				$num = Dever::db('clue/follow')->getCount(array('info_id'=>$v['id']));
+			}
+			$area = '';
+			if ($v['area']) {
+				$area = Dever::load("area/api.string", $v['area']);
+				if (strpos($area,',')!=false) {
+					$area = str_replace(',', '/', $area);
+				}
+			}
+			$branch = '';
+			if ($v['branch_id']) {
+				$v['branch_id'] = explode(',',$v['branch_id']);
+				if ($v['branch_id'][0] > 0) {
+					$branch = Dever::load('clue/lib/info')->group_admin($v['company_id'],$v['branch_id'][0],$v['branch_id'][1]);
+				}
+			}
+			$type = '';
+			$type = Dever::status($config_type,$v['type']);
+			$gdate = '';
+			if ($v['gdate']) {
+				$gdate = date('Y-m-d H:i',$v['gdate']);
+			}
+			$d = array
+			(
+				$v['name'],
+				$v['mobile'],
+				$userset_name,
+				$num,
+				$area,
+				$branch,
+				$type,
+				$gdate,
+			);
+			$body[] = $d;
+		}
+		$file = Dever::input('excel_name');
+    	return Dever::excelExport($body, $header, $file);
+	}
+	public function out_muban_api()
+	{
+		$header = array('客户姓名','手机号','客户等级','跟进次数','所在城市','跟进人','跟进状态','最近跟进时间');
+		$body = array();
+		
+		$file = "下载模板";
+    	return Dever::excelExport($body, $header, $file);
+	}
+	public function updateImport($id,$name,$data) {
+		$where = array();
+		$source = Dever::param('source',$data);
+		if ($source) {
+			$sou = Dever::db('clue/source')->find(array('name'=>$source));
+			if ($sou){
+				$where['source'] = $sou['id'];
+			}
+		}
+		$file = Dever::param('file',$data);
+		$file = Dever::local($file);
+		$res = Dever::excelImport($file,0);
+		if ($res) {
+			foreach ($res as $k => $v) {
+				if ($k >= 2) {
+					$where['name'] = $v['A'];
+					$where['mobile'] = $v['B'];
+					$where['clue_num'] = Dever::load('clue/lib/info')->getClueNum();
+					if ($v['C']) {
+						$userset = Dever::db('clue/user_set')->find(array('name'=>$v['C']));
+
+						if ($userset ) {
+							$where['userset_id'] = $userset['id'];
+						}
+					}
+					$where['num'] = $v['D'];
+					$provice = '';
+					$city_id = '';
+					if ($v['E']) {
+						$area = explode('/',$v['E']);
+						if ($area[0]) {
+							$pro = Dever::db('area/province')->find(array('name'=>$area[0]));
+							if ($pro) {
+								$province = $pro['id'];
+							}
+						}
+						if(isset($area[1]) && $area[1]) {
+							$city = Dever::db('area/city')->find(array('name'=>$area[1]));
+							if ($city) {
+								$city_id = ','.$city['id'];
+							}
+						}
+						$where['area'] = $province.$city_id;
+					}
+					if ($v['F']) {
+						$group_id = '';
+						$admin_id = '';
+						#跟进人
+						$f=explode('/',$v['F']);
+						if (isset($f[0]) && $f[0]) {
+							$group = Dever::db('manage/group')->find(array('name'=>$f[0]));
+							if ($group){
+								$group_id = $group['id'];
+								$where['follow_group_id'] = $group['id'];
+								$where['create_group_id'] = $group['id'];
+							}
+						}
+						if (isset($f[1]) && $f[1]) {
+							$f[1] = trim($f[1]);
+							$admin = Dever::db('manage/admin')->find(array('username'=>$f[1]));
+							if ($admin){
+								$admin_id = ','.$admin['id'];
+								$where['follow_admin_id'] = $admin['id'];
+								$where['create_admin_id'] = $admin['id'];
+							}
+						}
+						$where['follow'] = $group_id.$admin_id;
+					}
+					if ($v['G']) {
+						#跟进状态
+						if ($v['G'] == '待跟进') {
+							$where['type'] = 1;
+						}
+						if ($v['G'] == '未跟进') {
+							$where['type'] = 2;
+						}
+						if ($v['G'] == '已跟进') {
+							$where['type'] = 3;
+						}
+						if ($v['G'] == '已完成') {
+							$where['type'] = 4;
+						}
+						if ($v['G'] == '已关闭') {
+							$where['type'] = 5;
+						}
+					}
+					if ($v['H']) {
+						#跟进时间
+						$where['gdate'] = strtotime($v['H']);
+					}
+					$where['out_type'] = 2;
+					$info = Dever::db('clue/info')->find(array('mobile'=>$where['mobile'],'clear'=>true));
+					// $where['clear'] = true;
+					if (!$info && $where) {
+
+						Dever::db('clue/info')->insert($where);
+					}
+					
+				}
+			}
+
+		}
+	}
+	public function group($id)
+	{
+		$data = Dever::db('manage/group')->find($id);
+		return $data['name'];
+	}
+	
+}

+ 27 - 0
tool/clue/page/list.php

@@ -0,0 +1,27 @@
+<?php
+
+if ($page->page <= 1) {
+	$html->html = '<ul class="pagination layui-box layui-laypage layui-laypage-default" style="display:inline-flex;"><li><span class="layui-laypage-count">每页 '.$page->num.' 条,共 '.$page->total.' 条</span></li></ul>';
+} else {
+	# 定义父节点的类型、属性等(整个page的节点)
+	$html->parent = array('ul', 'class="pagination layui-box layui-laypage layui-laypage-default" style="display:inline-flex;"');
+	# 定义子节点的类型、属性等(每个page的节点)
+	$html->child = array('li', 'class=""');
+	# 定义上一页的名称、样式
+	$html->prev = array('上一页', 'btn p1 layui-laypage-prev');
+	# 定义下一页的名称、样式
+	$html->next = array('下一页', 'btn p2 layui-laypage-next');
+	# 定义每个页数的样式,当前页的样式 样式写在哪 是否和旧样式共用
+	$html->page = array('layui-laypage-curr', 'dever_page_disabled layui-disabled', '');
+	# 定义开始页
+	$html->start = array('首页', 'layui-laypage-first');
+	# 定义结束页
+	$html->end = array('末页', 'layui-laypage-last');
+	# 定义跳转页
+	$html->jump = '<li class="layui-laypage-skip"><input type="text" class="form-control" id="dever_page" style="margin-top:0px;width:50px;font-size: 12px;" value="'.$page->current().'" onclick="$(this).val(\'\')"/><a href="javascript:;" style="float:right;" class="" {click}>跳转</a></li><li><span class="layui-laypage-count">每页 '.$page->num.' 条,共 '.$page->total.' 条</span></li>';
+	# 定义扩展信息
+	$html->ext = '';
+	# 生成
+	$html->create();
+}
+

+ 1 - 1
tool/work/database/info.php

@@ -93,7 +93,7 @@ if ($search_auth == 2) {
 } 
 $button = array();
 if ($search_auth == 1) {
-    $button['回调界面'] = array('location',Dever::url('lib/appoint.back','work')); 
+    $button['回调界面'] = array('location',Dever::url('lib/appoint.callback','work')); 
     // $button['电话回调界面'] = array('location',Dever::url('lib/appoint.callback','work')); 
 }
 $excel = false;