Your Name 2 years ago
parent
commit
532ab49f06

+ 2 - 1
service/agent/database/order.php

@@ -115,8 +115,9 @@ if ($parent_mid) {
 if ($mid) {
    $pmid = $mid; 
 }
+$p = Dever::input('p');
 $excel = false;
-if ($pmid) {
+if ($pmid && $p !=1) {
     $button = array
     (
         '返回上一页' => array('location', 'l=project/database/list&project=agent&table=member_area&page_type=1&mid=' . $pmid),

+ 22 - 11
service/agent/lib/Member.php

@@ -503,17 +503,28 @@ class Member
             );
         }
         */
-        $head_btn[] = array
-        (
-            'type' => 'link',
-            'link' => 'refer',
-            'name' => '返回上一页',
-        );
-        $head = array
-        (
-            'name' => '基本信息',
-            'btn' => $head_btn,
-        );
+       $jump = Dever::input('jump');
+       if (!$jump) {
+            $head_btn[] = array
+            (
+                'type' => 'link',
+                'link' => 'refer',
+                'name' => '返回上一页',
+            );
+            $head = array
+            (
+                'name' => '基本信息',
+                'btn' => $head_btn,
+            );
+       } else {
+             $head = array
+            (
+                'name' => '基本信息',
+                'btn' => '',
+            );
+       }
+        
+        
         $foot = $button;
         $html = Dever::show($head, $result, $foot, false, 'dls-user-box');
 

+ 2 - 0
tool/boot.php

@@ -0,0 +1,2 @@
+<?php
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../boot.php');

+ 27 - 0
tool/work/assets/manage/html/info_log.html

@@ -0,0 +1,27 @@
+
+<form class="layui-form form10" action="" target="f10" method="post">
+<iframe id="f10" name="f10" style="display:none;"></iframe>
+<div class="layui-form-item" id="show">
+    <table class="layui-table">
+      <thead>
+        <tr>
+          <th>昵称</th>
+          <th>加入时间</th>
+          <th>签名</th>
+        </tr> 
+      </thead>
+      <tbody>
+        <tr>
+          <td>贤心</td>
+          <td>2016-11-29</td>
+          <td>人生就像是一场修行</td>
+        </tr>
+        <tr>
+          <td>许闲心</td>
+          <td>2016-11-28</td>
+          <td>于千万人之中遇见你所遇见的人,于千万年之中,时间的无涯的荒野里…</td>
+        </tr>
+      </tbody>
+    </table>
+</div>
+</form>

+ 264 - 0
tool/work/assets/pc/html/back.html

@@ -0,0 +1,264 @@
+<!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">
+<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 src="../script/dever/core.js?1"></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/fancybox/jquery.fancybox.js"></script>
+<script src="../script/lib/manage/main.js"></script>
+<style>
+
+.dever-upload-pic
+{
+  width:100px;
+}
+h5 {
+    margin-bottom: 10px;
+}
+
+td {
+  color: black;
+}
+.layui-card-body {
+    /*position: relative;*/
+    /*padding: 50px 15px;*/
+    line-height: 20px;
+    margin-left: -10px;
+}
+.layui-input {
+    /*position: relative;*/
+    /*padding: 30px;*/
+    margin-top: 20px;
+    /*line-height: 24px;*/
+}
+ .container{
+            max-width: 1024px;
+            margin: auto;
+        }
+  .layui-span{
+    color: blue;
+    margin-left: 80px;
+  }
+  .layui-col-xs4{
+    font-size: 18px;
+  }
+  .layui-col-xs6{
+    margin-top: 15px;
+    font-size: 15px;
+  }
+  #content{
+  	margin-left: 11px;
+  	margin-right: 18px;
+  }
+  .url{
+  	margin-top:40px;
+  	margin-bottom: 20px;
+  }
+  .huifu{
+  	border-style:none;
+  	background-color: white;
+  }
+  .pm{
+  	margin-left: 14px;
+  	margin-bottom: -14px;
+  }
+</style>
+
+</head>
+<body>
+
+<div class="layui-card">
+<div class="layui-container">
+<fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;"> </fieldset>
+  	<p class='pm'>手机号:</p>
+    <input type="text" value="<{$user['mobile']}>" autocomplete="off" id="content" class="layui-input" style="width: auto;display: inline;" placeholder="输入手机号"><a href="javascript:;" class="layui-btn" id="search" >搜索</a>
+
+  <div class="layui-card-body">
+<{if(isset($user)):}>
+    <table class="table layui-table layui-table-body" id="table">
+    <col width="100">
+    <col width="100">
+      <thead>
+    <tr>
+      <th>名称</th>
+      <th>电话号码</th>
+      <th>平台</th>
+      <th>角色</th>
+    </tr> 
+  </thead>
+  <tbody>
+    <tr>
+      <td><{$user['name']}></td>
+      <td><{$user['mobile']}></td>
+      <td width=80px;><{$user['type']}></td>
+      <td width=80px;><{$user['role_name']}></td>
+    </tr>
+  </tbody>
+      </table>
+      <div class="url">
+      <{if(isset($user['agent_uid']) && $user['agent_uid']>0):}>
+
+      <a  href="<{$user['order']}>" class="layui-btn" id="order" onclick="order();">代理商订单</a>
+
+		<a  href="<{$user['agent']}>" class="layui-btn" id="desc" onclick="desc();">代理商详情</a>
+		<a  href="<{$user['soft']}>" class="layui-btn" id="soft" onclick="soft();">软件服务费</a>
+		<{endif}>
+		<{if(isset($user['option_uid']) && $user['option_uid']>0):}>
+		<a  href="<{$user['option']}>;" class="layui-btn" id="option" onclick="option();">期权信息</a>
+		<{endif}>
+		<a  href="<{$user['work']}>" class="layui-btn" id="work" onclick="work();">创建工单</a>
+      </div>
+      <{endif}>
+      <{if(isset($info)):}>
+      <div class="layui-card-body">
+      <h3>往期问题工单:</h3>
+		<table class="table layui-table layui-table-body" id="table">
+		    <col width="100">
+		    <col width="100">
+		      <thead>
+		    <tr>
+		      <th>时间/完成时间</th>
+		      <th>问题类型</th>
+		      <th>优先级</th>
+		      <th>问题描述</th>
+		      <th>协助部门</th>
+		      <th>处理结果</th>
+		      <th>管理</th>
+		    </tr> 
+		  </thead>
+		  <{foreach($info as $k => $v):}>
+		  <tbody>
+		    <tr>
+		      <td><{$v['cdate']}><br/><{$v['fdate']}></td>
+		      <td><{$v['cate_name']}></td>
+		      <td><{$v['you']}></td>
+		      <td><{$v['desc']}></td>
+		      <td><{$v['branch']}></td>
+		      <td><{$v['status']}></td>
+		      <!-- <div class="zong"> -->
+		      <td width=60px><a href="<{$v['url']}>">查看详情</a><br/>
+		      <{if($v['zhipai'] ):}>
+		      <button class="huifu"  onclick="fastEdit($(this),'<{$v['zhipai']}>')">指派工单</button>
+		      <{endif}>
+		      </td>
+		      <!-- </div> -->
+		    </tr>
+		  </tbody>
+		  <{endforeach}>
+      </table>
+      <div><{$page}></div>
+      </div>
+      <{endif}>
+	</div>
+	</div>
+</div>
+</div>
+
+<!-- <input id="id" name="id" value="<{$id}>" type='hidden'/> -->
+</div>
+<script>
+var layer;
+layui.use('layer', function(){
+  layer = layui.layer;
+});
+function search()
+{
+	var content = $('#content').val();
+  	if (!content) {
+	    layer.alert('请输入手机号');
+	    layer.close();
+	} else {
+		$.ajax({
+	      type:"GET",
+	      url:config.host + 'lib/appoint.back',
+	      data: {
+	        mobile : $('#content').val(),
+	        json:2,
+	      },
+	      success: function (data) {
+	      	if(data == '代理商手机号不正确'){
+		      	layer.alert('请输入正确的手机号');
+		         layer.close();
+		    } else {
+		      	location.href = config.host + 'lib/appoint.back&mobile=' + $('#content').val();
+		    }
+	      	
+	      },
+	      error: function(data){
+	        layer.alert('手机号错误', function(){
+	        // location.href = config.host + "lib/appoint.back&id=<{$active_id}>";
+	        layer.close();
+	    });
+	        
+	     }
+	  });
+	}
+	
+  
+}
+$('#search').click(function() {
+  search();
+})
+$('#content').focus();
+$('#content').bind('keydown',function(event){
+	if(event.keyCode == "13")    
+   	{
+   		$.ajax({
+	      type:"GET",
+	      url:config.host + 'lib/appoint.back',
+	      data: {
+	        mobile : $('#content').val(),
+	        json:2,
+	      },
+	     success: function (data) {
+	      	if(data == '代理商手机号不正确'){
+		      	layer.alert('请输入正确的手机号');
+		         layer.close();
+		    } else {
+		      	location.href = config.host + 'lib/appoint.back&mobile=' + $('#content').val();
+		    }
+	      	
+	      },
+	      error: function(data){
+	        layer.alert('手机号错误', function(){
+	        // location.href = config.host + "lib/appoint.back&id=<{$active_id}>";
+	        layer.close();
+	    });
+	        
+	     // top.location.href = config.host + "lib/appoint.back&mobile=" + $('#content').val();
+	     }
+	  });
+   	}
+});
+// var order_url = "<{$user['order']}>";
+function order(){
+	// location.href = 'www.baidu.com';
+	//"<{$user['order']}>";
+}
+
+
+
+</script>
+</body>
+</html>

+ 309 - 0
tool/work/assets/pc/html/email.html

@@ -0,0 +1,309 @@
+<!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" />
+<style>
+/*.dever-upload-pic
+{
+  width:100px;
+}
+h5 {
+    margin-bottom: 10px;
+}
+td {
+  color: black;
+}
+.desc{
+  width:80px;
+}
+.layadmin-backlog-body {
+    display: block;
+    padding: 10px 15px;
+    background-color: #f8f8f8;
+    width: 150px;
+    height: 102px;
+    text-align: center;
+    font-size: 15px;
+    margin-top: 20px;
+    margin-bottom: 30px;
+
+    border-radius: 2px;
+    transition: all .3s;
+    -webkit-transition: all .3s;
+}
+a {
+    color: #333;
+    text-decoration: none;
+}
+.layui-card-body {
+    position: relative;
+    padding: 10px 15px;
+    line-height: 24px;
+    text-align: center;
+}
+p {
+    display: block;
+    margin-block-start: 1em;
+    margin-block-end: 1em;
+    margin-inline-start: 0px;
+    margin-inline-end: 0px;
+}
+a cite {
+    font-style: normal;
+    font-size: large;
+}
+h3{
+  font-weight: 400;
+  font-size: 18px;
+}
+tr{
+  height: 100px;
+}
+#nav ul li{
+  float: left;
+  margin-top: 30px;
+  margin-bottom: 70px;
+}
+.ktable{
+  margin-top: 80px;
+  margin-left:100px;
+}*/
+.zong {
+     margin-left: 100px;
+     margin-top: 30px;
+}
+.container{
+
+    height:150px;
+    position: relative;
+    line-height: 24px;
+    text-align: center;
+}
+#nav ul li{
+  float: left;
+  margin-left: 30px;
+  /*margin-bottom: 70px;*/
+}
+p {
+    display: block;
+    margin-block-start: 1em;
+    margin-block-end: 1em;
+    margin-inline-start: 0px;
+    margin-inline-end: 0px;
+    font-size: 18px;
+}
+li{
+    background-color: #f8f8f8;
+    width: 150px;
+    list-style-type: none;
+    /*font-size: 15px;*/
+    /*height: 100px;*/
+}
+h3{
+    font-weight: 400;
+  font-size: 18px;
+  /*background: #f8f8f8;*/
+  /*color:#F8f8f8;*/
+}
+
+.after{
+     /*height:200px;*/
+    /*position: relative;*/
+    /*line-height: 24px;*/
+    /*text-align: center;*/
+    margin-left: 20px;
+    /*color:#423e3e;*/
+
+}
+th{
+    background-color:#eeeeee;
+}
+</style>
+
+</head>
+<body>
+  <div class="zong">
+    <div class="container" id="nav">
+        <ul>
+            <li>
+                <p><{$info['app']}></p>
+                <h3>部门相关</h3>
+            </li>
+            <li>
+                <p><{$info['xu']}></p>
+                <h3>需处理</h3>
+            </li>
+            <li>
+                <p><{$info['yi']}></p>
+                <h3>已处理</h3>
+            </li>
+            <li>
+                <p><{$info['wei']}></p>
+                <h3>未完成</h3>
+            </li>
+        </ul>
+    </div>
+    <div class="after">
+        <table class="ntes_editor_table" id="ntes_editor_table_10010" style="border-collapse: collapse; table-layout: auto; font-size: inherit; border: 1px solid rgb(167, 167, 166); overflow: hidden;"><tbody>
+<tr style="border:1px solid #A7A7A6">
+<td style="border-right:1px solid #A7A7A6;border-bottom:1px solid #A7A7A6;padding:3px 8px;height: 36px;word-break: break-all; word-wrap: break-word; width:131px;" class=""><blockquote style="margin: 0 0 0 6px; border: none; padding: 0px;">创建时间</blockquote></td>
+<td style="border-right:1px solid #A7A7A6;border-bottom:1px solid #A7A7A6;padding:3px 8px;height: 36px;word-break: break-all; word-wrap: break-word; width:139px;" class=""><blockquote style="margin: 0 0 0 6px; border: none; padding: 0px;">指派时间/处理时间</blockquote></td>
+<td style="border-right:1px solid #A7A7A6;border-bottom:1px solid #A7A7A6;padding:3px 8px;height: 36px;word-break: break-all; word-wrap: break-word; width:131px;"class=""><blockquote style="margin: 0 0 0 6px; border: none; padding: 0px;">问题类型</blockquote></td>
+<td style="border-right:1px solid #A7A7A6;border-bottom:1px solid #A7A7A6;padding:3px 8px;height: 36px;word-break: break-all; word-wrap: break-word; width:131px;"class=""><blockquote style="margin: 0 0 0 6px; border: none; padding: 0px;">优先级</blockquote></td>
+<td style="border-right:1px solid #A7A7A6;border-bottom:1px solid #A7A7A6;padding:3px 8px;height: 36px;word-break: break-all; word-wrap: break-word; width:131px;"class=""><blockquote style="margin: 0 0 0 6px; border: none; padding: 0px;">问题描述</blockquote></td>
+<td style="border-right:1px solid #A7A7A6;border-bottom:1px solid #A7A7A6;padding:3px 8px;height: 36px;word-break: break-all; word-wrap: break-word; width:131px;"class=""><blockquote style="margin: 0 0 0 6px; border: none; padding: 0px;">处理结果</blockquote></td>
+</tr>
+<{if(isset($app)):}>
+    <{foreach($app as $k => $v):}>
+<tr style="border:1px solid #A7A7A6">
+<td style="border-right:1px solid #A7A7A6;border-bottom:1px solid #A7A7A6;padding:3px 8px;height: 36px;word-break: break-all; word-wrap: break-word; width:131px;"class=""><blockquote style="margin: 0 0 0 6px; border: none; padding: 0px;"><{$v['cdate']}></blockquote></td>
+<td style="border-right:1px solid #A7A7A6;border-bottom:1px solid #A7A7A6;padding:3px 8px;height: 36px;word-break: break-all; word-wrap: break-word; width:139px;"class=""><blockquote style="margin: 0 0 0 6px; border: none; padding: 0px;"><{$v['zhipai']}><br/><{$v['chu']}></blockquote></td>
+<td style="border-right:1px solid #A7A7A6;border-bottom:1px solid #A7A7A6;padding:3px 8px;height: 36px;word-break: break-all; word-wrap: break-word; width:131px;"class=""><blockquote style="margin: 0 0 0 6px; border: none; padding: 0px;"><{$v['cate_name']}></blockquote></td>
+<td style="border-right:1px solid #A7A7A6;border-bottom:1px solid #A7A7A6;padding:3px 8px;height: 36px;word-break: break-all; word-wrap: break-word; width:131px;"class=""><blockquote style="margin: 0 0 0 6px; border: none; padding: 0px;"><{$v['priority_name']}></blockquote></td>
+<td style="border-right:1px solid #A7A7A6;border-bottom:1px solid #A7A7A6;padding:3px 8px;height: 36px;word-break: break-all; word-wrap: break-word; width:131px;"class=""><blockquote style="margin: 0 0 0 6px; border: none; padding: 0px;"><{$v['desc']}></blockquote></td>
+<td style="border-right:1px solid #A7A7A6;border-bottom:1px solid #A7A7A6;padding:3px 8px;height: 36px;word-break: break-all; word-wrap: break-word; width:131px;"class=""><blockquote style="margin: 0 0 0 6px; border: none; padding: 0px;"><{$v['status']}></blockquote></td>
+</tr>
+ <{endforeach}>
+    <{endif}>
+</tbody>
+</table><p style="margin: 0;"><br /></p>
+        <!-- <table class="table" id="table" border="1" width="900">
+          <thead id="list-thead">
+              <tr align="center">
+                <th data-priority="1">创建时间</th>
+                <th data-priority="1">指派时间/处理时间</th>
+                <th data-priority="1">问题类型</th>
+                <th data-priority="1">优先级</th>
+                <th data-priority="1" class = 'desc'>问题描述</th>
+                <th data-priority="1">处理结过</th>
+              </tr>
+          </thead>
+            <tbody>
+            <{if(isset($app)):}>
+              <{foreach($app as $k => $v):}>
+                <tr align='center'>
+                  <td><{$v['cdate']}></td>
+                  <td><{$v['zhipai']}><br/><{$v['chu']}></td>
+                  <td><{$v['cate_name']}></td>
+                  <td><{$v['priority_name']}></td>
+                  <td><{$v['desc']}></td>
+                  <td><{$v['status']}></td>
+                  
+                </tr>
+                  <{endforeach}>
+                  <{endif}>
+          </tbody> 
+      </table> -->
+    </div>
+  </div>
+</body>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<!-- <body>
+<div class="layui-container">
+<div class="layui-card">
+
+     <div id="nav">
+     <ul>
+    <li class=" ">
+      <a class="">
+                
+      <p><cite><{$info['app']}></cite></p>
+      <h3>部门相关</h3>
+      </a>
+      </li>
+      <li class="">
+    <a class="">
+    
+      <p><cite><{$info['xu']}></cite></p><h3>需要处理</h3></a>
+      </li>
+      <li class="">
+    <a class="">
+    
+      <p><cite><{$info['yi']}></cite></p>
+      <h3>已处理</h3>
+      </a>
+      </li>
+      <li class="">
+    <a class="">
+      <p><cite><{$info['wei']}></cite></p>
+      <h3>未完成</h3>
+      </a>
+      </li>
+      </ul>
+  </div>  
+     
+     
+	</div>
+	</div>
+  <div class = 'ktable'>
+    <table class="table" id="table" border="1" width="800">
+          <thead id="list-thead">
+              <tr align="center">
+                <th data-priority="1">创建时间</th>
+                <th data-priority="1">指派时间/处理时间</th>
+                <th data-priority="1">问题类型</th>
+                <th data-priority="1">优先级</th>
+                <th data-priority="1" class = 'desc'>问题描述</th>
+                <th data-priority="1">处理结过</th>
+              </tr>
+          </thead>
+            <tbody>
+            <{if(isset($app)):}>
+              <{foreach($app as $k => $v):}>
+                <tr align='center'>
+                  <td><{$v['cdate']}></td>
+                  <td><{$v['zhipai']}><br/><{$v['chu']}></td>
+                  <td><{$v['cate_name']}></td>
+                  <td><{$v['priority_name']}></td>
+                  <td><{$v['desc']}></td>
+                  <td><{$v['status']}></td>
+                  
+                </tr>
+                  <{endforeach}>
+                  <{endif}>
+          </tbody> 
+      </table>
+      </div>
+</div>
+</div>
+      
+
+</div>
+</body> -->
+</html>

+ 441 - 0
tool/work/assets/pc/html/index.html

@@ -0,0 +1,441 @@
+<!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">
+<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/fancybox/jquery.fancybox.js"></script>
+<script src="../script/lib/manage/main.js"></script>
+<style>
+
+body{
+  /*overflow: hidden;*/
+    background:white;
+  padding-left: 20px;
+  height:100%;
+}
+.layui-col-space15 {
+    margin: 9.5px;
+}
+  .layui-col-xs4{
+    font-size: 15px;
+  }
+  .layui-col-xs6{
+    margin-top: 15px;
+    font-size: 14px;
+    /*margin-left:10px;*/
+  }
+  .onebor{
+    width: 750px;
+    padding-left: 10px;
+    padding-bottom: 10px;
+    border: 1px solid #ddd;
+    /*border-left: 1px solid grey;
+    border-right: 1px solid grey;
+    border-bottom: 1px solid grey;*/
+    margin-top: -8px;
+  }
+  .desc{
+    margin-top:10px;
+    margin-bottom: 15px;
+    width: 728px;
+  }
+  .chu{
+    margin-top:10px;
+    margin-bottom: 10px;
+    font-size: 14px;
+  }
+  .bian{
+    margin-bottom:15px;
+    font-size: 14px;
+  }
+  .gongdan{
+    margin-top:20px;
+    font-size:14px;
+  }
+  .layout{
+    width: 100%;
+
+    height: 100%;
+
+    display: flex;
+    justify-content : space-around;
+
+}
+.aside{
+
+    flex:1;
+    height: 100%;
+    /*overflow-y: auto;*/
+    background: white;
+}
+.article{
+    /*flex:1;*/
+    width:230px;
+    height: 100%;
+    /*overflow-y: auto;/*/
+    background: white;
+}
+
+
+  .row1{
+    margin-left:10px;
+    margin-top:20px;
+  }
+  .row2{
+    margin-left:15px;
+    margin-top:80px;
+    /*margin-bottom: 15px;*/
+  }
+  .row3{
+    margin-left:15px;
+    margin-bottom:10px;
+  }
+  .layui-btn-primary {
+    border: 0px solid #C9C9C9;
+    background-color: #dedede;
+    color: #555;
+    font-size: 5px;
+    width: 90px;
+    height: 36px;
+}
+.time {
+    border: 0px solid #C9C9C9;
+    background-color: #ededed;
+    color: #555;
+    font-size: 5px;
+    width: 130px;
+    height: 36px;
+}
+.layui-icon-praise{
+    margin-left: -30px;
+    margin-right: 10px;
+    /*margin-top: 100px;*/
+}
+/*.top {
+    border: 1px solid #C9C9C9;
+    background-color: #1d953f
+
+;
+    color: #555;
+    font-size: 10px;
+    width: 100px;
+    height: 36px;
+}*/
+.layui-col-md4{
+    margin-top: 10px;
+    /*margin-bottom:10px;*/
+}
+.you{
+    /*margin-left:90px;*/
+    position: relative;
+    top: -45px;
+    left: 180px;
+
+}
+.role{
+    margin-left:-80px;
+}
+.content{
+    margin-top:20px;
+    margin-bottom: 10px;
+}
+.list{
+    margin-top: 20px;
+    margin-bottom: 10px;
+}
+
+.show{
+  margin-left: 20px;
+}
+.video{
+  margin-bottom: 10px;
+}
+</style>
+
+</head>
+<body>
+<div class="layout">
+    <aside class='aside'>
+  <{if($info['status']<3):}>
+    <div class="layui-row row1">
+    <div class="layui-col-xs2">
+      <div class="grid-demo"> 
+      <button class="layui-btn layui-btn-radius  " type="button" style="vertical-align: middle;margin-bottom: 2px;" onclick="finish()">完成关闭</button>
+      </div>
+    </div>
+    <div class="layui-col-xs2">
+      <div class="grid-demo grid-demo-bg1"><button class="layui-btn layui-btn-radius  " id="quxiao" style="vertical-align: middle;margin-bottom: 2px;" onclick="quxiao();">取消关闭</button></div>
+    </div>
+    <div class="layui-col-xs2">
+      <div class="grid-demo"><button class="layui-btn layui-btn-radius  " id="huifu" style="vertical-align: middle;margin-bottom: 2px;" onclick="fastEdit($(this),'<{$hui}>')">回复/指派</button></div>
+    </div>
+  </div>
+  <{endif}>
+        <div class="layui-row">
+    <div class="layui-col-bg">
+      <div class="grid-demo grid-demo-bg1 gongdan">工单号:<{$info['work_num']}></div>
+    </div>
+  </div>
+  <div class="layui-row">
+    <div class="layui-col-md4">
+      <div class="grid-demo">创建时间:<{$info['cdate']}></div>
+    </div>
+    <div class="layui-col-md4">
+      <div class="grid-demo">创建人:<{$info['admin']}></div>
+    </div>
+    
+  </div>
+  
+  <div class="layui-row bian">
+    <div class="layui-col-md4 ">
+      <div class="grid-demo">工单来源:<{$info['source_name']}></div>
+    </div>
+    <div class="layui-col-md4">
+      <div class="grid-demo">相关系统产品:<{$info['product_name']}></div>
+    </div>
+    <!-- <div class="layui-col-md4 you"> -->
+      <div class="you"><button class="layui-btn layui-btn-radius layui-btn-primary" style="font-size: 15px; color: <{$info['color']}>;background: #f6f5ec; margin-left: 450px;margin-bottom: -19px;width: 120px;"><{$info['priority_name']}></button></div>
+    <!-- </div> -->
+  </div>
+
+
+  <div class="layui-row onebor">
+    <div class="layui-col-xs6">
+      <div class="grid-demo">姓名:<{$info['user_name']}></div>
+    </div>
+    <div class="layui-col-xs6 role">
+      <div class="grid-demo">代理商角色:<{$info['role_name']}></div>
+    </div>
+    <div class="layui-col-xs6 ">
+      <div class="grid-demo">手机号:<{$info['mobile']}></div>
+    </div>
+    <div class="layui-col-xs6 role">
+      <div class="grid-demo">身份证号:<{$info['idcard']}></div>
+    </div>
+    <div class="layui-col-xs6 ">
+      <div class="grid-demo">类别:<{$info['cate_name']}></div>
+    </div>
+  <div class="layui-col-bg layui-col-md8 ">
+      <div class="grid-demo grid-demo-bg desc">描述:<{$info['desc']}></div>
+    </div>
+    <div class="layui-row">
+    <{if(isset($info['video']) && $info['video']):}>
+    <div class="grid-demo layui-col-xs1">
+        
+      <video class="player "  height="100px" src="<{$info['video']}>" onclick="player($(this))">查看视频</video>
+      
+    </div>
+    <{endif}>
+    <{if(isset($info['pic']) && $info['pic']):}>
+      <div id="layer-photos-<{$info['id']}>" class="grid-demo layui-col-xs5 layer-photos-demo " id="tk">
+      <{foreach($info['pic'] as $k => $v):}>
+          <img src='<{$v}>' id='show' class="fd show" height='100px'>
+        <{endforeach}>
+      </div>
+      <{endif}>
+    </div>    
+  </div>
+  <div class="layui-row content">
+  <{if(isset($info_log)):}>
+    <{foreach($info_log as $k => $v):}>
+      <div class="layui-row list">
+        <div class="layui-col-xs4 chu">
+          <div class="grid-demo">处理时间:<{$v['cdate']}></div>
+        </div>
+        <div class="layui-col-xs4 chu">
+          <div class="grid-demo">处理人:<{$v['appoint_admin']}></div>
+        </div>
+        <div class="layui-col-xs4 chu">
+          <div class="grid-demo">指派:<{$v['admin_group']}></div>
+        </div>
+      </div>
+      <div class="layui-row onebor">
+      <div class="layui-col-bg layui-col-md8 ">
+        <div class="grid-demo grid-demo-bg desc">描述:<{$v['desc']}></div>
+      </div>
+      <div class="layui-row ">
+      <{if(isset($v['video'])):}>
+      <div class="grid-demo layui-col-xs1">
+      
+      <video class="player " height="100px" src="<{$v['video']}>" onclick="player($(this))">查看视频</video>
+      </div>
+       <{endif}>
+      <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 class="grid-demo"><{$v['pic']}></div> -->
+      </div>
+      </div>
+    <{endforeach}>
+  <{endif}>
+  </div>
+    </aside>
+    <article class="article">
+    <div class="layui-row  row2">
+      <div class="layui-col-lg  row3">
+      
+        <div class="grid-demo "><i class="layui-icon layui-icon-praise" style="font-size: 20px; color: #1E9FFF;"></i><{$info['cdate']}></div>
+      </div>
+      <div class="layui-col-lg row3">
+        <div class="grid-demo"><{$info['admin']}></div>
+      </div>
+      <div class="layui-col-lg row3">
+        <div class="grid-demo">
+            <button class="layui-btn layui-btn-radius layui-btn-primary">创建工单</button>
+        </div>
+      </div>
+        <{if(isset($zhi)):}>
+    <{foreach($zhi as $k => $v):}>
+      <div class="layui-col-lg row3">
+        <div class="grid-demo"><i class="layui-icon layui-icon-praise" style="font-size: 20px; color: #1E9FFF;"></i><{$v['cdate']}></div>
+      </div>
+      <div class="layui-col-lg row3">
+        <div class="grid-demo"><{$v['admin']}></div>
+      </div>
+      <{if($v['time']):}>
+      <div class="layui-col-lg row3">
+        <div class="grid-demo"><button class="layui-btn layui-btn-radius layui-btn-primary time"><{$v['time']}></button></div>
+      </div>
+      <{endif}>
+      <{if($v['finish']):}>
+      <div class="layui-col-lg row3">
+        <div class="grid-demo">
+        <!-- <button type="button" class="layui-btn"> -->
+          <button class="layui-btn layui-btn-radius layui-btn-primary"><{$v['finish']}></button>
+        <!-- </button> -->
+        </div>
+      </div>
+      <{endif}>
+      <{endforeach}>
+  <{endif}>
+  </div>
+    </article>
+</div>
+
+	</div>
+</div>
+</div>
+
+<!-- <input id="id" name="id" value="<{$info['id']}>" type='hidden'/> -->
+</div>
+<script>
+var layer;
+layui.use(['layer', 'form'], function(){
+  layer = layui.layer;
+
+  $('.layer-photos-demo').each(function() {
+      layer.photos({
+        photos: '#' + $(this).attr('id')
+        ,anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数)
+      }); 
+  })
+  
+});
+function player(e){
+  vUrl = e.attr('src');
+  // '<{$info['video']}>';  //获取到播放的url
+        var loadstr = '<video width="100%" height="100%"  controls="controls" autobuffer="autobuffer"  autoplay="autoplay" loop="loop">' +
+                '<source src='+vUrl+' type="video/mp4"></source></video>';
+        layer.open({
+            type: 1,
+            title: false,
+            area: ['730px', '500px'],
+            shade: [0.8, 'rgb(14, 16, 22)'],
+            skin: 'demo-class',
+            content: loadstr
+        });
+}
+
+function finish()
+    {
+        var id = '<{$info['id']}>';
+        if (!id) {
+            layui.layer.alert('工单id不存在');
+            return;
+        };
+        // alert(111);
+        layer.confirm('确定完成关闭吗', function() {
+          $.ajax({
+              type: "GET",
+              url: config.host + "lib/manage.setInfoStatus",
+              data: {
+                  id: id,
+                  // json : 1,
+              },
+              dataType: "json",
+
+              success: function (data) {
+              // var index = config.host + "lib/manage.code&id=<{$active_id}>";
+                layer.alert(data.msg, function(){
+                  location.href = config.host + "lib/manage.setInfoStatus&id=" + id;
+                  
+              });
+
+             },
+          });
+          layui.layer.closeAll();
+          location.reload();
+        });
+    }
+    function quxiao()
+    {
+        var id = '<{$info['id']}>';
+        if (!id) {
+            layui.layer.alert('工单id不存在');
+            return;
+        };
+        // alert(111);
+        layer.confirm('确定取消关闭吗', function() {
+          $.ajax({
+              type: "GET",
+              url: config.host + "lib/manage.setInfoStatus",
+              data: {
+                  id: id,
+                  type: '1',
+                  // json : 1,
+              },
+              dataType: "json",
+
+              success: function (data) {
+                layer.alert(data.msg, function(){
+                  location.href = config.host + "lib/manage.setInfoStatus&type=" + type +"&id=" + id;
+              });
+             },
+          });
+          layui.layer.closeAll();
+          location.reload();
+        });
+    }
+    // var function fastEdit 
+    // function huifu()
+    // {
+        
+    // }
+
+</script>
+</body>
+</html>

+ 188 - 0
tool/work/database/appoint.php

@@ -0,0 +1,188 @@
+<?php
+$admin = function()
+{
+	$array = array();
+	$data = Dever::load('work/lib/appoint.people');
+	if($data)
+    {
+        $array += $data;
+    }
+    return $array;
+};
+return array
+(
+    # 表名
+    'name' => 'appoint',
+    # 显示给用户看的名称
+    'lang' => '指派工单',
+    # 后台菜单排序
+    'order' => 2,
+    'menu' => false,
+    // 'start' => array
+    // (
+    //     'insert' => 'work/lib/appoint.InsertAppoint',
+    //     'update' => 'work/lib/appoint.InsertAppoint',
+    // ),
+    'end' => array
+    (
+    	'insert' => 'work/lib/appoint.updateAppoint',
+    	'update' => 'work/lib/appoint.updateAppoint',
+    ),
+    // 'auto' => 100000,
+    # 数据结构
+    '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,
+        ),
+
+        'admin_id'       => array
+        (
+            'type'      => 'varchar-500',
+            'name'      => '指派人',
+            'default'   => '',
+            'desc'      => '指派人',
+            'match'     => 'option',
+            'search'    => 'linkage',
+            'update'    => 'linkage',
+            'option'    => Dever::url('lib/appoint.get?level_total=2', 'work'),
+        ),
+
+        'group'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '部门',
+            'default'   => '',
+            'desc'      => '部门',
+            'match'     => 'option',
+            // 'search'    => 'linkage',
+            'update'    => 'hidden',
+            // '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',
+        ),
+
+        'video'        => array
+        (
+            'type'      => 'varchar-500',
+            'name'      => '相关视频',
+            'default'   => '',
+            'desc'      => '请选择相关视频',
+            'match'     => 'option',
+            'update'    => 'video',
+            'key'       => '3',
+            //'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,
+        
+    ),
+
+    'request' => array
+    (
+        'getData' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                //'id' => array('yes', '!='),
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('id' => 'desc'),
+            'col' => '*|id',
+        ),
+        'getAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'info_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('id' => 'asc'),
+            'col' => '*',
+        ),
+        'getEmail' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'group' => array('yes','in'),
+                'start' => array('yes-cdate','>='),
+                'end' =>array('yes-cdate','<='),
+                'state' => 1,
+            ),
+            'type' => 'count',
+            // 'order' => array('id' => 'desc'),
+            'col' => '*',
+        ),
+    ),
+);

+ 241 - 0
tool/work/database/branch.php

@@ -0,0 +1,241 @@
+<?php
+$group = function()
+{
+    $array = array
+    (
+        -1 => array('id' => '-1', 'name' => '请选择'),
+    );
+    $data = Dever::load('manage/group-state');
+    if($data)
+    {
+        $array += $data;
+    }
+    return $array;
+};
+$cadre = function()
+{
+    // $array = array();
+    $array = array
+    (
+        -1 => array('id' => '-1', 'name' => '请选择'),
+    );
+    $data = Dever::load('manage/admin-state');
+    if($data)
+    {
+        foreach ($data as $k => $v) {
+            $data[$k]['name'] = $v['username']; 
+        }
+        $array += $data;
+    }
+    return $array;
+};
+$type = array
+(
+    1 => '发送',
+    2 => '不发送',
+);
+return array
+(
+    # 表名
+    'name' => 'branch',
+    # 显示给用户看的名称
+    'lang' => '相关部门设置',
+    # 后台菜单排序
+    'order' => 94,
+    // 'menu' => false,
+    // 'auto' => 100000,
+    // 'check' => 'group_id',
+    'start' => array
+    (
+        'insert' => 'work/lib/appoint.startBranch',
+        'update' => 'work/lib/appoint.startBranch',
+    ),
+    'end' => array
+    (
+        'insert' => 'work/lib/appoint.updateBranch',
+        'update' => 'work/lib/appoint.updateBranch',
+    ),
+    # 数据结构
+    '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("work/lib/manage.xietiao#group",{id})',
+        ),
+
+
+
+        'group_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '部门',
+            'default'   => '-1',
+            'desc'      => '部门id',
+            'match'     => 'is_string',
+            // 'option'    => $cadre,
+            'update'    => 'hidden',
+        ),
+
+        'coor'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '协调人',
+            'default'   => '-1',
+            'desc'      => '协调人',
+            'match'     => 'is_string',
+            // 'option'    => $coor,
+            // 'update'    => 'select',
+            // 'search'    => array
+            // (
+            //     'api' => 'active/info-getSearch',
+            //     'col' => 'col',
+            //     'result' => 'id',
+            //     'search' => 'active_id',
+            // ),
+            'list'      => 'Dever::load("work/lib/manage.xietiao#name",{id})',
+        ),
+
+        // 'content'       => array
+        // (
+        //     'type'      => 'text-1000',
+        //     'name'      => '关联协调人',
+        //     'default'   => '-1',
+        //     'desc'      => '关联协调人',
+        //     'match'     => 'option',
+        //     'update'    => array
+        //     (
+                
+        //         array
+        //         (
+        //             'col'       => 'concert',
+        //             'name'      => '协调人',
+        //             'default'   => '-1',
+        //             'desc'      => '协调人',
+        //             'match'     => 'is_string',
+        //             'update'    => 'select',
+        //             'option'    => $cadre,
+        //         ),
+        //     ),
+        //     'list'     => 'Dever::load("work/lib/mange.xietiao",{id})',
+        // ),
+
+        'type'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '是否发送每日汇总邮件通知',
+            'default'   => '2',
+            'desc'      => '是否发送每日汇总邮件通知',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'option'    => $type,
+            // 'search'    => 'select',
+            // 'list'      => true,
+        ),
+
+        'num'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '关联问题数',
+            'default'   => '0',
+            'desc'      => '数量',
+            'match'     => 'option',
+            'update'    => 'hidden',
+            '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,
+        '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' => '*',
+        ),
+    ),
+);

+ 481 - 0
tool/work/database/info.php

@@ -0,0 +1,481 @@
+<?php
+$cate = function()
+{
+    $array = array();
+    $data = Dever::db('work/q_cate')->state();
+    if($data)
+    {
+        $array += $data;
+    }
+    return $array;
+};
+$branch = function()
+{
+    $array = array();
+    $data = Dever::db('work/branch')->state();
+    if($data)
+    {
+        $array += $data;
+    }
+    return $array;
+};
+$priority = function()
+{
+    $array = array();
+    $data = Dever::db('work/priority')->state();
+    if($data)
+    {
+        foreach ($data as $k => $v) {
+            $data[$k]['style'] = 'color:'.$v['color'];
+        }
+        $array += $data;
+    }
+    return $array;
+};
+$source = function()
+{
+    $array = array();
+    $data = Dever::db('work/q_source')->state();
+    if($data)
+    {
+        $array += $data;
+    }
+    return $array;
+};
+$question = function()
+{
+    $array = array();
+    $data = Dever::db('work/question')->state();
+    if($data)
+    {
+        $array += $data;
+    }
+    return $array;
+};
+$status = array
+(
+    // 1 => '全部',
+    1 => '待处理',
+    2 => '处理中',
+    3 => '完成关闭',
+    4 => '取消关闭',
+);
+$admin = Dever::load("manage/auth.info");
+$admin_id = '';
+if ($admin) {
+    $admin_id = $admin['id'];
+}
+#工单列表是1,我的工单列表2
+$search_auth = Dever::input('search_option_dever_auth', 1);
+
+$list_button = array();
+$list_button['location'] = array('查看详情',Dever::url('lib/appoint.show','work'));
+$list_button ['fast_add'] = array('指派工单','appoint&search_option_info_id={id}','{status}<3');
+$data = array();
+$insert = true;
+if ($search_auth == 2) {
+    $insert = false;
+    $audit_admin = Dever::setInput('search_option_col', $admin_id);
+    $data[]= array('待我处理',function() use ($admin_id) {return Dever::db('work/info')->getTotal(array('status'=>2,'appoint_id'=>$admin_id));});
+    $data[]= array('处理完成',function() use($admin_id) {return Dever::db('work/info')->getTotal(array('status'=>3,'appoint_id'=>$admin_id));});
+    $data[]= array('我创建的',function() use($admin_id) {return Dever::db('work/info')->getTotal(array('audit_admin'=>$admin_id));});
+} 
+$button = array();
+if ($search_auth == 1) {
+    $button['回调界面'] = array('location',Dever::url('lib/appoint.back','work')); 
+}
+$excel = false;
+if (Dever::load('manage/auth')->checkFunc('work.info', 'infoedit', '数据导出')) {
+    $excel[] = array('数据导出', '工单列表数据导出', 'work/lib/manage.out_info');
+}
+return array
+(
+    # 表名
+    'name' => 'info',
+    # 显示给用户看的名称
+    'lang' => '发起新工单',
+    # 后台菜单排序
+    'order' => 100,
+    // 'menu' => false,
+    // 'auto' => 100000,
+    'end' => array
+    (
+        'insert' => 'work/lib/manage.updateInfo',
+        'update' => 'work/lib/manage.updateInfo',
+    ),
+    'config_status' => $status,
+    # 数据结构
+    '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,
+        ),
+
+        'mobile'      => array
+        (
+            'type'      => 'bigint-11',
+            'name'      => '手机号',
+            'default'   => '',
+            'desc'      => '请输入手机号',
+            'match'     => 'option',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            # 绑定js脚本,更新时使用,第一个参数是执行的方式,第二个参数执行的方法,第三个参数是传值。
+            'bind'        => array('onblur', 'loading', array('url' => Dever::url("lib/manage.search","work"))),
+            'list_name' => '客户信息',
+            'list'      => 'Dever::load("work/lib/manage.getUser#user",{id})',#true,
+            // '"Dever::load("work/lib/manage.getUser",{mobile})"',
+        ),
+
+        'name'      => array
+        (
+            'type'      => 'varchar-200',
+            'name'      => '用户姓名(或微信名)',
+            'default'   => '',
+            'desc'      => '用户姓名(或微信名)',
+            'match'     => 'option',
+            'update'    => 'text',
+            // 'search'    => 'fulltext',
+            // 'list'      => true,
+        ),
+
+        'work_num'      => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '工单号',
+            'default'   => '',
+            'desc'      => '工单号',
+            'match'     => 'is_string',
+            'update'    => 'hidden',
+            // 'search'    => 'fulltext',
+            // 'list'      => true,
+        ),
+
+        'source'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '问题来源',
+            'default'   => '-1',
+            'desc'      => '问题来源',
+            'match'     => 'is_string',
+            'option'    => $source,
+            'update'    => 'radio',
+            'search'    => $search_auth == 1 ? 'select' : false,
+            // 'list'      => true,
+        ),
+
+        'cate_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '问题类型',
+            'default'   => '-1',
+            'desc'      => '问题类型',
+            'match'     => 'is_string',
+            'option'    => $cate,
+            'update'    => 'select',
+            'search'    => $search_auth == 1 ? 'select' : false,
+            'list'      => true,
+        ),
+
+        'question_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '问题类型描述',
+            'default'   => '-1',
+            'desc'      => '问题类型描述',
+            'match'     => 'is_string',
+            'option'    => $question,
+            'update'    => 'select',
+            'search'    => $search_auth == 1 ? 'select' : false,
+            // 'list'      => true,
+        ),
+
+        'priority_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '优先级',
+            'default'   => '-1',
+            'desc'      => '优先级',
+            'match'     => 'is_string',
+            'option'    => $priority,
+            'update'    => 'select',
+            'search'    => $search_auth == 1 ? 'select' : false,
+            'list'      => true,
+        ),
+
+        'appoint_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '指派人',
+            'default'   => '-1',
+            'desc'      => '指派人',
+            'match'     => 'is_string',
+            // 'option'    => $priority,
+            // 'update'    => 'select',
+            // 'search'    => 'select',
+            // 'list'      => true,
+        ),
+
+        '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',
+        ),
+
+        'video'        => array
+        (
+            'type'      => 'varchar-500',
+            'name'      => '相关视频',
+            'default'   => '',
+            'desc'      => '请选择相关视频',
+            'match'     => 'option',
+            'update'    => 'video',
+            'key'       => '3',
+            //'place'       => '150',
+        ),
+
+         'group'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '部门',
+            'default'   => '',
+            'desc'      => '部门',
+            'match'     => 'option',
+            // 'search'    => 'linkage',
+            'update'    => 'hidden',
+            // 'option'    => Dever::url('lib/appoint.get?level_total=2', 'work'),
+        ),
+
+        'branch_id'       => array
+        (
+            'type'      => 'varchar-500',
+            'name'      => '协助部门',
+            'default'   => '',
+            'desc'      => '协助部门',
+            'match'     => 'option',
+            // 'search'    => 'linkage',
+            'update'    => 'linkage',
+            'option'    => Dever::url('lib/appoint.get?level_total=1', 'work'),
+        ),
+
+        'status'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '处理结果',
+            'default'   => '1',
+            'desc'      => '处理结果',
+            'match'     => 'is_string',
+            'option'    => $status,
+            'update'    => 'select',
+            'search'    => 'select',
+            'list'      => true,
+        ),
+        'fdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '完成时间',
+            'default'   => '',
+            'match'     => 'is_numeric',
+            // 'search'    => 'date',
+            'list_name' => '时间/完成时间',
+            // 'desc'      => '',
+            'list'      => 'Dever::load("work/lib/manage.getUSer#time",{id})',
+            'list_order' => 1,
+        ),
+
+        'zdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '指派时间',
+            'default'   => '',
+            'match'     => 'is_numeric',
+            // 'search'    => 'date',
+        ),
+
+        'chdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '处理时间',
+            'default'   => '',
+            'match'     => 'is_numeric',
+            // 'search'    => 'date',
+            // 'desc'      => '',
+        ),
+
+        '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})',
+        ),
+
+        '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',
+
+            // 'list'      => 'date("Y-m-d H:i:s", {cdate})',
+        ),
+    ),
+
+    'manage' => array
+    (
+    	'insert' => $insert,
+        'delete' => false,
+        // 'edit' => false,
+        'list_button' => $list_button,
+        'data' => $data,
+        'button' => $button,
+        'excel'  => $excel,
+        # 设置公司权限
+        'company' => 'company_id',
+    ),
+
+    'request' => array
+    (
+        'list_option' => array
+        (
+         'col' => 'yes-appoint_id,audit_admin',
+        ),
+        // 'getData' => array
+        // (
+        //     # 匹配的正则或函数 选填项
+        //     'option' => array
+        //     (
+        //         //'id' => array('yes', '!='),
+        //         'state' => 1,
+        //     ),
+        //     'type' => 'all',
+        //     'order' => array('id' => 'desc'),
+        //     'col' => '*|id',
+        // ),
+        'getTotal' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'audit_admin' => 'yes',
+                'appoint_id' => 'yes',
+                'state' => 1,
+                'status'=> 'yes',
+            ),
+            'type' => 'count',
+            // 'order' => array('reorder' => 'desc', 'id' => 'asc'),
+            'col' => '*',
+        ),
+        'getCount' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'group' => 'yes',
+                'state' => 1,
+                'start' => array('yes-cdate','>='),
+                'end' => array('yes-cdate','<='),
+                'status'=> array('yes','in'),
+            ),
+            'type' => 'count',
+            // 'order' => array('reorder' => 'desc', 'id' => 'asc'),
+            'col' => '*',
+        ),
+        'getAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'group' => 'yes',
+                'state' => 1,
+                'start' => array('yes-cdate','>='),
+                'end' => array('yes-cdate','<='),
+                'status'=> array('yes','in'),
+            ),
+            'type' => 'all',
+            'order' => array('reorder' => 'desc', 'id' => 'desc'),
+            'col' => '*',
+        ),
+
+        'getHAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'mobile' =>'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('reorder' => 'desc', 'id' => 'desc'),
+            'page' => array(5,'list'),
+            'col' => '*',
+        ),
+    ),
+);

+ 127 - 0
tool/work/database/info_log.php

@@ -0,0 +1,127 @@
+<?php
+#1代理商,期权账户,小程序用户,
+$type = array
+(
+    1 => '代理商',
+    2 => '期权账户',
+    3 => '小程序用户',
+);
+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',
+            
+        ),
+        'admin_id'      => array
+        (
+            'type'      => 'varchar-500',
+            'name'      => '操作人',
+            'default'   => '-1',
+            'desc'      => '操作人',
+            'match'     => 'is_string',
+            // 'update'    => 'text',
+           
+        ),
+
+        'appoint_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '指派工单id',
+            'default'   => '-1',
+            'desc'      => '代理商',
+            'match'     => 'is_string',
+            // 'update'    => 'text',
+        ),
+
+        'fdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '完成时间',
+            'default'   => '',
+            'match'     => 'is_numeric',
+            'search'    => 'date',
+        ),
+
+        'cloce_date'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '完成关闭时间',
+            'default'   => '',
+            'match'     => 'is_numeric',
+            'search'    => 'date',
+            
+        ),
+
+        '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' => '*',
+        ),
+    ),
+);

+ 98 - 0
tool/work/database/pcate.php

@@ -0,0 +1,98 @@
+<?php
+
+return array
+(
+    # 表名
+    'name' => 'pcate',
+    # 显示给用户看的名称
+    'lang' => '产品类型设置',
+    # 后台菜单排序
+    'order' => 95,
+    '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,
+        ),
+
+        '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' => '*',
+        ),
+    ),
+);

+ 120 - 0
tool/work/database/priority.php

@@ -0,0 +1,120 @@
+<?php
+
+return array
+(
+    # 表名
+    'name' => 'priority',
+    # 显示给用户看的名称
+    'lang' => '优先级设置',
+    # 后台菜单排序
+    'order' => 96,
+    // '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
+    (
+        'getData' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                //'id' => array('yes', '!='),
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('id' => 'desc'),
+            'col' => '*|id',
+        ),
+        'getAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                // 'id' => array('yes','>'),
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('reorder' => 'desc', 'id' => 'asc'),
+            'col' => '*',
+        ),
+    ),
+);

+ 167 - 0
tool/work/database/product.php

@@ -0,0 +1,167 @@
+<?php
+$cate = function()
+{
+    $array = array
+    (
+        -1 => array('id' => '-1', 'name' => '请选择'),
+    );
+    $data = Dever::db('work/pcate')->state();
+    if($data)
+    {
+        $array += $data;
+    }
+    // print_R($array);die;
+    return $array;
+};
+return array
+(
+    # 表名
+    'name' => 'product',
+    # 显示给用户看的名称
+    'lang' => '相关系统产品设置',
+    # 后台菜单排序
+    'order' => 97,
+    // 'menu' => false,
+    // 'auto' => 100000,
+    # 数据结构
+    '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,
+        ),
+
+        'name'      => array
+        (
+            'type'      => 'varchar-200',
+            'name'      => '名称',
+            'default'   => '',
+            'desc'      => '名称',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'cate_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '产品类型',
+            'default'   => '-1',
+            'desc'      => '产品类型',
+            'match'     => 'is_string',
+            'option'    => $cate,
+            'update'    => 'select',
+            'list'      => true,
+        ),
+
+        'admin_id'       => array
+        (
+            'type'      => 'varchar-500',
+            'name'      => '关联产品负责人',
+            'default'   => '',
+            'desc'      => '关联产品负责人',
+            'match'     => 'option',
+            'search'    => 'linkage',
+            'update'    => 'linkage',
+            'option'    => Dever::url('lib/appoint.get?level_total=2', 'work'),
+            'list'      => "Dever::load('work/lib/manage.admin',{id})",
+        ),
+
+
+        '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,
+        'button' => array
+        (
+            '产品类型' => array('location', 'l=project/database/list&project=work&table=pcate&oper_table=product'),
+        ),
+        # 设置公司权限
+        'company' => 'company_id',
+        
+    ),
+
+    'request' => array
+    (
+        'getData' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                //'id' => array('yes', '!='),
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('id' => 'desc'),
+            'col' => '*|id',
+        ),
+        'getAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                // 'id' => array('yes','>'),
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('reorder' => 'desc', 'id' => 'asc'),
+            'col' => '*',
+        ),
+    ),
+);

+ 110 - 0
tool/work/database/q_cate.php

@@ -0,0 +1,110 @@
+<?php
+
+return array
+(
+    # 表名
+    'name' => 'q_cate',
+    # 显示给用户看的名称
+    'lang' => '问题分类设置',
+    # 后台菜单排序
+    'order' => 2,
+    '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,
+        ),
+
+        '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
+    (
+        'getData' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                //'id' => array('yes', '!='),
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('id' => 'desc'),
+            'col' => '*|id',
+        ),
+        'getAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                // 'id' => array('yes','>'),
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('reorder' => 'desc', 'id' => 'asc'),
+            'col' => '*',
+        ),
+    ),
+);

+ 110 - 0
tool/work/database/q_source.php

@@ -0,0 +1,110 @@
+<?php
+
+return array
+(
+    # 表名
+    'name' => 'q_source',
+    # 显示给用户看的名称
+    'lang' => '问题来源设置',
+    # 后台菜单排序
+    'order' => 2,
+    // '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'      => '名称-400电话',
+            'default'   => '',
+            'desc'      => '名称',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            '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
+    (
+        'getData' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                //'id' => array('yes', '!='),
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('id' => 'desc'),
+            'col' => '*|id',
+        ),
+        'getAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                // 'id' => array('yes','>'),
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('reorder' => 'desc', 'id' => 'asc'),
+            'col' => '*',
+        ),
+    ),
+);

+ 212 - 0
tool/work/database/question.php

@@ -0,0 +1,212 @@
+<?php
+$cate = function()
+{
+    $array = array();
+    $data = Dever::db('work/q_cate')->state();
+    if($data)
+    {
+        $array += $data;
+    }
+    return $array;
+};
+$branch = function()
+{
+    $array = array();
+    $data = Dever::db('manage/group')->state();
+    if($data)
+    {
+        $array += $data;
+    }
+    return $array;
+};
+$product = function()
+{
+    $array = array();
+    $data = Dever::db('work/product')->state();
+    if($data)
+    {
+        $array += $data;
+    }
+    return $array;
+};
+$type = array
+(
+    1 => '上架',
+    2 => '下架',
+);
+return array
+(
+    # 表名
+    'name' => 'question',
+    # 显示给用户看的名称
+    'lang' => '问题设置',
+    # 后台菜单排序
+    'order' => 98,
+    // 'menu' => false,
+    // 'auto' => 100000,
+    # 数据结构
+    '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,
+        ),
+
+        'name'      => array
+        (
+            'type'      => 'varchar-200',
+            'name'      => '名称',
+            'default'   => '',
+            'desc'      => '名称',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'cate_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '选择所属分类',
+            'default'   => '-1',
+            'desc'      => '选择所属分类',
+            'match'     => 'is_string',
+            'option'    => $cate,
+            'update'    => 'select',
+            'search'    => 'select',
+            'list'      => true,
+        ),
+
+        'branch_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '关联部门',
+            'default'   => '-1',
+            'desc'      => '关联部门',
+            'match'     => 'is_string',
+            'search'    => 'linkage',
+            'update'    => 'linkage',
+            'option'    => Dever::url('lib/appoint.get?level_total=1', 'work'),
+            'list'      => 'Dever::load("work/lib/manage.branch",{branch_id})',
+        ),
+
+        'product_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '相关系统产品',
+            'default'   => '-1',
+            'desc'      => '相关系统产品',
+            'match'     => 'is_string',
+            'option'    => $product,
+            'update'    => 'select',
+            'list'      => true,
+        ),
+
+        'type'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '上下架状态',
+            'default'   => '1',
+            'desc'      => '上下架状态',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'option'    => $type,
+            'search'    => 'select',
+            '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,
+        'button' => array
+        (
+            '问题分类' => array('location', 'l=project/database/list&project=work&table=q_cate&&oper_table=question'),
+        ),
+        # 设置公司权限
+        'company' => 'company_id',
+    ),
+
+    'request' => array
+    (
+        'getData' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                //'id' => array('yes', '!='),
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('id' => 'desc'),
+            'col' => '*|id',
+        ),
+        'getAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                // 'id' => array('yes','>'),
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('reorder' => 'desc', 'id' => 'asc'),
+            'col' => '*',
+        ),
+    ),
+);

+ 229 - 0
tool/work/database/user.php

@@ -0,0 +1,229 @@
+<?php
+#1代理商,期权账户,小程序用户,
+$type = array
+(
+    1 => '代理商',
+    2 => '期权账户',
+    3 => '小程序用户',
+);
+return array
+(
+    # 表名
+    'name' => 'user',
+    # 显示给用户看的名称
+    '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',
+        ),
+
+        'company_id'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '所属公司',
+            'default'   => '1',
+            'desc'      => '所属公司',
+            'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            //'search'    => $company ? 'select' : false,
+            //'list'      => true,
+        ),
+
+        'agent_uid'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '代理商姓名/手机号',
+            'default'   => '-1',
+            'desc'      => '代理商',
+            'match'     => 'is_string',
+            // 'update'    => 'text',
+            // 'search'    => array
+            // (
+            //     'api' => 'agent/member-getSearch',
+            //     'col' => 'col',
+            //     'result' => 'id',
+            //     'search' => 'mid',
+            // ),
+            // 'list_name' => '代理商信息',
+            // 'list'      => 'Dever::load("agent/lib/member.getOne", {mid}, "agent/member", true)',
+        ),
+        'option_uid'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '期权账户/手机号',
+            'default'   => '-1',
+            'desc'      => '代理商',
+            'match'     => 'is_string',
+            // 'update'    => 'text',
+            // 'search'    => array
+            // (
+            //     'api' => 'agent/member-getSearch',
+            //     'col' => 'col',
+            //     'result' => 'id',
+            //     'search' => 'mid',
+            // ),
+            // 'list_name' => '代理商信息',
+            // 'list'      => 'Dever::load("agent/lib/member.getOne", {mid}, "agent/member", true)',
+        ),
+
+        'passport_uid'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '小程序姓名/手机号',
+            'default'   => '-1',
+            'desc'      => '代理商',
+            'match'     => 'is_string',
+            // 'update'    => 'text',
+            // 'search'    => array
+            // (
+            //     'api' => 'agent/member-getSearch',
+            //     'col' => 'col',
+            //     'result' => 'id',
+            //     'search' => 'mid',
+            // ),
+            // 'list_name' => '代理商信息',
+            // 'list'      => 'Dever::load("agent/lib/member.getOne", {mid}, "agent/member", true)',
+        ),
+
+        'name'      => array
+        (
+            'type'      => 'varchar-200',
+            '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',
+            'list'      => true,
+        ),
+
+        'idcard'      => array
+        (
+            'type'      => 'varchar-32',
+            'name'      => '身份证号码',
+            'default'   => '',
+            'desc'      => '身份证号码',
+            'match'     => Dever::rule('idcard'),
+            'update'    => 'text',
+        ),
+
+        'username'      => array
+        (
+            'type'      => 'varchar-200',
+            'name'      => '昵称',
+            'default'   => '',
+            'desc'      => '昵称',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'avatar'        => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '头像',
+            'default'   => '',
+            'desc'      => '请选择头像',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => '1',
+            //'place'       => '150',
+        ),
+
+        'type'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '类型',
+            'default'   => '1',
+            'desc'      => '类型',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'option'    => $type,
+            // 'search'    => 'select',
+            '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,
+        # 设置公司权限
+        'company' => 'company_id',
+    ),
+
+    'request' => array
+    (
+        'getSearch' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'col' => array('yes-mobile,name', 'like'),
+            ),
+            'type' => 'all',
+            'col' => '*|id',
+        ),
+    ),
+);

+ 10 - 0
tool/work/index.php

@@ -0,0 +1,10 @@
+<?php
+
+define('DEVER_APP_NAME', 'work');
+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', '客诉工单');
+include(DEVER_APP_PATH . '../boot.php');

+ 425 - 0
tool/work/lib/Appoint.php

@@ -0,0 +1,425 @@
+<?php
+namespace Work\lib;
+use Dever;
+Class Appoint
+{
+	public function startBranch($id,$name,$data)
+	{
+		// Dever::config('base')->hook = true;
+		$group = Dever::param('group',$data);
+		// $id = Dever::param('id',$data);
+		if ($group) {
+			$res = Dever::db('work/branch')->find(array('group_id'=>$group[0]));
+			if ($res && isset($id['where_id']) && $id['where_id']){
+				if ($res['id'] !=  $id['where_id']){
+					Dever::alert('部门已存在');
+				} 
+			} else {
+				Dever::alert('部门已存在');
+			}
+			
+		}
+	}
+	public function updateBranch($id,$name,$data)
+	{
+		// Dever::config('base')->hook = true;
+		$group = Dever::param('group',$data);
+		if($group) {
+			$where['where_id'] = $id;
+			$where['group_id'] = $group[0];
+			Dever::db('work/branch')->update($where);
+		}
+
+	}
+	
+	public function updateAppoint($id,$name,$data)
+	{
+		Dever::config('base')->hook = true;
+		$info_id = Dever::param('info_id',$data);
+		$branch = Dever::param('admin_id',$data);
+		if ($info_id ) {
+			$info = Dever::db('work/info')->find($info_id);
+			$admin = Dever::load('manage/auth.info');
+			$admin_id = $info['audit_admin'];
+			if ($info['audit_admin'] != $admin['id']) {
+				$admin_id = $admin['id'];
+			}
+			if($info) {
+				if ($branch) {
+					$i['where_id'] = $info['id'];
+					if ($info['group']) {
+						 $group = $info['group'].',';
+					} else {
+						$group = $branch[0];
+					}
+					if (isset($branch[1]) && $branch[1]) {
+						$i['appoint_id'] = $branch[1];
+					}
+					
+					$i['group'] = $group;
+					$i['zdate'] = time();
+					$i['chdate'] = time();
+					$i['status'] = 2;
+					if ($i) {
+						Dever::db('work/info')->update($i);
+					}
+				}
+				$w['info_id'] = $info['id'];
+				$w['admin_id'] = $admin_id;
+				$w['appoint_id'] = $id;
+				Dever::db('work/info_log')->insert($w);
+			}
+			if ($branch) {
+				$data = Dever::db('work/branch')->find(array('group_id'=>$branch[0]));
+				if ($data) {
+					$where['where_id'] = $data['id'];
+					$where['num'] = $data['num'] +1;
+					Dever::db('work/branch')->update($where);
+				}
+				$wh['where_id'] = $id;
+				$wh['group'] = $branch[0];
+				Dever::db('work/appoint')->update($wh);
+			}
+		}
+	}
+	#指派人
+	 private $default = array
+    (
+        'value' => -1,
+        'name' => '不选择',
+    );
+    private $search_default = array
+    (
+        'value' => -1,
+        'name' => '部门',
+    );
+	public function get_api()
+    {
+        # 联动总数,默认到部门
+        $level_total = Dever::input('level_total', 1);
+
+        # 当前联动级别
+        $level_num = Dever::input('level_num');
+
+        # 一般为id
+        $level_id = Dever::input('level_id');
+
+        # 是否是搜索列表页
+        $level_search = Dever::input('level_search');
+        if ($level_search) {
+            $default = $this->search_default;
+            if ($level_num == 1) {
+                $default['name'] = '部门选择';
+            } elseif ($level_num == 2) {
+                $default['name'] = '组员选择';
+            } 
+        } else {
+            $default = $this->default;
+        }
+        // if ($level_id < 0) {
+        //     Dever::alert('error');
+        // }
+        if ($level_num == 1) {
+            $data = $this->group();
+
+        } elseif ($level_num == 2) {
+        	$data = $this->group_admin($level_id);
+        } 
+
+        if (!$data) {
+            Dever::alert('error');
+        }
+
+        if ($level_search || $level_num >= 1) {
+            array_unshift($data, $default);
+        }
+        $result['level_total'] = $level_total;
+        $result['list'] = $data;
+        return $result;
+    }
+    public function group(){
+    	$data = Dever::load('manage/company')->getGroup();
+    	foreach ($data as $k => $v) {
+    		$data[$k]['value'] = $v['id'];
+    	}
+    	return $data;
+    }
+    public function group_admin($level_id){
+    	$data = Dever::load('manage/company')->getAdmin($level_id);
+    	foreach ($data as $k => $v) {
+    		foreach ($v as $k1 => $v1) {
+    			$data[$k]['value'] = $v['id'];
+    			$data[$k]['name'] = $v['username'];
+    		}
+    	}
+    	return $data;
+    }
+    public function show_api()
+    {
+    	$info_id = Dever::input('id');
+    	$data['info'] = Dever::db('work/info')->find($info_id);
+    	$ztime = $data['info']['cdate'];
+    	$data['info']['cdate'] = date('Y-m-d H:i',$data['info']['cdate']);
+    	$priority = Dever::db('work/priority')->find($data['info']['priority_id']);
+    	$data['info']['priority_name'] = $priority['name'];
+    	$data['info']['color'] = $priority['color'];
+    	$admin = Dever::db('manage/admin')->find($data['info']['audit_admin']);
+    	$group = Dever::db('manage/group')->find($admin['group']);
+    	$data['info']['admin'] = $group['name'].'   /   '.$admin['username'];
+		if ($data['info']['source']) {
+			$source = Dever::db('work/q_source')->find($data['info']['source']);
+			if ($source) {
+				$data['info']['source_name'] = $source['name'];
+			}
+		} 
+		if ($data['info']['question_id']) {
+			$question = Dever::db('work/question')->find($data['info']['question_id']);
+			if ($question) {
+				$product = Dever::db('work/product')->find($question['product_id']);
+				if ($product) {
+					$data['info']['product_name'] = $product['name'];
+				}
+			}
+		}
+		$data['info']['role_name'] = '';
+		$user = Dever::db('work/user')->find(array('mobile'=>$data['info']['mobile']));
+		if ($user) {
+			$data['info']['user_name'] = $user['name'];
+			$data['info']['mobile'] = $user['mobile'];
+			$data['info']['idcard'] = $user['idcard'];
+			if ($user['agent_uid'] && $user['agent_uid']>0) {
+				$member = Dever::db('agent/member')->find($user['agent_uid']);
+				if ($member && $member['role']) {
+					$role = Dever::db('setting/role')->find($member['role']);
+					if ($role) {
+						$data['info']['role_name'] = $role['name'];
+					}
+				}
+			}
+		}
+		$data['info']['cate_name'] = '';
+		if ($data['info']['cate_id']) {
+			$cate = Dever::db('work/q_cate')->find($data['info']['cate_id']);
+			if ($cate && $question) {
+				$data['info']['cate_name'] = $cate['name'].'      /       '.$question['name'];
+			}
+		}
+		if ($data['info']['pic']) {
+			$data['info']['pic'] = explode(',',$data['info']['pic']);
+		}
+		$data['info_log'] = Dever::db('work/info_log')->getAll(array('info_id'=>$info_id));
+		foreach ($data['info_log'] as $k => $v) {
+			$data['info_log'][$k]['cdate'] = date('Y-m-d H:i:s',$v['cdate']);
+			$admin = Dever::db('manage/admin')->find($v['admin_id']);
+    		$admin_group = Dever::db('manage/group')->find($admin['group']);
+    		$data['info_log'][$k]['admin_group'] = $admin_group['name'].'   /   '.$admin['username'];
+    		$appoint = Dever::db('work/appoint')->find($v['appoint_id']);
+    		if (isset($appoint) && $appoint) {
+    			$data['info_log'][$k]['desc'] = $appoint['desc'];
+    			$appoint_admin = explode(',',$appoint['admin_id']);
+        		$appoint_group = Dever::db('manage/group')->find($appoint_admin[0]);
+        		$appoint_ad = Dever::db('manage/admin')->find($appoint_admin[1]);
+        		if ($appoint_admin && $appoint_ad) {
+        			$data['info_log'][$k]['appoint_admin'] = $appoint_group['name'].'   /   '.$appoint_ad['username'];
+        		}
+    		}
+    		
+    		$data['info_log'][$k]['image'] = '';
+			if ($appoint['video']) {
+				$data['info_log'][$k]['video'] = $appoint['video'];
+			}
+			if ($appoint['pic']) {
+				$data['info_log'][$k]['pic'] = explode(',',$appoint['pic']);
+			}
+		}
+		$data['s_zhi'] = array();
+		$data['s_zhi']['cdate'] = date('Y-m-d H:i',time());
+
+		$data['zhi'] = Dever::db('work/appoint')->getAll(array('info_id'=>$info_id));
+		foreach ($data['zhi'] as $k => $v) {
+			$time = $v['cdate'] - $ztime;
+			$data['zhi'][$k]['time'] = floor($time%86400/3600).'小时'.floor($time%3600/60).'分钟'.floor($time%60).'秒';
+			$admin = explode(',',$v['admin_id']);
+			$group = Dever::db('manage/group')->find($admin[0]);
+        	$adm = Dever::db('manage/admin')->find($admin[1]);
+        	$data['zhi'][$k]['admin'] = $group['name'].'   /   '.$adm['username'];
+        	$data['zhi'][$k]['cdate'] = date('Y-m-d H:i',$v['cdate']);
+        	$info_log = Dever::db('work/info_log')->find(array('appoint_id'=>$v['id']));
+        	if ($info_log && $info_log['fdate']) {
+        		$data['zhi'][$k]['finish'] = '完成关闭';
+        		$data['zhi'][$k]['time'] ='';
+        	} else {
+        		if ($info_log && $info_log['cloce_date']) {
+        			$data['zhi'][$k]['finish'] = '取消关闭';
+        			$data['zhi'][$k]['time'] ='';
+        		} else {
+        			$data['zhi'][$k]['finish'] = '';
+        			$data['zhi'][$k]['time'] = floor($time%86400/3600).'小时'.floor($time%3600/60).'分钟'.floor($time%60).'秒';
+        		}
+        	}
+		}
+		$data['hui'] = Dever::url('project/database/update?project=work&table=appoint&search_option_info_id='.$info_id, 'manage');
+    	return Dever::render('index', $data);
+    }
+    #发送邮件
+    public function email_api()
+    {
+    	$start=mktime(0,0,0,date('m'),date('d'),date('Y'));
+        $end = $start+86400-1;
+        $config = Dever::db('work/info')->config['config_status'];
+        $data['branch'] = Dever::db('work/branch')->state(array('type'=>1));
+        if ($data['branch']) {
+        	foreach($data['branch'] as $k => $v) {
+        		$data['info']['app'] = Dever::db('work/appoint')->getEmail(array('group'=>$v['group'],'start'=>$start,'end'=>$end));
+        		$data['info']['xu'] = Dever::db('work/info')->getCount(array('group'=>$v['group'],'start'=>$start,'end'=>$end,'status'=>1));
+        		$data['info']['yi'] = Dever::db('work/info')->getCount(array('group'=>$v['group'],'start'=>$start,'end'=>$end,'status'=>3));
+        		$data['info']['wei'] = Dever::db('work/info')->getCount(array('group'=>$v['group'],'start'=>$start,'end'=>$end,'status'=>'1,2,4'));
+        		$data['app'] = Dever::db('work/info')->getAll(array('group'=>$v['group'],'start'=>$start,'end'=>$end));
+        		foreach ($data['app'] as $k1 => $v1) {
+        			$data['app'][$k1]['cdate'] = date('Y-m-d H:i:s',$v1['cdate']);
+        			$data['app'][$k1]['zhipai'] = date('Y-m-d H:i:s',$v1['zdate']);
+        			$data['app'][$k1]['chu'] = date('Y-m-d H:i:s',$v1['chdate']);
+        			$cate = Dever::db('work/q_cate')->find($v1['cate_id']);
+        			$data['app'][$k1]['cate_name'] = $cate['name'];
+        			$priority = Dever::db('work/priority')->find($v1['priority_id']);
+        			$data['app'][$k1]['priority_name'] = $priority['name'];
+        			$data['app'][$k1]['status']= Dever::status($config,$v1['status']);
+        		}
+        	}
+        }
+        // print_R($data);die;
+        return Dever::render('email', $data);
+    }
+
+    #代理商日统计
+    public function index_api(){
+        $title = '工单每日统计';
+        $data = Dever::db('work/branch')->state(array('type'=>1));
+        foreach ($data as $k => $v) {
+        	$group_id = explode(',',$v['group']);
+        	$admin[] = Dever::db('manage/admin')->find($group_id[1]);
+        }
+        $content = $this->email_api();
+        foreach($admin as $key => $val){
+            $this->send($val['email'], $val['username'], $title, $content);
+        }
+    }
+    
+    #代理商统计发送邮件
+    public function send($email, $username, $title, $content)
+    {
+        $config = Dever::config('base', 'project')->email;
+
+        Dever::apply('src/PHPMailer', 'email');
+        Dever::apply('src/Exception', 'email');
+        Dever::apply('src/SMTP', 'email');
+        $mail = new \PHPMailer\PHPMailer\PHPMailer();
+
+        $mail->isSMTP();
+        //$mail->SMTPDebug = 2;
+        $mail->CharSet = 'UTF-8';
+        $mail->Host = $config['smtp'];
+        $mail->Port = 465;
+        $mail->SMTPSecure = 'ssl';
+        $mail->SMTPAuth = true;
+        $mail->Username = $config['username'];
+        $mail->Password = $config['password'];
+        $mail->setFrom($config['from'][0], '统计');
+        $mail->addAddress($email, $username);
+        $mail->Subject = "=?utf-8?B?" . base64_encode($title) . "?=";
+        $mail->Body = $content;
+        $mail->isHTML(true);
+        //$mail->addAttachment($file);
+        if (!$mail->send()) {
+            Dever::alert("Mailer Error: " . $mail->ErrorInfo);
+        } else {
+            return 'ok';
+        }
+    }
+    public function back_api(){
+    	$mobile = Dever::input('mobile');
+    	
+        $data = array();
+        if ($mobile) {
+        	if(!preg_match('/^1[3|5|6|7|8|9]\d{9}$/', $mobile)){
+        		// Dever::alert('代理商手机号不正确');
+            return  '代理商手机号不正确';
+        }
+        	$user = Dever::db('work/user')->find(array('mobile'=>$mobile));
+        	if (!$user) {
+        		return '无系统关联关系';
+        	}
+        	if ($user){
+        		$table = array();
+        		$user['role_name'] = '';
+        		$user['type'] = '';
+        		if ($user['agent_uid'] && $user['agent_uid'] > 0) {
+        			$member = Dever::db('agent/member')->find($user['agent_uid']);
+        			
+        			if ($member['role']) {
+        				$role = Dever::db('setting/role')->find($member['role']);
+        				if ($role) {
+        					$user['role_name'] = $role['name'];
+         				}
+        			}
+        			$user['type'] = '代理商';
+        			if ($user['option_uid'] && $user['option_uid']>0) {
+        				$user['type'] = $user['type'].'<br/>期权账户';
+        			}
+        			if ($user['passport_uid'] && $user['passport_uid']>0) {
+        				$user['type'] = $user['type'].'<br/>小程序';
+        			}
+	                
+        		} else {
+        			if ($user['option_uid'] && $user['option_uid']>0) {
+        				$user['type'] = '期权账户';
+        				if ($user['passport_uid'] && $user['passport_uid']>0) {
+	        				$user['type'] = $user['type'].'<br/>小程序';
+	        			}
+        			} else {
+        				if ($user['passport_uid'] && $user['passport_uid']>0) {
+	        				$user['type'] = '小程序';
+	        			} else {
+	        				return '无系统关联关系';
+	        			}
+        			}
+        		}
+        		if ($user['agent_uid']) {
+        			$user['order'] = Dever::url('project/database/list?project=agent&table=order&p=1&search_option_mid='.$user['agent_uid'], 'manage');
+        			$user['agent'] = Dever::url('project/database/list?project=agent&table=member_area&mid='.$user['agent_uid'].'&page_type=1&search_auth=1&page_type=1&jump=19','manage');
+        			// ('project/database/list?project=agent&table=member&search_option_id='.$user['agent_uid'], 'manage');
+        			$user['soft'] = Dever::url('project/database/list?project=agent&table=soft_cash&search_option_mid='.$user['agent_uid'], 'manage');
+        		}
+        		if ($user['option_uid']) {
+        			$user['option'] = Dever::url('project/database/list?project=option&table=member&search_option_id='.$user['option_uid'], 'manage');
+        		}
+        		$user['work'] = Dever::url('project/database/update?project=work&table=info&menu=work', 'manage');
+        		$data['user'] = $user;
+        		$data['info'] = Dever::db('work/info')->getHAll(array('mobile'=>$mobile));
+        		$config = Dever::db('work/info')->config['config_status'];
+        		foreach($data['info'] as $k => $v) {
+        			$data['info'][$k]['cdate'] = date('Y-m-d H:i',$v['cdate']);
+        			$data['info'][$k]['fdate'] = date('Y-m-d H:i',$v['fdate']);
+        			$cate = Dever::db('work/q_cate')->find(array('id'=>$v['cate_id']));
+        			$data['info'][$k]['cate_name'] = $cate['name'];
+        			$you = Dever::db('work/priority')->find(array('id'=>$v['priority_id']));
+        			$data['info'][$k]['you'] = $you['name'];
+        			$group = Dever::db('manage/group')->find(array('id'=>$v['branch_id']));
+        			$data['info'][$k]['branch'] = $group['name'];
+        			$data['info'][$k]['status'] = Dever::status($config,$v['status']);
+        			$data['info'][$k]['url'] = Dever::url('lib/appoint.show&id='.$v['id'],'work');
+        			if ($v['status']<3) {
+        				$data['info'][$k]['zhipai'] =  Dever::url('project/database/update?project=work&table=appoint&search_option_info_id='.$v['id'], 'manage');
+        			} else {
+        				$data['info'][$k]['zhipai'] = '';
+        			}
+        			
+        		}
+        		
+            }
+            $data['page'] = Dever::page("current");
+        }
+        // print_R($data);die;
+        return Dever::render('back', $data);
+    }
+}

+ 291 - 0
tool/work/lib/Manage.php

@@ -0,0 +1,291 @@
+<?php
+namespace Work\Lib;
+
+use Dever;
+Class Manage 
+{
+	
+	public function setInfoStatus_api ()
+	{
+		$id = Dever::input('id');
+		$status = Dever::input('status');
+		$type = Dever::input('type');
+
+		if ($id) {
+			$data = Dever::db('work/info')->find($id);
+			$where['where_id'] = $id;
+			if ($type == 1) {
+				$where['status'] = 4;
+			} else {
+				$where['status'] = 3;
+			}
+			$where['fdate'] = time();
+			$where['chdate'] = time();
+			Dever::db('work/info')->update($where);
+			$log = Dever::db('work/info_log')->find(array('info_id'=>$id));
+			$w['where_id'] = $log['id'];
+			$w['fdate'] = time();
+			if($type == 1){
+				$w['cloce_date'] = time();
+			}
+			Dever::db('work/info_log')->update($w);
+			return 'ok';
+		}
+	}
+	public function updateInfo($id,$name,$data) 
+	{
+		$mobile = Dever::param('mobile',$data);
+		$name = Dever::param('name',$data);
+		$user = Dever::db('work/user')->find(array('mobile'=>$mobile));
+		if ($name && $user['name'] != $name) {
+			Dever::db('work/user')->update(array('where_id'=>$user['id'],'name'=>$name));
+		}
+		$info = Dever::db('work/info')->find($id);
+		if ($info && !$info['work_num']) {
+			$w['where_id'] = $id;
+			$w['work_num'] = $this->getWorkId();
+			Dever::db('work/info')->update($w);
+		}
+	}
+	public function getWorkId()
+	{
+	    $where['work_num'] = Dever::order('W');
+	    $state = Dever::db('work/info')->one($where);
+	    if (!$state) {
+	        return $where['work_num'];
+	    } else {
+	        return $this->getWorkId();
+	    }
+	}
+	public function getUser($id)
+	{
+		$info = Dever::db('work/info')->find($id);
+		$data= Dever::db('work/user')->find(array('mobile'=>$info['mobile']));
+		if ($data) {
+			$html['user'] = $data['name'].'<br/>'.$data['mobile'];
+			if (isset($info['fdate']) && $info['fdate']) {
+				$fdate = date('Y-m-d H:i:s',$info['fdate']);
+			} else {
+				$fdate = '';
+			}
+			$html['time'] = date('Y-m-d H:i:s',$info['cdate']).'<br/>'.$fdate;
+			return $html;
+		} else {
+			return '';
+		}
+	}
+	public function xietiao_api($id)
+	{
+		$data = Dever::db('work/branch')->find($id);
+		$data['group'] = explode(',',$data['group']);
+		$group = Dever::db('manage/group')->find($data['group'][0]);
+
+		$admin = Dever::load('manage/company')->getAdmin($group['id'], $data['group'][1]);
+		// Dever::db('manage/admin')->fetchAll('select * from churen_manage_admin where group='.$group['id'].' and id !='.$data['group'][1]);
+		// state(array('group'=>$group['id']));
+		$gad = Dever::db('manage/admin')->find($data['group'][1]);
+		$res = array();
+		foreach ($admin as $k => $v) {
+			$res[$k] = $v['username'].'<br/>'.$v['email'];
+		}
+		$html = array();
+		$html['group'] = $group['name'].'<br/>'.$gad['username'];
+		$html['name'] = implode('<br/>',$res);
+		return $html;
+	}
+	#获取客户信息
+	public function search_api()
+	{
+		$value = Dever::input('value');
+		if(!preg_match('/^1[3|5|6|7|8|9]\d{9}$/', $value)){
+            return '代理商手机号不正确';
+        }
+        if ($value) {
+        	$user = Dever::db('work/user')->find(array('mobile'=>$value));
+        	if (!$user) {
+        		$uid = $this->member($value);
+        		$user = Dever::db('work/user')->find($uid);
+        	}
+        	if ($user){
+        		$table = array();
+        		$role_name = '';
+        		$type = '';
+        		$table['head'] = array('名称', '电话号码', '平台' ,'角色');
+        		if ($user['agent_uid'] && $user['agent_uid'] > 0) {
+        			$member = Dever::db('agent/member')->find($user['agent_uid']);
+        			
+        			if ($member['role']) {
+        				$role = Dever::db('setting/role')->find($member['role']);
+        				if ($role) {
+        					$role_name = $role['name'];
+         				}
+        			}
+        			$type = '代理商';
+        			if ($user['option_uid'] && $user['option_uid']>0) {
+        				$type = $type.'<br/>期权账户';
+        			}
+        			if ($user['passport_uid'] && $user['passport_uid']>0) {
+        				$type = $type.'<br/>小程序';
+        			}
+	                
+        		} else {
+        			if ($user['option_uid'] && $user['option_uid']>0) {
+        				$type = '期权账户';
+        				if ($user['passport_uid'] && $user['passport_uid']>0) {
+	        				$type = $type.'<br/>小程序';
+	        			}
+        			} else {
+        				if ($user['passport_uid'] && $user['passport_uid']>0) {
+	        				$type = '小程序';
+	        			} else {
+	        				return '无系统关联关系';
+	        			}
+        			}
+        		}
+        		$table['body'] = array();
+	            $table['body'] = array($user['name'], $user['mobile'], $type, $role_name);
+                $result[] = array
+                (
+                    'type' => 'table',
+                    'content' => $table,
+                );
+
+                $html = Dever::show('', $result, false, false);
+                return array('html' => $html, 'data' => array('name' => $user['name']));
+        	}
+        }
+	}
+
+	private function member($value)
+	{
+		$uid ='';
+		$member = Dever::db('agent/member')->find(array('mobile'=>$value));
+		if ($member) {
+			$uid = $this->upUser($member);
+		}
+		if ($uid && $uid > 0) {
+			$option = Dever::db('option/member')->find(array('mobile'=>$value));
+			$user = Dever::db('work/user')->find($uid);
+			if ($option) {
+				$type = $user['type'].',2';
+				$uid = Dever::db('work/user')->update(array('where_id'=>$uid,'type'=>$type,'option_uid'=>$option['id']));
+				if ($uid && $uid > 0) {
+					$passport = Dever::db('passport/user')->find(array('mobile'=>$value));
+					if ($passport) {
+						$user = Dever::db('work/user')->find($uid);
+						$type = $user['type'].',3';
+						$uid = Dever::db('work/user')->update(array('where_id'=>$uid,'type'=>$type,'passport_uid'=>$passport['id']));
+					}
+				}
+			} else {
+				$passport = Dever::db('passport/user')->find(array('mobile'=>$value));
+				$uid = $this->upUser($passport);
+			}
+		} else {
+			$option = Dever::db('option/member')->find(array('mobile'=>$value));
+			if($option) {
+				$uid = $this->upUser(false,$option);
+				$user = Dever::db('work/user')->find($uid);
+				if ($uid && $uid > 0){
+					$passport = Dever::db('passport/user')->find(array('mobile'=>$value));
+					if ($passport) {
+						$user = Dever::db('work/user')->find($uid);
+						$type = $user['type'].',3';
+						$uid = Dever::db('work/user')->update(array('where_id'=>$uid,'type'=>$type,'passport_uid'=>$passport['id']));
+					}
+				}
+			} else {
+				$passport = Dever::db('passport/user')->find(array('mobile'=>$value));
+				if ($passport) {
+					$uid = $this->upUser(false,false,$passport);
+				}
+				if (!$uid) {
+					$uid = Dever::db('work/user')->insert(array('mobile'=>$value));
+				}
+			}
+		}
+		return $uid;
+	}
+	private function upUser($member = false, $option = false, $passport = false)
+	{
+		if ($member) {
+			$w['agent_uid'] = $member['id'];
+			$w['name'] = $member['name'];
+			$w['mobile'] = $member['mobile'];
+			$w['idcard'] = $member['idcard'];
+			$w['username'] = $member['username'];
+			$w['avatar'] = $member['avatar'];
+			$w['type'] = 1;
+		} elseif ($option) {
+			$w['option_uid'] = $option['id'];
+			$w['name'] = $option['name'];
+			$w['mobile'] = $option['mobile'];
+			$w['idcard'] = $option['idcard'];
+			$w['type'] = 2;
+		} elseif ($passport) {
+			$w['passport_uid'] = $passport['id'];
+			$w['name'] = $passport['username'];
+			$w['mobile'] = $passport['mobile'];
+			$w['username'] = $passport['truename'];
+			$w['avatar'] = $passport['avatar']; 
+		}
+
+		if ($w) {
+			$uid = Dever::db('work/user')->insert($w);
+			return $uid;
+		}
+	}
+	public function admin($id)
+	{
+		$data = Dever::db('work/product')->find(array($id));
+		$admin_id = explode(',',$data['admin_id']);
+		$admin = Dever::db('manage/admin')->find($admin_id[1]);
+		if ($admin) {
+			return $admin['username'].'<br/>'.$admin['email'];
+		}
+	}
+	public function branch($id)
+	{
+		$group = Dever::db('manage/group')->find($id);
+		return $group['name'];
+	}
+	#工单列表导出
+	public function out_info($data)
+	{
+		$header = array('客户名称','手机号','问题类型','优先级','问题描述','处理结果','创建时间','完成时间');
+		$body = array();
+		$config = Dever::db('work/info')->config['config_status'];
+		foreach ($data as $k => $v ) {
+			$cate_name = '';
+			$cate = Dever::db('work/q_cate')->find(array('id'=>$v['cate_id']));
+			if ($cate) {
+				$cate_name = $cate['name'];
+			}
+			$priority_name = '';
+			$priority = Dever::db('work/priority')->find(array('id'=>$v['priority_id']));
+			if ($priority) {
+				$priority_name = $priority['name'];
+			}
+			$status_name = Dever::status($config,$v['status']);
+			$cdate = date('Y-m-d H:i',$v['cdate']);
+			$fdate = '';
+			if ($v['fdate']){
+				$fdate = date('Y-m-d H:i',$v['fdate']);
+			}
+			$d = array
+			(
+				$v['name'],
+				$v['mobile'],
+				$cate_name,
+				$priority_name,
+				$v['desc'],
+				$status_name,
+				$cdate,
+				$fdate,
+			);
+			$body[] = $d;
+		}
+		$file = Dever::input('excel_name');
+    	return Dever::excelExport($body, $header, $file);
+	}
+}

+ 27 - 0
tool/work/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();
+}
+

+ 5 - 0
tool/work/template/manage/email.php

@@ -0,0 +1,5 @@
+<?php
+
+$view
+->fetch('#show', 'work/lib/appoint.email')
+->display();

+ 5 - 0
tool/work/template/manage/info_log.php

@@ -0,0 +1,5 @@
+<?php
+
+$view
+->fetch('#show', 'work/lib/manage.show')
+->display();