Jimy 6 år sedan
förälder
incheckning
3e614b23ff
100 ändrade filer med 8975 tillägg och 0 borttagningar
  1. 4 0
      .gitignore
  2. 5 0
      .gitignore.bak
  3. 42 0
      .travis.yml
  4. 32 0
      LICENSE.txt
  5. 39 0
      README.md
  6. 1 0
      application/.htaccess
  7. 153 0
      application/admin/controller/Accesskf.php
  8. 170 0
      application/admin/controller/Admin.php
  9. 251 0
      application/admin/controller/AdminControl.php
  10. 261 0
      application/admin/controller/Admingroup.php
  11. 173 0
      application/admin/controller/Adminlog.php
  12. 62 0
      application/admin/controller/Config.php
  13. 341 0
      application/admin/controller/Db.php
  14. 124 0
      application/admin/controller/Index.php
  15. 177 0
      application/admin/controller/Jobcv.php
  16. 99 0
      application/admin/controller/Login.php
  17. 176 0
      application/admin/controller/Member.php
  18. 139 0
      application/admin/controller/Message.php
  19. 71 0
      application/admin/controller/Pic.php
  20. 212 0
      application/admin/controller/Product.php
  21. 193 0
      application/admin/controller/Service.php
  22. 175 0
      application/admin/controller/Upload.php
  23. 69 0
      application/admin/controller/Wlcome.php
  24. 98 0
      application/admin/lang/en-us.php
  25. 26 0
      application/admin/lang/en-us/admin.lang.php
  26. 20 0
      application/admin/lang/en-us/admingroup.lang.php
  27. 10 0
      application/admin/lang/en-us/adminlog.lang.php
  28. 38 0
      application/admin/lang/en-us/column.lang.php
  29. 30 0
      application/admin/lang/en-us/config.lang.php
  30. 1 0
      application/admin/lang/en-us/db.lang.php
  31. 51 0
      application/admin/lang/en-us/index.lang.php
  32. 14 0
      application/admin/lang/en-us/link.lang.php
  33. 6 0
      application/admin/lang/en-us/login.lang.php
  34. 16 0
      application/admin/lang/en-us/member.lang.php
  35. 12 0
      application/admin/lang/en-us/message.lang.php
  36. 12 0
      application/admin/lang/en-us/nav.lang.php
  37. 20 0
      application/admin/lang/en-us/product.lang.php
  38. 144 0
      application/admin/lang/zh-cn.php
  39. 27 0
      application/admin/lang/zh-cn/admin.lang.php
  40. 20 0
      application/admin/lang/zh-cn/admingroup.lang.php
  41. 10 0
      application/admin/lang/zh-cn/adminlog.lang.php
  42. 39 0
      application/admin/lang/zh-cn/config.lang.php
  43. 1 0
      application/admin/lang/zh-cn/db.lang.php
  44. 52 0
      application/admin/lang/zh-cn/index.lang.php
  45. 7 0
      application/admin/lang/zh-cn/login.lang.php
  46. 31 0
      application/admin/lang/zh-cn/member.lang.php
  47. 12 0
      application/admin/lang/zh-cn/message.lang.php
  48. 13 0
      application/admin/lang/zh-cn/nav.lang.php
  49. 21 0
      application/admin/lang/zh-cn/product.lang.php
  50. 59 0
      application/admin/view/accesskf/form.html
  51. 83 0
      application/admin/view/accesskf/index.html
  52. 89 0
      application/admin/view/admin/form.html
  53. 101 0
      application/admin/view/admin/index.html
  54. 73 0
      application/admin/view/admingroup/form.html
  55. 42 0
      application/admin/view/admingroup/index.html
  56. 93 0
      application/admin/view/adminlog/index.html
  57. 87 0
      application/admin/view/config/index.html
  58. 155 0
      application/admin/view/db/db.html
  59. 146 0
      application/admin/view/db/restore.html
  60. 200 0
      application/admin/view/index/index.html
  61. 41 0
      application/admin/view/index/modifypw.html
  62. 90 0
      application/admin/view/jobcv/index.html
  63. 14 0
      application/admin/view/layout/admin_items.html
  64. 32 0
      application/admin/view/layout/home.html
  65. 53 0
      application/admin/view/login/index.html
  66. 78 0
      application/admin/view/member/form.html
  67. 92 0
      application/admin/view/member/index.html
  68. 60 0
      application/admin/view/message/form.html
  69. 106 0
      application/admin/view/message/index.html
  70. 186 0
      application/admin/view/product/form.html
  71. 81 0
      application/admin/view/product/index.html
  72. 71 0
      application/admin/view/service/index.html
  73. 14 0
      application/admin/view/service/upload.html
  74. 85 0
      application/admin/view/wlcome/index.html
  75. 12 0
      application/command.php
  76. 632 0
      application/common.php
  77. 48 0
      application/common/model/Access.php
  78. 90 0
      application/common/model/Admin.php
  79. 46 0
      application/common/model/Admingroup.php
  80. 35 0
      application/common/model/Cache.php
  81. 85 0
      application/common/model/Chatlog.php
  82. 70 0
      application/common/model/Config.php
  83. 48 0
      application/common/model/Jobcv.php
  84. 213 0
      application/common/model/Member.php
  85. 63 0
      application/common/model/Message.php
  86. 57 0
      application/common/model/News.php
  87. 57 0
      application/common/model/Pic.php
  88. 66 0
      application/common/model/Product.php
  89. 81 0
      application/common/model/Service.php
  90. 78 0
      application/common/taglib/Dstaglib.php
  91. 6 0
      application/common_global.php
  92. 274 0
      application/config.php
  93. 44 0
      application/database.php
  94. 14 0
      application/extra/queue.php
  95. 202 0
      application/home/controller/Admin.php
  96. 235 0
      application/home/controller/AdminControl.php
  97. 254 0
      application/home/controller/Admingroup.php
  98. 124 0
      application/home/controller/Config.php
  99. 151 0
      application/home/controller/Glservice.php
  100. 159 0
      application/home/controller/Index.php

+ 4 - 0
.gitignore

@@ -0,0 +1,4 @@
+.idea
+composer.lock
+*.log
+/nbproject/private/

+ 5 - 0
.gitignore.bak

@@ -0,0 +1,5 @@
+.idea
+composer.lock
+*.log
+thinkphp
+/nbproject/private/

+ 42 - 0
.travis.yml

@@ -0,0 +1,42 @@
+sudo: false
+
+language: php
+
+branches:
+  only:
+    - stable
+
+cache:
+  directories:
+    - $HOME/.composer/cache
+
+before_install:
+  - composer self-update
+
+install:
+  - composer install --no-dev --no-interaction --ignore-platform-reqs
+  - zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Core.zip .
+  - composer require --update-no-dev --no-interaction "topthink/think-image:^1.0"
+  - composer require --update-no-dev --no-interaction "topthink/think-migration:^1.0"
+  - composer require --update-no-dev --no-interaction "topthink/think-captcha:^1.0"
+  - composer require --update-no-dev --no-interaction "topthink/think-mongo:^1.0"
+  - composer require --update-no-dev --no-interaction "topthink/think-worker:^1.0"
+  - composer require --update-no-dev --no-interaction "topthink/think-helper:^1.0"
+  - composer require --update-no-dev --no-interaction "topthink/think-queue:^1.0"
+  - composer require --update-no-dev --no-interaction "topthink/think-angular:^1.0"
+  - composer require --dev --update-no-dev --no-interaction "topthink/think-testing:^1.0"
+  - zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Full.zip .
+
+script:
+  - php think unit
+
+deploy:
+  provider: releases
+  api_key:
+    secure: TSF6bnl2JYN72UQOORAJYL+CqIryP2gHVKt6grfveQ7d9rleAEoxlq6PWxbvTI4jZ5nrPpUcBUpWIJHNgVcs+bzLFtyh5THaLqm39uCgBbrW7M8rI26L8sBh/6nsdtGgdeQrO/cLu31QoTzbwuz1WfAVoCdCkOSZeXyT/CclH99qV6RYyQYqaD2wpRjrhA5O4fSsEkiPVuk0GaOogFlrQHx+C+lHnf6pa1KxEoN1A0UxxVfGX6K4y5g4WQDO5zT4bLeubkWOXK0G51XSvACDOZVIyLdjApaOFTwamPcD3S1tfvuxRWWvsCD5ljFvb2kSmx5BIBNwN80MzuBmrGIC27XLGOxyMerwKxB6DskNUO9PflKHDPI61DRq0FTy1fv70SFMSiAtUv9aJRT41NQh9iJJ0vC8dl+xcxrWIjU1GG6+l/ZcRqVx9V1VuGQsLKndGhja7SQ+X1slHl76fRq223sMOql7MFCd0vvvxVQ2V39CcFKao/LB1aPH3VhODDEyxwx6aXoTznvC/QPepgWsHOWQzKj9ftsgDbsNiyFlXL4cu8DWUty6rQy8zT2b4O8b1xjcwSUCsy+auEjBamzQkMJFNlZAIUrukL/NbUhQU37TAbwsFyz7X0E/u/VMle/nBCNAzgkMwAUjiHM6FqrKKBRWFbPrSIixjfjkCnrMEPw=
+  file:
+    - ThinkPHP_Core.zip
+    - ThinkPHP_Full.zip
+  skip_cleanup: true
+  on:
+    tags: true

+ 32 - 0
LICENSE.txt

@@ -0,0 +1,32 @@
+
+ThinkPHP遵循Apache2开源协议发布,并提供免费使用。
+版权所有Copyright © 2006-2017 by ThinkPHP (http://thinkphp.cn)
+All rights reserved。
+ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。
+
+Apache Licence是著名的非盈利开源组织Apache采用的协议。
+该协议和BSD类似,鼓励代码共享和尊重原作者的著作权,
+允许代码修改,再作为开源或商业软件发布。需要满足
+的条件: 
+1. 需要给代码的用户一份Apache Licence ;
+2. 如果你修改了代码,需要在被修改的文件中说明;
+3. 在延伸的代码中(修改和有源代码衍生的代码中)需要
+带有原来代码中的协议,商标,专利声明和其他原来作者规
+定需要包含的说明;
+4. 如果再发布的产品中包含一个Notice文件,则在Notice文
+件中需要带有本协议内容。你可以在Notice中增加自己的
+许可,但不可以表现为对Apache Licence构成更改。 
+具体的协议参考:http://www.apache.org/licenses/LICENSE-2.0
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.

+ 39 - 0
README.md

@@ -0,0 +1,39 @@
+# DSCMS
+
+#### 项目介绍
+DSCMS 企业站
+
+#### 软件架构
+软件架构说明
+
+
+#### 安装教程
+
+1. xxxx
+2. xxxx
+3. xxxx
+
+#### 使用说明
+
+1. xxxx
+2. xxxx
+3. xxxx
+
+#### 更新日志
+
+V1.1
+1. 新增SEO标题、SEO关键词、SEO描述相关设置
+2. 添加双语语言包
+3. 修复若干BUG
+
+V1.2
+1. 优化新闻模块图片上传处理
+2. 优化面包屑导航
+3. 优化广告位相关处理
+
+V1.3
+1. 优化系统初始数据
+2. 其它bug修复
+3. 第三方客服处理
+
+

+ 1 - 0
application/.htaccess

@@ -0,0 +1 @@
+deny from all

+ 153 - 0
application/admin/controller/Accesskf.php

@@ -0,0 +1,153 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\Validate;
+use think\Lang;
+
+class Accesskf extends AdminControl
+{
+
+    public function _initialize()
+    {
+        parent::_initialize();
+        Lang::load(APP_PATH . 'admin/lang/' . config('default_lang') . '/member.lang.php');
+    }
+
+    /**
+     * 客户接入列表
+     * @return mixed
+     */
+    public function index()
+    {
+        $model_Access = Model('Access');
+        $title = input('post.title');
+        $condition = array();
+        if($title){
+            $condition['access_gsjrname|access_gsname|access_appid'] = $title;
+        }
+        $access_list = $model_Access->getAccessList($condition, '*', 10);
+        if($access_list){
+            for ($i=0; $i < count($access_list); $i++) { 
+                $where['member_id'] = $access_list[$i]["access_pid"];
+                $member_list[] = model('member')->getMemberInfo($where,$field = 'member_name');
+            }
+            $this->assign('member_list',$member_list);
+        }
+        $allpower = $this->qxhans();
+        $this->assign('allpower',$allpower);
+        $this->assign('access_list', $access_list);
+        $this->assign('show_page', $model_Access->page_info->render());
+        $this->setAdminCurItem('index');
+        return $this->fetch();
+    }
+
+    /**
+     * 添加用户
+     * @return mixed
+     */
+    public function add()
+    {
+        if (request()->isPost()) {
+            $model_access = Model('access');
+            //判断用户名是否存在
+            if ($model_access->getAccessInfo(['access_gsjrname' => input('post.access_gsjrname')])) {
+                $this->error("接入用户名已存在");
+            }
+            $data = array(
+                'access_gsjrname' => input('post.access_gsjrname'),
+                'access_pid' => input('post.access_pid'),
+                'access_gsname' => input('post.access_gsname'),
+                'access_url' => input('post.access_url'),
+                'access_appid' => random(22,0).time(),
+                'access_appsecrect' => random(32,0),
+                'access_addtime' => TIMESTAMP,
+            );
+            //添加到数据库
+            $result = $model_access->addAccess($data);
+            if ($result) {
+                dsLayerOpenSuccess("接入添加成功!");
+            } else {
+                $this->error("接入添加失败!");
+            }
+        } else {
+            $member_array = array(
+                'member_status' => 0,
+                'add' => 1,
+            );
+            $onlygs = array(
+                'member_id'=>'',
+                'member_name'=>'',
+            );
+            $allgs = Model('member')->allcompany('');
+            $this->assign('allgs',$allgs);
+            $this->assign('onlygs',$onlygs);
+            $this->assign('member', $member_array);
+            $this->setAdminCurItem('add');
+            return $this->fetch('form');
+        }
+    }
+
+    public function edit()
+    {
+        $access_id = input('param.access_id');
+        if (empty($access_id)) {
+            $this->error(lang('param_error'));
+        }
+        $model_access = Model('Access');
+        if (!request()->isPost()) {
+            $condition['access_id'] = $access_id;
+            $access_array = $model_access->getAccessInfo($condition);
+            $access_array['add'] = 0;
+            $allgs = Model('member')->allcompany('');
+            $where['member_id'] = $access_array['access_pid'];
+            $onlygs = Model('member')->getMemberInfo($where,$field = 'member_id,member_name');
+            $this->assign('onlygs',$onlygs);
+            $this->assign('allgs',$allgs);
+            $this->assign('access', $access_array);
+            $this->setAdminCurItem('edit');
+            return $this->fetch('form');
+        } else {
+            $data = array(
+                'access_gsjrname' => input('post.access_gsjrname'),
+                'access_pid' => input('post.access_pid'),
+                'access_gsname' => input('post.access_gsname'),
+                'access_url' => input('post.access_url'),
+            );
+            //验证数据  END
+            $result = $model_access->editAccess(array('access_id' => intval($access_id)), $data);
+            if ($result) {
+                dsLayerOpenSuccess("接入编辑成功!");
+            } else {
+                $this->error("接入编辑失败!");
+            }
+        }
+    }
+
+    public function del()
+    {
+        $access_id = input('param.access_id');
+        if (empty($access_id)) {
+            $this->error(lang('param_error'));
+        }
+        $result = db('Access')->delete($access_id);
+        if ($result) {
+            ds_json_encode(10000, "删除成功");
+        } else {
+            ds_json_encode(10001, "删除失败");
+        }
+    }
+
+    protected function getAdminItemList()
+    {
+        $menu_array = array(
+            array(
+                'name' => 'index', 'text' => lang('ds_manage'), 'url' => url('Accesskf/index')
+            ), array(
+                'name' => 'add', 'text' => lang('ds_add'), 'url' => "javascript:dsLayerOpen('".url('Accesskf/add')."','".lang('ds_add')."')"
+            ),
+        );
+        return $menu_array;
+    }
+
+}

+ 170 - 0
application/admin/controller/Admin.php

@@ -0,0 +1,170 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\Lang;
+
+
+class Admin extends AdminControl
+{
+    public function _initialize()
+    {
+        parent::_initialize();
+        Lang::load(APP_PATH . 'admin/lang/' . config('default_lang') . '/admin.lang.php');
+    }
+
+    /**
+     * 管理员列表
+     * @return mixed
+     */
+    public function index()
+    {
+        $model_admin = Model('admin');
+        $admsuos = $model_admin->suosgsAdmin(session('admin_id'));
+        $groupid = input('post.admingroupid');
+        $title = input('post.title');
+        $condition = array();
+        if($groupid){
+            $condition['admin_group_id'] = $groupid;
+        }
+        if($title){
+            $condition['admin_name'] = $title;
+        }
+        if($admsuos['admin_id']!=1){
+            $condition['admin_pid'] = $admsuos['admin_id'];
+        }
+        $admin_list = $model_admin->getAdminList($condition, '*', 10);
+        $allpower = $this->qxhans();
+        $condition = array();
+        $condition['suosgs'] =1;
+        $admin_group = model('admingroup')->getAdminGroupList($condition,'group_name,group_id');
+        $this->assign('admin_group', $admin_group);//管理组
+        $this->assign('allpower',$allpower);
+        $this->assign('admin_list', $admin_list);
+        $this->assign('show_page', $model_admin->page_info->render());
+        $this->setAdminCurItem('index');
+        return $this->fetch();
+    }
+
+    /**
+     * 添加管理员
+     * @return mixed
+     */
+    public function add()
+    { 
+        $this->assign('is_super',session('admin_id'));
+        if (request()->isPost()) {
+            $model_admin = Model('admin');
+            //判断用户名是否存在
+            if ($model_admin->getOneAdmin(['admin_name' => input('post.admin_name')])) {
+                $this->error(lang('admin_existence'));
+            }
+            $data = array(
+                'admin_name' => input('post.admin_name'),
+                'admin_password' => input('post.admin_password') ? md5(input('post.admin_password')) : md5('123'),
+                'admin_group_id' => input('post.group_id'),
+                'admin_status' => input('post.admin_status'),
+                'admin_add_time' => TIMESTAMP,
+            );
+            if(input('post.group_id')==3){
+                $suosgsid = $model_admin->suosgsAdmin(session('admin_id'));
+                $data['admin_pid'] = input('post.admin_pid') ? input('post.admin_pid') : $suosgsid['admin_id'];
+            }
+
+            //添加到数据库
+            $result = $model_admin->addAdmin($data);
+            if ($result) {
+                dsLayerOpenSuccess(lang('admin_add_succ'));
+            } else {
+                $this->error(lang('admin_add_fail'));
+            }
+        } else {
+            $model_admin = Model('admin');
+            $jlzgsmz = $model_admin->ogroupAdmin(0);
+            $admin_array = array('add' => 1,'admin_status'=>0);
+            $condition = array();
+            $condition['suosgs'] = 1;
+            $admin_group = model('admingroup')->getAdminGroupList($condition,'group_name,group_id');
+            $this->assign('admin_group', $admin_group);
+            $this->assign('admin', $admin_array);
+            $this->assign('jlzgsmz',$jlzgsmz);
+            return $this->fetch('form');
+        }
+    }
+
+    public function edit()
+    {
+        $this->assign('is_super',session('admin_id'));
+        $admin_id = input('param.admin_id');
+        if (empty($admin_id)) {
+            $this->error(lang('param_error'));
+        }
+        $model_admin = Model('admin');
+        if (!request()->isPost()) {
+            $condition['admin_id'] = $admin_id;
+            $admin_array = $model_admin->getOneAdmin($condition);
+            $admin_array['add'] = 0;
+            $where = array();
+            $admin_group = model('admingroup')->getAdminGroupList($where,'group_name,group_id');
+            $group_id = $admin_array['admin_group_id'];
+            $jlzgsmz = $model_admin->ogroupAdmin($admin_id);
+            $suosgs = $model_admin->suosgsAdmin($admin_array['admin_pid']);
+            $this->assign('suosgs',$suosgs);
+            $this->assign('jlzgsmz',$jlzgsmz);
+            $this->assign('admin_group', $admin_group);
+            $this->assign('qxgroup_name',$admin_group[$group_id-1]['group_name']);
+            $this->assign('qxgroup_id',$admin_group[$group_id-1]['group_id']);
+            $this->assign('admin', $admin_array);
+            return $this->fetch('form');
+        } else {
+            $data = array(
+                'admin_name' => input('post.admin_name'),
+                'admin_status' => input('post.admin_status'),
+                'admin_group_id' => input('post.group_id')
+            );
+            if (input('post.admin_password')) {
+                $data['admin_password'] = md5(input('post.admin_password'));
+            }
+            if(input('post.group_id')==3){
+                $suosgsid = $model_admin->suosgsAdmin(session('admin_id'));
+                $data['admin_pid'] = input('post.admin_pid')? input('post.admin_pid') : $suosgsid['admin_id'];
+            }
+            if(input('post.group_id')==2){
+                $data['admin_pid'] = '';   
+            }
+            //验证数据  END
+            $result = $model_admin->editAdmin(array('admin_id' => intval($admin_id)), $data);
+            if ($result) {
+                dsLayerOpenSuccess(lang('admin_edit_succ'));
+            } else {
+                $this->error(lang('admin_edit_fail'));
+            }
+        }
+    }
+
+    public function del()
+    {
+        $admin_id = input('param.admin_id');
+        if (empty($admin_id)) {
+            $this->error(lang('param_error'));
+        }
+        $result = db('admin')->delete($admin_id);
+        if ($result) {
+            ds_json_encode(10000, lang('admin_del_succ'));
+        } else {
+            ds_json_encode(10001, lang('admin_del_fail'));
+        }
+    }
+
+    protected function getAdminItemList()
+    {
+        $menu_array = array(
+            array(
+                'name' => 'index', 'text' => lang('ds_manage'), 'url' => url('Admin/index')
+            ), array(
+                'name' => 'add', 'text' => lang('ds_add'), 'url' => "javascript:dsLayerOpen('".url('Admin/add')."','".lang('ds_add')."')"
+            ),
+        );
+        return $menu_array;
+    }
+}

+ 251 - 0
application/admin/controller/AdminControl.php

@@ -0,0 +1,251 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\Controller;
+use think\Lang;
+
+class AdminControl extends Controller
+{
+
+    /**
+     * 管理员资料 name id group
+     */
+    protected $admin_info;
+
+    public function _initialize()
+    {
+        if (in_array(cookie('ds_admin_lang'), array('zh-cn', 'en-us'))) {
+            config('default_lang', cookie('ds_admin_lang'));
+        }
+        Lang::load(APP_PATH . 'admin/lang/' . config('default_lang') . '.php');
+        $this->admin_info = $this->systemLogin();
+        if ($this->admin_info['admin_id'] != 1) {
+            // 验证权限
+//            $this->checkPermission();
+        }
+        $this->setMenuList();
+    }
+
+    /**
+     * 取得当前管理员信息
+     *
+     * @param
+     * @return 数组类型的返回结果
+     */
+    protected final function getAdminInfo()
+    {
+        return $this->admin_info;
+    }
+
+    /**
+     * 系统后台登录验证
+     *
+     * @param
+     * @return array 数组类型的返回结果
+     */
+    protected final function systemLogin()
+    {
+        $admin_info = array(
+            'admin_id' => session('admin_id'),
+            'admin_name' => session('admin_name'),
+            'admin_group_id' => session('admin_group_id'),
+            'admin_is_super' => session('admin_is_super'),
+            'admin_pid' => session('admin_pid'),
+        );
+        if (empty($admin_info['admin_id']) || empty($admin_info['admin_name']) || !isset($admin_info['admin_group_id']) || !isset($admin_info['admin_is_super'])) {
+            $this->redirect('Admin/Login/index');
+        }
+
+        return $admin_info;
+    }
+
+    /**
+     * 侧边栏
+     */
+    public function setMenuList()
+    {
+        header("content-type:text/html;charset=utf-8");//设置编码
+        $menu_list = $this->menuList();
+        //权限组单组管理(已有权限)
+        $admin_group_model = model('admingroup');
+        $group_info = $admin_group_model->getOneAdmingroup(array('group_id' => session('admin_group_id')));
+        $hlimit = ds_decrypt($group_info['group_limits'], MD5_KEY . md5($group_info['group_name']));
+        $allkzq = $group_info['group_limits'] = explode('|', $hlimit);
+        for ($i=0; $i < count($allkzq); $i++) { 
+            $oallkzq[] = strtolower($allkzq[$i]);
+        }
+
+        $this->assign('gupinfo',$oallkzq);
+        $this->assign('menu_list', $menu_list);
+    }
+
+    //所有权限
+    public function qxhans(){
+        //权限组单组管理(已有权限)
+        $admin_group_model = model('admingroup');
+        $group_info = $admin_group_model->getOneAdmingroup(array('group_id' => session('admin_group_id')));
+        $hlimit = ds_decrypt($group_info['group_limits'], MD5_KEY . md5($group_info['group_name']));
+        $allkzq = $group_info['group_limits'] = explode('|', $hlimit);
+        for ($i=0; $i < count($allkzq); $i++) { 
+            $oallkzq[] = strtolower($allkzq[$i]);
+        }
+
+        return $oallkzq;
+    }
+
+    /**
+     * 当前选中的栏目
+     */
+    protected function setAdminCurItem($curitem = '')
+    {
+        $this->assign('admin_item', $this->getAdminItemList());
+        $this->assign('curitem', $curitem);
+    }
+
+    /**
+     * 获取卖家栏目列表,针对控制器下的栏目
+     */
+    protected function getAdminItemList()
+    {
+        return array();
+    }
+
+    /**
+     * 侧边栏列表
+     */
+    function menuList()
+    {
+        return array(
+            'dashboard_manage' => array(
+                'name' => 'dashboard_manage',
+                'text' => lang('ds_dashboard_manage'),
+                'children' => array(
+                    'wlcome' => array(
+                        'text' => lang('ds_welcome'), 'url' => url('Wlcome/index'),
+                    ),
+                ),
+            ),
+            'setting_manage' => array(
+                'name' => 'setting_manage',
+                'text' => lang('ds_setting_manage'),
+                'children' => array(
+                    'config' => array(
+                        'text' => lang('ds_config'),
+                        'url' => url('Config/index'),
+                    ),
+                    'db' => array(
+                        'text' => lang('ds_db'),
+                        'url' => url('Db/index'),
+                    ),
+                    'adminlog' => array(
+                        'text' => lang('ds_adminlog'),
+                        'url' => url('Adminlog/index'),
+                    ),
+                ),
+				'url' => url('Config/index'),
+				'children' => array(
+					'config' => array(
+						'text' => lang('ds_config'),
+						'url' => url('Config/index'),
+					),
+					'db' => array(
+						'text' => lang('ds_db'),
+						'url' => url('Db/index'),
+					),
+					'adminlog' => array(
+						'text' => lang('ds_adminlog'),
+						'url' => url('Adminlog/index'),
+					),
+				),
+            ),
+            'personnel_manage' => array(
+                'name' => 'personnel_manage',
+                'text' => lang('ds_personnel_manage'),
+                'children' => array(
+                    'member' => array(
+                        'text' => lang('ds_member'),
+                        'url' => url('Member/index'),
+                    ),
+                    'accesskf' => array(
+                        'text' => lang('ds_accesskf'),
+                        'url' =>url('Accesskf/index'),
+                    ),
+                    'admin' => array(
+                        'text' => lang('ds_admin'),
+                        'url' => url('Admin/index'),
+                    ),
+                    'admingroup' => array(
+                        'text' => lang('ds_admin_group'),
+                        'url' => url('Admingroup/index'),
+                    ),
+                ),
+            ),
+            'content_manage' => array(
+                'name' => 'content_manage',
+                'text' => lang('ds_content_manage'),
+                'children' => array(
+                    'product' => array(
+                        'text' => lang('ds_product'),
+                        'url' => url('Product/index'),
+                    ),
+                    'adv' => array(
+                        'text' => lang('ds_adv'),
+                        'url' => url('Adv/adv_manage'),
+                    ),
+                ),
+            ),
+            'operation_manage' => array(
+                'name' => 'operation_manage',
+                'text' => lang('ds_operation_manage'),
+                'children' => array(
+                    'message' => array(
+                        'text' => lang('ds_message'),
+                        'url' => url('Message/index'),
+                    ),
+                    // 'Service' => array(
+                    //     'text' => lang('ds_service'),
+                    //     'url' => url('Service/index'),
+                    // ),
+                    'records' => array(
+                        'text' => lang('ds_records'),
+                        'url' => url('Jobcv/index'),
+                    ),
+                ),
+            ),
+            
+        );
+    }
+
+    /**
+     * 记录系统日志
+     *
+     * @param $lang 日志语言包
+     * @param $state 1成功0失败null不出现成功失败提示
+     * @param $admin_name
+     * @param $admin_id
+     */
+    protected final function log($lang = '', $state = 1, $admin_name = '', $admin_id = 0)
+    {
+        if ($admin_name == '') {
+            $admin_name = session('admin_name');
+            $admin_id = session('admin_id');
+        }
+        $data = array();
+        if (is_null($state)) {
+            $state = null;
+        } else {
+            $state = $state ? '' : lang('nc_fail');
+        }
+        $data['content'] = $lang . $state;
+        $data['admin_name'] = $admin_name;
+        $data['createtime'] = TIMESTAMP;
+        $data['admin_id'] = $admin_id;
+        $data['ip'] = request()->ip();
+        $data['url'] = request()->controller() . '&' . request()->action();
+        $data['lang'] = config('default_lang');
+        return db('adminlog')->insertGetId($data);
+    }
+}
+
+?>

+ 261 - 0
application/admin/controller/Admingroup.php

@@ -0,0 +1,261 @@
+<?php
+namespace app\admin\controller;
+
+use think\Lang;
+
+class Admingroup extends AdminControl
+{
+    public function _initialize()
+    {
+        parent::_initialize();
+        Lang::load(APP_PATH . 'admin/lang/' . config('default_lang') . '/admingroup.lang.php');
+    }
+
+    /**
+     * 管理权限组
+     * @return mixed
+     */
+    public function index()
+    {
+        $model_admingroup = Model('admingroup');
+        $condition = array();
+        $condition['lang'] = config('default_lang');
+        $condition['suosgs'] = 1;
+        $admingroup_list = $model_admingroup->getAdminGroupList($condition,'*');
+        $allpower = $this->qxhans();
+        $this->assign('allpower',$allpower);
+        $this->assign('admin_group_list', $admingroup_list);
+        $this->setAdminCurItem('index');
+        return $this->fetch();
+    }
+
+    public function getControllers($dir) {
+        $pathList = glob($dir . '/*.php');
+        $res = [];
+        foreach($pathList as $key => $value) {
+            $res[] = basename($value, '.php');
+        }
+        return $res;
+    }
+
+    /**
+     * 添加权限组
+     * @return mixed
+     */
+    public function add()
+    {
+        if (request()->isPost()) {
+            $admin_group_model = model('admingroup');
+            //判断权限组名是否存在
+            $where['group_name'] = input('post.group_name');
+            $where['suosgs'] = 1;
+            if ($admin_group_model->getOneAdmingroup($where)) {
+                $this->error(lang('admin_group_existence'));
+            }
+            var_dump($_POST['permission']);die;
+            $limit_str = '';
+            if (is_array($_POST['permission'])) {
+                $limit_str = implode('|', $_POST['permission']);
+            }
+            $data['group_limits'] = ds_encrypt($limit_str, MD5_KEY . md5(input('post.group_name')));
+            $data['group_name'] = input('post.group_name');
+            $data['lang'] = config('default_lang');
+            $data['addtime'] = TIMESTAMP;
+            if ($admin_group_model->addAdminGroup($data)) {
+                $this->log(lang('ds_add') . lang('ds_admin_group') . '[' . input('post.group_name') . ']', 1);
+                dsLayerOpenSuccess(lang('admin_group_add_succ'));
+            } else {
+                $this->error(lang('admin_group_add_fail'));
+            }
+        } else {
+            $this->assign('admin_array', 'add');
+            $this->assign('limit', $this->permission());
+            $this->setAdminCurItem('add');
+            return $this->fetch('form');
+        }
+    }
+
+    public function edit()
+    {
+        $admin_group_model = model('admingroup');
+        $group_id = intval(input('param.group_id'));
+        $group_info = $admin_group_model->getOneAdmingroup(array('group_id' => $group_id));
+        if (empty($group_info)) {
+            $this->error(lang('admin_set_admin_not_exists'));
+        }
+        if (request()->isPost()) {
+            $limit_str = '';
+            if (is_array($_POST['permission'])) {
+                $limit_str = implode('|', $_POST['permission']);
+            }
+            $limit_str = ds_encrypt($limit_str, MD5_KEY . md5(input('post.group_name')));
+            $data['group_limits'] = $limit_str;
+            $data['group_name'] = input('post.group_name');
+            $update = $admin_group_model->editAdminGroup(array('group_id' => $group_id), $data);
+            if ($update) {
+                $this->log(lang('ds_edit') . lang('group_limits') . '[' . input('post.group_limits') . ']', 1);
+                dsLayerOpenSuccess(lang('admin_group_edit_succ'));
+            } else {
+                $this->error(lang('admin_group_edit_fail'));
+            }
+        } else {
+            //解析已有权限
+            $hlimit = ds_decrypt($group_info['group_limits'], MD5_KEY . md5($group_info['group_name']));
+            $group_info['group_limits'] = explode('|', $hlimit);
+            $this->assign('admin_array', 'edit');
+            $this->assign('group_info', $group_info);
+            $this->assign('limit', $this->permission());
+            $this->setAdminCurItem('edit');
+            return $this->fetch('form');
+        }
+    }
+
+    public function del()
+    {
+        $group_id = input('param.group_id');
+        if (empty($group_id)) {
+            $this->error(lang('param_error'));
+        }
+        $result = db('admingroup')->delete($group_id);
+        if ($result) {
+            ds_json_encode(10000, lang('admin_group_del_succ'));
+        } else {
+            ds_json_encode(10001, lang('admin_group_del_fail'));
+        }
+    }
+
+    /**
+     * 取得所有权限项
+     *
+     * @return array
+     */
+    private function permission()
+    {
+        $limit = $this->limitList();
+        if (is_array($limit)) {
+            foreach ($limit as $k => $v) {
+                if (is_array($v['child'])) {
+                    $tmp = array();
+                    foreach ($v['child'] as $key => $value) {
+                        $controller = (!empty($value['controller'])) ? $value['controller'] : $v['controller'];
+                        if (strpos($controller, '|') == false) {//controller参数不带|
+                            $limit[$k]['child'][$key]['action'] = rtrim($controller . '.' . str_replace('|', '|' . $controller . '.', $value['action']), '.');
+                        } else {//controller参数带|
+                            $tmp_str = '';
+                            if (empty($value['action'])) {
+                                $limit[$k]['child'][$key]['action'] = $controller;
+                            } elseif (strpos($value['action'], '|') == false) {//action参数不带|
+                                foreach (explode('|', $controller) as $v1) {
+                                    $tmp_str .= "$v1.{$value['action']}|";
+                                }
+                                $limit[$k]['child'][$key]['action'] = rtrim($tmp_str, '|');
+                            } elseif (strpos($value['action'], '|') != false && strpos($controller, '|') != false) {//action,controller都带|,交差权限
+                                foreach (explode('|', $controller) as $v1) {
+                                    foreach (explode('|', $value['action']) as $v2) {
+                                        $tmp_str .= "$v1.$v2|";
+                                    }
+                                }
+                                $limit[$k]['child'][$key]['action'] = rtrim($tmp_str, '|');
+                            }
+                        }
+                    }
+                }
+            }
+            return $limit;
+        } else {
+            return array();
+        }
+    }
+
+    /*
+    * 权限选择列表
+    */
+    function limitList()
+    {
+        $_limit = array(
+            array('name' => lang('ds_dashboard_manage'), 'child' => array(
+                array('name' => lang('ds_welcome'), 'action' => null, 'controller' => 'Wlcome'),
+                array('name' => lang('ds_welcome'), 'action' => "index", 'controller' => 'Wlcome'),
+            )),
+            array('name' => lang('ds_config'), 'child' => array(
+                array('name' => lang('ds_config'), 'action' => null, 'controller' => 'Config'),
+                array('name' => lang('ds_wzconfig'), 'action' => "index", 'controller' => 'Config'),
+                // array('name' => lang('ds_fzsconfig'), 'action' => "dump", 'controller' => 'Config'),
+                //array('name' => lang('ds_seoconfig'), 'action' => "seo", 'controller' => 'Config'),
+            )),
+            array('name' => "数据库设置", 'child' => array(
+                array('name' => lang('ds_db'), 'action' => null, 'controller' => 'Db'),
+                array('name' => lang('ds_bfdb'), 'action' => "index", 'controller' => 'Db'),
+                array('name' => lang('ds_hydb'), 'action' => "restore", 'controller' => 'Db'),
+            )),
+            array('name' => lang('ds_adminlog'), 'child' => array(
+                array('name' => lang('ds_adminlog'), 'action' => null, 'controller' => 'AdminLog'),
+                array('name' => lang('ds_adminczlog'), 'action' => 'index', 'controller' => 'AdminLog'),
+            )),
+            array('name' => lang('ds_member'), 'child' => array(
+                array('name' => lang('ds_member'), 'action' => null, 'controller' => 'Member'),
+                array('name' => lang('ds_glmember'), 'action' => "index", 'controller' => 'Member'),
+                array('name' => lang('ds_addmember'), 'action' => "add", 'controller' => 'Member'),
+                array('name' => lang('ds_edmember'), 'action' => "edit", 'controller' => 'Member'),
+                array('name' => lang('ds_dlmember'), 'action' => "del", 'controller' => 'Member'),
+            )),
+            array('name' => "接入设置", 'child' => array(
+                array('name' => "接入设置", 'action' => null, 'controller' => 'Accesskf'),
+                array('name' => "接入列表", 'action' => "index", 'controller' => 'Accesskf'),
+                array('name' => "接入添加", 'action' => "add", 'controller' => 'Accesskf'),
+                array('name' => "接入编辑", 'action' => "edit", 'controller' => 'Accesskf'),
+                array('name' => "接入删除", 'action' => "del", 'controller' => 'Accesskf'),
+            )),
+            array('name' => lang('ds_admin'), 'child' => array(
+                array('name' => lang('ds_admin'), 'action' => null, 'controller' => 'Admin'),
+                array('name' => lang('ds_gladmin'), 'action' => "index", 'controller' => 'Admin'),
+                array('name' => lang('ds_addadmin'), 'action' => "add", 'controller' => 'Admin'),
+                array('name' => lang('ds_edadmin'), 'action' => "edit", 'controller' => 'Admin'),
+                array('name' => lang('ds_dladmin'), 'action' => "del", 'controller' => 'Admin'),
+            )),
+            array('name' => lang('ds_admin_group'), 'child' => array(
+                array('name' => lang('ds_admin_group'), 'action' => null, 'controller' => 'AdminGroup'),
+                array('name' => lang('ds_admin_glgroup'), 'action' => "index", 'controller' => 'AdminGroup'),
+                array('name' => lang('ds_admin_addgroup'), 'action' => "add", 'controller' => 'AdminGroup'),
+                array('name' => lang('ds_admin_edgroup'), 'action' => "edit", 'controller' => 'AdminGroup'),
+                array('name' => lang('ds_admin_dlgroup'), 'action' => "del", 'controller' => 'AdminGroup'),
+            )),
+            array('name' => lang('ds_product'), 'child' => array(
+                array('name' => lang('ds_product'), 'action' => null, 'controller' => 'Product'),
+                array('name' => lang('ds_product'), 'action' => "index", 'controller' => 'Product'),
+                array('name' => lang('ds_addproduct'), 'action' => 'add', 'controller' => 'Product'),
+                array('name' => lang('ds_edproduct'), 'action' => 'edit', 'controller' => 'Product'),
+                array('name' => lang('ds_dlproduct'), 'action' => 'del', 'controller' => 'Product'),
+            )),
+            array('name' => lang('ds_message'), 'child' => array(
+                array('name' => lang('ds_message'), 'action' => null, 'controller' => 'Message'),
+                array('name' => lang('ds_glmessage'), 'action' => "index", 'controller' => 'Message'),//留言表
+                array('name' => lang('ds_ckmessage'), 'action' => "reply", 'controller' => 'Message'),
+                array('name' => lang('ds_dlmessage'), 'action' => "del", 'controller' => 'Message'),
+            )),
+            array('name' => lang('ds_kfchat'), 'child' => array(
+                array('name' => lang('ds_kfchat'), 'action' => null, 'controller' => 'Service'),
+                array('name' => lang('ds_kfchat'), 'action' => "index", 'controller' => 'Service'),
+            )),//对话平台
+            array('name' => lang('ds_records'), 'child' => array(
+                array('name' => lang('ds_records'), 'action' => null, 'controller' => 'Jobcv'),
+                array('name' => lang('ds_glrecords'), 'action' => "index", 'controller' => 'Jobcv'),
+            )),//历史记录
+        );
+
+        return $_limit;
+    }
+
+    protected function getAdminItemList()
+    {
+        $menu_array = array(
+            array(
+                'name' => 'index', 'text' => lang('ds_manage'), 'url' => url('Admingroup/index')
+            ), array(
+                'name' => 'add', 'text' => lang('ds_add'), 'url' => "javascript:dsLayerOpen('".url('Admingroup/add')."','".lang('ds_add')."')"
+
+            ),
+        );
+        return $menu_array;
+    }
+}

+ 173 - 0
application/admin/controller/Adminlog.php

@@ -0,0 +1,173 @@
+<?php
+
+namespace app\admin\controller;
+
+
+use think\Lang;
+
+class Adminlog extends AdminControl
+{
+    const EXPORT_SIZE = 5000;
+
+    public function _initialize()
+    {
+        parent::_initialize(); // TODO: Change the autogenerated stub
+        Lang::load(APP_PATH . 'admin/lang/' . config('default_lang') . '/adminlog.lang.php');
+    }
+
+    /**
+     * 日志列表
+     *
+     */
+    public function index()
+    {
+        $condition = array();
+        $time1 = '';
+        $time2 = '';
+        if (!empty(input('param.admin_name'))) {
+            $condition['admin_name'] = input('param.admin_name');
+        }
+        if (!empty(input('param.time_from'))) {
+            $time1 = strtotime(input('param.time_from'));
+        }
+        if (!empty(input('param.time_to'))) {
+            $time2 = strtotime(input('param.time_to'));
+            if ($time2 !== false)
+                $time2 = $time2 + 86400;
+        }
+        if ($time1 && $time2) {
+            $condition['createtime'] = array('between', array($time1, $time2));
+        } elseif ($time1) {
+            $condition['createtime'] = array('egt', $time1);
+        } elseif ($time2) {
+            $condition['createtime'] = array('elt', $time2);
+        }
+        $list = db('adminlog')->where($condition)->order('adminlog_id desc')->paginate(9, false, ['query' => request()->param()]);
+        $page = $list->render();
+        $allpower = $this->qxhans();
+        $this->assign('allpower',$allpower);
+        $this->assign('list', $list);
+        $this->assign('page', $page);
+        $this->setAdminCurItem('loglist');
+        return $this->fetch();
+    }
+
+    /**
+     * 删除日志
+     *
+     */
+    public function list_del()
+    {
+        $adminlog_id = input('param.adminlog_id');
+        $adminlog_id_array = ds_delete_param($adminlog_id);
+        if ($adminlog_id_array == FALSE) {
+            $this->error(lang('param_error'));
+        }
+        $condition = array();
+        $condition['adminlog_id'] = array('in', $adminlog_id_array);
+        if (db('adminlog')->where($condition)->delete()) {
+            $this->log(lang('ds_adminlog').'-'.lang('del_succ').'->' .lang('ds_number_id'). '[' . $adminlog_id . ']', null);
+            $this->success(lang('admin_log_del_succ'), url('adminlog/index'));
+        } else {
+            $this->error(lang('admin_log_del_fail'));
+
+        }
+    }
+
+    /**
+     * 导出第一步
+     */
+    public function export_step1()
+    {
+        $time1 = '';
+        $time2 = '';
+        $condition = array();
+        if (!empty(input('param.admin_name'))) {
+            $condition['admin_name'] = input('param.admin_name');
+        }
+        if (!empty(input('param.time_from'))) {
+            $time1 = strtotime(input('param.time_from'));
+        }
+        if (!empty(input('param.time_to'))) {
+            $time2 = strtotime(input('param.time_to'));
+            if ($time2 !== false)
+                $time2 = $time2 + 86400;
+        }
+        if ($time1 && $time2) {
+            $condition['createtime'] = array('between', array($time1, $time2));
+        } elseif ($time1) {
+            $condition['createtime'] = array('egt', $time1);
+        } elseif ($time2) {
+            $condition['createtime'] = array('elt', $time2);
+        }
+        if (!is_numeric(input('param.curpage'))) {
+            $count = db('adminlog')->where($condition)->count();
+            $array = array();
+            if ($count > self::EXPORT_SIZE) {    //显示下载链接
+                $page = ceil($count / self::EXPORT_SIZE);
+                for ($i = 1; $i <= $page; $i++) {
+                    $limit1 = ($i - 1) * self::EXPORT_SIZE + 1;
+                    $limit2 = $i * self::EXPORT_SIZE > $count ? $count : $i * self::EXPORT_SIZE;
+                    $array[$i] = $limit1 . ' ~ ' . $limit2;
+                }
+                $this->assign('list', $array);
+                $this->assign('murl', url('adminlog/list'));
+                return $this->fetch('excel');
+            } else {    //如果数量小,直接下载
+                $data = db('adminlog')->where($condition)->order('adminlog_id desc')->limit(self::EXPORT_SIZE)->select();
+                $this->createExcel($data);
+            }
+        } else {    //下载
+            $limit1 = (input('param.curpage') - 1) * self::EXPORT_SIZE;
+            $limit2 = self::EXPORT_SIZE;
+            $data = db('adminlog')->where($condition)->order('adminlog_id desc')->limit("{$limit1},{$limit2}")->select();
+            $this->createExcel($data);
+        }
+    }
+
+    /**
+     * 生成excel
+     *
+     * @param array $data
+     */
+    private function createExcel($data = array())
+    {
+        Lang::load(APP_PATH . 'admin/lang/zh-cn/export.php');
+        $excel_obj = new \excel\Excel();
+        $excel_data = array();
+        //设置样式
+        $excel_obj->setStyle(array(
+            'id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')
+        ));
+        //header
+        $excel_data[0][] = array('styleid' => 's_title', 'data' => lang('admin_log_man'));
+        $excel_data[0][] = array('styleid' => 's_title', 'data' => lang('admin_log_do'));
+        $excel_data[0][] = array('styleid' => 's_title', 'data' => lang('admin_log_dotime'));
+        $excel_data[0][] = array('styleid' => 's_title', 'data' => 'IP');
+        foreach ((array)$data as $k => $v) {
+            $tmp = array();
+            $tmp[] = array('data' => $v['admin_name']);
+            $tmp[] = array('data' => $v['content']);
+            $tmp[] = array('data' => date('Y-m-d H:i:s', $v['createtime']));
+            $tmp[] = array('data' => $v['ip']);
+            $excel_data[] = $tmp;
+        }
+        $excel_data = $excel_obj->charset($excel_data, CHARSET);
+        $excel_obj->addArray($excel_data);
+        $excel_obj->addWorksheet($excel_obj->charset(lang('admin_log'), CHARSET));
+        $excel_obj->generateXML($excel_obj->charset(lang('admin_log'), CHARSET) . input('param.curpage') . '-' . date('Y-m-d-H', time()));
+    }
+
+    protected function getAdminItemList()
+    {
+        $menu_array = array(
+            array(
+                'name' => 'loglist',
+                'text' => lang('admin_log'),
+                'url' => url('adminlog/loglist')
+            )
+        );
+        return $menu_array;
+
+    }
+}

+ 62 - 0
application/admin/controller/Config.php

@@ -0,0 +1,62 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\Lang;
+
+class Config extends AdminControl {
+
+    public function _initialize() {
+        parent::_initialize();
+        Lang::load(APP_PATH . 'admin/lang/' . config('default_lang') . '/config.lang.php');
+    }
+
+    /**
+     * 网站配置
+     * @return mixed
+     */
+    public function index() {
+        $model_config = model('config');
+        $allpower = $this->qxhans();
+        $this->assign('allpower',$allpower);
+        if (!request()->isPost()) {
+            $list_config = $model_config->getListConfig();
+            $this->assign('list_config', $list_config);
+            $this->setAdminCurItem('index');
+            return $this->fetch();
+        } else {
+            $update_array = array();
+            $update_array['cache_open'] = isset($_POST['cache_open']) ? '1' : '';
+            $update_array['guest_comment'] = isset($_POST['guest_comment']) ? '1' : '';
+            $update_array['words_open'] = isset($_POST['words_open']) ? '1' : '';
+            $update_array['img_open'] = isset($_POST['img_open']) ? '1' : '';
+            $update_array['voice_open'] = isset($_POST['voice_open']) ? '1' : '';
+            $update_array['video_open'] = isset($_POST['video_open']) ? '1' : '';
+            $update_array['look_open'] = isset($_POST['look_open']) ? '1' : '';
+            
+            $result = $model_config->updateConfig($update_array);
+            if ($result === true) {
+                $this->log(lang('ds_edit') . lang('dis_dump'), 1);
+                $this->success('修改成功', 'Config/index');
+            } else {
+                $this->log(lang('ds_edit') . lang('dis_dump'), 0);
+                $this->error(lang('修改失败'));
+            }
+        }
+    }
+
+    /**
+     * 获取卖家栏目列表,针对控制器下的栏目
+     */
+    protected function getAdminItemList() {
+        $menu_array = array(
+            array(
+                'name' => 'base',
+                'text' => lang('site_set'),
+                'url' => url('Admin/Config/index')
+            ),
+        );
+        return $menu_array;
+    }
+
+}

+ 341 - 0
application/admin/controller/Db.php

@@ -0,0 +1,341 @@
+<?php
+
+namespace app\admin\controller;
+use think\Lang;
+
+//数据库备份根路径
+define('DATA_BACKUP_PATH', 'uploads/sqldata/');
+//数据库备份卷大小  20971520表示为 20M
+//define('DATA_BACKUP_PART_SIZE', 20971520);
+define('DATA_BACKUP_PART_SIZE', 1024 * 1024 * 10);
+//数据库备份文件是否启用压缩
+define('DATA_BACKUP_COMPRESS', 0);
+//数据库备份文件压缩级别
+define('DATA_BACKUP_COMPRESS_LEVEL', 9);
+
+class Db extends AdminControl
+{
+
+    public function _initialize()
+    {
+        parent::_initialize(); // TODO: Change the autogenerated stub
+        Lang::load(APP_PATH . 'admin/lang/' . config('default_lang') . '/db.lang.php');
+
+    }
+
+    public function index()
+    {
+        $dbtables = db('member')->query('SHOW TABLE STATUS');
+        $total = 0;
+        foreach ($dbtables as $k => $v) {
+            $dbtables[$k]['size'] = format_bytes($v['Data_length'] + $v['Index_length']);
+            $total += $v['Data_length'] + $v['Index_length'];
+        }
+        $allpower = $this->qxhans();
+        $this->assign('allpower',$allpower);
+        $this->assign('list', $dbtables);
+        $this->assign('total', format_bytes($total));
+        $this->assign('tableNum', count($dbtables));
+        $this->setAdminCurItem('db');
+        return $this->fetch('db');
+    }
+
+    public function export($tables = null, $id = null, $start = null)
+    {
+        //防止备份数据过程超时
+        function_exists('set_time_limit') && set_time_limit(0);
+        if (request()->isPost() && !empty($tables) && is_array($tables)) { //初始化
+            $path = DATA_BACKUP_PATH;
+            if (!is_dir($path)) {
+                mkdir($path, 0755, true);
+            }
+            //读取备份配置
+            $config = array(
+                'path' => realpath($path) . DIRECTORY_SEPARATOR,
+                'part' => DATA_BACKUP_PART_SIZE,
+                'compress' => DATA_BACKUP_COMPRESS,
+                'level' => DATA_BACKUP_COMPRESS_LEVEL,
+            );
+            //检查是否有正在执行的任务
+            $lock = "{$config['path']}backup.lock";
+            if (is_file($lock)) {
+                return json(array('info' => '检测到有一个备份任务正在执行,请稍后再试!', 'status' => 0, 'url' => ''));
+            } else {
+                //创建锁文件
+                file_put_contents($lock, TIMESTAMP);
+            }
+
+            //检查备份目录是否可写
+            if (!is_writeable($config['path'])) {
+                return json(array('info' => '备份目录不存在或不可写,请检查后重试!', 'status' => 0, 'url' => ''));
+            }
+            session('backup_config', $config);
+
+            //生成备份文件信息
+            $file = array(
+                'name' => date('Ymd-His', $_SERVER['REQUEST_TIME']),
+                'part' => 1,
+            );
+            session('backup_file', $file);
+            //缓存要备份的表
+            session('backup_tables', $tables);
+            //创建备份文件
+            $Database = new \mall\Backup($file, $config);
+            if (false !== $Database->create()) {
+                $tab = array('id' => 0, 'start' => 0);
+                return json(array('tables' => $tables, 'tab' => $tab, 'info' => '初始化成功!', 'status' => 1, 'url' => ''));
+            } else {
+                return json(array('info' => '初始化失败,备份文件创建失败!', 'status' => 0, 'url' => ''));
+            }
+        } elseif (request()->isGet() && is_numeric($id) && is_numeric($start)) { //备份数据
+            $tables = session('backup_tables');
+            //备份指定表
+            $Database = new \mall\Backup(session('backup_file'), session('backup_config'));
+            $start = $Database->backup($tables[$id], $start);
+            if (false === $start) { //出错
+                return json(array('info' => '备份出错!', 'status' => 0, 'url' => ''));
+            } elseif (0 === $start) { //下一表
+                if (isset($tables[++$id])) {
+                    $tab = array('id' => $id, 'start' => 0);
+                    return json(array('tab' => $tab, 'info' => '备份完成!', 'status' => 1, 'url' => ''));
+                } else { //备份完成,清空缓存
+                    unlink(session('backup_config.path') . 'backup.lock');
+                    session('backup_tables', null);
+                    session('backup_file', null);
+                    session('backup_config', null);
+                    return json(array('info' => '备份完成!', 'status' => 1, 'url' => ''));
+                }
+            } else {
+                $tab = array('id' => $id, 'start' => $start[0]);
+                $rate = floor(100 * ($start[0] / $start[1]));
+                return json(array('tab' => $tab, 'info' => "正在备份...({$rate}%)", 'status' => 1, 'url' => ''));
+            }
+        } else {
+            //出错
+            return json(array('info' => '参数错误!', 'status' => 0, 'url' => ''));
+        }
+    }
+
+    public function restore()
+    {
+        $path = DATA_BACKUP_PATH;
+        if (!is_dir($path)) {
+            mkdir($path, 0755, true);
+        }
+        $path = realpath($path);
+        $flag = \FilesystemIterator::KEY_AS_FILENAME;
+        $glob = new \FilesystemIterator($path, $flag);
+        $list = array();
+        $filenum = $total = 0;
+        foreach ($glob as $name => $file) {
+            if (preg_match('/^\d{8,8}-\d{6,6}-\d+\.sql(?:\.gz)?$/', $name)) {
+                $name = sscanf($name, '%4s%2s%2s-%2s%2s%2s-%d');
+                $date = "{$name[0]}-{$name[1]}-{$name[2]}";
+                $time = "{$name[3]}:{$name[4]}:{$name[5]}";
+                $part = $name[6];
+                $info = pathinfo($file);
+                if (isset($list["{$date} {$time}"])) {
+                    $info = $list["{$date} {$time}"];
+                    $info['part'] = max($info['part'], $part);
+                    $info['size'] = $info['size'] + $file->getSize();
+                } else {
+                    $info['part'] = $part;
+                    $info['size'] = $file->getSize();
+                }
+                $info['compress'] = ($info['extension'] === 'sql') ? '-' : $info['extension'];
+                $info['time'] = strtotime("{$date} {$time}");
+                $filenum++;
+                $total += $info['size'];
+                $list["{$date} {$time}"] = $info;
+            }
+        }
+        $allpower = $this->qxhans();
+        $this->assign('allpower',$allpower);
+        $this->assign('list', $list);
+        $this->assign('filenum', $filenum);
+        $this->assign('total', $total);
+        $this->setAdminCurItem('restore');
+        return $this->fetch();
+    }
+
+    /**
+     * 执行还原数据库操作
+     * @param int $time
+     * @param null $part
+     * @param null $start
+     */
+    public function import($time = 0, $part = null, $start = null)
+    {
+        function_exists('set_time_limit') && set_time_limit(0);
+
+        if (is_numeric($time) && is_null($part) && is_null($start)) { //初始化
+            //获取备份文件信息
+            $name = date('Ymd-His', $time) . '-*.sql*';
+            $path = realpath(DATA_BACKUP_PATH) . DIRECTORY_SEPARATOR . $name;
+            $files = glob($path);
+            $list = array();
+            foreach ($files as $name) {
+                $basename = basename($name);
+                $match = sscanf($basename, '%4s%2s%2s-%2s%2s%2s-%d');
+                $gz = preg_match('/^\d{8,8}-\d{6,6}-\d+\.sql.gz$/', $basename);
+                $list[$match[6]] = array($match[6], $name, $gz);
+            }
+            ksort($list);
+
+            //检测文件正确性
+            $last = end($list);
+            if (count($list) === $last[0]) {
+                session('backup_list', $list); //缓存备份列表
+                $this->success('初始化完成!', NULL, ['part' => 1, 'start' => 0]);
+            } else {
+                $this->error('备份文件可能已经损坏,请检查!');
+            }
+        } elseif (is_numeric($part) && is_numeric($start)) {
+            $list = session('backup_list');
+            $db = new \mall\Backup($list[$part], array(
+                    'path' => realpath(DATA_BACKUP_PATH) . DIRECTORY_SEPARATOR,
+                    'compress' => $list[$part][2])
+            );
+            $start = $db->import($start);
+            if (false === $start) {
+                $this->error('还原数据出错!');
+            } elseif (0 === $start) { //下一卷
+                if (isset($list[++$part])) {
+                    $data = array('part' => $part, 'start' => 0);
+                    $this->success("正在还原...#{$part}", null, $data);
+                } else {
+                    session('backup_list', null);
+                    $this->success('还原完成!');
+                }
+            } else {
+                $data = array('part' => $part, 'start' => $start[0]);
+                if ($start[1]) {
+                    $rate = floor(100 * ($start[0] / $start[1]));
+                    $this->success("正在还原...#{$part} ({$rate}%)", null, $data);
+                } else {
+                    $data['gz'] = 1;
+                    $this->success("正在还原...#{$part}", null, $data);
+                }
+            }
+        } else {
+            $this->error('参数错误!');
+        }
+    }
+
+    /**
+     * 优化
+     */
+    public function optimize()
+    {
+        $batchFlag = intval(input('param.batchFlag'));
+        //批量删除
+        if ($batchFlag) {
+            $table = I('key', array());
+        } else {
+            $table[] = input('param.tablename');
+        }
+        if (empty($table)) {
+            $this->error('请选择要优化的表');
+        }
+
+        $strTable = implode(',', $table);
+
+        if (!db()->query("OPTIMIZE TABLE {$strTable} ")) {
+            $strTable = '';
+        }
+        $this->success("优化表成功" . $strTable, url('Admin/Db/index'));
+    }
+
+    /**
+     * 修复
+     */
+    public function repair()
+    {
+        $batchFlag = intval(input('param.batchFlag'));
+        //批量删除
+        if ($batchFlag) {
+            $table = I('key', array());
+        } else {
+            $table[] = input('param.tablename');
+        }
+
+        if (empty($table)) {
+            $this->error('请选择修复的表');
+        }
+
+        $strTable = implode(',', $table);
+        if (!db()->query("REPAIR TABLE {$strTable} ")) {
+            $strTable = '';
+        }
+
+        $this->success("修复表成功" . $strTable, url('Admin/Db/index'));
+    }
+
+    /**
+     * 下载
+     * @param int $time
+     */
+    public function downFile($time = 0)
+    {
+        $name = date('Ymd-His', $time) . '-*.sql*';
+        $path = realpath(DATA_BACKUP_PATH) . DIRECTORY_SEPARATOR . $name;
+        $files = glob($path);
+        if (is_array($files)) {
+            foreach ($files as $filePath) {
+                if (!file_exists($filePath)) {
+                    $this->error("该文件不存在,可能是被删除");
+                } else {
+                    $filename = basename($filePath);
+                    header("Content-type: application/octet-stream");
+                    header('Content-Disposition: attachment; filename="' . $filename . '"');
+                    header("Content-Length: " . filesize($filePath));
+                    readfile($filePath);
+                }
+            }
+        }
+    }
+
+    /**
+     * 删除备份文件
+     * @param  Integer $time 备份时间
+     */
+    public function del($time = 0)
+    {
+        if ($time) {
+            $name = date('Ymd-His', $time) . '-*.sql*';
+            $path = realpath(DATA_BACKUP_PATH) . DIRECTORY_SEPARATOR . $name;
+            array_map("unlink", glob($path));
+            if (count(glob($path))) {
+                $this->error('备份文件删除失败,请检查权限!');
+            } else {
+                $this->success('备份文件删除成功!');
+            }
+        } else {
+            $this->error('参数错误!');
+        }
+    }
+
+    /**
+     * 获取卖家栏目列表,针对控制器下的栏目
+     */
+    protected function getAdminItemList()
+    {
+        $menu_array = array(
+            array(
+                'name' => 'db',
+                'text' => '数据备份',
+                'url' => url('Admin/Db/index')
+            ),
+            array(
+                'name' => 'restore',
+                'text' => '数据还原',
+                'url' => url('Admin/Db/restore')
+            ),
+        );
+
+        return $menu_array;
+    }
+
+}
+
+?>

+ 124 - 0
application/admin/controller/Index.php

@@ -0,0 +1,124 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\Lang;
+use think\Cache;
+
+class Index extends AdminControl
+{
+
+    public function _initialize()
+    {
+        parent::_initialize();
+        Lang::load(APP_PATH . 'admin/lang/' . config('default_lang') . '/index.lang.php');
+    }
+
+    public function index()
+    {
+        $allpower = $this->qxhans();
+        $this->assign('allpower',$allpower);
+        $this->assign('admin_info', $this->getAdminInfo());
+        return $this->fetch();
+    }
+
+    /**
+     * 修改密码
+     */
+    public function modifypw()
+    {
+        if (request()->isPost()) {
+            $new_pw = trim(input('post.new_pw'));
+            $new_pw2 = trim(input('post.new_pw2'));
+            $old_pw = trim(input('post.old_pw'));
+            if ($new_pw !== $new_pw2) {
+                $this->error(lang('index_modifypw_repeat_error'));
+            }
+            $admininfo = $this->getAdminInfo();
+            //查询管理员信息
+            $admin_model = model('admin');
+            $admininfo = $admin_model->getOneAdmin(array('admin_id' => $admininfo['admin_id']));
+            if (!is_array($admininfo) || count($admininfo) <= 0) {
+                $this->error(lang('index_modifypw_admin_error'));
+            }
+            //旧密码是否正确
+            if ($admininfo['admin_password'] != md5($old_pw)) {
+                $this->error(lang('index_modifypw_oldpw_error'));
+            }
+            $new_pw = md5($new_pw);
+            $result = $admin_model->editAdmin(array('admin_id' => $admininfo['admin_id']), array('admin_password' => $new_pw));
+            if ($result) {
+                session(null);
+                dsLayerOpenSuccess(lang('index_modifypw_succ'));
+            } else {
+                $this->error(lang('index_modifypw_fail'));
+            }
+        } else {
+            $this->setAdminCurItem('modifypw');
+            return $this->fetch();
+        }
+    }
+
+    private function _mysql_version()
+    {
+        $version = db()->query("select version() as ver");
+        return $version[0]['ver'];
+    }
+
+    /**
+     * 修改当前语言
+     */
+    public function setLanguageCookie()
+    {
+        $language = input('param.language');
+        if ($language == config('default_lang')) {
+            $this->error(\lang('ds_language_repetition'), url('Index/index'));
+            exit();
+        }
+        setcookie("ds_admin_lang", $language, 0, '/');
+        $this->success(\lang('ds_language_switching'), url('Index/index'));
+        exit();
+    }
+
+    /**
+     * 删除缓存
+     */
+    function clear()
+    {
+        $this->delCacheFile('temp');
+        $this->delCacheFile('cache');
+        Cache::clear();
+        ds_json_encode(10000, lang('eliminate_succ'));
+        exit();
+    }
+
+    /**
+     * 删除缓存目录下的文件或子目录文件
+     *
+     * @param string $dir 目录名或文件名
+     * @return boolean
+     */
+    function delCacheFile($dir)
+    {
+        //防止删除cache以外的文件
+        if (strpos($dir, '..') !== false)
+            return false;
+        $path = RUNTIME_PATH . '/' . $dir;
+        if (is_dir($path)) {
+            $file_list = array();
+            read_file_list($path, $file_list);
+            if (!empty($file_list)) {
+                foreach ($file_list as $v) {
+                    if (basename($v) != 'index.html')
+                        @unlink($v);
+                }
+            }
+        } else {
+            if (basename($path) != 'index.html')
+                @unlink($path);
+        }
+        return true;
+    }
+
+
+}

+ 177 - 0
application/admin/controller/Jobcv.php

@@ -0,0 +1,177 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\Lang;
+use think\Validate;
+
+class Jobcv extends AdminControl
+{
+    public function _initialize()
+    {
+        parent::_initialize();
+        Lang::load(APP_PATH . 'admin/lang/' . config('default_lang') . '/jobcv.lang.php');
+    }
+
+    /**
+     * 聊天历史管理
+     */
+    public function index()
+    {
+        $model_chatlog = Model('Chatlog');
+        $erwh = array();
+        $allkf = Model('service')->allkef($erwh = array(), $field = 'service_id,service_name');//所有客服
+        if(request()->isPost()){
+            $lyaddtime = $_POST['lyaddtime'];
+        }else{
+            $lyaddtime = 0;
+        }
+
+        if($lyaddtime==1){
+            $kstime = strtotime(date("Y-m-d 23:59:59",strtotime("-3 day")));
+        }elseif($lyaddtime==2){
+            $kstime = strtotime(date("Y-m-d 23:59:59",strtotime("-1 week")));
+        }elseif($lyaddtime==3){
+            $kstime = strtotime(date("Y-m-d",strtotime("-1 month")));
+        }else{
+            $kstime = "1546272000";
+        }
+        $endtime = TIMESTAMP;
+
+        if (input('post.kstime')) {
+            $kstime = strtotime(input('post.kstime'));
+        }
+        if (input('post.endtime')) {
+            $endtime = strtotime(input('post.endtime'));
+        }
+
+        $readok = input('post.record_readok');
+        $uid = input('post.record_uid');
+        $condition = array();
+        $condition['create_time'] = array('between', array($kstime, $endtime));
+        if($readok){
+            $condition['sid'] = $readok;
+        }
+        if($uid){
+            $condition['uid'] = $uid;
+        }
+        $record_list = $model_chatlog->getChatlogList($condition, '*', 10);
+
+        if($record_list){
+            for ($i=0; $i < count($record_list); $i++) { 
+                $where[' log_id'] = $record_list[$i]["id"];
+                $list[] = db('chat_message')->field('id,create_time,from')->where($where)->select();
+            }
+            if(!empty($list)){
+                for ($ii=0; $ii < count($list); $ii++) { 
+                    for ($ie=0; $ie < count($list[$ii]); $ie++) { 
+                        $who['id'] = $list[$ii][$ie]["id"];
+                        $cjtime[] = date("Y-m-d H:i:s",$list[$ii][$ie]["create_time"]);
+                        $conlist[] = db('chat_message_content')->where($who)->find();
+                    }
+                }
+            }
+            $this->assign('conlist',$conlist);
+            //所属公司
+            for ($i=0; $i < count($record_list); $i++) { 
+                $ere['member_id'] = $record_list[$i]["uid"];
+                $gslist[] = db('member')->field('member_name')->where($ere)->find();
+            }
+            $this->assign('gslist',$gslist);
+            //所属客服
+            for ($i=0; $i < count($record_list); $i++) { 
+                $sere['service_id'] = $record_list[$i]["sid"];
+                $kflist[] = db('service')->field('service_name')->where($sere)->find();
+            }
+            $this->assign('kflist',$kflist);
+        }
+
+        $allgs = Model('member')->allcompany('');
+        $allpower = $this->qxhans();
+        $this->assign('allgs',$allgs);
+        $this->assign('allpower',$allpower);
+        $this->assign('record_list', $record_list);
+        $this->assign('lyaddtime',$lyaddtime);
+        $this->assign('endtime',$endtime);
+        $this->assign('kstime',$kstime);
+        $this->assign('show_page', $model_chatlog->page_info->render());
+        $this->assign('allkf',$allkf);
+        $this->setAdminCurItem('index');
+        return $this->fetch();
+    }
+
+    //客服下的访问客户
+    public function kfvisitor(){
+        $pid = $_GET['uid'];//客服id
+        $kflist = model('Chatlog');
+        $visitorlist = $kflist->allvisitor($pid);
+        echo json_encode($visitorlist);
+    }
+
+    //客服客户聊天内容
+    public function chatcontent(){
+        $sid = $_GET['forWhat'];//客服id
+        $kname = $_GET['kname'];//客户名
+        $type = $_GET['type'];
+        $choicetime = $_GET['choicetime'];
+        if($type=="nearWeek"){
+            $begin = strtotime(date('Y-m-d', strtotime('-7 days')));
+        }else{
+            $begin = strtotime("-0 year -1 month -0 day");
+        }
+        $end = TIMESTAMP;
+        if(!empty($choicetime)){
+            $gap = explode(' - ', $choicetime);
+            $begin = strtotime($gap[0]);
+            $end = strtotime($gap[1]);
+        }
+
+        $ltlist = model('Chatlog');
+        $ltjt = $ltlist->chatdata($begin,$end,$kname,$sid);
+        if($ltjt){
+            for ($i=0; $i < count($ltjt); $i++) { 
+                $where[' log_id'] = $ltjt[$i]["id"];
+                $list[] = db('chat_message')->field('id,create_time,from')->where($where)->select();
+            }
+            if(!empty($list)){
+                for ($i=0; $i < count($list); $i++) { 
+                    for ($ie=0; $ie < count($list[$i]); $ie++) { 
+                        $who['id'] = $list[$i][$ie]["id"];
+                        $cjtime[] = date("Y-m-d H:i:s",$list[$i][$ie]["create_time"]);
+                        $conlist[] = db('chat_message_content')->where($who)->find();
+                    }
+                }
+            }
+        }
+        
+        if(!empty($cjtime) && !empty($conlist) && !empty($kname)){
+            $array = array(
+                'list'=>$list,
+                'cjtime'=>$cjtime,
+                'conlist'=>$conlist, 
+                'kname'=>$kname,
+            );
+        }else{
+            $array = array(
+                'list'=>'',
+                'cjtime'=>'',
+                'conlist'=>'',
+                'kname'=>'',
+            );
+        }
+        echo json_encode($array);
+    }
+
+    protected function getAdminItemList()
+    {
+        $menu_array = array(
+            array(
+                'name' => 'index', 'text' => lang('ds_manage'), 'url' => url('jobcv/index')
+            )
+        );
+        return $menu_array;
+    }
+
+}
+
+?>

+ 99 - 0
application/admin/controller/Login.php

@@ -0,0 +1,99 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\Controller;
+use think\Lang;
+use think\Validate;
+
+class Login extends Controller
+{
+
+    public function _initialize()
+    {
+        parent::_initialize();
+        Lang::load(APP_PATH . 'admin/lang/' . config('default_lang') . '/login.lang.php');
+    }
+
+    /**
+     * 登录
+     * @return mixed
+     */
+    public function index()
+    {
+        if (session('admin_id')) {
+            $this->success('已经登录', 'Admin/Index/index');
+        }
+        if (request()->isPost()) {
+
+            $admin_name = input('post.admin_name');
+            $admin_password = input('post.admin_password');
+            $captcha = input('post.captcha');
+
+            $data = array(
+                'admin_name' => $admin_name,
+                'admin_password' => $admin_password,
+                'captcha' => $captcha,
+            );
+
+            //验证数据  BEGIN
+            $rule = [
+                ['admin_name', 'require|min:2', '帐号为必填|帐号长度至少为2位'],
+                ['admin_password', 'require|min:2', '密码为必填|帐号长度至少为6位'],
+                ['captcha', 'require|min:3', '验证码为必填|帐号长度至少为3位'],
+            ];
+            $validate = new Validate($rule);
+            $validate_result = $validate->check($data);
+
+            if (!$validate_result) {
+                $this->error($validate->getError());
+            }
+            //验证数据  END
+            if (!captcha_check(input('post.captcha'))) {
+                //验证失败
+                $this->error('验证码错误');
+            }
+
+            $condition['admin_name'] = $admin_name;
+            $condition['admin_password'] = md5($admin_password);
+
+            $admin_info = db('admin')->where($condition)->find();
+            if (is_array($admin_info) and !empty($admin_info)) {
+                //更新 admin 最新信息
+                $update_info = array(
+                    'admin_login_num' => ($admin_info['admin_login_num'] + 1),
+                    'admin_login_time' => TIMESTAMP
+                );
+                db('admin')->where('admin_id', $admin_info['admin_id'])->update($update_info);
+
+                //设置 session
+                session('admin_id', $admin_info['admin_id']);
+                session('admin_name', $admin_info['admin_name']);
+                session('admin_group_id', $admin_info['admin_group_id']);
+                session('admin_is_super', $admin_info['admin_is_super']);
+                session('admin_pid', $admin_info['admin_pid']);
+
+                return $this->redirect('Admin/Index/index');
+            } else {
+                $this->success('帐号密码错误');
+            }
+        } else {
+            return $this->fetch();
+        }
+    }
+
+    /**
+     * 退出登录
+     */
+    public function logout()
+    {
+        //设置 session
+        session(null);
+        return $this->redirect('Admin/Login/index');
+        exit;
+    }
+
+}
+
+
+?>

+ 176 - 0
application/admin/controller/Member.php

@@ -0,0 +1,176 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\Validate;
+use think\Lang;
+
+class Member extends AdminControl
+{
+
+    public function _initialize()
+    {
+        parent::_initialize();
+        Lang::load(APP_PATH . 'admin/lang/' . config('default_lang') . '/member.lang.php');
+    }
+
+    /**
+     * 用户列表
+     * @return mixed
+     */
+    public function index()
+    {
+        $model_member = Model('member');
+        $title = input('post.title');
+        $time = input('post.timeRang');
+        if(!empty($time)){
+            $gap = explode(' - ', $time);
+            $begin = strtotime($gap[0]);
+            $end = strtotime($gap[1]);
+        }
+        $condition = array();
+        if($title){
+            $condition['member_contacts|member_mobile|member_name'] = $title;
+        }
+        if($time && $begin && $end){
+            $condition['member_add_time'] = array('between', array($begin, $end));
+        }
+        $member_list = $model_member->getMemberList($condition, '*', 10);
+        $allpower = $this->qxhans();
+        $this->assign('allpower',$allpower);
+        $this->assign('member_list', $member_list);
+        $this->assign('show_page', $model_member->page_info->render());
+        $this->setAdminCurItem('index');
+        return $this->fetch();
+    }
+
+    /**
+     * 添加用户
+     * @return mixed
+     */
+    public function add()
+    {
+        if (request()->isPost()) {
+            $model_member = Model('member');
+            //判断用户名是否存在
+            $usetime = input('post.member_usetime');
+            $validitytime = $model_member->validity($usetime);
+            $data = array(
+                'member_name' => input('post.member_name'),
+                'member_url' =>input('post.member_url'),
+                'member_mobile' => input('post.member_mobile'),
+                'member_contacts' =>input('post.member_contacts'),
+                'member_mailbox' => input('post.member_mailbox'),
+                'member_usetime' => $usetime,
+                'member_validitytime' => $validitytime,
+                'member_status' => input('post.member_status') ? input('post.member_status') : 1,
+                'member_add_time' => TIMESTAMP
+            );
+            //添加到数据库
+            $result = $model_member->addMember($data);
+
+            if ($result) {
+                $cjglz =array('wlcome','wlcome.index','config','config.index','config.add','config.edit','config.del','admin','admin.index','admin.add','admin.edit','admin.del','admingroup','admingroup.index','admingroup.add','admingroup.edit','admingroup.del','product','product.index','product.add','product.edit','product.del','news','news.index','news.add','news.edit','news.del','message','message.index','message.reply','message.del','service','service.index','jobcv','jobcv.index','Visitkf','Visitkf.index','glservice','glservice.index');
+                $limit_str = '';
+                if (is_array($cjglz)) {
+                    $limit_str = implode('|', $cjglz);
+                }
+                $sgda = array(
+                    'group_name' => '超级管理员',
+                    'group_limits' => ds_encrypt($limit_str, MD5_KEY . md5('超级管理员')),
+                    'lang' => 'zh-cn',
+                    'suosgs' => $result,
+                    'addtime' => TIMESTAMP
+                );
+                $groupid = Model('Admingroup')->addAdminGroup($sgda);
+                if($groupid){
+                    //创建一个客服帐号
+                    $erda = array(
+                        'service_name' => input('post.member_mailbox'),
+                        'service_password' => md5('123456'),
+                        'service_group_id' => $groupid,
+                        'service_is_super' => 1,
+                        'service_pid' => $result,
+                        'service_add_time' => TIMESTAMP
+                    );
+                    Model('service')->addservice($erda);
+                    dsLayerOpenSuccess(lang('member_add_succ'));
+                }
+            } else {
+                $this->error(lang('member_add_fail'));
+            }
+        } else {
+            $member_array = array(
+                'member_status' => 0,
+                'add' => 1,
+            );
+            $this->assign('member', $member_array);
+            $this->setAdminCurItem('add');
+            return $this->fetch('form');
+        }
+    }
+
+    public function edit()
+    {
+        $member_id = input('param.member_id');
+        if (empty($member_id)) {
+            $this->error(lang('param_error'));
+        }
+        $model_member = Model('member');
+        $usetime = input('post.member_usetime');
+        $validitytime = $model_member->validity($usetime);
+        if (!request()->isPost()) {
+            $condition['member_id'] = $member_id;
+            $member_array = $model_member->getMemberInfo($condition);
+            $member_array['add'] = 0;
+            $this->assign('member', $member_array);
+            $this->setAdminCurItem('edit');
+            return $this->fetch('form');
+        } else {
+            $data = array(
+                'member_name' => input('post.member_name'),
+                'member_url' => input('post.member_url'),
+                'member_mobile' => input('post.member_mobile'),
+                'member_contacts' => input('post.member_contacts'),
+                'member_mailbox' => input('post.member_mailbox'),
+                'member_usetime' => $usetime,
+                'member_validitytime' => $validitytime,
+                'member_status' => input('post.member_status'),
+            );
+            //验证数据  END
+            $result = $model_member->editMember(array('member_id' => intval($member_id)), $data);
+            if ($result) {
+                dsLayerOpenSuccess(lang('member_edit_succ'));
+            } else {
+                $this->error(lang('member_edit_fail'));
+            }
+        }
+    }
+
+    public function del()
+    {
+        $member_id = input('param.member_id');
+        if (empty($member_id)) {
+            $this->error(lang('param_error'));
+        }
+        $result = db('member')->delete($member_id);
+        if ($result) {
+            ds_json_encode(10000, lang('member_del_succ'));
+        } else {
+            ds_json_encode(10001, lang('member_del_fail'));
+        }
+    }
+
+    protected function getAdminItemList()
+    {
+        $menu_array = array(
+            array(
+                'name' => 'index', 'text' => lang('ds_manage'), 'url' => url('Member/index')
+            ), array(
+                'name' => 'add', 'text' => lang('ds_add'), 'url' => "javascript:dsLayerOpen('".url('Member/add')."','".lang('ds_add')."')"
+            ),
+        );
+        return $menu_array;
+    }
+
+}

+ 139 - 0
application/admin/controller/Message.php

@@ -0,0 +1,139 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\Lang;
+use think\Validate;
+
+class Message extends AdminControl
+{
+    public function _initialize()
+    {
+        parent::_initialize();
+        Lang::load(APP_PATH . 'admin/lang/' . config('default_lang') . '/message.lang.php');
+    }
+
+    /**
+     * 留言管理
+     */
+    public function index()
+    {
+        $model_message = Model('message');
+        if(request()->isPost()){
+            $lyaddtime = $_POST['lyaddtime'];
+        }else{
+            $lyaddtime = 0;
+        }
+
+        if($lyaddtime==1){
+            $kstime = strtotime(date("Y-m-d 23:59:59",strtotime("-3 day")));
+        }elseif($lyaddtime==2){
+            $kstime = strtotime(date("Y-m-d 23:59:59",strtotime("-1 week")));
+        }elseif($lyaddtime==3){
+            $kstime = strtotime(date("Y-m-d",strtotime("-1 month")));
+        }else{
+            $kstime = "1546272000";
+        }
+        $endtime = TIMESTAMP;
+
+        if (input('post.kstime')) {
+            $kstime = strtotime(input('post.kstime'));
+        }
+        if (input('post.endtime')) {
+            $endtime = strtotime(input('post.endtime'));
+        }
+
+        $readok = input('post.message_readok');
+        $sid = input('post.message_sid');
+        $condition = array();
+        $condition['message_addtime'] = array('between', array($kstime, $endtime));
+        if($readok){
+            $condition['message_readok'] = $readok;
+        }
+        if($sid){
+            $condition['message_sid'] = $sid;
+        }
+        $message_list = $model_message->getMessageList($condition, '*', 10);
+        if($message_list){
+            for ($i=0; $i < count($message_list); $i++) { 
+                $where['member_id'] = $message_list[$i]["admin_id"];
+                $admin_list[] = model('member')->getMemberInfo($where,$field = 'member_name');
+            }
+            $this->assign('admin_list',$admin_list);
+        }
+        $allgs = Model('member')->allcompany('');
+        $allpower = $this->qxhans();
+        $this->assign('allgs',$allgs);
+        $this->assign('allpower',$allpower);
+        $this->assign('message_list', $message_list);
+        $this->assign('lyaddtime',$lyaddtime);
+        $this->assign('endtime',$endtime);
+        $this->assign('kstime',$kstime);
+        $this->assign('show_page', $model_message->page_info->render());
+        $this->setAdminCurItem('index');
+        return $this->fetch();
+    }
+
+    /**
+     * 留言回复
+     */
+    public function reply(){
+        $message_id = intval(input('param.message_id'));
+        if (!request()->isPost()) {
+            $message = model('message')->getOneMessage(['message_id' => $message_id]);
+            $this->assign('message', $message);
+            $this->setAdminCurItem('reply');
+            return $this->fetch('form');
+        } else {
+            $data = array(
+                'admin_id' => $this->admin_info['admin_id'],
+                'message_useinfo' => input('post.message_useinfo'),
+                'message_result' => input('post.message_result'),
+                'message_readok' => 1,
+                'message_replytime' => TIMESTAMP,
+            );
+
+            $result = model('message')->editMessage(['message_id' => $message_id], $data);
+            if ($result) {
+                $this->log(lang('ds_message').'-'.lang('edit_succ') . '[' . $data['message_useinfo'] . ']', null);
+                dsLayerOpenSuccess(lang('edit_succ'));
+            } else {
+                $this->error(lang('edit_fail'));
+            }
+        }
+    }
+
+    /**
+     * 删除留言
+     */
+    public function del()
+    {
+        $message_id = intval(input('param.message_id'));
+        if ($message_id) {
+            $condition['message_id'] = $message_id;
+            $result = model('message')->delMessage($condition);
+            if ($result) {
+                $this->log(lang('ds_message').'-'.lang('del_succ') . '[' . $message_id . ']', null);
+                ds_json_encode(10000, lang('del_succ'));
+            } else {
+                ds_json_encode(10001, lang('del_fail'));
+            }
+        } else {
+            ds_json_encode(10001, lang('del_fail'));
+        }
+
+    }
+
+    protected function getAdminItemList()
+    {
+        $menu_array = array(
+            array(
+                'name' => 'index', 'text' => lang('ds_manage'), 'url' => url('message/index'),
+            )
+        );
+        return $menu_array;
+    }
+
+}
+
+?>

+ 71 - 0
application/admin/controller/Pic.php

@@ -0,0 +1,71 @@
+<?php
+
+namespace app\admin\controller;
+class Pic extends AdminControl
+{
+    public function upload()
+    {
+        if (!empty($_FILES['file']['name'])) {
+
+            $pic_type_id = intval(input('param.pic_type_id'));
+            $pic_type = input('param.pic_type');
+            switch ($pic_type){
+                case 'product':
+                    $pic_type_url = ATTACH_PRODUCT;
+                    break;
+                case 'cases':
+                    $pic_type_url = ATTACH_CASES;
+                    break;
+                case 'news':
+                    $pic_type_url = ATTACH_NEWS;
+                    break;
+                default:
+                    break;
+            }
+            $upload_file = BASE_UPLOAD_PATH . DS . $pic_type_url;
+            $upload = request()->file('file');
+            $info = $upload->validate(['ext' => 'jpg,png,gif,jpeg'])->move($upload_file);
+            if ($info) {
+                $file_name = $info->getFilename();
+                $save_name = $info->getSaveName();
+                list($width, $height, $type, $attr) = getimagesize($upload_file . DS . $save_name);
+                $insert = array(
+                    'pic_type' => $pic_type,
+                    'pic_type_id' => $pic_type_id,
+                    'pic_name' => $file_name,
+                    'pic_cover' => $save_name,
+                    'pic_size' => intval($_FILES['file']['size']),
+                    'pic_time' => TIMESTAMP,
+                );
+                $result = model('pic')->addpic($insert);
+                $file_url = "get_".$pic_type."_Img";
+                if ($result) {
+                    $data = array(
+                        'file_id' => $result,
+                        'file_name' => $file_name,
+                        'file_url' => $file_url($save_name)
+                    );
+                    $output = json_encode($data);
+                    echo $output;
+                }
+            }
+        }
+    }
+
+    /**
+     * 删除图片
+     */
+    function del()
+    {
+        $pic_id = intval(input('param.file_id'));
+        $pic_type = intval(input('param.pic_type'));
+        if ($pic_id > 0) {
+            $result = model('pic')->delPic(array('pic_id' => $pic_id),$pic_type);
+            if ($result > 0) {
+                echo 'true';
+                exit;
+            }
+        }
+        echo 'false';
+    }
+}

+ 212 - 0
application/admin/controller/Product.php

@@ -0,0 +1,212 @@
+<?php
+
+namespace app\admin\controller;
+use think\Lang;
+
+class Product extends AdminControl
+{
+    public function _initialize()
+    {
+        parent::_initialize();
+        Lang::load(APP_PATH . 'admin/lang/' . config('default_lang') . '/product.lang.php');
+    }
+
+    public function index()
+    {
+        $model_product = Model('product');
+        $product_keywords = input('post.product_keywords');
+        $product_type = input('post.product_type');
+        $condition = array();
+        if($product_keywords){
+            $condition['product_keywords'] = $product_keywords;
+        }
+        if($product_type){
+            $condition['product_type'] = $product_type;
+        }
+        $product_list = $model_product->getProductList($condition,'*',10);
+        if($product_list){
+            for ($i=0; $i < count($product_list); $i++) { 
+                $where['member_id'] = $product_list[$i]['product_companyid'];
+                $gsname_list[] = model('member')->getMemberInfo($where,$field = 'member_name');
+            }
+            $this->assign('gsname_list',$gsname_list);
+            for ($ie=0; $ie < count($product_list); $ie++) { 
+                $con = $product_list[$ie]['product_content'];
+                $pattern="/<[img|IMG].*?src=[\'\"](.*?(?:[\.gif|\.jpg]))[\'|\"].*?[\/]?>/";
+                $replacement = '';
+                $conlist[] = preg_replace($pattern,$replacement ,$con);
+            }
+            $this->assign('conlist',$conlist);
+        }
+
+        $allpower = $this->qxhans();
+        $this->assign('allpower',$allpower);
+        $this->assign('product_list', $product_list);
+        $this->assign('show_page', $model_product->page_info->render());
+        $this->setAdminCurItem('index');
+        return $this->fetch();
+    }
+
+    public function add()
+    {
+        $allpower = $this->qxhans();
+        $this->assign('allpower',$allpower);
+        if (request()->isPost()) {
+            $data = array(
+                'product_type' => input('post.product_type'),
+                'product_companyid' => input('post.product_companyid'),
+                'product_title' => input('post.product_title'),
+                'product_ctitle' => input('post.product_ctitle'),
+                'product_keywords' => input('post.product_keywords'),
+                'product_status' => input('post.product_status'),
+                'product_isjump' => input('post.product_isjump'),
+                'product_content' => input('post.product_content'),
+                'product_usetime' => input('post.product_usetime'),
+            );
+            if (!input('param.product_addtime')) {
+                $data['product_addtime'] = TIMESTAMP;
+            } else {
+                $data['product_addtime'] = strtotime(input('param.product_addtime'));
+            }
+
+            $result = model('product')->addproduct($data);
+            if ($result){
+                $this->success(lang('add_succ'), url('product/index'));
+            }
+            $this->error(lang('add_fail'));
+        } else {
+            $product = array(
+                'product_isjump' => 0,
+                'product_status' => 0,
+                'product_type' => '',
+                'product_usetime' => '',
+            );
+            $onlygs = array(
+                'member_id' => 0,
+                'member_name' =>"请选择所属公司",
+            );
+            $pic_list = model('pic')->getPicList(array('pic_id' => 0));
+            $allgs = model('member')->allcompany('');
+            $this->assign('allgs',$allgs);//所有开启的公司
+            $this->assign('product', $product);
+            $this->assign('onlygs',$onlygs);
+            $this->assign('product_pic_type', ['pic_type' => 'product']);
+            $this->assign('pic_list', $pic_list);
+            $this->setAdminCurItem('add');
+            return $this->fetch('form');
+        }
+    }
+
+    public function edit()
+    {
+        $allpower = $this->qxhans();
+        $this->assign('allpower',$allpower);
+        $product_id = input('param.product_id');
+        if ($product_id <= 0) {
+            $this->error('系统错误');
+        }
+        $condition['pic_type'] = 'product';
+        $condition['pic_type_id'] = $product_id;
+        if (request()->isPost()) {
+            $data = array(
+                'product_type' => input('post.product_type'),
+                'product_companyid' => input('post.product_companyid'),
+                'product_title' => input('post.product_title'),
+                'product_ctitle' => input('post.product_ctitle'),
+                'product_keywords' => input('post.product_keywords'),
+                'product_usetime' => input('post.product_usetime'),
+                'product_status' => input('post.product_status'),
+                'product_isjump' => input('post.product_isjump'),
+                'product_content' => input('post.product_content'),
+            );
+            if (!input('param.product_updatetime')) {
+                $data['product_updatetime'] = TIMESTAMP;
+            } else {
+                $data['product_updatetime'] = strtotime(input('param.product_updatetime'));
+            }
+
+            $result = model('product')->editproduct(['product_id' => $product_id], $data);
+            if ($result >= 0) {
+                $this->success(lang('edit_succ'), 'product/index');
+            } else {
+                $this->error(lang('edit_fail'));
+            }
+        } else {
+            $pic_list = model('pic')->getpicList($condition);
+            $this->assign('pic_list', $pic_list);
+
+            //获取当前帮助中心的内容
+            $product = model('product')->getOneProduct(['product_id' => $product_id]);
+            $allgs = model('member')->allcompany($product['product_companyid']);
+            $where['member_id'] = $product['product_companyid'];
+            $onlygs = model('member')->getMemberInfo($where,$field = 'member_id,member_name');
+            $this->assign('onlygs',$onlygs);//所属公司
+            $this->assign('allgs',$allgs);//所有开启的公司
+            $this->assign('product_pic_type', ['pic_type' => 'product']);
+            $this->assign('product', $product);
+            $this->setAdminCurItem('edit');
+            return $this->fetch('form');
+        }
+    }
+
+    function del()
+    {
+        $product_id = intval(input('param.product_id'));
+        if ($product_id) {
+            $condition['product_id'] = $product_id;
+            $result = model('product')->delproduct($condition);
+            if ($result) {
+                ds_json_encode(10000, lang('del_succ'));
+            } else {
+                ds_json_encode(10001, lang('del_fail'));
+            }
+        } else {
+            ds_json_encode(10001, lang('param_error'));
+        }
+    }
+
+    function ajax()
+    {
+        $branch = input('param.branch');
+        switch ($branch) {
+            case 'product':
+                $product_mod = model('product');
+                $condition = array('product_id' => intval(input('param.id')));
+                $update[input('param.column')] = input('param.value');
+                $product_mod->editproduct($condition, $update);
+                echo 'true';
+        }
+    }
+
+    function setproduct()
+    {
+        $product_type = input('param.product_type');
+        $product_id = input('param.product_id');
+        $res = model('product')->getOneProduct(['product_id' => $product_id], $product_type);
+        $id = $res[$product_type] == 0 ? 1 : 0;
+        $update[$product_type] = $id;
+        $condition['product_id'] = $product_id;
+        if (model('product')->editproduct($condition, $update)) {
+            ds_json_encode(10000, lang('edit_succ'));
+        } else {
+            $this->error(lang('edit_fail'));
+        }
+    }
+
+    protected function getAdminItemList()
+    {
+        $menu_array = array(
+            array(
+                'name' => 'index', 'text' => '管理', 'url' => url('product/index')
+            ), array(
+                'name' => 'add', 'text' => '新增', 'url' => url('product/add')
+            ),
+        );
+        if (request()->action() == 'edit') {
+            $menu_array[] = array(
+                'name' => 'edit', 'text' => '编辑', 'url' => url('product/edit')
+            );
+        }
+        return $menu_array;
+    }
+}

+ 193 - 0
application/admin/controller/Service.php

@@ -0,0 +1,193 @@
+<?php
+/**
+ * 客服
+ * Date: 2019年1月9日
+ * Time: 下午4:26:19
+ */
+namespace app\admin\controller;
+
+use BM\Unit\Pusher;
+use BM\Model\Chat;
+use BM\Model\ChatList;
+use BM\Model\ChatMessage;
+use BM\Model\Reply;
+use app\common\model\Admin;
+
+class Service extends AdminControl
+{
+    
+    /**
+    * @客服聊天界面
+    */
+    public function index()
+    {
+        //通讯节点
+        $node_info = [
+            'address' => !empty(config('GATEWAY_NODE')) ? config('GATEWAY_NODE') : '',
+        ];
+        
+        //第三方平台信息
+        $site_info = [
+            'code' => 'kf_100001_1234566121',
+        ];
+        
+        //当前聊天列表
+        $res       = ChatList::instance()->getChatList(['sid' => $this->admin_info['admin_id']]);
+        $chat_list = $res['status'] == 1 ? $res['data'] : [];
+        
+        //客服常用语
+        $where  = [
+            'reply_company' => $this->admin_info['admin_pid'],
+            'reply_type'    => 3,
+            'reply_status'  => 1,
+            '_fields_'      => [
+                'reply_content'
+            ],
+        ];
+        $replys = Reply::instance()->lists($where);
+        
+        $data = [
+            'node'      => $node_info,
+            'site'      => $site_info,
+            'chat_list' => $chat_list,
+            'replys'    => $replys,
+        ];
+        
+        $this->assign('data', $data);
+        
+        return $this->fetch();
+    }
+    
+    /**
+    * @绑定客服
+    */
+    public function bind()
+    {
+        $client_id  = !empty($this->request->param('client_id')) ? $this->request->param('client_id') : '';
+        
+        if (empty($client_id)) {
+            return ['status' => 0, 'msg' => 'error[expect client_id]'];
+        }
+        
+        //绑定
+        Pusher::instance()->bindUid($client_id, $this->admin_info['admin_id']);
+        
+        return [
+            'status' => 200,
+            'msg'    => 'success'
+        ];
+    }
+    
+    /**
+    * @聊天
+    */
+    public function chat()
+    {
+        $to_id  = !empty($this->request->param('to_id')) ? $this->request->param('to_id') : '';
+        $content= !empty($this->request->param('content')) ? $this->request->param('content') : '';
+        $type   = !empty($this->request->param('type')) ? intval($this->request->param('type')) : ChatMessage::MESSAGE_TYPE_NORMAL;
+        
+        //获取聊天
+        $chat    = ChatList::instance()->info(['sid' => $this->admin_info['admin_id'], 'vid' => $to_id, '_fields_' => 'log_id']);
+        
+        if (empty($chat)) {
+            return ['status' => 0, 'msg' => 'fail["chat data not exist"]'];
+        }
+        
+        $param   = [
+            'log_id'  => $chat['log_id'],
+            'uid'     => $this->admin_info['admin_pid'],
+            'to_id'   => $to_id,//发送客户端
+            'from_id' => $this->admin_info['admin_id'],//来源客户端
+            'type'    => $type,//消息类型
+            'content' => $content,//内容
+        ];
+        
+        $res = Chat::instance()->sendMessage($param);
+        
+        if ($res['status'] != 1) {
+            return $res;
+        }
+        
+        return [
+            'status' => 200,
+            'msg'    => 'success'
+        ];
+    }
+    
+    /**
+    * @消息记录
+    */
+    public function messageLog()
+    {
+        $to_id      = !empty($this->request->param('to_id')) ? $this->request->param('to_id') : '';
+        $page       = !empty($this->request->param('page')) ? intval($this->request->param('page')) : 1;
+        $page_size  = 50;
+        
+        if (empty($to_id)) {
+            return [
+                'status' => 0,
+                'msg'    => '获取消息记录失败[无用户信息]',
+            ];
+        }
+        
+        $param = [
+            'sid'       => $this->admin_info['admin_id'],
+            'vid'       => $to_id,
+            'page'      => $page,
+            'page_size' => $page_size,
+        ];
+        
+        $res = ChatMessage::instance()->messageLog($param);
+        
+        if ($res['status'] != 1) {
+            return $res;
+        }
+        
+        return [
+            'status' => 200,
+            'msg'    => 'success',
+            'data'   => $res['data'],
+        ];
+    }
+    
+    /**
+    * @删除访问列表
+    */
+    public function delChatList()
+    {
+        $to_id      = !empty($this->request->param('to_id')) ? $this->request->param('to_id') : '';
+        
+        if (empty($to_id)) {
+            return [
+                'status' => 0,
+                'msg'    => 'fail[expect to_id]'
+            ];
+        }
+        
+        $where = [
+            'sid' => $this->admin_info['admin_id'],
+            'vid' => $to_id,
+        ];
+        
+        ChatList::instance()->del($where);
+        
+        //断开连接
+        $client_lists = Pusher::instance()->getClientIdByUid($to_id);
+        
+        $message = [
+            'method' => 'delVisitor',
+            'data'   => [
+                'time' => date('Y-m-d H:i:s'),
+            ],
+        ];
+        foreach ($client_lists as $item) {
+            Pusher::instance()->closeClient($item, json_encode($message));
+        }
+        
+        return [
+            'status' => 200,
+            'msg'    => 'success'
+        ];
+    }
+}

+ 175 - 0
application/admin/controller/Upload.php

@@ -0,0 +1,175 @@
+<?php
+/**
+ * 文件上传
+ * @聊天过程中的文件上传(图片、声音、视频等)
+ * Date: 2019年1月4日
+ * Time: 下午3:53:38
+ */
+namespace app\admin\controller;
+
+use think\File;
+
+class Upload extends AdminControl
+{
+    /**
+     * 上传文件目录
+     * @access protected
+     * @var    string
+     */
+    protected $upload_dir;
+    
+    /**
+     * domain
+     * @access public
+     * @var    string
+     */
+    protected $domain;
+    
+    /**
+     * 文件类型
+     * @access protected
+     * @var    array
+     */
+    protected $file_type = [
+        'image' => [
+            'title' => '图片',
+            'dir'   => '/image/'
+        ],
+        'video' => [
+            'title' => '视频',
+            'dir'   => '/video/'
+        ],
+        'voice'  => [
+            'title' => '声音',
+            'dir'   => '/voice/'
+        ],
+        'file'  => [
+            'title' => '文件',
+            'dir'   => '/file/'
+        ],
+    ];
+    
+    /**
+     * 文件允许大小
+     * @access proetcted
+     * @var    array
+     */
+    protected $file_allow_size = [
+        'image' => 1024000,//1M
+        'video' => 5100000,//5M
+        'voice' => 3072000,//3M
+        'file'  => 5100000,//5M
+    ];
+    
+    /**
+     * 文件允许格式
+     * @access protected
+     * @var    array
+     */
+    protected $file_allow_ext = [
+        'image' => [
+            'gif', 'jpg', 'jpeg', 'png', 'bmp'
+        ],
+        'video' => [
+            'mp4', 'avi', 'ogg', 'flv', 'webm',
+            'ogv', 'mpg'
+        ],
+        'voice' => [
+            'mp3', 'ogg', 'wav', 'm4a'
+        ],
+        'file'  => [],
+    ];
+    
+    public function _initialize()
+    {
+        parent::_initialize();
+        
+        if (!empty(config('FILE_UPLOADS_DIR'))) {
+            $this->upload_dir = config('FILE_UPLOADS_DIR');
+        }
+        
+        $this->domain = !empty($this->request->domain()) ? $this->request->domain() : '';
+    }
+    
+    /**
+    * @上传文件
+    * @param    
+    * @access   
+    * @return   
+    */
+    public function upFile()
+    {
+        $type = !empty($this->request->param('type')) ? $this->request->param('type') : '';
+        
+        if (empty($type)) {
+            return ['status' => 0, 'msg' => 'error[expect type]'];
+        }
+        
+        if (!in_array($type, array_keys($this->file_type))) {
+            return ['status' => 0, 'msg' => 'error[type not exist]'];
+        }
+        
+        try {
+            $file = $this->request->file($type);
+        } catch (\Exception $e) {
+            return ['status' => 0, 'msg' => 'error[file empty]'];
+        }
+        if (empty($file)) {
+            return ['status' => 0, 'msg' => 'error[file empty]'];
+        }
+        
+        $res = $this->_upFile($file, $type);
+        
+        if ($res['status'] != 1) {
+            return $res;
+        }
+        
+        return ['status' => 200, 'msg' => 'success', 'data' => $res['data']];
+    }
+    
+    /**
+    * @上传操作
+    * @param    object $file
+    * @param    string $type
+    * @access   protected
+    * @return   array
+    */
+    protected function _upFile(File $file, $type)
+    {
+        //验证文件类型
+        if (!empty($this->file_allow_ext[$type]) && $file->checkExt($this->file_allow_ext[$type]) === false) {
+            return [
+                'status' => 0,
+                'msg'    => '文件格式不允许',
+            ];
+        }
+        
+        //验证大小
+        if (!empty($this->file_allow_size[$type]) && $file->checkSize($this->file_allow_size[$type]) === false) {
+            return [
+                'status' => 0,
+                'msg'    => '文件大小不符',
+            ];
+        }
+        
+        $info = $file->move('.'.$this->upload_dir.$this->file_type[$type]['dir']);
+        
+        if (empty($info)) {
+            return [
+                'status' => 0,
+                'msg'    => $file->getError(),
+            ];
+        }
+        
+        return [
+            'status' => 1,
+            'msg'    => 'success',
+            'data'   => [
+                'ext'   => $info->getExtension(),
+                'name'  => $info->getFilename(),
+                'path'  => $this->domain.str_replace("\\", "/", $this->upload_dir.$this->file_type[$type]['dir'].$info->getSaveName()),
+            ],
+        ];
+    }
+    
+}

+ 69 - 0
application/admin/controller/Wlcome.php

@@ -0,0 +1,69 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\Lang;
+use think\Cache;
+
+class Wlcome extends AdminControl
+{
+
+    public function _initialize()
+    {
+        parent::_initialize();
+        Lang::load(APP_PATH . 'admin/lang/' . config('default_lang') . '/index.lang.php');
+    }
+
+
+    /**
+     * 首页
+     * @return mixed
+     */
+    public function index()
+    {
+        $setup_date = config('setup_date');
+        $statistics['os'] = PHP_OS;
+        $statistics['web_server'] = $_SERVER['SERVER_SOFTWARE'];
+        $statistics['php_version'] = PHP_VERSION;
+        $statistics['sql_version'] = $this->_mysql_version();
+        $statistics['setup_date'] = substr($setup_date, 0, 10);
+
+        $statistics['domain'] = $_SERVER['HTTP_HOST'];
+        $statistics['ip'] = GetHostByName($_SERVER['SERVER_NAME']);
+        $statistics['zlib'] = function_exists('gzclose') ? 'YES' : 'NO'; //zlib
+        $statistics['safe_mode'] = (boolean)ini_get('safe_mode') ? 'YES' : 'NO'; //safe_mode = Off
+        $statistics['timezone'] = function_exists("date_default_timezone_get") ? date_default_timezone_get() : "no_timezone";
+        $statistics['curl'] = function_exists('curl_init') ? 'YES' : 'NO';
+        $statistics['fileupload'] = @ini_get('file_uploads') ? ini_get('upload_max_filesize') : 'unknown';
+        $statistics['max_ex_time'] = @ini_get("max_execution_time") . 's'; //脚本最大执行时间
+        $statistics['set_time_limit'] = function_exists("set_time_limit") ? true : false;
+        $statistics['memory_limit'] = ini_get('memory_limit');
+        $statistics['version'] = file_get_contents(APP_PATH . 'version.php');
+        if (function_exists("gd_info")) {
+            $gd = gd_info();
+            $statistics['gdinfo'] = $gd['GD Version'];
+        } else {
+            $statistics['gdinfo'] = lang('Unknown');
+        }
+
+        $this->assign('statistics', $statistics);
+        return $this->fetch('index');
+    }
+
+    private function _mysql_version()
+    {
+        $version = db()->query("select version() as ver");
+        return $version[0]['ver'];
+    }
+
+    protected function getAdminItemList()
+    {
+        $menu_array = array(
+            array(
+                'name' => 'index', 'text' => "欢迎界面", 'url' => url('Wlcome/index')
+            )
+        );
+        return $menu_array;
+    }
+
+}

+ 98 - 0
application/admin/lang/en-us.php

@@ -0,0 +1,98 @@
+<?php
+//提示信息
+$lang['add_succ'] = 'Add succ';
+$lang['add_fail'] = 'Add fail';
+$lang['edit_succ'] = 'Edit succ';
+$lang['edit_fail'] = 'Edit fail';
+$lang['del_succ'] = 'Del succ';
+$lang['del_fail'] = 'Del fail';
+$lang['param_error'] = 'Param error';
+$lang['ds_confirm_cancel'] = 'Confirm Cancel';
+$lang['ds_confirm_update'] = 'Confirm Update';
+
+//页面公用信息
+$lang['ds_yes'] = 'yes';
+$lang['ds_no'] = 'no';
+$lang['ds_operation'] = 'Operation';
+$lang['ds_manage'] = 'Manage';
+$lang['ds_add'] = 'Add';
+$lang['ds_edit'] = 'Edit';
+$lang['ds_del'] = 'Del';
+$lang['ds_reply'] = 'Reply';
+$lang['ds_search'] = 'Search';
+$lang['ds_reset'] = 'Reset';
+$lang['ds_submit'] = 'Submit';
+$lang['ds_view'] = 'View';
+$lang['ds_check'] = 'Check';
+$lang['ds_select_all'] = 'Select All';
+$lang['ds_unknown'] = 'Unknown';
+$lang['ds_export'] = 'Export';
+$lang['ds_please_enter'] = 'Please Enter';
+$lang['ds_show'] = 'Show';
+$lang['ds_no_login'] = 'No Login';
+$lang['ds_number_id'] = 'Number ID';
+$lang['no_record']= 'No record';
+$lang['ds_empty_current_time'] = 'Empty Current Time';
+
+//编辑器
+$lang['ds_uploading_files'] = 'Uploading Files';
+$lang['ds_insert_editor'] = 'Insert Editor';
+$lang['ds_delete_picture'] = 'Delete picture';
+
+//更换语言
+$lang['ds_language_switching'] = 'Language handover success';
+$lang['ds_language_repetition'] = 'Language handover repetition';
+
+//导航栏
+$lang['ds_language_switch'] = 'Language Switch';
+$lang['ds_shalom'] = 'Shalom';
+$lang['ds_change_password'] = 'Change Password';
+$lang['ds_clear_cache'] = 'Clear Cache';
+$lang['ds_visit_home'] = 'Visit Home';
+$lang['ds_safe_withdrawing'] = 'Safe Withdrawing';
+
+
+//控制面板
+$lang['ds_dashboard_manage'] = 'Control panel';
+$lang['ds_welcome'] = 'Welcome interface';
+
+//基本设置
+$lang['ds_setting_manage'] = 'Setting manage';
+$lang['ds_config'] = 'Config';
+$lang['ds_db'] = 'Data base';
+$lang['ds_adminlog'] = 'Admin log';
+
+//会员管理
+$lang['ds_personnel_manage'] = 'Member manage';
+$lang['ds_member'] = 'Member';
+$lang['ds_admin'] = 'Admin';
+$lang['ds_admin_group'] = 'Admin Group';
+
+//内容管理
+$lang['ds_content_manage'] = 'Content manage';
+$lang['ds_column'] = 'Column';
+$lang['ds_product'] = 'Product';
+$lang['ds_adv'] = 'Adv';
+
+//运营管理
+$lang['ds_operation_manage'] = 'Operation manage';
+$lang['ds_message'] = 'Message';
+$lang['ds_feedback'] = 'Feedback';
+$lang['ds_job'] = 'Job';
+$lang['ds_records'] = 'Job Records';
+
+//微信端
+$lang['ds_wechat_manage'] = 'Wechar manage';
+$lang['ds_wechat_setting'] = 'Wechar setting';
+$lang['ds_wechat_menu'] = 'Wechar menu';
+$lang['ds_wechat_keywords'] = 'Wechar keywords';
+$lang['ds_wechat_member'] = 'Wechar member';
+$lang['ds_wechat_push'] = 'Wechar push';
+
+//常用
+$lang['seo_title'] = 'SEO Title';
+$lang['seo_keywords'] = 'SEO Keywords';
+$lang['seo_description'] = 'SEO Description';
+
+
+?>

+ 26 - 0
application/admin/lang/en-us/admin.lang.php

@@ -0,0 +1,26 @@
+<?php
+//管理员列表
+$lang['admin_name'] = 'Name';
+$lang['admin_lgoin_num'] = 'Login Num';
+$lang['admin_is_super'] = 'Is Super';
+$lang['admin_login_time'] = 'Login Time';
+$lang['admin_add_time'] = 'Add Time';
+$lang['admin_confirm_del'] = 'Confirm Del';
+$lang['admin_non_editable'] = 'Non Editable';
+
+//添加
+$lang['admin_password'] = 'Password';
+$lang['admin_existence'] = 'Existence';
+$lang['admin_add_succ'] = 'Add Succ';
+$lang['admin_add_fail'] = 'Add Fail';
+
+//修改
+$lang['admin_edit_password_keep'] = 'Edit Password Keep';
+$lang['admin_edit_succ'] = 'Edit Succ';
+$lang['admin_edit_fail'] = 'Edit Fail';
+
+//删除
+$lang['admin_del_succ'] = 'Del Succ';
+$lang['admin_del_fail'] = 'Del Fail';
+
+

+ 20 - 0
application/admin/lang/en-us/admingroup.lang.php

@@ -0,0 +1,20 @@
+<?php
+//权限组列表
+$lang['admin_group_name'] = 'Group Name';
+$lang['admin_group_confirm_del'] = 'Group Confirm Del';
+
+//添加
+$lang['admin_group_set_limt'] = 'Group Set Limt';
+$lang['admin_group_existence'] = 'Group Existence';
+$lang['admin_group_add_succ'] = 'Group Add Succ';
+$lang['admin_group_add_fail'] = 'Group Add Fail';
+
+//修改
+$lang['admin_group_edit_succ'] = 'Group Edit Succ';
+$lang['admin_group_edit_fail'] = 'Group Edit Fail';
+
+//删除
+$lang['admin_group_del_succ'] = 'Group Del Succ';
+$lang['admin_group_del_fail'] = 'Group Del Fail';
+
+

+ 10 - 0
application/admin/lang/en-us/adminlog.lang.php

@@ -0,0 +1,10 @@
+<?php
+//日志列表
+$lang['admin_log']              ='Operation Log';
+$lang['admin_log_man']			= 'Operation Man';
+$lang['admin_log_do']			= 'Log DO';
+$lang['admin_log_dotime']		= 'Log Dotime';
+
+//删除
+$lang['admin_log_del_succ'] = 'Log Del Succ';
+$lang['admin_log_del_fail'] = 'Log Del Fail';

+ 38 - 0
application/admin/lang/en-us/column.lang.php

@@ -0,0 +1,38 @@
+<?php
+$lang['column'] = 'Column';
+$lang['column_position'] = 'Position';
+$lang['column_lang'] = 'Lang';
+$lang['column_display'] = 'Display';
+$lang['column_name'] = 'Nmae';
+$lang['column_ctitle'] = 'Title';
+$lang['column_keywords'] = 'Keywords';
+$lang['column_description'] = 'Description';
+$lang['column_content'] = 'Content';
+$lang['column_wap_ok'] = 'Wap Ok';
+$lang['column_img_ok'] = 'Img Ok';
+$lang['column_imgurl'] = 'Img Url';
+$lang['column_com_ok'] = 'Com Ok';
+$lang['column_issue'] = 'Issue';
+$lang['column_hits'] = 'Hits';
+$lang['column_updatetime'] = 'UpdateTime';
+$lang['column_addtime'] = 'AddTime';
+$lang['column_tag'] = 'Tag';
+$lang['column_links'] = 'Links';
+$lang['ds_no_order'] = 'Order';
+$lang['ds_add_sub_class'] = 'Add Sub Class';
+$lang['ds_select_all'] = 'Select All';
+
+//添加栏目
+$lang['column_module'] = 'Module';
+$lang['column_news'] = 'News';
+$lang['column_product'] = 'Product';
+$lang['add_name_null'] = 'Name Null';
+$lang['ds_please_choose'] = 'Please Choose';
+
+$lang['column_add_succ'] = 'Add Succ';
+$lang['column_add_fail'] = 'Add Fail';
+$lang['column_param_error'] = 'Param Error';
+$lang['is_system_column'] = 'Is System Column';
+$lang['index_ensure_del'] = 'Index Ensure Del';
+
+

+ 30 - 0
application/admin/lang/en-us/config.lang.php

@@ -0,0 +1,30 @@
+<?php
+//nav
+$lang['site_set'] = 'Site Settings';
+$lang['anti_irrigation_set'] = 'Anti Irrigation Setting';
+
+
+$lang['web_set'] = 'Web Set';
+$lang['dis_dump'] = 'Dis Dump';
+$lang['site_name'] = 'Site Name';
+$lang['site_logo'] = 'Site LOGO';
+$lang['member_logo'] = 'Member LOGO';
+$lang['site_mobile_logo'] = 'Site Mobile LOGO';
+$lang['site_logowx'] = 'Site LogoWX';
+$lang['icp_number'] = 'ICP Number';
+$lang['site_phone'] = 'Site Phone';
+$lang['site_tel400'] = 'Site Tel 400';
+$lang['site_email'] = 'Site Email';
+$lang['flow_static_code'] = 'Flow Static Code';
+$lang['site_state'] = 'Site State';
+$lang['closed_reason'] = 'Closed Reason';
+
+
+$lang['allowed_visitors_consult'] = 'Allowed Visitors Consult';
+$lang['open_checkname'] = 'Open CheckName';
+$lang['front_login'] = 'Front Login';
+$lang['front_feedback'] = 'Front feedback';
+$lang['front_regist'] = 'Front Regist';
+
+
+?>

+ 1 - 0
application/admin/lang/en-us/db.lang.php

@@ -0,0 +1 @@
+<?php

+ 51 - 0
application/admin/lang/en-us/index.lang.php

@@ -0,0 +1,51 @@
+<?php
+//密码页面
+$lang['index_modifypw_oldpw'] ='Modifypw Old pw';
+$lang['index_modifypw_newpw'] ='Modifypw New pw';
+$lang['index_modifypw_newpw2'] ='Modifypw New pws';
+
+
+$lang['eliminate_succ'] = 'Eliminate Succ';
+$lang['eliminate_fail'] = 'Eliminate Fail';
+
+//提示性语言包
+$lang['index_modifypw_repeat_error'] ='Modifypw Repeat Error';
+$lang['index_modifypw_admin_error'] ='Admin error';
+$lang['index_modifypw_oldpw_error'] ='Modifypw Old pw Error';
+$lang['index_modifypw_succ'] ='Modifypw Succ';
+$lang['index_modifypw_fail'] ='Modifypw Fail';
+
+//版本信息
+$lang['wel_version_info'] ='Version Info';
+$lang['wel_version'] ='Version';
+$lang['wel_install_date'] ='Install Date';
+$lang['wel_program_development'] ='Program Development';
+$lang['wel_all_right_reserved'] ='All Reserved';
+$lang['wel_aboutus_website'] ='Aboutus Website';
+$lang['wel_aboutus_bbs'] ='Aboutus BBS';
+
+//系统信息
+$lang['wel_sys_info'] ='Sys Info';
+$lang['wel_thinkphp_version'] ='ThinkPHP Version';
+$lang['wel_class_library_file_suffix'] ='Class Library File Suffix';
+$lang['wel_server_os'] ='Server Os';
+$lang['wel_server_domain_ip'] ='Server Domain IP';
+$lang['wel_server'] ='Server';
+$lang['wel_version'] ='Version';
+$lang['wel_file_uplode_limit'] ='File Uplode Limit';
+$lang['wel_max_occupied_memory'] ='Max Occupied Memory';
+$lang['wel_max_ex_time'] ='Max Ex Time';
+$lang['wel_safe_mode'] ='Safe Mode';
+$lang['wel_support'] ='Support';
+
+$lang['wel_deshangwangluo'] ='DeShang WangLuo';
+$lang['wel_piracy_must_be_studied'] ='Piracy Must Be Studied';
+$lang['aboutus_website'] ='Aboutus Website';
+$lang['wel_communication_bbs'] ='Communication BBS';
+$lang['temporary_installation'] ='Temporary Installation';
+
+
+
+
+
+

+ 14 - 0
application/admin/lang/en-us/link.lang.php

@@ -0,0 +1,14 @@
+<?php
+//登录
+$lang['link_webname'] = 'WebName';
+$lang['link_weburl'] = 'WebUrl';
+$lang['link_weblogo'] = 'WebLogo';
+$lang['link_type'] = 'Type';
+$lang['link_info'] = 'Info';
+$lang['link_contact'] = 'Contact';
+$lang['link_order'] = 'Order';
+$lang['link_com_ok'] = 'Com Ok';
+$lang['link_show_ok'] = 'Show Ok';
+$lang['link_addtime'] = 'AddTime';
+$lang['ip'] = 'Applicant IP';
+

+ 6 - 0
application/admin/lang/en-us/login.lang.php

@@ -0,0 +1,6 @@
+<?php
+//管理员登录
+$lang['login_admin_name'] = 'Admin name';
+$lang['login_admin_password'] = 'Admin password';
+$lang['login_captcha'] = 'Captcha';
+$lang['login_sumbit'] = 'Sumbit';

+ 16 - 0
application/admin/lang/en-us/member.lang.php

@@ -0,0 +1,16 @@
+<?php
+//用户添加
+$lang['please_enter'] = 'Please enter ';
+$lang['member_yes'] = 'Yes';
+$lang['member_no'] = 'No';
+
+$lang['member_name'] = 'User name';
+$lang['member_password'] = 'Password';
+$lang['member_edit_password_keep'] = 'Do not modify the password';
+$lang['member_truename'] = 'True name';
+$lang['member_qq'] = 'User QQ';
+$lang['member_mobile'] = 'Phone number';
+$lang['member_email'] = 'Mailbox';
+$lang['member_mobile_bind'] = 'Binding cell phone';
+$lang['member_email_bind'] = 'Binding mailbox';
+$lang['member_index_last_login'] = 'Last log in';

+ 12 - 0
application/admin/lang/en-us/message.lang.php

@@ -0,0 +1,12 @@
+<?php
+//列表
+$lang['message_ip'] = 'IP';
+$lang['message_addtime'] = 'AddTime';
+$lang['message_readok'] = 'Readok';
+$lang['message_useinfo'] = 'UseInfo';
+$lang['message_customer'] = 'Customer';
+$lang['message_title'] = 'Title';
+$lang['message_ctitle'] = 'Ctitle';
+$lang['message_content'] = 'Content';
+$lang['admin_id'] = 'Admin ID';
+

+ 12 - 0
application/admin/lang/en-us/nav.lang.php

@@ -0,0 +1,12 @@
+<?php
+//登录
+$lang['nav_type'] = 'Type';
+$lang['nav_title'] = 'Title';
+$lang['nav_url'] = 'URL';
+$lang['nav_location'] = 'Location';
+$lang['nav_new_open'] = 'New Open';
+$lang['nav_order'] = 'Order';
+$lang['nav_content'] = 'Content';
+$lang['item_id'] = 'Item Id';
+$lang['nav_is_show'] = 'IS Show';
+

+ 20 - 0
application/admin/lang/en-us/product.lang.php

@@ -0,0 +1,20 @@
+<?php
+//产品列表
+$lang['product_title'] = 'Title';
+$lang['product_order'] = 'Order';
+$lang['product_new_ok'] = 'New Ok';
+$lang['product_top_ok'] = 'Top Ok';
+$lang['product_com_ok'] = 'Com Ok';
+
+
+$lang['product_parent'] = 'Parent';
+$lang['product_sort'] = 'Sort';
+$lang['product_addtime'] = 'AddTime';
+$lang['product_imgurl'] = 'ImgUrl';
+$lang['product_content'] = 'Content';
+$lang['product_displaytype'] = 'DisplayType';
+$lang['product_wap_ok'] = 'Product';
+
+
+
+?>

+ 144 - 0
application/admin/lang/zh-cn.php

@@ -0,0 +1,144 @@
+<?php
+//提示信息
+$lang['add_succ'] = '添加成功';
+$lang['add_fail'] = '添加失败';
+$lang['edit_succ'] = '编辑成功';
+$lang['edit_fail'] = '编辑失败';
+$lang['del_succ'] = '删除成功';
+$lang['del_fail'] = '删除失败';
+$lang['param_error'] = '参数错误';
+$lang['ds_confirm_cancel'] = '是否确认删除';
+$lang['ds_confirm_update'] = '是否确认修改';
+
+//页面公用信息
+$lang['ds_operation'] = '操作';
+$lang['ds_manage'] = '管理';
+$lang['ds_add'] = '添加';
+$lang['ds_edit'] = '编辑';
+$lang['ds_del'] = '删除';
+$lang['ds_reply'] = '回复';
+$lang['ds_search'] = '搜索';
+$lang['ds_reset'] = '重置';
+$lang['ds_submit'] = '提交';
+$lang['ds_view'] = '查看';
+$lang['ds_check'] = '审核';
+$lang['ds_select_all'] = '全选';
+$lang['ds_unknown'] = '未知';
+$lang['ds_export'] = '导出';
+$lang['ds_please_enter'] = '请输入';
+$lang['ds_show'] = '查看详细';
+$lang['ds_no_login'] = '暂未登录';
+$lang['ds_number_id'] = '编号ID为';
+$lang['ds_no_record'] = '没有符合条件的记录';
+$lang['ds_empty_current_time'] = '设置为空,默认为当前时间';
+$lang['ds_please_choose'] = '请选择';
+
+//选项
+$lang['ds_yes'] = '是';
+$lang['ds_no'] = '否';
+$lang['ds_pc'] = 'PC端';
+$lang['ds_web'] = '手机端';
+
+//编辑器
+$lang['ds_uploading_files'] = '上传文件';
+$lang['ds_insert_editor'] = '插入编辑器';
+$lang['ds_delete_picture'] = '删除图片';
+
+//更换语言
+$lang['ds_language_switching'] = '语言切换成功';
+$lang['ds_language_repetition'] = '更换语言重复';
+
+//导航栏
+$lang['ds_language_switch'] = '语言切换';
+$lang['ds_shalom'] = '您好';
+$lang['ds_change_password'] = '修改密码';
+$lang['ds_clear_cache'] = '清除缓存';
+$lang['ds_clear_cache_confirm'] = '确定立即清除缓存';
+$lang['ds_visit_home'] = '访问首页';
+$lang['ds_safe_withdrawing'] = '安全退出';
+
+//控制面板
+$lang['ds_dashboard_manage'] = '控制面板';
+$lang['ds_welcome'] = '欢迎界面';
+
+//基本设置
+$lang['ds_setting_manage'] = '系统设置';
+$lang['ds_config'] = '网站设置';
+$lang['ds_wzconfig'] = '前台设置';
+$lang['ds_fzsconfig'] = '网站防灌水';
+$lang['ds_seoconfig'] = 'seo设置';
+$lang['ds_glkjreply'] = '回复管理';
+$lang['ds_addkjreply'] = '回复添加';
+$lang['ds_edkjreply'] = '回复编辑';
+$lang['ds_dlkjreply'] = '回复删除';
+$lang['ds_db'] = '数据库';
+$lang['ds_bfdb'] = '数据备份';
+$lang['ds_hydb'] = '数据还原';
+$lang['ds_adminlog'] = '日志记录';
+$lang['ds_adminczlog'] = '操作日志';
+
+//会员管理
+$lang['ds_personnel_manage'] = '用户管理';
+$lang['ds_member'] = '客户列表';
+$lang['ds_accesskf'] = '客户接入设置';
+$lang['ds_glmember'] = '会员管理';
+$lang['ds_addmember'] = '会员添加';
+$lang['ds_edmember'] = '会员编辑';
+$lang['ds_dlmember'] = '会员删除';
+$lang['ds_admin'] = '管理员操作';
+$lang['ds_gladmin'] = '管理员列表';
+$lang['ds_addadmin'] = '管理员添加';
+$lang['ds_edadmin'] = '管理员编辑';
+$lang['ds_dladmin'] = '管理员删除';
+$lang['ds_admin_group'] = '权限组操作';
+$lang['ds_admin_glgroup'] = '权限列表';
+$lang['ds_admin_addgroup'] = '权限添加';
+$lang['ds_admin_edgroup'] = '权限编辑';
+$lang['ds_admin_dlgroup'] = '权限删除';
+
+//内容管理
+$lang['ds_content_manage'] = '内容管理';
+$lang['ds_addcolumn'] = '栏目添加';
+$lang['ds_edcolumn'] = '栏目编辑';
+$lang['ds_dlcolumn'] = '栏目删除';
+$lang['ds_addnews'] = '新闻添加';
+$lang['ds_ednews'] = '新闻编辑';
+$lang['ds_dlnews'] = '新闻删除';
+$lang['ds_product'] = '知识库';
+$lang['ds_addproduct'] = '产品添加';
+$lang['ds_edproduct'] = '产品编辑';
+$lang['ds_dlproduct'] = '产品删除';
+$lang['ds_adv'] = '广告管理';
+$lang['ds_ap'] = '广告位管理';
+
+//运营管理
+$lang['ds_operation_manage'] = '运营管理';
+$lang['ds_message'] = '客户留言';
+$lang['ds_glmessage'] = '留言列表';
+$lang['ds_ckmessage'] = '留言查看';
+$lang['ds_dlmessage'] = '留言删除';
+$lang['ds_feedback'] = '网站反馈';
+$lang['ds_service'] = '客服聊天';
+$lang['ds_records'] = '历史记录';
+$lang['ds_glrecords'] = '历史列表';
+$lang['ds_gllink'] = '链接列表';
+$lang['ds_addlink'] = '友情添加';
+$lang['ds_edlink'] = '友情编辑';
+$lang['ds_dllink'] = '友情删除';
+$lang['ds_kfchat'] = '客服聊天';
+
+
+//微信端
+$lang['ds_wechat_manage'] = '公众号配置';
+$lang['ds_wechat_setting'] = '公众号配置';
+$lang['ds_wechat_menu'] = '微信菜单';
+$lang['ds_wechat_keywords'] = '关键字回复';
+$lang['ds_wechat_member'] = '绑定列表';
+$lang['ds_wechat_push'] = '消息推送';
+
+//常用
+$lang['seo_title'] = 'SEO标题';
+$lang['seo_keywords'] = 'SEO关键字';
+$lang['seo_description'] = 'SEO描述';
+
+?>

+ 27 - 0
application/admin/lang/zh-cn/admin.lang.php

@@ -0,0 +1,27 @@
+<?php
+//管理员列表
+$lang['admin_name'] = '管理员名';
+$lang['admin_lgoin_num'] = '登录次数';
+$lang['admin_is_super'] = '管理员权限';
+$lang['admin_login_time'] = '上次登录时间';
+$lang['admin_add_time'] = '创建时间';
+$lang['admin_confirm_del'] = '您确认删除该管理员吗';
+$lang['admin_non_editable'] = '系统管理员不可编辑';
+
+//添加
+$lang['admin_password'] = '密码';
+$lang['admin_qxzmz'] = '权限组';
+$lang['admin_existence'] = '管理员已存在';
+$lang['admin_add_succ'] = '管理员新增成功';
+$lang['admin_add_fail'] = '管理员新增失败';
+
+//修改
+$lang['admin_edit_password_keep'] = '不修改密码请留空';
+$lang['admin_edit_succ'] = '管理员编辑成功';
+$lang['admin_edit_fail'] = '管理员编辑失败';
+
+//删除
+$lang['admin_del_succ'] = '管理员删除成功';
+$lang['admin_del_fail'] = '管理员删除失败';
+
+

+ 20 - 0
application/admin/lang/zh-cn/admingroup.lang.php

@@ -0,0 +1,20 @@
+<?php
+//权限组列表
+$lang['admin_group_name'] = '权限组名';
+$lang['admin_group_confirm_del'] = '您确认删除该权限组吗';
+
+//添加
+$lang['admin_group_set_limt'] = '设置权限';
+$lang['admin_group_existence'] = '权限组名已存在';
+$lang['admin_group_add_succ'] = '权限组新增成功';
+$lang['admin_group_add_fail'] = '权限组新增失败';
+
+//修改
+$lang['admin_group_edit_succ'] = '权限组编辑成功';
+$lang['admin_group_edit_fail'] = '权限组编辑失败';
+
+//删除
+$lang['admin_group_del_succ'] = '权限组删除成功';
+$lang['admin_group_del_fail'] = '权限组删除失败';
+
+

+ 10 - 0
application/admin/lang/zh-cn/adminlog.lang.php

@@ -0,0 +1,10 @@
+<?php
+//日志列表
+$lang['admin_log']              ='操作日志';
+$lang['admin_log_man']			= '操作人';
+$lang['admin_log_do']			= '行为';
+$lang['admin_log_dotime']		= '时间';
+
+//删除
+$lang['admin_log_del_succ'] = '所选日志删除成功';
+$lang['admin_log_del_fail'] = '所选日志删除失败';

+ 39 - 0
application/admin/lang/zh-cn/config.lang.php

@@ -0,0 +1,39 @@
+<?php
+
+$lang['site_set'] = '前台设置';
+$lang['anti_irrigation_set'] = '网站防灌水';
+$lang['seo_set'] = 'seo设置';
+$lang['site_name'] = '网站名称';
+$lang['site_logo'] = '网站Logo';
+$lang['member_logo'] = '会员中心Logo';
+$lang['site_mobile_logo'] = '手机端LOGO';
+$lang['site_logowx'] = '微信二维码';
+$lang['icp_number'] = 'ICP证书号';
+$lang['site_phone'] = '联系电话';
+$lang['site_tel400'] = '400电话';
+$lang['site_email'] = '电子邮件';
+$lang['flow_static_code'] = '版权底部信息';
+$lang['site_state'] = '站点状态';
+$lang['closed_reason'] = '关闭原因';
+$lang['seo_home_title'] = 'seo标题';
+$lang['seo_home_title_type'] = 'seo标题类型';
+$lang['seo_home_keywords'] = 'seo关键词';
+$lang['seo_home_description'] = 'seo描述';
+
+
+
+
+$lang['allowed_visitors_consult'] = '允许游客咨询';
+$lang['words_open'] = '是否开启文字';
+$lang['img_open'] = '是否开启图片';
+$lang['voice_open'] = '是否开启语音';
+$lang['video_open'] = '是否开启视频';
+$lang['look_open'] = '是否开启表情';
+$lang['cache_open'] = '是否开启缓存';
+$lang['open_checkname'] = '使用验证码';
+$lang['front_login'] = '前台登录';
+$lang['front_feedback'] = '游客反馈';
+$lang['front_regist'] = '前台注册';
+
+
+?>

+ 1 - 0
application/admin/lang/zh-cn/db.lang.php

@@ -0,0 +1 @@
+<?php

+ 52 - 0
application/admin/lang/zh-cn/index.lang.php

@@ -0,0 +1,52 @@
+<?php
+//密码页面
+$lang['index_modifypw_oldpw'] ='旧密码';
+$lang['index_modifypw_newpw'] ='新密码';
+$lang['index_modifypw_newpw2'] ='确认密码';
+
+
+$lang['eliminate_succ'] = '缓存清除成功';
+$lang['eliminate_fail'] = '缓存清除失败';
+
+//提示性语言包
+$lang['index_modifypw_repeat_error'] ='两次密码输入不一致';
+$lang['index_modifypw_admin_error'] ='管理员不存在';
+$lang['index_modifypw_oldpw_error'] ='旧密码错误';
+$lang['index_modifypw_succ'] ='修改密码成功,请重新登录';
+$lang['index_modifypw_fail'] ='密码修改失败';
+
+//版本信息
+$lang['wel_version_info'] ='版本信息';
+$lang['wel_version'] ='版本';
+$lang['wel_install_date'] ='安装时间';
+$lang['wel_program_development'] ='程序开发';
+$lang['wel_all_right_reserved'] ='版权所有';
+$lang['wel_aboutus_website'] ='官方网站';
+$lang['wel_aboutus_bbs'] ='官方论坛';
+
+//系统信息
+$lang['wel_sys_info'] ='系统信息';
+$lang['wel_thinkphp_version'] ='ThinkPHP 版本号';
+$lang['wel_class_library_file_suffix'] ='类库文件后缀';
+$lang['wel_server_os'] ='服务器操作系统';
+$lang['wel_server_domain_ip'] ='服务器域名/IP';
+$lang['wel_server'] ='服务器';
+$lang['wel_version'] ='版本';
+$lang['wel_file_uplode_limit'] ='文件上传限制';
+$lang['wel_max_occupied_memory'] ='最大占用内存';
+$lang['wel_max_ex_time'] ='最大执行时间';
+$lang['wel_safe_mode'] ='安全模式';
+$lang['wel_support'] ='支持';
+
+$lang['wel_deshangwangluo'] ='成都麦邦科技有限公司';
+$lang['wel_piracy_must_be_studied'] ='盗版必究';
+$lang['aboutus_website'] ='官方论坛';
+$lang['wel_communication_bbs'] ='交流论坛';
+$lang['temporary_installation'] ='暂未安装';
+
+
+
+
+
+
+

+ 7 - 0
application/admin/lang/zh-cn/login.lang.php

@@ -0,0 +1,7 @@
+<?php
+//登录
+$lang['login_admin_name'] = '管理员账户名';
+$lang['login_admin_password'] = '管理员密码';
+$lang['login_captcha'] = '验证码';
+$lang['login_sumbit'] = '登录';
+

+ 31 - 0
application/admin/lang/zh-cn/member.lang.php

@@ -0,0 +1,31 @@
+<?php
+//客户列表
+$lang['member_name'] = '客户名称';  
+$lang['member_url'] = '客户网址';
+$lang['member_contacts'] = '联系人';
+$lang['member_usetime'] = '使用时间段';
+$lang['member_validitytime'] = '有效时间';
+$lang['member_add_time'] = '添加时间';
+$lang['member_status'] = '状态';
+$lang['member_mobile'] = '联系方式';
+$lang['member_confirm_del'] = '您确认删除该客户吗';
+
+//添加
+$lang['member_yes'] = '通过';
+$lang['member_no'] = '拒绝';
+$lang['member_password'] = '密码';
+$lang['member_edit_password_keep'] = '不修改密码请留空';
+$lang['member_existence'] = '客户已存在';
+$lang['member_add_succ'] = '客户新增成功';
+$lang['member_add_fail'] = '客户新增失败';
+
+//修改
+$lang['mailbox_format_error'] = '邮箱格式错误';
+$lang['member_edit_succ'] = '客户编辑成功';
+$lang['member_edit_fail'] = '客户编辑失败';
+
+//删除
+$lang['member_del_succ'] = '客户删除成功';
+$lang['member_del_fail'] = '客户删除失败';
+
+

+ 12 - 0
application/admin/lang/zh-cn/message.lang.php

@@ -0,0 +1,12 @@
+<?php
+//列表
+$lang['message_ip'] = 'IP地址';
+$lang['message_addtime'] = '提交时间';
+$lang['message_readok'] = '管理员是否阅读';
+$lang['message_useinfo'] = '管理员回复';
+$lang['message_customer'] = '留言者';
+$lang['message_way'] = '联系方式';
+$lang['message_ctitle'] = '留言短标题';
+$lang['message_content'] = '留言内容';
+$lang['admin_id'] = '管理员';
+

+ 13 - 0
application/admin/lang/zh-cn/nav.lang.php

@@ -0,0 +1,13 @@
+<?php
+//登录
+$lang['nav_type'] = '导航类别';
+$lang['nav_title'] = '导航标题';
+$lang['nav_url'] = '导航链接';
+$lang['nav_location'] = '导航位置';
+$lang['nav_display'] = '显示方式';
+$lang['nav_new_open'] = '导航栏跳转';
+$lang['nav_order'] = '导航排序';
+$lang['nav_content'] = '详细信息';
+$lang['item_id'] = '类别ID';
+$lang['nav_is_show'] = '前台显示';
+

+ 21 - 0
application/admin/lang/zh-cn/product.lang.php

@@ -0,0 +1,21 @@
+<?php
+//产品列表
+$lang['product_title'] = '产品标题';
+$lang['product_order'] = '产品排序';
+$lang['product_new_ok'] = '是否最新';
+$lang['product_top_ok'] = '是否顶置';
+$lang['product_com_ok'] = '是否推荐';
+
+
+$lang['product_parent'] = '产品所属栏目';
+$lang['product_sort'] = '产品排序';
+$lang['product_addtime'] = '添加时间';
+$lang['product_imgurl'] = '图片';
+$lang['product_content'] = '描述';
+$lang['product_displaytype'] = '前台显示';
+$lang['product_wap_ok'] = '手机版显示';
+$lang['ds_please_choose'] = '请选择';
+
+
+
+?>

+ 59 - 0
application/admin/view/accesskf/form.html

@@ -0,0 +1,59 @@
+{extend name="layout:home" /}
+
+{block name="container"}
+<form class="layui-form layui-form-pane" method="post">
+    <div class="layui-tab layui-tab-card">
+        <div class="layui-tab-content page-tab-content">
+            <div class="layui-tab-item layui-show ">
+                <div class="layui-form-item">
+                    <label class="layui-form-label">所属客户</label>
+                    <div class="layui-input-inline">
+                        <select name="access_pid" id="access_pid">
+                            <option value="{$onlygs.member_id}">{if $onlygs}{$onlygs.member_name}{else}请选择所属客户{/if}</option>
+                            {foreach name="allgs" id="v"}
+                                <option value="{$v.member_id}">{$v.member_name}</option>
+                            {/foreach}
+                        </select>
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <label class="layui-form-label">公司名</label>
+                    <div class="layui-input-block">
+                        <input type="text" class="layui-input field-name" name="access_gsname" id="access_gsname" value="{$access.access_gsname|default=''}" lay-verify="access_gsname" autocomplete="off" placeholder="{:lang('ds_please_enter')}公司名" required />
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <label class="layui-form-label">接入名称</label>
+                    <div class="layui-input-block">
+                        <input type="text" class="layui-input field-name" name="access_gsjrname" id="access_gsjrname" value="{$access.access_gsjrname|default=''}"  placeholder="{:lang('ds_please_enter')}接入名称" />
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <label class="layui-form-label">域名</label>
+                    <div class="layui-input-block">
+                        <input type="text" class="layui-input field-name" name="access_url" id="access_url" value="{$access.access_url|default=''}"  placeholder="{:lang('ds_please_enter')}域名" lay-verify="domainName"/>
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <div class="layui-input-block">
+                        <input type="submit" class="layui-btn layui-btn-normal" lay-submit value="{:lang('ds_submit')}" />
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</form>
+<script>
+    layui.use('form', function() {
+        var form = layui.form;
+    });
+	$('#access_url').blur(function(){
+		if(!/^(?=^.{3,255}$)()?(www\.)?[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+(:\d+)*(\/\w+\.\w+)*$/.test($('#access_url').val())){
+			layer.msg('域名格式不正确');
+		}
+	})
+</script>
+{/block}
+
+
+

+ 83 - 0
application/admin/view/accesskf/index.html

@@ -0,0 +1,83 @@
+{extend name="layout:home" /}
+{block name="container"}
+<div class="layui-tab layui-tab-card">
+    {include file="layout/admin_items" /}
+    <div class="layui-tab-content page-tab-content">
+        <!-- 搜索框开始 -->
+        <div class="search-form">
+        <form class="" method="post">
+            <div class="layui-form-item">
+                <div class="layui-inline">
+                    <input type="text" name="title"  placeholder="输入公司名或appid或接入名" autocomplete="off" class="layui-input">
+                </div>
+                <div class="layui-inline">
+                    <button type="submit" class="layui-btn search-subBtn">搜索</button>
+                </div>
+            </div>
+        </form>
+        </div>
+        <!-- 搜索框结束 -->
+        <table class="layui-table lay-even">
+            <colgroup>
+                <col width="150">
+                <col width="200">
+                <col>
+            </colgroup>
+            <thead>
+            <tr>
+                <th>公司名</th>
+                <th>接入名称</th>
+                <th>appid</th>
+                <th>appsecrect</th>
+                <th>域名</th>
+                <th>所属公司</th>
+                <th>操作</th>
+            </tr>
+            </thead>
+            <tbody>
+            {if $access_list}
+            {volist name="access_list" id="access" key="k"}
+            <tr>
+                <td>{$access.access_gsname}</td>
+                <td>{$access.access_gsjrname}</td>
+                <td>{$access.access_appid}</td>
+                <td>{$access.access_appsecrect}</td>
+                <td>{$access.access_url}</td>
+                <td>{$member_list[$k-1]['member_name']}</td>
+                <td>
+                    {if array_intersect(explode(" ",str_replace("/", ".","accesskf/edit")),$allpower)}
+                        <a href="javascript:dsLayerOpen('{:url('Accesskf/edit',['access_id'=>$access.access_id])}','{$Think.lang.ds_edit}-{$access.access_gsname}')" class="layui-btn layui-btn-xs"><i class="layui-icon layui-icon-edit"></i>{$Think.lang.ds_edit}</a>
+                    {/if}
+                    {if array_intersect(explode(" ",str_replace("/", ".","accesskf/del")),$allpower)}
+                        <a href="javascript:dsLayerConfirm('{:url('Accesskf/del',['access_id'=>$access.access_id])}','{$Think.lang.member_confirm_del}')" class="layui-btn layui-btn-xs layui-btn-danger"><i class="layui-icon layui-icon-delete"></i>删除</a>
+                    {/if}
+                </td>
+            </tr>
+            {/volist}
+            {else}
+            <td>无数据</td>
+            {/if}
+            </tbody>
+        </table>
+        {$show_page}
+    </div>
+</div>
+<script type="text/javascript">
+    layui.use('laydate', function(){
+      var laydate = layui.laydate;
+      
+      //执行一个laydate实例
+      laydate.render({
+        elem: '#creatTime' //指定元素
+      });
+        laydate.render({
+            elem:'#timeRang',
+            range:true,
+            format: 'yyyy/MM/dd',
+            done: function(value, date){
+                /* 时间选择完成后的回调 */
+            }
+        })
+    });
+</script>
+{/block}

+ 89 - 0
application/admin/view/admin/form.html

@@ -0,0 +1,89 @@
+{extend name="layout:home" /}
+
+{block name="container"}
+<?php 
+    if(empty($qxgroup_name)){
+        $qxgroup_name="";
+        echo $qxgroup_name;
+    } 
+    if(empty($qxgroup_id)){
+        $qxgroup_id=0;
+    }
+    if(empty($suosgs)){
+        $suosgs=0;
+    }
+?>
+<form class="layui-form layui-form-pane" method="post">
+    <div class="layui-tab layui-tab-card">
+        <div class="layui-tab-content page-tab-content">
+            <div class="layui-tab-item layui-show ">
+                <div class="layui-form-item">
+                    <label class="layui-form-label">{$Think.lang.admin_name}</label>
+                    <div class="layui-input-block">
+                        <input type="text" class="layui-input field-name" name="admin_name" id="admin_name" value="{$admin.admin_name|default=''}" lay-verify="admin_name" autocomplete="off" placeholder="{:lang('ds_please_enter')}{:lang('admin_name')}" required />
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <label class="layui-form-label">{$Think.lang.admin_password}</label>
+                    <div class="layui-input-block">
+                        <input type="password" class="layui-input field-name" name="admin_password" id="admin_password" value=""  placeholder="{if $admin.add eq '1'} {:lang('ds_please_enter')}{:lang('admin_password')}{else}{:lang('admin_edit_password_keep')}{/if} " />
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <label class="layui-form-label">{$Think.lang.admin_qxzmz}</label>
+                    <div class="layui-input-block">
+                        <select name="group_id" id="groups" lay-filter="groups">
+                            <option value="{$qxgroup_id}">{if $qxgroup_name}{$qxgroup_name}{else /}请选择权限组{/if}</option>
+                            {if $is_super==1}
+                                {foreach name="admin_group" item="v"}
+                                <option value="{$v.group_id}">{$v.group_name}</option>
+                                {/foreach}
+                            {else /}
+                                <option value="3">客服</option>
+                            {/if}
+                        </select>
+                    </div>
+                </div>
+                {if $is_super==1}
+                <div class="layui-form-item" id="oajax">
+                    <label class="layui-form-label">所属公司</label>
+                    <div class="layui-input-block">
+                        <select name="admin_pid" lay-filter="groups">
+                            <option value="{$suosgs['admin_id']}"><?php if($suosgs){echo $suosgs['admin_name'];}else{echo "请选择所属公司";} ?></option>
+                            {foreach name="jlzgsmz" item="vv"}
+                            <option value="{$vv.admin_id}">{$vv.admin_name}</option>
+                            {/foreach}
+                        </select>
+                    </div>
+                    <p style="margin-left:110px;color:red">* 若选择客服必选所属公司,若选择经理组不必选择</p>
+                </div>
+                {/if}
+                <div class="layui-form-item">
+                    <label class="layui-form-label">是否启用</label>
+                    <div class="layui-input-inline">
+                        <input type="checkbox" name="admin_status" lay-skin="switch" lay-text="{$Think.lang.ds_yes}|{$Think.lang.ds_no}" value="1" {if condition="$admin.admin_status eq '1'"}checked{/if}>
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <div class="layui-input-block">
+                        <input type="submit" class="layui-btn layui-btn-normal" lay-submit value="{:lang('ds_submit')}" />
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</form>
+
+<script>
+    layui.use('form', function() {
+        var form = layui.form;
+        form.on('select(groups)',function(data){
+            
+        });
+    });
+    
+</script>
+<script type="text/javascript" charset="utf-8">
+    
+</script>
+{/block}

+ 101 - 0
application/admin/view/admin/index.html

@@ -0,0 +1,101 @@
+{extend name="layout:home" /}
+{block name="container"}
+<div class="layui-tab layui-tab-card">
+    {include file="layout/admin_items" /}
+    <div class="layui-tab-content page-tab-content">
+		<!-- 搜索框 -->
+		<div class="search-form">
+		<form action="" method="post" enctype="multipart/form-data" >
+			<div class="layui-form-item">
+				<div class="layui-inline">
+					<input type="text" name="title"  placeholder="输入管理员名称" autocomplete="off" class="layui-input">
+				</div>
+				<div class="layui-inline">
+					<select name="admingroupid" lay-verify="" class="layui-select layui-unselect layui-form-select">
+						<option value="">管理组</option>
+						{foreach name="admin_group" item="v"}
+							<option value="{$v.group_id}">{$v.group_name}</option>
+						{/foreach}
+					</select>
+				</div>
+				<div class="layui-inline">
+					<button type="submit" class="layui-btn search-subBtn">搜索</button>
+				</div>
+				<div class="layui-inline right-per" style="float: right;">
+					<div class="button-group">
+						<button type="button" class="layui-btn"><i class="layui-icon layui-icon-table"></i><span>导出数据</span></button>
+					</div>
+				</div>
+			</div>
+			
+		</form>
+		</div>
+        <table class="layui-table lay-even">
+            <colgroup>
+                <col width="150">
+                <col width="200">
+                <col>
+            </colgroup>
+            <thead>
+            <tr>
+                <th>{$Think.lang.admin_name}</th>
+                <th>{$Think.lang.admin_lgoin_num}</th>
+                <th>{$Think.lang.admin_is_super}</th>
+                <th>{$Think.lang.admin_login_time}</th>
+                <th>{$Think.lang.admin_add_time}</th>
+                <th>状态</th>
+                <th>{$Think.lang.ds_operation}</th>
+            </tr>
+            </thead>
+            <tbody>
+            {if $admin_list}
+            {volist name="admin_list" id="admin"}
+            <tr>
+                <td>{$admin.admin_name}</td>
+                <td>{$admin.admin_login_num}</td>
+                <td>{$admin.group_name}</td>
+                <td>{if condition="$admin.admin_login_time eq 0"}{$Think.lang.ds_no_login}{else}{$admin.admin_login_time|date='Y-m-d H:i:s',###}{/if}
+                </td>
+                <td>{if condition="$admin.admin_add_time eq 0"}{$Think.lang.ds_no_login}{else}{$admin.admin_add_time|date='Y-m-d H:i:s',###}{/if}</td>
+                <td>{if condition="$admin.admin_status eq 0"}停用{else}启用{/if}</td>
+                <td>
+                    {if condition="$admin.admin_id eq 1"}
+                    {$Think.lang.admin_non_editable}
+                    {else}
+                    <?php if(array_intersect(explode(" ",str_replace("/", ".","admin/edit")),$allpower)){ ?>
+                        <a href="javascript:dsLayerOpen('{:url('Admin/edit',['admin_id'=>$admin.admin_id])}','{$Think.lang.ds_edit}-{$admin.admin_name}')" class="layui-btn layui-btn-xs"><i class="layui-icon layui-icon-edit"></i>{$Think.lang.ds_edit}</a>
+                    <?php } ?>
+                    <?php if(array_intersect(explode(" ",str_replace("/", ".","admin/del")),$allpower)){ ?>
+                        <a href="javascript:dsLayerConfirm('{:url('admin/del',['admin_id'=>$admin.admin_id])}','{$Think.lang.admin_confirm_del}')" class="layui-btn layui-btn-xs layui-btn-danger"><i class="layui-icon layui-icon-delete"></i>{$Think.lang.ds_del}</a>
+                    <?php } ?>
+                    {/if}
+                </td>
+            </tr>
+            {/volist}
+            {else}
+            <td>无数据</td>
+            {/if}
+            </tbody>
+        </table>
+        {$show_page}
+    </div>
+</div>
+<script type="text/javascript">
+	layui.use('laydate', function(){
+	  var laydate = layui.laydate;
+	  
+	  //执行一个laydate实例
+	  laydate.render({
+		elem: '#creatTime' //指定元素
+	  });
+		laydate.render({
+			elem:'#timeRang',
+			range:true,
+			format: 'yyyy/MM/dd',
+			done: function(value, date){
+				/* 时间选择完成后的回调 */
+			}
+		})
+	});
+</script>
+{/block}

+ 73 - 0
application/admin/view/admingroup/form.html

@@ -0,0 +1,73 @@
+{extend name="layout:home" /}
+{block name="container"}
+<form method="post">
+    <div class="layui-tab layui-tab-card">
+        <div class="layui-tab-content page-tab-content">
+            <div class="layui-tab-item layui-show ">
+                <div class="layui-form-item">
+                    <label class="layui-form-label">{$Think.lang.admin_group_name}</label>
+                    <div class="layui-input-block">
+                        <input type="text" class="layui-input field-name" name="group_name" id="group_name"
+                               value="{$group_info.group_name|default=''}" lay-verify="group_name" autocomplete="off"
+                               placeholder="{:lang('ds_please_enter')}{:lang('admin_group_name')}" required/>
+                    </div>
+                </div>
+                <table class="ds-default-table">
+                    <thead>
+                    <tr class="space">
+                        <th><input id="limitAll" value="1" type="checkbox">&nbsp;&nbsp;{$Think.lang.admin_group_set_limt}</th>
+                    </tr>
+                    </thead>
+                    <tbody>
+                    {foreach name="limit" item="v" key="k" }
+                    <tr>
+                        <td>
+                            <label style="width:100px">{$v.nav|default=''}</label>
+                            <input id="limit{$k}" type="checkbox" onclick="selectLimit('limit{$k}')">
+                            <label for="limit{$k}"><b>{$v.name}</b></label>
+                            {foreach name="$v.child" item="xv" key="xk" }
+                            {if condition="$admin_array eq 'add'"}
+                            <label><input dstype='limit' class="limit{$k}" type="checkbox" name="permission[]" value="{$xv.action}">{$xv.name}&nbsp;</label>
+                            {else/}
+                            <label><input dstype="limit{$k}" class="limit{$k}" type="checkbox" name="permission[]" value="{$xv.action}" <?php if(in_array(substr($xv['action'],0,($t=strpos($xv['action'],'|'))?$t:100),$group_info['group_limits'])){ echo "checked=\"checked\""; }?>>{$xv.name}&nbsp;</label>
+                            {/if}
+                            {/foreach}
+                        </td>
+                    </tr>
+                    {/foreach}
+                    </tbody>
+                </table>
+                <div class="layui-form-item">
+                    <div class="layui-input-block">
+                        <input type="submit" class="layui-btn layui-btn-normal" lay-submit value="{:lang('ds_submit')}"/>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</form>
+<script>
+    function selectLimit(name) {
+        if ($('#' + name).prop('checked')) {
+            $('.' + name).prop('checked', true);
+        } else {
+            $('.' + name).prop('checked', false);
+        }
+    }
+    $(function () {
+        $('#limitAll').on('click', function () {
+            if ($(this).prop('checked')) {
+                $(this).parents('table').find('input:checkbox').prop('checked', true);
+            } else {
+                $(this).parents('table').find('input:checkbox').prop('checked', false);
+            }
+        });
+    });
+    layui.use('form', function () {
+        var form = layui.form;
+    });
+</script>
+{/block}
+
+
+

+ 42 - 0
application/admin/view/admingroup/index.html

@@ -0,0 +1,42 @@
+{extend name="layout:home" /}
+{block name="container"}
+<div class="layui-tab layui-tab-card">
+    {include file="layout/admin_items" /}
+    <div class="layui-tab-content page-tab-content">
+        <table class="layui-table lay-even">
+            <colgroup>
+                <col width="150">
+                <col width="200">
+                <col>
+            </colgroup>
+            <thead>
+            <tr>
+                <th>{$Think.lang.admin_group_name}</th>
+                <th>创建时间</th>
+                <th>{$Think.lang.ds_operation}</th>
+            </tr>
+            </thead>
+            <tbody>
+            {if $admin_group_list}
+            {volist name="admin_group_list" id="admin_group"}
+            <tr>
+                <td>{$admin_group.group_name}</td>
+                <td>{$admin_group.addtime|date="Y-m-d H:i:s",###}</td>
+                <td>
+                    {if array_intersect(explode(" ",str_replace("/", ".","admingroup/edit")),$allpower)}
+                        <a href="javascript:dsLayerOpen('{:url('Admingroup/edit',['group_id'=>$admin_group.group_id])}','{$Think.lang.ds_edit}-{$admin_group.group_name}')" class="layui-btn layui-btn-xs"><i class="layui-icon layui-icon-edit"></i>{$Think.lang.ds_edit}</a>
+                    {/if}
+                    {if array_intersect(explode(" ",str_replace("/", ".","admingroup/del")),$allpower)}
+                        <a href="javascript:dsLayerConfirm('{:url('Admingroup/del',['group_id'=>$admin_group.group_id])}','{$Think.lang.admin_group_confirm_del}')" class="layui-btn layui-btn-xs layui-btn-danger"><i class="layui-icon layui-icon-delete"></i>{$Think.lang.ds_del}</a>
+                    {/if}
+                </td>
+            </tr>
+            {/volist}
+            {else}
+            <td>无数据</td>
+            {/if}
+            </tbody>
+        </table>
+    </div>
+</div>
+{/block}

+ 93 - 0
application/admin/view/adminlog/index.html

@@ -0,0 +1,93 @@
+{extend name="layout:home" /}
+{block name="container"}
+<div class="layui-tab layui-tab-card">
+    {include file="layout/admin_items" /}
+    <div>&nbsp;</div>
+    <form method="get" class="layui-form layui-form-pane">
+        <input type="hidden" name="delago" id="delago" value="">
+        <div class="layui-form-item">
+            <div class="layui-input-inline" style="width: 250px;">
+                <label class="layui-form-label">{$Think.lang.admin_log_man}</label>
+                <input name="admin_name" value="{$Request.get.admin_name}" type="text" class="layui-input field-name float_input" id="admin_name"
+                       style="display: inline-block;width: 50%;"/>
+            </div>
+            <div class="layui-input-inline" style="width: 440px;">
+                <label class="layui-form-label">{$Think.lang.admin_log_dotime}</label>
+                <input value="{$Request.get.time_from}" id="time_from" name="time_from" type="text" class="layui-input field-name"
+                       style="display: inline-block;width: 30%;"/>
+                <label for="time_to">~</label>
+                <input value="{$Request.get.time_to}" id="time_to" name="time_to" type="text" class="layui-input field-name"
+                       style="display: inline-block;width: 30%;"/>
+            </div>
+            <div class="layui-input-inline">
+                <input type="submit" class="layui-btn layui-btn-normal" lay-submit value="{:lang('ds_search')}"/>
+                <input type="reset" class="layui-btn layui-btn-warm" value="{:lang('ds_reset')}"/>
+                <input type="button" class="layui-btn laydate-day-next" onclick="location.href = '{:url('Adminlog/export_step1')}'" value="{$Think.lang.ds_export}"/>
+            </div>
+        </div>
+    </form>
+    <div class="layui-tab-content page-tab-content">
+        <table class="layui-table lay-even">
+            <colgroup>
+                <col width="50">
+            </colgroup>
+            <thead>
+            <tr>
+                <th></th>
+                <th>{$Think.lang.admin_log_man}</th>
+                <th>{$Think.lang.admin_log_do}</th>
+                <th class="align-center">{$Think.lang.admin_log_dotime}</th>
+                <th class="align-center">IP</th>
+            </tr>
+            </thead>
+            <tbody>
+            {notempty name="list"}
+            {volist name="list" id="v"}
+            <tr>
+                <td class="w24">
+                    <input type="checkbox" class="checkitem" value="{$v.adminlog_id}">
+                </td>
+                <td>{$v.admin_name}</td>
+                <td>{$v.content}</td>
+                <td class="align-center">{$v.createtime|date="Y-m-d H:i:s",###}</td>
+                <td class="align-center">{$v.ip}</td>
+            </tr>
+            {/volist}
+            {else}
+            <tr class="no_data">
+                <td colspan="10">{$Think.lang.ds_no_record}</td>
+            </tr>
+            {/notempty}
+            </tbody>
+            <tfoot class="tfoot">
+            {notempty name="list"}
+            <tr class="tfoot">
+                <td><input type="checkbox" class="checkall" id="checkallBottom" name="chkVal"></td>
+                <td colspan="16"><label for="checkallBottom">{$Think.lang.ds_select_all}</label>
+                    &nbsp;&nbsp;<a href="JavaScript:void(0);" class="btn btn-small" onclick="submit_delete_batch()"><span>{$Think.lang.ds_del}</span></a>
+                </td>
+            </tr>
+            {/notempty}
+            </tfoot>
+        </table>
+        {$page}
+    </div>
+</div>
+<script>
+    layui.use('laydate', function () {
+        var laydate = layui.laydate;
+        //执行一个laydate实例
+        laydate.render({
+            elem: '#time_from' //指定元素
+        });
+        //执行一个laydate实例
+        laydate.render({
+            elem: '#time_to' //指定元素
+        });
+    });
+    function submit_delete(ids_str){
+        _uri = ADMINSITEURL+"/Adminlog/list_del.html?adminlog_id=" + ids_str;
+        dsLayerConfirm(_uri,'{$Think.lang.ds_confirm_cancel}');
+    }
+</script>
+{/block}

+ 87 - 0
application/admin/view/config/index.html

@@ -0,0 +1,87 @@
+{extend name="layout:home" /}
+
+{block name="container"}
+<form class="layui-form layui-form-pane" method="post">
+    <div class="layui-tab layui-tab-card">
+        {include file="layout/admin_items" /}
+        <div class="layui-tab-content page-tab-content">
+            <div class="layui-tab-item layui-show ">
+                <div class="layui-form-item">
+                    <label class="layui-form-label">{$Think.lang.cache_open}</label>
+                    <div class="layui-input-block">
+                        <input type="checkbox" name="cache_open" lay-skin="switch" lay-text="是|否" value="1" {if
+                               condition="$list_config.cache_open eq '1'" }checked{/if}>
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <label class="layui-form-label">{$Think.lang.allowed_visitors_consult}</label>
+                    <div class="layui-input-block">
+                        <input type="checkbox" name="guest_comment" lay-skin="switch" lay-text="是|否" value="1" {if
+                               condition="$list_config.guest_comment eq '1'" }checked{/if}>
+                    </div>
+                </div>
+                <!-- //////////////////// -->
+                <div class="layui-form-item">
+                    <label class="layui-form-label">{$Think.lang.words_open}</label>
+                    <div class="layui-input-block">
+                        <input type="checkbox" name="words_open" lay-skin="switch" lay-text="是|否" value="1" {if
+                               condition="$list_config.words_open eq '1'" }checked{/if}>
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <label class="layui-form-label">{$Think.lang.img_open}</label>
+                    <div class="layui-input-block">
+                        <input type="checkbox" name="img_open" lay-skin="switch" lay-text="是|否" value="1" {if
+                               condition="$list_config.img_open eq '1'" }checked{/if}>
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <label class="layui-form-label">{$Think.lang.voice_open}</label>
+                    <div class="layui-input-block">
+                        <input type="checkbox" name="voice_open" lay-skin="switch" lay-text="是|否" value="1" {if
+                               condition="$list_config.voice_open eq '1'" }checked{/if}>
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <label class="layui-form-label">{$Think.lang.video_open}</label>
+                    <div class="layui-input-block">
+                        <input type="checkbox" name="video_open" lay-skin="switch" lay-text="是|否" value="1" {if
+                               condition="$list_config.video_open eq '1'" }checked{/if}>
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <label class="layui-form-label">{$Think.lang.look_open}</label>
+                    <div class="layui-input-block">
+                        <input type="checkbox" name="look_open" lay-skin="switch" lay-text="是|否" value="1" {if
+                               condition="$list_config.look_open eq '1'" }checked{/if}>
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <div class="layui-input-block">
+                        <input type="submit" class="layui-btn layui-btn-normal" lay-submit value="{:lang('ds_submit')}"/>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</form>
+<script>
+    layui.use('form', function () {
+        var form = layui.form;
+    });
+</script>
+<script>
+    //Demo
+    layui.use('form', function () {
+        var form = layui.form;
+
+        //监听提交
+        form.on('submit(formDemo)', function (data) {
+            layer.msg(JSON.stringify(data.field));
+            return false;
+        });
+    });
+</script>
+
+{/block}
+

+ 155 - 0
application/admin/view/db/db.html

@@ -0,0 +1,155 @@
+{extend name="layout:home" /}
+{block name="container"}
+<div class="layui-tab layui-tab-card">
+    {include file="layout/admin_items" /}
+    <div class="layui-tab-content page-tab-content">
+        <div class="explanation" id="explanation">
+            <div class="title" id="checkZoom">
+                <h4 title="提示相关设置操作时应注意的要点">操作提示</h4>
+                <span id="explanationZoom" title="收起提示" class="arrow"></span>
+            </div>
+            <ul>
+                <li>1.会员相关信息。</li>
+            </ul>
+        </div>
+        <div class="mDiv">
+            <div class="ftitle">
+                <div style="width: 100px;float: left;line-height: 56px;"><h3>数据库表列表</h3></div>
+                <div style="width: 300px;float: left;line-height: 56px;"><h5>(共{$tableNum}张记录,共计{$total})</h5></div>
+            </div>
+            <a id="export" class="layui-btn layui-btn-primary " style="background-color: #009688;color: #fff;margin-top: 10px;">数据备份</a>
+        </div>
+        <form method="post" id="export-form" action="{:url('Admin/Db/export')}">
+            <div class="layui-tab-content page-tab-content">
+                <table class="layui-table lay-even">
+                    <colgroup>
+                        <col width="80">
+                        <col width="200">
+                        <col width="100">
+                        <col width="200">
+                        <col width="200">
+                        <col width="150">
+                        <col>
+                    </colgroup>
+                    <thead>
+                    <tr>
+                        <th><input type="checkbox" onclick="javascript:$('input[name*=tables]').prop('checked', this.checked);">全选</th>
+                        <th>数据库表</th>
+                        <th>记录条数</th>
+                        <th>占用空间</th>
+                        <th>编码</th>
+                        <th>冗余</th>
+                        <th>创建时间</th>
+                        <th>备注</th>
+                        <th>操作</th>
+                    </tr>
+                    </thead>
+                    <tbody>
+                    {notempty name="list"}
+                    {volist name="list" id="db"}
+                    <tr data-id="{$db.Name}">
+                        <td>
+                            <input type="checkbox" name="tables[]" value="{$db.Name}">
+                        </td>
+                        <td class="align-center">
+                            {$db.Name}
+                        </td>
+                        <td class="align-center">
+                            {$db.Rows}
+                        </td>
+                        <td class="align-center">
+                            {$db.Data_length|format_bytes}
+                        </td>
+                        <td class="align-center">
+                            {$db.Collation}
+                        </td>
+
+                        <td>{$db['Data_free']/1024} kb
+                        </td>
+                        <td class="align-center">
+                            {$db.Create_time}
+                        </td>
+                        <td>{$db['Comment']}
+                        </td>
+                        <td class="align-center">
+                            <div style="text-align: center;">
+                                <a href="{:url('Admin/Db/optimize',array('tablename'=>$db['Name']))}" class="layui-btn layui-btn-xs">优化</a>
+                                <a href="{:url('Admin/Db/repair',array('tablename'=>$db['Name']))}" class="layui-btn layui-btn-xs layui-btn-danger">修复</a>
+                            </div>
+                        </td>
+                    </tr>
+                    {/volist}
+                    {else}
+                    <tr class="no_data">
+                        <td colspan="11">{$Think.lang.ds_no_record}</td>
+                    </tr>
+                    {/notempty}
+                    </tbody>
+                </table>
+
+            </div>
+        </form>
+    </div>
+</div>
+<script>
+    (function ($) {
+        var $form = $("#export-form"), $export = $("#export"), tables;
+        $export.click(function () {
+            if ($("input[name^='tables']:checked").length == 0) {
+                alert('请选中要备份的数据表');
+                return false;
+            }
+            $export.addClass("disabled");
+            $export.html("正在发送备份请求...");
+            $.post(
+                $form.attr("action"),
+                $form.serialize(),
+                function (data) {
+                    if (data.status) {
+                        tables = data.tables;
+                        $export.html(data.info + "开始备份,请不要关闭本页面!");
+                        backup(data.tab);
+                        window.onbeforeunload = function () {
+                            return "正在备份数据库,请不要关闭!"
+                        }
+                    } else {
+                        alert(data.info);
+                        $export.removeClass("disabled");
+                        $export.html("立即备份");
+                    }
+                },
+                "json"
+            );
+            return false;
+        });
+
+        function backup(tab, status) {
+            status && showmsg(tab.id, "开始备份...(0%)");
+            $.get($form.attr("action"), tab, function (data) {
+                if (data.status) {
+                    showmsg(tab.id, data.info);
+                    if (!$.isPlainObject(data.tab)) {
+                        $export.removeClass("disabled");
+                        $export.html("备份完成,点击重新备份");
+                        window.onbeforeunload = function () {
+                            return null
+                        }
+                        return;
+                    }
+                    backup(data.tab, tab.id != data.tab.id);
+                } else {
+                    $export.removeClass("disabled");
+                    $export.html("立即备份");
+                }
+            }, "json");
+
+        }
+
+        function showmsg(id, msg) {
+            $("input[value=" + tables[id] + "]").closest("tr").find(".info").html(msg);
+//                            $("input[value=" + tables[id] + "]").closest("tr").hide(3000);
+        }
+    })(jQuery);
+</script>
+{/block}
+

+ 146 - 0
application/admin/view/db/restore.html

@@ -0,0 +1,146 @@
+{extend name="layout:home" /}
+{block name="container"}
+<div class="layui-tab layui-tab-card">
+    {include file="layout/admin_items" /}
+    <!-- 操作说明 -->
+    <div class="layui-tab-content page-tab-content" id="flexigrid">
+        <div class="explanation" id="explanation">
+            <div class="title" id="checkZoom">
+                <h4 title="提示相关设置操作时应注意的要点">操作提示</h4>
+                <span id="explanationZoom" title="收起提示" class="arrow"></span>
+            </div>
+            <ul>
+                <li> 数据还原, 点击恢复选项进行数据库导入.</li>
+                <li> 导入的SQL文件语句必须按照MYSQL的语法编写</li>
+            </ul>
+        </div>
+
+        <div class="mDiv">
+            <div class="ftitle">
+                <div style="width: 100px;float: left;line-height: 56px;"><h3>sql文件列表</h3></div>
+                <div style="width: 300px;float: left;line-height: 56px;"><h5>(备份文件数量:{$filenum},占空间大小:{$total|format_bytes})</h5></div>
+            </div>
+            <div title="刷新数据" class="pReload"><i class="fa fa-refresh"></i></div>
+        </div>
+        <table class="layui-table lay-even">
+            <colgroup>
+                <col width="150">
+                <col width="200">
+                <col width="200">
+                <col>
+                <col width="150">
+            </colgroup>
+            <thead>
+            <tr>
+                <th align="left" abbr="article_title" axis="col3" class="">
+                    <div style="text-align: left; width: 200px;" class="">文件名称</div>
+                </th>
+                <th align="center" abbr="ac_id" axis="col4" class="">
+                    <div style="text-align: center; width: 50px;" class="">卷号</div>
+                </th>
+                <th align="center" abbr="article_show" axis="col5" class="">
+                    <div style="text-align: center; width: 50px;" class="">压缩</div>
+                </th>
+                <th align="center" abbr="article_time" axis="col6" class="">
+                    <div style="text-align: center; width: 150px;" class="">数据大小</div>
+                </th>
+                <th align="center" abbr="article_show" axis="col7" class="">
+                    <div style="text-align: center; width: 150px;" class="">备份时间</div>
+                </th>
+                <th align="center" abbr="article_show" axis="col8" class="">
+                    <div style="text-align: center; width: 130px;" class="">状态</div>
+                </th>
+                <th align="center" axis="col1" class="handle">
+                    <div style="text-align: center; width: 250px;">操作</div>
+                </th>
+            </tr>
+            </thead>
+            <tbody>
+            {notempty name="list"}
+            {volist name="list" id="vo"}
+            <tr>
+                <td align="left" class="">
+                    <div style="text-align: left; width: 200px;">{$vo.basename}</div>
+                </td>
+                <td align="center" class="">
+                    <div style="text-align: center; width: 50px;">{$vo.part}</div>
+                </td>
+                <td align="center" class="">
+                    <div style="text-align: center; width: 50px;">{$vo.compress}</div>
+                </td>
+                <td align="center" class="">
+                    <div style="text-align: center; width: 150px;">{$vo.size|format_bytes}</div>
+                </td>
+                <td align="center" class="">
+                    <div style="text-align: center; width: 150px;">{$vo.time|date="Y-m-d H:i:s",###}</div>
+                </td>
+                <td align="center" class="">
+                    <div style="text-align: center; width: 130px;">-</div>
+                </td>
+                <td align="center" class="handle">
+                    <div style="text-align: center; width: 170px; max-width:170px;">
+                        <a value="{:url('/Admin/Db/import',['time'=>$vo.time])}" href="javascript:void(0)" class="db-import"><i
+                                class="fa fa-repeat"></i>恢复</a> |
+                        <a href="{:url('/Admin/Db/downFile',['time'=>$vo.time])}"><i class="fa fa-download"></i>下载</a> |
+                        <a href="{:url('/Admin/Db/del',['time'=>$vo.time])}"><i class="fa fa-trash"></i>删除</a>
+                    </div>
+                </td>
+            </tr>
+            {/volist}
+            {else}
+            <tr class="no_data">
+                <td colspan="11">{$Think.lang.ds_no_record}</td>
+            </tr>
+            {/notempty}
+            </tbody>
+        </table>
+    </div>
+</div>
+<script>
+
+    $(document).ready(function () {
+        // 表格行点击选中切换
+        $('#flexigrid > table>tbody >tr').click(function () {
+            $(this).toggleClass('trSelected');
+        });
+
+        // 点击刷新数据
+        $('.fa-refresh').click(function () {
+            location.href = location.href;
+        });
+    });
+
+    $(".db-import").click(function () {
+
+        var self = this, status = ".";
+        $.get($('.db-import').attr('value'), success, "json");
+        window.onbeforeunload = function () {
+            return "正在还原数据库,请不要关闭!"
+        }
+        function success(data) {
+            if (data.code) {
+                if (data.gz) {
+                    data.info += status;
+                    if (status.length === 5) {
+                        status = ".";
+                    } else {
+                        status += ".";
+                    }
+                }
+                $(self).parent().parent().prev().find('div').text(data.msg);
+                if (data.data) {
+                    $.get($('.db-import').attr('value'), {"part": data.data.part, "start": data.data.start}, success, "json");
+                } else {
+                    window.onbeforeunload = function () {
+                        return null;
+                    }
+                }
+            } else {
+                layer.alert(data.msg, {icon: 2});
+            }
+        }
+    });
+</script>
+{/block}
+
+    

+ 200 - 0
application/admin/view/index/index.html

@@ -0,0 +1,200 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/html">
+<head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <title>麦帮官网</title>
+    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
+    <!-- Bootstrap 3.3.7 -->
+    <link rel="stylesheet" href="{$Think.PLUGINS_SITE_ROOT}/layui/css/layui.css">
+    <link rel="stylesheet" href="{$Think.ADMIN_SITE_ROOT}/css/admin.css">
+    <link rel="stylesheet" href="{$Think.ADMIN_SITE_ROOT}/iconfont/iconfont.css">
+    <script src="{$Think.PLUGINS_SITE_ROOT}/jquery-2.1.4.min.js"></script>
+    <script src="{$Think.ADMIN_SITE_ROOT}/js/admin.js"></script>
+    <script type="text/javascript" src="{$Think.PLUGINS_SITE_ROOT}/layui/layui.js"></script>
+    <script type="text/javascript">
+        var BASESITEROOT = "{$Think.BASE_SITE_ROOT}";
+        var ADMINSITEROOT = "{$Think.ADMIN_SITE_ROOT}";
+        var BASESITEURL = "{$Think.BASE_SITE_URL}";
+        var HOMESITEURL = "{$Think.HOME_SITE_URL}";
+        var ADMINSITEURL = "{$Think.ADMIN_SITE_URL}";
+    </script>
+</head>
+<body>
+<style type="text/css">
+    .layui-tab {
+        position: absolute;
+        left: 0;
+        top: 0;
+        height: 100%;
+        width: 100%;
+        z-index: 10;
+        margin: 0;
+        border: none;
+        overflow: hidden;
+    }
+
+    .layui-tab-content {
+        padding: 0;
+        height: 100%;
+    }
+
+    .layui-tab-item {
+        height: 100%;
+    }
+    .treeview .admin-nav-item{
+            color: #a7b1c2 !important;
+            padding-left: 5px;
+    }
+    .treeview .admin-nav-item:hover{
+            color: #fff !important;
+    }
+</style>
+<div class="admincp-header">
+    <div class="logo">
+        <img width="200" src="{$Think.ADMIN_SITE_ROOT}/images/backlogo.png"/>
+    </div>
+    <div class="navbar">
+        <ul class="fr" style="float:right" id="nav">
+            <li>
+                <span>{$Think.lang.ds_shalom},{$Think.session.admin_name}</span>
+                <dl class="layui-nav-child"> <!-- 二级菜单 -->
+                    <dd><a href="javascript:dsLayerOpen('{:url('Index/modifypw')}','{$Think.lang.ds_change_password}')">{$Think.lang.ds_change_password}</a></dd>
+                    <dd><a href="{:url('Login/logout')}">{$Think.lang.ds_safe_withdrawing}</a></dd>
+                </dl>
+            </li>
+            <li><a href="javascript:dsLayerConfirm('{:url('Index/clear')}','{$Think.lang.ds_clear_cache_confirm}')">{$Think.lang.ds_clear_cache}</a></li>
+        </ul>
+    </div>
+</div>
+<div class="admincp-container">
+    <div class="admincp-container-left">
+        <ul class="sidebar-menu" id="gloMenu">
+            {foreach name="menu_list" item="menu" key="fe_menu"}
+            {if !empty($menu.children)}
+            <li class="treeview">
+                <div class="title" id="navT"><i class="iconfont icon-{$fe_menu}"></i><span class="title-txt"> {$menu.text}</span><span class="layui-nav-more"></span></div>
+                <ul class="treeview-menu" id="navC" style="display:none;">
+                    {foreach name="menu.children" item="submenu" key="fe_submenu" }
+                    {if array_intersect(explode("/",substr($submenu['url'],7,-5)),$gupinfo)}
+                        <li><a data-id="{$fe_menu}-{$fe_submenu}" href="{$submenu.url}" class="admin-nav-item">{$submenu.text}</a></li>
+                    {/if}
+                    {/foreach}
+                </ul>
+            </li>
+            {else}
+                <li class="treeview">
+                    <div class="title" id="navT"><i class="iconfont icon-{$fe_menu}"></i><a data-id="{$fe_menu}" href="{$menu.url}" class="admin-nav-item">{$menu.text}</a></div>
+                </li>
+            {/if}
+        
+            {/foreach}
+        </ul>
+    </div>
+
+    <div class="admincp-container-right">
+        <div class="layui-tab layui-tab-card" lay-filter="dsTab" lay-allowclose="true">
+            <ul class="layui-tab-title">
+                <li class="layui-this" lay-id="0">
+                    <cite>{$Think.lang.ds_welcome}</cite>
+                </li>
+            </ul>
+            <div class="layui-tab-content">
+                <div class="layui-tab-item layui-show">
+                    <iframe lay-id="0" src="{:url('Wlcome/index')}" width="100%" height="100%" frameborder="0" scrolling="yes"></iframe>
+                </div>
+            </div>
+        </div>
+    </div>
+    {block name="container"}{/block}
+</div>
+<script type="text/javascript">
+    var width =document.body.clientWidth;
+    var changesmall =function(){
+        if($(".admincp-container-left").css("width")=="200px"){
+            $(".admincp-container-left").css("width","55px");
+            $("#layout-center").css({"position":"absolute","left":"55px","width":(width-55)+"px"});
+            $(".title").attr('title',$(".title .title-txt").html())
+            $(".title .title-txt").css("display","none");
+            $('.admincp-container-right').css("left","55px");
+        }else{
+            $(".admincp-container-left").css("width","200px");
+            $("#layout-center").css({"position":"absolute","left":"130px","width":(width-130)+"px"});
+            $(".title").attr('title',"")
+            $(".title span").css("display","inline-block");
+            $('.admincp-container-right').css("left","200px");
+        }
+    }
+
+</script>
+<script type="text/javascript">
+    layui.use(['jquery', 'element', 'layer'], function () {
+        var $ = layui.jquery, element = layui.element, layer = layui.layer;
+        $('.layui-tab-content').height($(window).height() - 145);
+        var tab = {
+            add: function (title, url, id) {
+                element.tabAdd('dsTab', {
+                    title: title,
+                    content: '<iframe width="100%" height="100%" lay-id="' + id + '" frameborder="0" src="' + url + '" scrolling="yes" class="x-iframe"></iframe>',
+                    id: id
+                });
+            }, change: function (id) {
+                element.tabChange('dsTab', id);
+            }
+        };
+        $('.admin-nav-item').click(function (event) {
+            var that = $(this);
+            if ($('iframe[src="' + that.attr('href') + '"]')[0]) {
+                tab.change(that.attr('data-id'));
+                event.stopPropagation();
+                return false;
+            }
+            if ($('iframe').length == 20) {
+                layer.msg('最多可打开20个标签页');
+                return false;
+            }
+            that.css({color: '#fff'});
+            tab.add(that.text(), that.attr('href'), that.attr('data-id'));
+            tab.change(that.attr('data-id'));
+            event.stopPropagation();
+            return false;
+        });
+        $(document).on('click', '.layui-tab-close', function () {
+            $('.layui-nav-child a[data-id="' + $(this).parent('li').attr('lay-id') + '"]').css({color: 'rgba(255,255,255,.7)'});
+        });
+    });
+    $('#gloMenu').on('click', '#navT', function () {
+        var parent = $(this).closest('li');
+        var index = parent.index();
+        if (parent.find('#navC').find('li').length) {
+            if (parent.hasClass('open')) {
+                parent.find('#navC').stop(true).slideUp(300, function () {
+                    parent.removeClass('open')
+                });
+            } else {
+                var openLi = $('.sidebar-menu').find('li.open');
+                openLi.removeClass('open').find('#navC').stop(true).slideUp(300);
+                parent.addClass('open').find('#navC').stop(true).slideDown(300);
+            }
+        }
+    })
+    $('#nav').on('click', '#nav1', function () {
+        var parent = $(this).closest('li');
+        var index = parent.index();
+        if (parent.find('#nav2').find('li').length) {
+            if (parent.hasClass('open')) {
+                parent.find('#nav2').stop(true).slideUp(300, function () {
+                    parent.removeClass('open')
+                });
+            } else {
+                var openLi = $('.sidebar-menu').find('li.open');
+                openLi.removeClass('open').find('#nav2').stop(true).slideUp(300);
+                parent.addClass('open').find('#nav2').stop(true).slideDown(300);
+            }
+        }
+    })
+</script>
+</body>
+
+
+</html>

+ 41 - 0
application/admin/view/index/modifypw.html

@@ -0,0 +1,41 @@
+{extend name="layout:home" /}
+
+{block name="container"}
+<form class="layui-form layui-form-pane" method="post">
+    <div class="layui-tab layui-tab-card">
+        {include file="layout/admin_items" /}
+        <div class="layui-tab-content page-tab-content">
+            <div class="layui-tab-item layui-show ">
+                <div class="layui-form-item">
+                    <label class="layui-form-label">{$Think.lang.index_modifypw_oldpw}</label>
+                    <div class="layui-input-inline">
+                        <input type="password" class="layui-input field-name" name="old_pw" id="old_pw" value=""  placeholder="{$Think.lang.ds_please_enter}{$Think.lang.index_modifypw_oldpw}" />
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <label class="layui-form-label">{$Think.lang.index_modifypw_newpw}</label>
+                    <div class="layui-input-inline">
+                        <input type="password" class="layui-input field-name" name="new_pw" id="new_pw" value=""  placeholder="{$Think.lang.ds_please_enter}{$Think.lang.index_modifypw_newpw}" />
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <label class="layui-form-label">{$Think.lang.index_modifypw_newpw2}</label>
+                    <div class="layui-input-inline">
+                        <input type="password" class="layui-input field-name" name="new_pw2" id="new_pw2" value=""  placeholder="{$Think.lang.ds_please_enter}{$Think.lang.index_modifypw_newpw2}" />
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <div class="layui-input-inline">
+                        <input type="submit" class="layui-btn layui-btn-normal" lay-submit value="{:lang('ds_submit')}" />
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</form>
+<script>
+    layui.use('form', function () {
+        var form = layui.form;
+    });
+</script>
+{/block}

+ 90 - 0
application/admin/view/jobcv/index.html

@@ -0,0 +1,90 @@
+{extend name="layout:home" /}
+{block name="container"}
+<div class="layui-tab layui-tab-card">
+    {include file="layout/admin_items" /}
+    <div class="layui-tab-content page-tab-content">
+        <form action="" method="post" enctype="multipart/form-data" >
+            <div class="layui-form-item">
+                <div class="layui-inline">
+                    <select name="lyaddtime" lay-verify="" class="layui-select layui-unselect layui-form-select">
+                        <option value ="{$lyaddtime}">{if $lyaddtime==1}近三天{elseif $lyaddtime==2/}最近一周{elseif $lyaddtime==3/}最近一月{else}所有{/if}</option>
+                        <option value ="0">所有</option>
+                        <option value ="1">近三天</option>
+                        <option value="2">最近一周</option>
+                        <option value="3">最近一月</option>
+                    </select>
+                </div>
+                <div class="layui-inline">
+                    <select name="record_uid" lay-verify="" class="layui-select layui-unselect layui-form-select">
+                        <option value="">请选择所属公司</option>
+                        {volist name="allgs" id="vv"}
+                            <option value="{$vv.member_id}">{$vv.member_name}</option>
+                        {/volist}
+                    </select>
+                </div>
+                <div class="layui-inline">
+                    <select name="record_readok" lay-verify="" class="layui-select layui-unselect layui-form-select">
+                        <option value="">请选择客服</option>
+                        {volist name="allkf" id="v"}
+                            <option value="{$v.service_id}">{$v.service_name}</option>
+                        {/volist}
+                    </select>
+                </div>
+                <div class="layui-inline">
+                    <button type="submit" class="layui-btn search-subBtn">搜索</button>
+                </div>
+            </div>
+        </form>
+        <table class="layui-table lay-even">
+            <colgroup>
+                <col width="150">
+                <col>
+            </colgroup>
+            <thead>
+                <tr>
+                    <th>所属公司</th>
+                    <th>客服人员</th>
+                    <th>对话用户</th>
+                    <th>时间</th>
+                    <th>内容</th>
+                </tr>
+            </thead>
+            <tbody>
+            {if $record_list}
+            {volist name="record_list" id="record" key="k"}
+            <tr>
+                <td>{$gslist[$k-1]['member_name']}</td>
+                <td>{$kflist[$k-1]['service_name']}</td>
+                <td>{$record.vid}</td>
+                <td>{$record.create_time|date='Y-m-d H:i:s',###}</td>
+                <td>{$conlist[$k-1]['content'] ?: '暂未结果'}</td>
+            </tr>
+            {/volist}
+            {else}
+            <td>无数据</td>
+            {/if}
+        </tbody>
+        </table>
+        {$show_page}
+    </div>
+</div>
+<script type="text/javascript" src="{$Think.ADMIN_SITE_ROOT}/js/jquery.edit.js"></script>
+<script>
+    layui.use('form', function () {
+        var form = layui.form;
+    });
+    layui.use('laydate', function(){
+        var laydate = layui.laydate;
+        laydate.render({
+            elem: '#kstime'
+        });
+    });
+    layui.use('laydate', function(){
+        var laydate = layui.laydate;
+        laydate.render({
+            elem: '#endtime'
+        });
+    });
+</script>
+
+{/block}

+ 14 - 0
application/admin/view/layout/admin_items.html

@@ -0,0 +1,14 @@
+{if $admin_item}
+<ul class="layui-tab-title">
+    {foreach name="admin_item" item="item" }
+    {if array_intersect(explode(" ",str_replace("/", ".",substr($item['url'],7,-5))),$allpower) || array_intersect(explode(" ",str_replace("/", ".",substr($item['url'],31,-16))),$allpower)}
+    <li {if condition="$item.name eq $curitem" }class="layui-this" {/if}>
+    <a href="{$item.url}">{$item.text}</a>
+    {/if}
+    </li>
+    {/foreach}
+    <div class="tool-btns">
+        <a href="javascript:location.reload();" title="刷新当前页面" class="iconfont icon-reload"></i></a>
+    </div>
+</ul>
+{/if}

+ 32 - 0
application/admin/view/layout/home.html

@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <meta charset="utf-8">
+        <meta http-equiv="X-UA-Compatible" content="IE=edge">
+        <title>麦帮官网</title>
+        <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
+        <!-- Bootstrap 3.3.7 -->
+        <link rel="stylesheet" href="{$Think.PLUGINS_SITE_ROOT}/layui/css/layui.css">
+        <link rel="stylesheet" href="{$Think.ADMIN_SITE_ROOT}/css/admin.css">
+        <link rel="stylesheet" href="{$Think.ADMIN_SITE_ROOT}/iconfont/iconfont.css">
+        <script src="{$Think.PLUGINS_SITE_ROOT}/jquery-2.1.4.min.js"></script>
+        <script src="{$Think.ADMIN_SITE_ROOT}/js/admin.js"></script>
+        <script type="text/javascript" src="{$Think.PLUGINS_SITE_ROOT}/layui/layui.js"></script>
+        <script type="text/javascript">
+            var BASESITEROOT = "{$Think.BASE_SITE_ROOT}";
+            var ADMINSITEROOT = "{$Think.ADMIN_SITE_ROOT}";
+            var BASESITEURL = "{$Think.BASE_SITE_URL}";
+            var HOMESITEURL = "{$Think.HOME_SITE_URL}";
+            var ADMINSITEURL = "{$Think.ADMIN_SITE_URL}";
+            layui.use('layer', function () {
+                var layer = layui.layer;
+            });
+        </script>
+    </head>
+    <body>
+        {block name="container"}{/block}
+    </body>
+</html>
+
+
+

+ 53 - 0
application/admin/view/login/index.html

@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <title>麦帮官网</title>
+    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
+    <!-- Bootstrap 3.3.7 -->
+    <link rel="stylesheet" href="{$Think.PLUGINS_SITE_ROOT}/layui/css/layui.css">
+    <link rel="stylesheet" href="{$Think.ADMIN_SITE_ROOT}/css/admin.css">
+    <script src="{$Think.PLUGINS_SITE_ROOT}/jquery-2.1.4.min.js"></script>
+    <script src="{$Think.ADMIN_SITE_ROOT}/js/admin.js"></script>
+    <link rel="stylesheet" href="{$Think.PLUGINS_SITE_ROOT}/font-awesome/css/font-awesome.min.css">
+    <script type="text/javascript">
+        var BASESITEROOT = "{$Think.BASE_SITE_ROOT}";
+        var ADMINSITEROOT = "{$Think.ADMIN_SITE_ROOT}";
+        var BASESITEURL = "{$Think.BASE_SITE_URL}";
+        var HOMESITEURL = "{$Think.HOME_SITE_URL}";
+        var ADMINSITEURL = "{$Think.ADMIN_SITE_URL}";
+    </script>
+</head>
+<body style="background-image:url({$Think.ADMIN_SITE_ROOT}/wallpage/bg_<?php echo rand(0,8)?>.jpg);background-size: cover;">
+<div class="login">
+    <div class="login_body">
+        <div class="login_header">
+            <img style="margin: 0px auto; display: block; margin-bottom: 10px;" src="{$Think.ADMIN_SITE_ROOT}/images/logo.png"/>
+        </div>
+        <div class="login_content">
+            <form method="post">
+                <div class="form-group">
+                    <input type="text" name="admin_name" placeholder="{:lang('login_admin_name')}" required class="text">
+                </div>
+                <div class="form-group">
+                    <input type="password" name="admin_password" placeholder="{:lang('login_admin_password')}" required class="text">
+                </div>
+                <div class="form-group">
+                    <input type="text" name="captcha" placeholder="{:lang('login_captcha')}" required class="text" style="width:60%;float:left;">
+                    <img src="{:captcha_src()}" style="width:30%;height:38px;" id="change_captcha"/>
+                </div>
+                <div class="form-group">
+                    <input type="submit" class="layui-btn" value="{:lang('login_sumbit')}" lay-submit lay-filter="login"/>
+                </div>
+            </form>
+        </div>
+    </div>
+</div>
+<script>
+    $('#change_captcha').click(function () {
+        $(this).attr('src', '{:captcha_src()}?'+(new Date().getTime()));
+    });
+</script>
+</body>
+</html>

+ 78 - 0
application/admin/view/member/form.html

@@ -0,0 +1,78 @@
+{extend name="layout:home" /}
+
+{block name="container"}
+<?php 
+    if(empty($member['member_usetime'])){
+        $member['member_usetime'] = '';
+    }
+?>
+<form class="layui-form layui-form-pane" method="post">
+    <div class="layui-tab layui-tab-card">
+        <div class="layui-tab-content page-tab-content">
+            <div class="layui-tab-item layui-show ">
+                <div class="layui-form-item">
+                    <label class="layui-form-label">{$Think.lang.member_name}</label>
+                    <div class="layui-input-block">
+                        <input type="text" class="layui-input field-name" name="member_name" id="member_name" value="{$member.member_name|default=''}" lay-verify="member_name" autocomplete="off" placeholder="{:lang('ds_please_enter')}{:lang('member_name')}" required />
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <label class="layui-form-label">邮箱地址</label>
+                    <div class="layui-input-block">
+                        <input type="text" class="layui-input field-name" name="member_mailbox" id="member_mailbox" value="{$member.member_mailbox|default=''}" lay-verify="email" autocomplete="off" placeholder="{:lang('ds_please_enter')}邮箱地址" required />
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <label class="layui-form-label">{$Think.lang.member_url}</label>
+                    <div class="layui-input-block">
+                        <input type="text" class="layui-input field-name" name="member_url" id="member_url" value="{$member.member_url|default=''}"  lay-verify="url" placeholder="{if $member.add eq '1'} {:lang('ds_please_enter')}{:lang('member_url')}{else}{:lang('member_edit_password_keep')}{/if} " />
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <label class="layui-form-label"> {$Think.lang.member_mobile}</label>
+                    <div class="layui-input-block">
+                        <input type="text" class="layui-input field-name" name="member_mobile" id="member_mobile" value="{$member.member_mobile|default=''}"  placeholder="{:lang('ds_please_enter')}{:lang('member_mobile')}" lay-verify="phone"/>
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <label class="layui-form-label">{$Think.lang.member_contacts}</label>
+                    <div class="layui-input-block">
+                        <input type="text" class="layui-input field-name" name="member_contacts" id="member_contacts" value="{$member.member_contacts|default=''}"  placeholder="{:lang('ds_please_enter')}{:lang('member_contacts')}" />
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <label class="layui-form-label"> {$Think.lang.member_usetime} </label>
+                    <div class="layui-input-block">
+                        <select name="member_usetime"> 
+                            <option value="{$member.member_usetime}">{if $member.member_usetime}{$member.member_usetime}{else}请选择时间段{/if}</option>
+                            <option value="一个月">一个月</option> 
+                            <option value="一季度">一季度</option>
+                            <option value="半年">半年</option> 
+                            <option value="一年">一年</option> 
+                        </select>
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <label class="layui-form-label">{$Think.lang.member_status}</label>
+                    <div class="layui-input-block">
+                        <input type="checkbox" name="member_status" lay-skin="switch" lay-text="{:lang('member_yes')}|{:lang('member_no')}" value="1" {if condition="$member.member_status eq '1'"}checked{/if}>
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <div class="layui-input-block">
+                        <input type="submit" class="layui-btn layui-btn-normal" lay-submit value="{:lang('ds_submit')}" />
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</form>
+<script>
+    layui.use('form', function() {
+        var form = layui.form;
+    });
+</script>
+{/block}
+
+
+

+ 92 - 0
application/admin/view/member/index.html

@@ -0,0 +1,92 @@
+{extend name="layout:home" /}
+{block name="container"}
+<div class="layui-tab layui-tab-card">
+    {include file="layout/admin_items" /}
+    <div class="layui-tab-content page-tab-content">
+        <!-- 搜索框开始 -->
+        <div class="search-form">
+        <form class="" method="post">
+            <div class="layui-form-item">
+                <div class="layui-inline">
+                    <input type="text" name="title"  placeholder="输入名称或联系人或电话" autocomplete="off" class="layui-input">
+                </div>
+                <div class="layui-inline">
+                    <input type="text" class="layui-input" name="timeRang" id="timeRang" placeholder="选择时间段" style="width: 170px;">
+                </div>
+                <div class="layui-inline">
+                    <button type="submit" class="layui-btn search-subBtn">搜索</button>
+                </div>
+            </div>
+        </form>
+        </div>
+        <!-- 搜索框结束 -->
+        <table class="layui-table lay-even">
+            <colgroup>
+                <col width="150">
+                <col width="200">
+                <col>
+            </colgroup>
+            <thead>
+            <tr>
+                <th>{$Think.lang.member_name}</th>
+                <th>{$Think.lang.member_url}</th>
+                <th>{$Think.lang.member_mobile}</th>
+                <th>邮箱</th>
+                <th>{$Think.lang.member_contacts}</th>
+                <th>{$Think.lang.member_add_time}</th>
+                <th>{$Think.lang.member_usetime}</th>
+                <th>{$Think.lang.member_validitytime}</th>
+                <th>{$Think.lang.member_status}</th>
+                <th>操作</th>
+            </tr>
+            </thead>
+            <tbody>
+            {if $member_list}
+            {volist name="member_list" id="member"}
+            <tr>
+                <td>{$member.member_name}</td>
+                <td>{$member.member_url}</td>
+                <td>{$member.member_mobile}</td>
+                <td>{$member.member_mailbox}</td>
+                <td>{$member.member_contacts}</td>
+                <td>{$member.member_add_time|date='Y-m-d H:i:s',###}</td>
+                <td>{$member.member_usetime}</td>
+                <td>{$member.member_validitytime|date='Y-m-d H:i:s',###}</td>
+                <td>{if $member['member_status']==1}通过{else}拒绝{/if}</td>
+                <td>
+                    {if array_intersect(explode(" ",str_replace("/", ".","member/edit")),$allpower)}
+                        <a href="javascript:dsLayerOpen('{:url('Member/edit',['member_id'=>$member.member_id])}','{$Think.lang.ds_edit}-{$member.member_name}')" class="layui-btn layui-btn-xs"><i class="layui-icon layui-icon-edit"></i>{$Think.lang.ds_edit}</a>
+                    {/if}
+                    {if array_intersect(explode(" ",str_replace("/", ".","member/del")),$allpower)}
+                        <a href="javascript:dsLayerConfirm('{:url('Member/del',['member_id'=>$member.member_id])}','{$Think.lang.member_confirm_del}')" class="layui-btn layui-btn-xs layui-btn-danger"><i class="layui-icon layui-icon-delete"></i>{$Think.lang.ds_del}</a>
+                    {/if}
+                </td>
+            </tr>
+            {/volist}
+            {else}
+            <td>无数据</td>
+            {/if}
+            </tbody>
+        </table>
+        {$show_page}
+    </div>
+</div>
+<script type="text/javascript">
+    layui.use('laydate', function(){
+      var laydate = layui.laydate;
+      
+      //执行一个laydate实例
+      laydate.render({
+        elem: '#creatTime' //指定元素
+      });
+        laydate.render({
+            elem:'#timeRang',
+            range:true,
+            format: 'yyyy/MM/dd',
+            done: function(value, date){
+                /* 时间选择完成后的回调 */
+            }
+        })
+    });
+</script>
+{/block}

+ 60 - 0
application/admin/view/message/form.html

@@ -0,0 +1,60 @@
+{extend name="layout:home" /}
+
+{block name="container"}
+<form class="layui-form layui-form-pane" method="post" enctype="multipart/form-data" >
+    <div class="layui-tab layui-tab-card">
+        <div class="layui-tab-content page-tab-content">
+            <div class="layui-tab-item layui-show ">
+                <div class="layui-form-item">
+                    <label class="layui-form-label">{$Think.lang.message_customer}</label>
+                    <div class="layui-input-inline">
+                        <input type="text" class="layui-input field-name" value="{$message.message_customer}" disabled />
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <label class="layui-form-label">{$Think.lang.message_way}</label>
+                    <div class="layui-input-inline">
+                        <input type="text" class="layui-input field-name" class="layui-input field-name" value="{$message.message_way}" disabled />
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <label class="layui-form-label">{$Think.lang.message_ctitle}</label>
+                    <div class="layui-input-inline">
+                        <input type="text" class="layui-input field-name" value="{$message.message_ctitle}" disabled />
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <label class="layui-form-label">{$Think.lang.message_content}</label>
+                    <div class="layui-input-inline">
+                        <textarea class="layui-textarea" disabled>{$message.message_content}</textarea>
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <label class="layui-form-label"><b>{$Think.lang.message_useinfo}</b></label>
+                    <div class="layui-input-inline">
+                        <textarea class="layui-textarea field-name" name="message_useinfo" placeholder="{$Think.lang.ds_please_enter}{$Think.lang.message_useinfo}">{$message.message_useinfo}</textarea>
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <label class="layui-form-label"><b>处理结果</b></label>
+                    <div class="layui-input-inline">
+                        <textarea class="layui-textarea field-name" name="message_result" placeholder="{$Think.lang.ds_please_enter}处理结果">{$message.message_result}</textarea>
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <div class="layui-input-inline">
+                        <input type="submit" class="layui-btn layui-btn-normal" lay-submit value="{:lang('ds_submit')}" />
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</form>
+<script>
+    layui.use('form', function () {
+        var form = layui.form;
+    });
+</script>
+{/block}
+
+

+ 106 - 0
application/admin/view/message/index.html

@@ -0,0 +1,106 @@
+{extend name="layout:home" /}
+{block name="container"}
+<div class="layui-tab layui-tab-card">
+    {include file="layout/admin_items" /}
+    <div class="layui-tab-content page-tab-content">
+        <form action="" method="post" enctype="multipart/form-data" >
+            <div class="layui-form-item">
+                <div class="layui-inline">
+                    <select name="lyaddtime" lay-verify="" class="layui-select layui-unselect layui-form-select">
+                        <option value ="{$lyaddtime}">{if $lyaddtime==1}近三天{elseif $lyaddtime==2/}最近一周{elseif $lyaddtime==3/}最近一月{else}所有{/if}</option>
+                        <option value ="0">所有</option>
+                        <option value ="1">近三天</option>
+                        <option value="2">最近一周</option>
+                        <option value="3">最近一月</option>
+                    </select>
+                </div>
+                <div class="layui-inline">
+                    <select name="message_sid" lay-verify="" class="layui-select layui-unselect layui-form-select">
+                        <option value="">请选择所属公司</option>
+                        {volist name="allgs" id="vv"}
+                            <option value="{$vv.member_id}">{$vv.member_name}</option>
+                        {/volist}
+                    </select>
+                </div>
+                <div class="layui-inline">
+                    <select name="message_readok" lay-verify="" class="layui-select layui-unselect layui-form-select">
+                        <option value="">请选择是否处理</option>
+                        <option value="1">已处理</option>
+                        <option value="2">未处理</option>
+                    </select>
+                </div>
+                <div class="layui-inline">
+                    <button type="submit" class="layui-btn search-subBtn">搜索</button>
+                </div>
+            </div>
+        </form>
+        <table class="layui-table lay-even">
+            <colgroup>
+                <col width="150">
+                <col>
+            </colgroup>
+            <thead>
+                <tr>
+                    <th>{$Think.lang.message_customer}</th>
+                    <th>{$Think.lang.message_way}</th>
+                    <th>留言内容</th>
+                    <th>{$Think.lang.message_readok}</th>
+                    <th>{$Think.lang.message_useinfo}</th>
+                    <th>处理结果</th>
+                    <th>回复者</th>
+                    <th>{$Think.lang.message_addtime}</th>
+                    <th>处理时间</th>
+                    <th>{$Think.lang.ds_operation}</th>
+                </tr>
+            </thead>
+            <tbody>
+            {if $message_list}
+            {volist name="message_list" id="message" key="k"}
+            <tr>
+                <td>{$message.message_customer ?: '匿名'}</td>
+                <td>{$message.message_way}</td>
+                <td>{$message.message_content}</td>
+                <td>{if condition="$message.message_readok eq 0"}否{else}是{/if}</td>
+                <td>{$message.message_useinfo ?: '暂未回复'}</td>
+                <td>{$message.message_result ?: '暂未结果'}</td>
+                <td>{$admin_list[$k-1]['member_name']}</td>
+                <td>{$message.message_addtime|date='Y-m-d H:i:s',###}</td>
+                <td>{$message.message_replytime|date='Y-m-d H:i:s',###}</td>
+                <td>
+                    {if array_intersect(explode(" ",str_replace("/", ".","message/reply")),$allpower)}
+                        <a href="javascript:dsLayerOpen('{:url('message/reply',['message_id'=>$message.message_id])}','留意着-{$message.message_way}')"class="layui-btn layui-btn-xs"><i class="layui-icon layui-icon-edit"></i>{$Think.lang.ds_view}</a>
+                    {/if}
+                    {if array_intersect(explode(" ",str_replace("/", ".","message/del")),$allpower)}
+                        <a href="javascript:dsLayerConfirm('{:url('message/del',['message_id'=>$message.message_id])}','{$Think.lang.ds_confirm_cancel}')" class="layui-btn layui-btn-danger layui-btn-xs"><i class="layui-icon layui-icon-delete"></i>{$Think.lang.ds_del}</a>
+                    {/if}
+                </td>
+            </tr>
+            {/volist}
+            {else}
+            <td>无数据</td>
+            {/if}
+        </tbody>
+        </table>
+        {$show_page}
+    </div>
+</div>
+<script type="text/javascript" src="{$Think.ADMIN_SITE_ROOT}/js/jquery.edit.js"></script>
+<script>
+    layui.use('form', function () {
+        var form = layui.form;
+    });
+    layui.use('laydate', function(){
+        var laydate = layui.laydate;
+        laydate.render({
+            elem: '#kstime'
+        });
+    });
+    layui.use('laydate', function(){
+        var laydate = layui.laydate;
+        laydate.render({
+            elem: '#endtime'
+        });
+    });
+</script>
+
+{/block}

+ 186 - 0
application/admin/view/product/form.html

@@ -0,0 +1,186 @@
+{extend name="layout:home" /}
+
+{block name="container"}
+<form class="layui-form" method="post" enctype="multipart/form-data" >
+    <div class="layui-tab layui-tab-card">
+        {include file="layout/admin_items" /}
+        <div class="layui-tab-content page-tab-content">
+            <div class="layui-tab-item layui-show ">
+                
+                <div class="layui-collapse">
+                    <div class="layui-colla-item">
+                        <h2 class="layui-colla-title">基本设置</h2>
+                        <div class="layui-colla-content layui-show">
+                            <div class="layui-form-item">
+                                <label class="layui-form-label">所属类别</label>
+                                <div class="layui-input-inline">
+                                    <select name="product_type" id="product_type">
+                                        <option value="{$product['product_type']}">{if $product.product_type==1}客服常用语{elseif $product.product_type==2}客户常用问题{elseif $product.product_type==3}客服快捷回复{elseif $product.product_type==4}自动回复{elseif $product.product_type==5}新闻{else}请选择类别{/if}</option>
+                                        <option value="1">客服常用语</option>
+                                        <option value="2">客户常用问题</option>
+                                        <option value="3">客服快捷回复</option>
+                                        <option value="4">自动回复</option>
+                                        <option value="5">新闻</option>
+                                    </select>
+                                </div>
+                            </div>
+                            <div class="layui-form-item">
+                                <label class="layui-form-label">时间段</label>
+                                <div class="layui-input-inline">
+                                    <select name="product_usetime" id="product_usetime">
+                                        <option value="{$product['product_usetime']}">{if $product.product_usetime==1}凌晨{elseif $product.product_usetime==2}上午{elseif $product.product_usetime==3}下午{elseif $product.product_usetime==4}晚上{else}请选择时间段{/if}</option>
+                                        <option value="1">凌晨</option>
+                                        <option value="2">上午</option>
+                                        <option value="3">下午</option>
+                                        <option value="4">晚上</option>
+                                    </select>
+                                </div>
+                            </div>
+                            <div class="layui-form-item">
+                                <label class="layui-form-label">所属公司</label>
+                                <div class="layui-input-inline">
+                                    <select name="product_companyid" id="product_companyid">
+                                        <option value="{$onlygs.member_id}">{$onlygs.member_name}</option>
+                                        {foreach name="allgs" id="v"}
+                                            <option value="{$v.member_id}">{$v.member_name}</option>
+                                        {/foreach}
+                                    </select>
+
+                                </div>
+                            </div>
+                            <div class="layui-form-item">
+                                <label class="layui-form-label">标题</label>
+                                <div class="layui-input-inline">
+                                    <input type="text" class="layui-input field-name" name="product_title" id="product_title" value="{$product.product_title|default=''}" lay-verify="product_title" autocomplete="off" placeholder="{$Think.lang.ds_please_enter}标题" required />
+                                </div>
+                            </div>
+                            <div class="layui-form-item">
+                                <label class="layui-form-label">副标题</label>
+                                <div class="layui-input-inline">
+                                    <input type="text" class="layui-input field-name" name="product_ctitle" id="product_ctitle" value="{$product.product_ctitle|default=''}" lay-verify="product_ctitle" autocomplete="off" placeholder="{$Think.lang.ds_please_enter}副标题" required />
+                                </div>
+                            </div>
+
+                            <div class="layui-form-item">
+                                <label class="layui-form-label">关键字</label>
+                                <div class="layui-input-inline">
+                                    <input type="text" class="layui-input field-name" name="product_keywords" id="product_keywords" value="{$product.product_keywords|default=''}" lay-verify="product_keywords" autocomplete="off" placeholder="{$Think.lang.ds_please_enter}关键字" required />
+                                </div>
+                            </div>
+                            <div class="layui-form-item">
+                                <label class="layui-form-label">状态</label>
+                                <div class="layui-input-inline">
+                                    <input type="checkbox" name="product_status" lay-skin="switch" lay-text="{$Think.lang.ds_yes}|{$Think.lang.ds_no}" value="1" {if condition="$product.product_status eq '1'"}checked{/if}>
+                                </div>
+                            </div>
+                            <div class="layui-form-item">
+                                <label class="layui-form-label">是否跳转</label>
+                                <div class="layui-input-inline">
+                                    <input type="checkbox" name="product_isjump" lay-skin="switch" lay-text="{$Think.lang.ds_yes}|{$Think.lang.ds_no}" value="1" {if condition="$product.product_isjump eq '1'"}checked{/if}>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                    
+                    <div class="layui-colla-item">
+                        <h2 class="layui-colla-title">详情内容</h2>
+                        <div class="layui-colla-content">
+                            <div class="layui-form-item">
+                                <label class="layui-form-label">{$Think.lang.product_content}</label>
+                                <div class="layui-input-block">
+                                    {:build_editor(['name'=>'product_content','content'=>isset($product.product_content)?$product.product_content:''])}
+                                    <textarea name="product_content" id="product_content" style="min-height:400px;"></textarea>
+                                </div>
+                            </div>
+                            <!-- <button type="button" class="layui-btn" id="upload_productpic"><i class="layui-icon"></i>{$Think.lang.ds_uploading_files}</button> -->
+                            <div class="selected_pic clearfix">
+                                <ul>
+                                    {foreach name="pic_list" id="productpic"}
+                                    <li id="{$productpic.pic_id}">
+                                        <img src="{:get_product_img($productpic['pic_cover'])}"/>
+                                        <i class="delect layui-icon" title="{$Think.lang.ds_insert_editor}" onclick="insert_editor('{:get_product_img($productpic['pic_cover'])}')">&#xe654;</i>
+                                        <i class="insert layui-icon" title="{$Think.lang.ds_delete_picture}" onclick="del_productpic({$productpic.pic_id})">&#xe640;</i>
+                                    </li>
+                                    {/foreach}
+                                </ul>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                
+                <div class="layui-form-item mt20">
+                    <div class="layui-input-inline">
+                        <input type="submit" class="layui-btn layui-btn-normal" lay-submit value="{:lang('ds_submit')}" />
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</form>
+<script>
+    layui.use('form', function () {
+        var form = layui.form;
+    });
+    layui.use('element', function () {
+        var element = layui.element;
+    });
+    layui.use('laydate', function(){
+        var laydate = layui.laydate;
+        laydate.render({
+            elem: '#product_addtime'
+        });
+    });
+    /**
+     * 图片异步上传
+     */
+    layui.use('upload', function () {
+        var $ = layui.jquery, upload = layui.upload;
+        //指定允许上传的文件类型
+        upload.render({
+            elem: '#upload_productpic'
+            , url: "{:url('pic/upload',['pic_type_id'=>$Request.param.product_id,'pic_type'=>$product_pic_type.pic_type])}"
+            , accept: 'file' //普通文件
+            , done: function (res) {
+                add_uploadedfile(res);
+//                console.log(res)
+            }
+        });
+    });
+    function add_uploadedfile(file_data)
+    {
+        var newImg = '<li id="' + file_data.file_id + '"><img src="' + file_data.file_url + '"/><i class="delect layui-icon" title="插入编辑器" onclick="insert_editor(\''+file_data.file_url+'\')">&#xe654;</i><i class="insert layui-icon" title="删除图片" onclick="del_productpic(' + file_data.file_id + ')">&#xe640;</i></li>'
+        $('.selected_pic ul').prepend(newImg);
+    }
+
+
+    /**
+     * 插入编辑器
+     */
+    function insert_editor(file_path){
+        ue.execCommand('insertimage', {src:file_path});
+    }
+
+    function del_productpic(file_id)
+    {
+        layer.open({
+            content: '{$Think.lang.ds_confirm_cancel}',
+            yes: function(index, layero){
+                $.getJSON("{:url('pic/del')}",{file_id: + file_id,pic_type:'product'}, function(result){
+                    if(result){
+                        $('#' + file_id).remove();
+                        layer.msg('{$Think.lang.del_succ}');
+                        layer.close(index);
+                        return;
+                    }else{
+                        layer.msg('{$Think.lang.del_fail}');
+                        layer.close(index);
+                        return;
+                    }
+                });
+            }
+        });
+    }
+</script>
+{/block}
+
+

+ 81 - 0
application/admin/view/product/index.html

@@ -0,0 +1,81 @@
+{extend name="layout:home" /}
+{block name="container"}
+<div class="layui-tab layui-tab-card">
+    {include file="layout/admin_items" /}
+    <div class="layui-tab-content page-tab-content">
+    <!-- 搜索框开始 -->
+        <div class="search-form">
+        <form class="" method="post">
+            <div class="layui-form-item">
+                <div class="layui-inline">
+                    <input type="text" name="product_keywords"  placeholder="输入关键字" autocomplete="off" class="layui-input">
+                </div>
+                <div class="layui-inline">
+                    <select name="product_type" lay-verify="" class="layui-select layui-unselect layui-form-select">
+                        <option value="">请选择类别</option>
+                        <option value="1">客服常用语</option>
+                        <option value="2">客户常用问题</option>
+                        <option value="3">客服快捷回复</option>
+                        <option value="4">自动回复</option>
+                        <option value="5">新闻</option>
+                    </select>
+                </div>
+                <div class="layui-inline">
+                    <button type="submit" class="layui-btn search-subBtn">搜索</button>
+                </div>
+            </div>
+        </form>
+        </div>
+        <!-- 搜索框结束 -->
+        <table class="layui-table lay-even">
+            <colgroup>
+                <col width="150">
+                <col width="200">
+                <col width="100">
+                <col width="100">
+                <col width="100">
+                <col>
+            </colgroup>
+            <thead>
+                <tr>
+                    <th>{$Think.lang.product_title}</th>
+                    <th>副标题</th>
+                    <th>内容</th>
+                    <th>关键字</th>
+                    <th>创建时间</th>
+                    <th>所属公司</th>
+                    <th>所属类别</th>
+                    <th>是否跳转</th>
+                    <th>状态</th>
+                    <th>{$Think.lang.ds_operation}</th>
+                </tr>
+            </thead>
+            <tbody>
+            {if $product_list && $gsname_list}
+            {volist name="product_list" id="product" key="kk"}
+            <tr>
+                <td>{$product.product_title}</td>
+                <td>{$product.product_ctitle}</td>
+                <td>{$conlist[$kk-1]}</td>
+                <td>{$product.product_keywords}</td>
+                <td style="width:80px;">{$product.product_addtime|date='Y-m-d ',###}</td>
+                <td>{$gsname_list[$kk-1]['member_name']}</td>
+                <td>{if $product.product_type==1}客服常用语{elseif $product.product_type==2}客户常用问题{elseif $product.product_type==3}客服快捷回复{elseif $product.product_type==4}自动回复{else}新闻{/if}</td>
+                <td>{if $product.product_isjump==1}跳转{else}不跳转{/if}</td>
+                <td>{if $product.product_status==1}使用中{else}未使用{/if}</td>
+                <td>
+                    <a href="{:url('product/edit',['product_id'=>$product.product_id])}" class="layui-btn layui-btn-xs"><i class="layui-icon layui-icon-edit"></i>{$Think.lang.ds_edit}</a>
+                    <a class="layui-btn layui-btn-danger layui-btn-xs" href="javascript:dsLayerConfirm('{:url('product/del',['product_id'=>$product.product_id])}','{$Think.lang.ds_confirm_cancel}')"><i class="layui-icon layui-icon-delete"></i>{$Think.lang.ds_del}</a>
+                </td>
+            </tr>
+            {/volist}
+            {else}
+            <td>无数据</td>
+            {/if}
+        </tbody>
+        </table>
+        {$show_page}
+    </div>
+</div>
+<script type="text/javascript" src="{$Think.ADMIN_SITE_ROOT}/js/jquery.edit.js"></script>
+{/block}

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 71 - 0
application/admin/view/service/index.html


+ 14 - 0
application/admin/view/service/upload.html

@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="UTF-8">
+<title>Insert title here</title>
+</head>
+<body>
+    <form action="{:url('upload/upfile')}" method="post" enctype="multipart/form-data">
+        <input type='file' name='image'/>
+        <input type='hidden' name='type' value='image'/>
+        <input type='submit' value='提交'/>
+    </form>
+</body>
+</html>

+ 85 - 0
application/admin/view/wlcome/index.html

@@ -0,0 +1,85 @@
+{extend name="layout:home" /}
+{block name="container"}
+<div class="layui-tab-content page-tab-content">
+    <h1>{$Think.lang.wel_version_info}</h1>
+    <table class="layui-table lay-even">
+        <colgroup>
+            <col width="300">
+            <col width="530">
+        </colgroup>
+        <tbody>
+        <tr>
+            <td class="gray_bg">{$Think.lang.wel_version}</td>
+            <td>{$statistics['version']}</td>
+            <td class="gray_bg">{$Think.lang.wel_install_date}</td>
+            <td>{notempty name="statistics['setup_date']"}$statistics['setup_date']{else}{$Think.lang.temporary_installation}{/notempty}</td>
+        </tr>
+        <tr>
+            <td class="gray_bg">{$Think.lang.wel_program_development}</td>
+            <td>{$Think.lang.wel_deshangwangluo}</td>
+            <td class="gray_bg">{$Think.lang.wel_all_right_reserved}</td>
+            <td>{$Think.lang.wel_piracy_must_be_studied}</td>
+        </tr>
+        <tr>
+            <td class="gray_bg">{$Think.lang.wel_aboutus_website}</td>
+            <td><a href="http://www.csdeshang.com" target="_blank">{$Think.lang.aboutus_website}</a></td>
+            <td class="gray_bg">{$Think.lang.wel_aboutus_bbs}</td>
+            <td><a href="http://bbs.csdeshang.com" target="_blank">{$Think.lang.wel_communication_bbs}</a></td>
+        </tr>
+        </tbody>
+    </table>
+
+    <h1>{$Think.lang.wel_sys_info}</h1>
+    <table class="layui-table lay-even">
+        <colgroup>
+            <col width="300">
+            <col width="530">
+        </colgroup>
+        <tbody>
+        <tr>
+            <td class="gray_bg">{$Think.lang.wel_thinkphp_version}</td>
+            <td>{$Think.THINK_VERSION}</td>
+            <td class="gray_bg">{$Think.lang.wel_class_library_file_suffix}</td>
+            <td>{$Think.EXT}</td>
+        </tr>
+        <tr>
+            <td class="gray_bg">{$Think.lang.wel_server_os}</td>
+            <td>{$statistics['os']}</td>
+            <td class="gray_bg">{$Think.lang.wel_server_domain_ip}</td>
+            <td>{$statistics.domain} [ {$statistics.ip} ]</td>
+        </tr>
+        <tr>
+            <td class="gray_bg">WEB {$Think.lang.wel_server}</td>
+            <td>{$statistics['web_server']}</td>
+            <td class="gray_bg">PHP {$Think.lang.wel_version}</td>
+            <td>{$statistics['php_version']}</td>
+        </tr>
+        <tr>
+            <td class="gray_bg">MYSQL {$Think.lang.wel_version}</td>
+            <td>{$statistics['sql_version']}</td>
+            <td class="gray_bg">GD {$Think.lang.wel_version}</td>
+            <td>{$statistics.gdinfo}</td>
+        </tr>
+        <tr>
+            <td class="gray_bg">{$Think.lang.wel_file_uplode_limit}</td>
+            <td>{$statistics.fileupload}</td>
+            <td class="gray_bg">{$Think.lang.wel_max_occupied_memory}</td>
+            <td>{$statistics.memory_limit}</td>
+        </tr>
+        <tr>
+            <td class="gray_bg">{$Think.lang.wel_max_ex_time}</td>
+            <td>{$statistics.max_ex_time}</td>
+            <td class="gray_bg">{$Think.lang.wel_safe_mode}</td>
+            <td>{$statistics.safe_mode}</td>
+        </tr>
+        <tr>
+            <td class="gray_bg">Zlib {$Think.lang.wel_support}</td>
+            <td>{$statistics.zlib}</td>
+            <td class="gray_bg">Curl {$Think.lang.wel_support}</td>
+            <td>{$statistics.curl}</td>
+        </tr>
+        </tbody>
+    </table>
+</div>
+
+{/block}

+ 12 - 0
application/command.php

@@ -0,0 +1,12 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: yunwuxin <448901948@qq.com>
+// +----------------------------------------------------------------------
+
+return [];

+ 632 - 0
application/common.php

@@ -0,0 +1,632 @@
+<?php
+/* 引用全局定义 */
+require __DIR__ . '/common_global.php';
+
+//获取URL访问的ROOT地址 网站的相对路径
+define('BASE_SITE_ROOT', str_replace('/index.php', '', \think\Request::instance()->root()));
+define('PLUGINS_SITE_ROOT', BASE_SITE_ROOT . '/static/plugins');
+define('ADMIN_SITE_ROOT', BASE_SITE_ROOT . '/static/admin');
+define('HOME_SITE_ROOT', BASE_SITE_ROOT . '/static/home');
+define('MOBILE_SITE_ROOT', BASE_SITE_ROOT . '/static/mobile');
+define('LINK_SITE_ROOT', BASE_SITE_ROOT . '/uploads/home/link');
+
+define("REWRITE_MODEL", FALSE); // 设置伪静态
+if (!REWRITE_MODEL) {
+    define('BASE_SITE_URL', \think\Request::instance()->domain() . \think\Request::instance()->baseFile());
+} else {
+    // 系统开启伪静态
+    if (empty(BASE_SITE_ROOT)) {
+        define('BASE_SITE_URL', \think\Request::instance()->domain());
+    } else {
+        define('BASE_SITE_URL', \think\Request::instance()->domain() . \think\Request::instance()->root());
+    }
+}
+
+//检测是否安装 DSCMS 系统
+if(file_exists("install/") && !file_exists("install/install.lock")){
+    header('Location: '.BASE_SITE_ROOT.'/install/install.php');
+    exit();
+}
+
+define('HOME_SITE_URL', BASE_SITE_URL . '/home');
+define('ADMIN_SITE_URL', BASE_SITE_URL . '/admin');
+define('MOBILE_SITE_URL', BASE_SITE_URL . '/mobile');
+define('WAP_SITE_URL', str_replace('/index.php', '', BASE_SITE_URL) . '/wap');
+define('UPLOAD_SITE_URL', str_replace('/index.php', '', BASE_SITE_URL) . '/uploads');
+define('EXAMPLES_SITE_URL', str_replace('/index.php', '', BASE_SITE_URL) . '/examples');
+define('CHAT_SITE_URL', str_replace('/index.php', '', BASE_SITE_URL) . '/static/chat');
+define('SESSION_EXPIRE', 3600);
+
+
+define('PUBLIC_PATH', ROOT_PATH . 'public');
+define('BASE_UPLOAD_PATH', PUBLIC_PATH . '/uploads');
+
+define('TIMESTAMP', time());
+define('DIR_HOME', 'home');
+define('DIR_ADMIN', 'admin');
+define('DIR_PUBLIC', 'public');
+define('DIR_STATIC', 'static');
+
+define('DIR_UPLOAD', 'public/uploads');
+
+define('ATTACH_PATH', 'home');
+define('ATTACH_COMMON', ATTACH_PATH . '/common');
+define('ATTACH_CASES', ATTACH_PATH . '/cases');
+define('ATTACH_PRODUCT', ATTACH_PATH . '/product');
+define('ATTACH_NEWS', ATTACH_PATH . '/news');
+define('ATTACH_LINK', ATTACH_PATH . '/link');
+define('ATTACH_ADV', ATTACH_PATH . '/adv');
+define('ATTACH_MEMBER', ATTACH_PATH . '/member');
+
+define('DS_THEME_STYLE_URL', ROOT_PATH . DIR_PUBLIC .DS. DIR_STATIC . DS .DIR_HOME. DS);
+
+define('ALLOW_IMG_EXT', 'jpg,png,gif,bmp,jpeg');#上传图片后缀
+
+//栏目所属模块
+define('COLUMN_NEWS', 1);   //新闻模块
+define('COLUMN_PRODUCT', 2);//产品模块
+define('COLUMN_CASES', 3);//案例模块
+define('COLUMN_JOB', 4);//招聘模块
+define('COLUMN_LINK', 5);//友情链接
+define('COLUMN_MEMBER', 6);//会员中心
+
+//文章状态
+define('CHECK_OK', 1);//通过
+define('CHECK_FAIL', 2);//失败
+
+//新闻
+define('NEWS_RECYCLE_OK', 0);//没有删除在回收站
+define('NEWS_RECYCLE_FALL', 3);//回收站
+
+//产品
+define('PRODUCT_RECYCLE_OK', 0);//没有删除在回收站
+define('PRODUCT_RECYCLE_FALL', 3);//回收站
+
+/**
+ * KV缓存 读
+ *
+ * @param string $key 缓存名称
+ * @param boolean $callback 缓存读取失败时是否使用回调 true代表使用cache.model中预定义的缓存项 默认不使用回调
+ * @param callable $callback 传递非boolean值时 通过is_callable进行判断 失败抛出异常 成功则将$key作为参数进行回调
+ * @return mixed
+ */
+function rkcache($key, $callback = false)
+{
+    $value = cache($key);
+    if (empty($value) && $callback !== false) {
+        if ($callback === true) {
+            $callback = array(model('cache'), 'call');
+        }
+
+        if (!is_callable($callback)) {
+            exception('Invalid rkcache callback!');
+        }
+        $value = call_user_func($callback, $key);
+        wkcache($key, $value);
+    }
+    return $value;
+}
+
+/**
+ * KV缓存 写
+ *
+ * @param string $key 缓存名称
+ * @param mixed $value 缓存数据 若设为否 则下次读取该缓存时会触发回调(如果有)
+ * @param int $expire 缓存时间 单位秒 null代表不过期
+ * @return boolean
+ */
+function wkcache($key, $value, $expire = 7200)
+{
+    return cache($key, $value, $expire);
+}
+
+/**
+ * 消息提示,主要适用于普通页面AJAX提交的情况
+ *
+ * @param string $message 消息内容
+ * @param string $url 提示完后的URL去向
+ * @param stting $alert_type 提示类型 error/succ/notice 分别为错误/成功/警示
+ * @param string $extrajs 扩展JS
+ * @param int $time 停留时间
+ */
+function showDialog($message = '', $url = '', $alert_type = 'error', $extrajs = '', $time = 2)
+{
+    $message = str_replace("'", "\\'", strip_tags($message));
+
+    $paramjs = null;
+    if ($url == 'reload') {
+        $paramjs = 'window.location.reload()';
+    } elseif ($url != '') {
+        $paramjs = 'window.location.href =\'' . $url . '\'';
+    }
+    if ($paramjs) {
+        $paramjs = 'function (){' . $paramjs . '}';
+    } else {
+        $paramjs = 'null';
+    }
+    $modes = array('error' => 'alert', 'succ' => 'succ', 'notice' => 'notice', 'js' => 'js');
+    $cover = $alert_type == 'error' ? 1 : 0;
+    $extra = 'parent.showDialog(\'' . $message . '\', \'' . $modes[$alert_type] . '\', null, ' . ($paramjs ? $paramjs : 'null') . ', ' . $cover . ', null, null, null, null, ' . (is_numeric($time) ? $time : 'null') . ', null);';
+    $extra = '<script type="text/javascript" reload="1">' . $extra . '</script>';
+    if ($extrajs != '' && substr(trim($extrajs), 0, 7) != '<script') {
+        $extrajs = '<script type="text/javascript" reload="1">' . $extrajs . '</script>';
+    }
+    $extra .= $extrajs;
+    ob_end_clean();
+    @header("Expires: -1");
+    @header("Cache-Control: no-store, private, post-check=0, pre-check=0, max-age=0", FALSE);
+    @header("Pragma: no-cache");
+    @header("Content-type: text/xml; charset=utf-8");
+
+    $string = '<?xml version="1.0" encoding="utf-8"?>' . "\r\n";
+    $string .= '<root><![CDATA[' . $message . $extra . ']]></root>';
+    echo $string;
+    exit;
+}
+
+/**
+ * KV缓存 删
+ *
+ * @param string $key 缓存名称
+ * @return boolean
+ */
+function dkcache($key)
+{
+    return cache($key, NULL);
+}
+
+/**
+ * 格式化字节大小
+ * @param  number $size 字节数
+ * @param  string $delimiter 数字和单位分隔符
+ * @return string            格式化后的带单位的大小
+ */
+function format_bytes($size, $delimiter = '')
+{
+    $units = array('B', 'KB', 'MB', 'GB', 'TB', 'PB');
+    for ($i = 0; $size >= 1024 && $i < 5; $i++)
+        $size /= 1024;
+    return round($size, 2) . $delimiter . $units[$i];
+}
+
+/**
+ * 取得随机数
+ *
+ * @param int $length 生成随机数的长度
+ * @param int $numeric 是否只产生数字随机数 1是0否
+ * @return string
+ */
+function random($length, $numeric = 0)
+{
+    $seed = base_convert(md5(microtime() . $_SERVER['DOCUMENT_ROOT']), 16, $numeric ? 10 : 35);
+    $seed = $numeric ? (str_replace('0', '', $seed) . '012340567890') : ($seed . 'zZ' . strtoupper($seed));
+    $hash = '';
+    $max = strlen($seed) - 1;
+    for ($i = 0; $i < $length; $i++) {
+        $hash .= $seed{mt_rand(0, $max)};
+    }
+    return $hash;
+}
+
+/**
+ * 读取缓存信息
+ *
+ * @param string $key 要取得缓存键
+ * @param string $prefix 键值前缀
+ * @param string $fields 所需要的字段
+ * @return array/bool
+ */
+function rcache($key = null, $prefix = '', $fields = '*')
+{
+    if ($key === null || !config('cache_open'))
+        return array();
+    if (!empty($prefix)) {
+        $name = $prefix . $key;
+    } else {
+        $name = $key;
+    }
+    $name .= request()->module();
+    $cache_info = cache($name);
+    //如果name值不存在,则默认返回 false。
+    return $cache_info;
+}
+
+/**
+ * 写入缓存
+ *
+ * @param string $key 缓存键值
+ * @param array $data 缓存数据
+ * @param string $prefix 键值前缀
+ * @param int $period 缓存周期  单位分,0为永久缓存
+ * @return bool 返回值
+ */
+function wcache($key = null, $data = array(), $prefix, $period = 0)
+{
+    if ($key === null || !config('cache_open') || !is_array($data))
+        return;
+
+    if (!empty($prefix)) {
+        $name = $prefix . $key;
+    } else {
+        $name = $key;
+    }
+    $name .= request()->module();
+    $cache_info = cache($name, $data, 3600);
+    //如果设置成功返回true,否则返回false。
+    return $cache_info;
+}
+
+/**
+ * 删除缓存
+ * @param string $key 缓存键值
+ * @param string $prefix 键值前缀
+ * @return boolean
+ */
+function dcache($key = null, $prefix = '')
+{
+    if ($key === null || !config('cache_open'))
+        return true;
+    if (!empty($prefix)) {
+        $name = $prefix . $key;
+    } else {
+        $name = $key;
+    }
+    return cache($name, NULL);
+}
+
+/**
+ * 获取文件列表(所有子目录文件)
+ *
+ * @param string $path 目录
+ * @param array $file_list 存放所有子文件的数组
+ * @param array $ignore_dir 需要忽略的目录或文件
+ * @return array 数据格式的返回结果
+ */
+function read_file_list($path, &$file_list, $ignore_dir = array())
+{
+    $path = rtrim($path, '/');
+    if (is_dir($path)) {
+        $handle = @opendir($path);
+        if ($handle) {
+            while (false !== ($dir = readdir($handle))) {
+                if ($dir != '.' && $dir != '..') {
+                    if (!in_array($dir, $ignore_dir)) {
+                        if (is_file($path . '/' . $dir)) {
+                            $file_list[] = $path . '/' . $dir;
+                        } elseif (is_dir($path . '/' . $dir)) {
+                            read_file_list($path . '/' . $dir, $file_list, $ignore_dir);
+                        }
+                    }
+                }
+            }
+            @closedir($handle);
+        } else {
+            return false;
+        }
+    } else {
+        return false;
+    }
+}
+
+/**
+ * 加密函数
+ *
+ * @param string $txt 需要加密的字符串
+ * @param string $key 密钥
+ * @return string 返回加密结果
+ */
+function ds_encrypt($txt, $key = '')
+{
+    if (empty($txt))
+        return $txt;
+    if (empty($key))
+        $key = md5(MD5_KEY);
+    $chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.";
+    $ikey = "-x6g6ZWm2G9g_vr0Bo.pOq3kRIxsZ6rm";
+    $nh1 = rand(0, 64);
+    $nh2 = rand(0, 64);
+    $nh3 = rand(0, 64);
+    $ch1 = $chars{$nh1};
+    $ch2 = $chars{$nh2};
+    $ch3 = $chars{$nh3};
+    $nhnum = $nh1 + $nh2 + $nh3;
+    $knum = 0;
+    $i = 0;
+    while (isset($key{$i}))
+        $knum += ord($key{$i++});
+    $mdKey = substr(md5(md5(md5($key . $ch1) . $ch2 . $ikey) . $ch3), $nhnum % 8, $knum % 8 + 16);
+    $txt = base64_encode(time() . '_' . $txt);
+    $txt = str_replace(array('+', '/', '='), array('-', '_', '.'), $txt);
+    $tmp = '';
+    $j = 0;
+    $k = 0;
+    $tlen = strlen($txt);
+    $klen = strlen($mdKey);
+    for ($i = 0; $i < $tlen; $i++) {
+        $k = $k == $klen ? 0 : $k;
+        $j = ($nhnum + strpos($chars, $txt{$i}) + ord($mdKey{$k++})) % 64;
+        $tmp .= $chars{$j};
+    }
+    $tmplen = strlen($tmp);
+    $tmp = substr_replace($tmp, $ch3, $nh2 % ++$tmplen, 0);
+    $tmp = substr_replace($tmp, $ch2, $nh1 % ++$tmplen, 0);
+    $tmp = substr_replace($tmp, $ch1, $knum % ++$tmplen, 0);
+    return $tmp;
+}
+
+/**
+ * 解密函数
+ *
+ * @param string $txt 需要解密的字符串
+ * @param string $key 密匙
+ * @return string 字符串类型的返回结果
+ */
+function ds_decrypt($txt, $key = '', $ttl = 0)
+{
+    if (empty($txt))
+        return $txt;
+    if (empty($key))
+        $key = md5(MD5_KEY);
+
+    $chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.";
+    $ikey = "-x6g6ZWm2G9g_vr0Bo.pOq3kRIxsZ6rm";
+    $knum = 0;
+    $i = 0;
+    $tlen = @strlen($txt);
+    while (isset($key{$i}))
+        $knum += ord($key{$i++});
+    $ch1 = @$txt{$knum % $tlen};
+    $nh1 = strpos($chars, $ch1);
+    $txt = @substr_replace($txt, '', $knum % $tlen--, 1);
+    $ch2 = @$txt{$nh1 % $tlen};
+    $nh2 = @strpos($chars, $ch2);
+    $txt = @substr_replace($txt, '', $nh1 % $tlen--, 1);
+    $ch3 = @$txt{$nh2 % $tlen};
+    $nh3 = @strpos($chars, $ch3);
+    $txt = @substr_replace($txt, '', $nh2 % $tlen--, 1);
+    $nhnum = $nh1 + $nh2 + $nh3;
+    $mdKey = substr(md5(md5(md5($key . $ch1) . $ch2 . $ikey) . $ch3), $nhnum % 8, $knum % 8 + 16);
+    $tmp = '';
+    $j = 0;
+    $k = 0;
+    $tlen = @strlen($txt);
+    $klen = @strlen($mdKey);
+    for ($i = 0; $i < $tlen; $i++) {
+        $k = $k == $klen ? 0 : $k;
+        $j = strpos($chars, $txt{$i}) - $nhnum - ord($mdKey{$k++});
+        while ($j < 0)
+            $j += 64;
+        $tmp .= $chars{$j};
+    }
+    $tmp = str_replace(array('-', '_', '.'), array('+', '/', '='), $tmp);
+    $tmp = trim(base64_decode($tmp));
+
+    if (preg_match("/\d{10}_/s", substr($tmp, 0, 11))) {
+        if ($ttl > 0 && (time() - substr($tmp, 0, 11) > $ttl)) {
+            $tmp = null;
+        } else {
+            $tmp = substr($tmp, 11);
+        }
+    }
+    return $tmp;
+}
+
+/**
+ * 编辑器内容
+ */
+
+function build_editor($params = array())
+{
+    $name = isset($params['name']) ? $params['name'] : null;
+    $theme = isset($params['theme']) ? $params['theme'] : 'normal';
+    $content = isset($params['content']) ? $params['content'] : null;
+    //http://fex.baidu.com/ueditor/#start-toolbar
+    /* 指定使用哪种主题 */
+    $themes = array(
+        'normal' => "[   
+           'fullscreen', 'source', '|', 'undo', 'redo', '|',   
+           'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '|',   
+           'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',   
+           'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',   
+           'directionalityltr', 'directionalityrtl', 'indent', '|',   
+           'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'touppercase', 'tolowercase', '|',   
+           'link', 'unlink', 'anchor', '|', 'imagenone', 'imageleft', 'imageright', 'imagecenter', '|',   
+           'emotion',  'map', 'gmap',  'insertcode', 'template',  '|',   
+           'horizontal', 'date', 'time', 'spechars', '|',   
+           'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols', 'charts', '|',   
+           'searchreplace', 'help', 'drafts', 'charts'
+       ]", 'simple' => " ['fullscreen', 'source', 'undo', 'redo', 'bold']",
+    );
+    switch ($theme) {
+        case 'simple':
+            $theme_config = $themes['simple'];
+            break;
+        case 'normal':
+            $theme_config = $themes['normal'];
+            break;
+        default:
+            $theme_config = $themes['normal'];
+            break;
+    }
+    /* 配置界面语言 */
+    switch (config('default_lang')) {
+        case 'zh-cn':
+            $lang = PLUGINS_SITE_ROOT . '/ueditor/lang/zh-cn/zh-cn.js';
+            break;
+        case 'en-us':
+            $lang = PLUGINS_SITE_ROOT . '/ueditor/lang/en/en.js';
+            break;
+        default:
+            $lang = PLUGINS_SITE_ROOT . '/ueditor/lang/zh-cn/zh-cn.js';
+            break;
+    }
+    $include_js = '<script type="text/javascript" charset="utf-8" src="' . PLUGINS_SITE_ROOT . '/ueditor/ueditor.config.js"></script> <script type="text/javascript" charset="utf-8" src="' . PLUGINS_SITE_ROOT . '/ueditor/ueditor.all.min.js""> </script><script type="text/javascript" charset="utf-8" src="' . $lang . '"></script>';
+	$content = json_encode($content);
+    $str = <<<EOT
+$include_js
+<script type="text/javascript">
+var ue = UE.getEditor('{$name}',{
+    toolbars:[{$theme_config}],
+        });
+      ue.ready(function() {
+       this.setContent($content);	
+})
+</script>
+EOT;
+    return $str;
+}
+
+/**
+ * 取得用户头像图片
+ *
+ * @param string $member_avatar
+ * @return string
+ */
+function get_member_avatar($member_avatar = '')
+{
+    if (empty($member_avatar) || !file_exists(BASE_UPLOAD_PATH . '/' . ATTACH_MEMBER . '/' . $member_avatar)) {
+        return UPLOAD_SITE_URL . '/' . ATTACH_COMMON . '/default_member_image.jpg';
+    }
+    return UPLOAD_SITE_URL . '/' . ATTACH_MEMBER . '/' . str_replace('\\', '/', $member_avatar);
+}
+/**
+ * 获取案例图
+ */
+function get_cases_img($image_name = '')
+{
+    if (empty($image_name) || !file_exists(BASE_UPLOAD_PATH . '/' . ATTACH_CASES . '/' . $image_name)) {
+        return UPLOAD_SITE_URL . '/' . ATTACH_COMMON . '/default_cases_image.jpg';
+    }
+    return UPLOAD_SITE_URL . '/' . ATTACH_CASES . '/' . str_replace('\\', '/', $image_name);
+}
+/**
+ * 获取产品图
+ */
+function get_product_img($image_name = '')
+{
+    if (empty($image_name) || !file_exists(BASE_UPLOAD_PATH . '/' . ATTACH_PRODUCT . '/' . $image_name)) {
+        return UPLOAD_SITE_URL . '/' . ATTACH_COMMON . '/default_product_image.jpg';
+    }
+    return UPLOAD_SITE_URL . '/' . ATTACH_PRODUCT . '/' . str_replace('\\', '/', $image_name);
+}
+/**
+ * 获取新闻图
+ */
+function get_news_img($image_name = '')
+{
+    if (empty($image_name) || !file_exists(BASE_UPLOAD_PATH . '/' . ATTACH_NEWS . '/' . $image_name)) {
+        return UPLOAD_SITE_URL . '/' . ATTACH_COMMON . '/default_news_image.jpg';
+    }
+    return UPLOAD_SITE_URL . '/' . ATTACH_NEWS . '/' . str_replace('\\', '/', $image_name);
+}
+/**
+ * 获取友链LOGO图
+ */
+function get_link_img($image_name = '')
+{
+    if (empty($image_name) || !file_exists(BASE_UPLOAD_PATH . '/' . ATTACH_LINK . '/' . $image_name)) {
+        return UPLOAD_SITE_URL . '/' . ATTACH_COMMON . '/default_type_image.jpg';
+    }
+    return UPLOAD_SITE_URL . '/' . ATTACH_LINK . '/' . str_replace('\\', '/', $image_name);
+}
+/**
+ * 获取广告LOGO图
+ */
+function get_adv_img($image_name = '')
+{
+    if (empty($image_name) || !file_exists(BASE_UPLOAD_PATH . '/' . ATTACH_ADV . '/' . $image_name)) {
+        return UPLOAD_SITE_URL . '/' . ATTACH_COMMON . '/default_adv_image.jpg';
+    }
+    return UPLOAD_SITE_URL . '/' . ATTACH_ADV . '/' . str_replace('\\', '/', $image_name);
+}
+/**
+ * 针对批量删除进行处理  '1,2,3' 转换为数组批量删除
+ * @param type $ids
+ * @return boolean
+ */
+function ds_delete_param($ids)
+{
+    //转换为数组
+    $ids_array = explode(',', $ids);
+    //数组值转为整数型
+    $ids_array = array_map("intval", $ids_array);
+    if (empty($ids_array) || in_array(0, $ids_array)) {
+        return FALSE;
+    } else {
+        return $ids_array;
+    }
+}
+
+
+/**
+ *    列表风格
+ *
+ * @author    Garbin
+ * @param     string $who
+ * @return    array
+ */
+function list_style($who, $template = 'mall', $type = '')
+{
+    $style_dir = DS_THEME_STYLE_URL . ($type == 'mobile' ? '/mobile' : '') . $who . '/styles';
+    $dir = dir($style_dir);
+    $array = array();
+    while (($item = $dir->read()) !== false) {
+        if (in_array($item, array('.', '..')) || $item{0} == '.' || $item{0} == '$') {
+            continue;
+        }
+        $style_path = $style_dir . '/' . $item;
+        if (is_dir($style_path)) {
+            if (is_file($style_path . '/style.info.php')) {
+                $array[] = $item;
+            }
+        }
+    }
+    return $array;
+}
+
+/**
+ * 
+ * @param type $code   100000表示为正确,其他为错误代码
+ * @param type $message  提示消息
+ * @param type $result  返回数据
+ */
+function ds_json_encode($code, $message, $result = '')
+{
+    echo json_encode(array('code' => $code, 'message' => $message, 'result' => $result));
+    exit;
+}
+
+/**
+ * Layer 提交成功返回函数
+ * @param type $message
+ */
+function dsLayerOpenSuccess($msg = '',$url='') {
+//    echo "<script>var index = parent.layer.getFrameIndex(window.name);parent.layer.close(index);parent.location.reload();</script>";
+    $url_js = empty($url)?"parent.location.reload();":"parent.location.href='".$url."';";
+            
+    $str = "<script>";
+    $str .= "parent.layer.alert('".$msg."',{yes:function(index, layero){".$url_js."},cancel:function(index, layero){".$url_js."}});";
+    $str .= "</script>";
+    echo $str;
+    exit;
+}
+
+/**
+ * 截取指定长度的字符
+ * @param type $string  内容
+ * @param type $start 开始
+ * @param type $length 长度
+ * @return type
+ */
+function ds_substing($string, $start=0,$length=80) {
+    $string = strip_tags($string);
+    $string = preg_replace('/\s/', '', $string);
+    return mb_substr($string, $start, $length);
+}
+
+
+/*手机端翻页显示*/
+
+function page_mobile($page){
+    
+}

+ 48 - 0
application/common/model/Access.php

@@ -0,0 +1,48 @@
+<?php
+namespace app\common\model;
+use think\Model;
+class Access extends Model
+{
+	public $page_info;
+
+	/**
+     * 接入信息管理
+     */
+    public function getAccessList($condition = array(), $field = '*', $page = 0, $order = 'access_id desc')
+    {
+        if ($page) {
+            $access_list = db('access')->where($condition)->order($order)->paginate($page, false, ['query' => request()->param()]);
+            $this->page_info = $access_list;
+            return $access_list->items();
+        } else {
+            return db('access')->where($condition)->order($order)->select();
+        }
+    }
+
+    /**
+     * 新增接入
+     */
+    public function addAccess($data)
+    {
+        return db('access')->insertGetId($data);
+    }
+
+    /**
+     * 编辑接入
+     */
+    public function editAccess($condition, $data)
+    {
+        return db('access')->where($condition)->update($data);
+    }
+
+    /**
+     * 取单个接入
+     */
+    public function getAccessInfo($condition, $field = '*')
+    {
+        return db('access')->field($field)->where($condition)->find();
+    }
+
+    
+    
+}

+ 90 - 0
application/common/model/Admin.php

@@ -0,0 +1,90 @@
+<?php
+namespace app\common\model;
+use think\Model;
+class Admin extends Model
+{
+    /**
+     * 管理员列表
+     */
+    public function getAdminList($condition = array(), $field = '*', $page = 0, $order = 'admin_id desc')
+    {
+        if ($page) {
+            $member_list = db('admin')->alias('a')->join('__ADMINGROUP__ g', 'g.group_id = a.admin_group_id', 'LEFT')->where($condition)->order($order)->paginate($page, false, ['query' => request()->param()]);
+            $this->page_info = $member_list;
+            return $member_list->items();
+        } else {
+            return db('admin')->alias('a')->join('__ADMINGROUP__ g', 'g.group_id = a.admin_group_id', 'LEFT')->where($condition)->order($order)->select();
+        }
+    }
+
+    /**
+     * 新增管理员
+     */
+    public function addAdmin($data)
+    {
+        return db('admin')->insertGetId($data);
+    }
+
+    /**
+     * 编辑管理员
+     */
+    public function editAdmin($condition, $data)
+    {
+        return db('admin')->where($condition)->update($data);
+    }
+
+    /**
+     * 删除管理员
+     */
+    public function delAdmin($condition)
+    {
+        return db('admin')->where($condition)->delete();
+    }
+
+    /**
+     * 取单个管理员
+     */
+    public function getOneAdmin($condition, $field = '*')
+    {
+        return db('admin')->field($field)->where($condition)->find();
+    }
+
+    //单个组管理员列表
+    public function ogroupAdmin($admin_id){
+        $map['admin_group_id'] = 2;
+        $map['admin_id'] = array('neq',$admin_id);
+        return db('admin')->field('admin_name,admin_id')->where($map)->select();
+    }
+
+    //所有公司
+    public function allgsAdmin(){
+        return db('admin')->field('admin_name,admin_id')->where("admin_group_id=2")->select();
+    }
+
+    //用户登录查询所属公司(admin_pid:登录人的id)
+    public function suosgsAdmin($admin_pid){
+        $map['admin_id'] = $admin_pid;
+        $gsadmin = db('admin')->field('admin_name,admin_group_id,admin_id,admin_pid')->where($map)->find();
+        if($gsadmin['admin_group_id']==2 || $gsadmin['admin_group_id']==1){
+            $ogsadmin = $gsadmin;
+        }else{
+            $where['admin_id']=$gsadmin['admin_pid'];
+            $ogsadmin = db('admin')->field('admin_name,admin_group_id,admin_id')->where($where)->find();
+        }
+        return $ogsadmin;
+    }
+    
+    //公司下的所有客服(admin_pid:公司id)
+    public function suosservice($admin_pid){
+        $map['admin_group_id'] = 3;
+        if($admin_pid==1){
+            $allkef = db('admin')->field('admin_name,admin_id')->where($map)->select();
+        }else{
+            $map['admin_pid'] = $admin_pid;
+            $allkef = db('admin')->field('admin_name,admin_id')->where($map)->select();
+        }
+        return $allkef;
+    }
+
+    
+}

+ 46 - 0
application/common/model/Admingroup.php

@@ -0,0 +1,46 @@
+<?php
+namespace app\common\model;
+use think\Model;
+
+class Admingroup extends Model
+{
+    /**
+     * 权限组列表
+     */
+    public function getAdminGroupList($condition ,$field = '*')
+    {
+        return db('admingroup')->where($condition)->field($field)->select();
+    }
+
+    /**
+     * 新增管理员权限组
+     */
+    public function addAdminGroup($data)
+    {
+        return db('admingroup')->insertGetId($data);
+    }
+
+    /**
+     * 编辑管理员权限组
+     */
+    public function editAdminGroup($condition, $data)
+    {
+        return db('admingroup')->where($condition)->update($data);
+    }
+
+    /**
+     * 删除权限组
+     */
+    public function delAdminGroup($condition)
+    {
+        return db('admingroup')->where($condition)->delete();
+    }
+
+    /**
+     * 取单个权限组
+     */
+    public function getOneAdmingroup($condition, $field = '*')
+    {
+        return db('admingroup')->field($field)->where($condition)->find();
+    }
+}

+ 35 - 0
application/common/model/Cache.php

@@ -0,0 +1,35 @@
+<?php
+
+namespace app\common\model;
+use think\Model;
+
+class Cache extends Model
+{
+
+    public function call($method)
+    {
+        $method = '_' . strtolower($method);
+        if (method_exists($this, $method)) {
+            return $this->$method();
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * 基本设置
+     * @return array
+     */
+    private function _config()
+    {
+        $result = db('config')->select();
+        if (is_array($result)) {
+            $list_config = array();
+            foreach ($result as $k => $v) {
+                $list_config[$v['code']] = $v['value'];
+            }
+        }
+        unset($result);
+        return $list_config;
+    }
+}

+ 85 - 0
application/common/model/Chatlog.php

@@ -0,0 +1,85 @@
+<?php
+
+namespace app\common\model;
+
+use think\Model;
+
+class Chatlog extends Model
+{
+	/*
+     * 留言列表
+     */
+    public function getChatlogList($condition, $field = '*', $page = 0, $order = 'create_time desc', $limit = '')
+    {
+        if ($limit) {
+            return db('chat_log')->where($condition)->field($field)->order($order)->page($page)->limit($limit)->select();
+        } else {
+            $res = db('chat_log')->where($condition)->field($field)->order($order)->paginate($page);
+            $this->page_info = $res;
+            return $res->items();
+        }
+    }
+
+    //客服评价率统计
+    public function chatlogcoRate($condition){
+        $rateCount = db('chat_log')->where($condition)->count();
+        $condition['comment'] = array('egt',3);
+        $mydcount = db('chat_log')->where($condition)->count();
+        if(empty($mydcount) || empty($rateCount)){
+            return 0;
+        }else{
+            return $mydcount/$rateCount*100;
+        }
+    }
+
+    //客服转化率
+    public function chatlogConversion($condition){
+        $condition['tob'] = 1;
+        $condition['tob_value'] = array('in','2,3');
+        $rateCount = db('chat_log')->where($condition)->count();
+        $condition['tob_value'] = 2;
+        $zhCount = db('chat_log')->where($condition)->count();
+        if(empty($zhCount) || empty($rateCount)){
+            return 0;
+        }else{
+            return $zhCount/$rateCount*100;
+        }
+    }
+
+    //客服挽留率
+    public function chatlogDetainment($condition){
+        $condition['tob'] = 3;
+        $rateCount = db('chat_log')->where($condition)->count();
+        $condition['tob_value'] = 2;
+        $wlCount = db('chat_log')->where($condition)->count();
+        if(empty($wlCount) || empty($rateCount)){
+            return 0;
+        }else{
+            return $wlCount/$rateCount*100;
+        }
+    }
+
+	//访问的客户
+	public function allvisitor($condition, $field = '*', $page = 0, $order = 'create_time desc', $limit = ''){
+		if ($limit) {
+            return db('chat_log')->distinct(true)->where($condition)->field($field)->order($order)->page($page)->limit($limit)->select();
+        } else {
+            $res = db('chat_log')->distinct(true)->where($condition)->field($field)->order($order)->paginate($page);
+            $this->page_info = $res;
+            return $res->items();
+        }
+	}
+
+	//聊天用户信息(begin:开始时间,end:结束时间,kname:客服名字)
+	public function chatdata($begin,$end,$kname,$sid){
+		$map['create_time'] = array('between', array($begin, $end));
+		$map['vid'] = $kname;
+		$map['sid'] = $sid;
+		$list = db('chat_log')->field('id,vid,create_time')->where($map)->select();
+		
+		return $list;
+	}
+
+
+
+}

+ 70 - 0
application/common/model/Config.php

@@ -0,0 +1,70 @@
+<?php
+
+namespace app\common\model;
+
+use think\Model;
+
+class Config extends Model
+{
+    /**
+     * 读取系统设置信息
+     *
+     * @param string $name 系统设置信息名称
+     * @return array 数组格式的返回结果
+     */
+    public function getRowConfig($name)
+    {
+        $where = "name='" . $name . "'";
+        $result = db('config')->where($where)->select();
+        if (is_array($result) and is_array($result[0])) {
+            return $result[0];
+        }
+        return false;
+    }
+
+    /**
+     * 读取系统设置列表
+     *
+     * @param
+     * @return array 数组格式的返回结果
+     */
+    public function getListConfig()
+    {
+        $result = db('config')->select();
+        if (is_array($result)) {
+            $list_config = array();
+            foreach ($result as $k => $v) {
+                $list_config[$v['code']] = $v['value'];
+            }
+        }
+        return $list_config;
+    }
+
+    /**
+     * 更新信息
+     *
+     * @param array $param 更新数据
+     * @return bool 布尔类型的返回结果
+     */
+    public function updateConfig($param)
+    {
+        if (empty($param)) {
+            return false;
+        }
+        if (is_array($param)) {
+            foreach ($param as $k => $v) {
+                $tmp = array();
+                $specialkeys_arr = array('statistics_name');
+                $tmp['value'] = (in_array($k, $specialkeys_arr) ? htmlentities($v, ENT_QUOTES) : $v);
+                $result = db('config')->where('code', $k)->update($tmp);
+                dkcache('config');
+            }
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+}
+
+?>

+ 48 - 0
application/common/model/Jobcv.php

@@ -0,0 +1,48 @@
+<?php
+
+namespace app\common\model;
+
+use think\Model;
+
+class Jobcv extends Model
+{
+    public $page_info;
+
+    /**
+     * 历史记录
+     * @param unknown $condition
+     * @return boolean
+     */
+    public function addJobcv($data)
+    {
+        return db('jobcv')->insert($data);
+    }
+  
+    public function editJobcv($condition, $update)
+    {
+        return db('jobcv')->where($condition)->update($update);
+    }
+
+    public function delJobcv($condition)
+    {
+        return db('jobcv')->where($condition)->delete();
+    }
+
+    public function getJobcvList($condition, $field = '*', $page = 0, $order = 'jobcv_addtime desc, jobcv_id desc', $limit = '')
+    {
+        if ($limit) {
+            return db('jobcv')->where($condition)->field($field)->order($order)->page($page)->limit($limit)->select();
+        } else {
+            $res = db('jobcv')->where($condition)->field($field)->order($order)->paginate($page);
+            $this->page_info = $res;
+            return $res->items();
+        }
+    }
+
+    public function getOneJobcv($condition, $field = '*')
+    {
+        return db('jobcv')->field($field)->where($condition)->find();
+    }
+}
+
+?>

+ 213 - 0
application/common/model/Member.php

@@ -0,0 +1,213 @@
+<?php
+
+namespace app\common\model;
+
+use think\Model;
+
+class Member extends Model
+{
+    public $page_info;
+
+    /**
+     * 会员列表
+     * @access public
+     * @author csdeshang
+     * @param array $condition 条件
+     * @param string $field 字段
+     * @param number $page 分页
+     * @param string $order 排序
+     * @return array
+     */
+    public function getMemberList($condition = array(), $field = '*', $page = 0, $order = 'member_id desc')
+    {
+        if ($page) {
+            $member_list = db('member')->where($condition)->order($order)->paginate($page, false, ['query' => request()->param()]);
+            $this->page_info = $member_list;
+            return $member_list->items();
+        } else {
+            return db('member')->where($condition)->order($order)->select();
+        }
+    }
+
+    /**
+     * 新增用户
+     */
+    public function addMember($data)
+    {
+        return db('member')->insertGetId($data);
+    }
+
+    /**
+     * 编辑用户
+     */
+    public function editMember($condition, $data)
+    {
+        return db('member')->where($condition)->update($data);
+    }
+
+    /**
+     * 删除用户
+     */
+    public function delMember($condition)
+    {
+        return db('member')->where($condition)->delete();
+    }
+
+    /**
+     * 取单个用户
+     */
+    public function getMemberInfo($condition, $field = '*')
+    {
+        return db('member')->field($field)->where($condition)->find();
+    }
+
+    /**
+     * 取得会员详细信息(优先查询缓存)
+     * 如果未找到,则缓存所有字段
+     * @param int $member_id
+     * @param string $field 需要取得的缓存键值, 例如:'*','member_name,member_sex'
+     * @return array
+     */
+    public function getMemberInfoByID($member_id, $fields = '*')
+    {
+        $member_info = rcache($member_id, 'member', $fields);
+        if (empty($member_info)) {
+            $member_info = $this->getMemberInfo(array('member_id' => $member_id), '*', true);
+            wcache($member_id, $member_info, 'member');
+        }
+        return $member_info;
+    }
+
+    /**
+     * 注册
+     */
+    public function register($register_info)
+    {
+        // 验证用户名是否重复
+        $check_member_name = $this->getMemberInfo(array('member_name' => $register_info['member_name']));
+        if (is_array($check_member_name) and count($check_member_name) > 0) {
+            return array('error' => '用户名已存在');
+        }
+
+        // 会员添加
+        $member_info = array();
+        $member_info['member_name'] = $register_info['member_name'];
+        $member_info['member_password'] = md5($register_info['member_password']);
+
+        if (isset($register_info['member_mobilebind'])) {
+            $member_info['member_mobile_bind'] = $register_info['member_mobilebind'];
+            $member_info['member_mobile'] = $register_info['member_mobile'];
+        }
+        $member_id = $this->addMember($member_info);
+        $member_res = $this->getMemberInfo(['member_id' => $member_id]);
+        if ($member_id) {
+            return $member_res;
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * 7天内自动登录 v3-b12
+     */
+    public function auto_login()
+    {
+        // 自动登录标记 保存7天
+        cookie('auto_login', encrypt(session('member_id'), MD5_KEY), 7 * 24 * 60 * 60);
+    }
+
+    public function set_avatar_cookie()
+    {
+        cookie('member_avatar', session('avatar'), 365 * 24 * 60 * 60);
+    }
+
+    /**
+     * 登录时创建会话SESSION
+     *
+     * @param array $member_info 会员信息
+     */
+    public function createSession($member_info = array(), $reg = false)
+    {
+        if (empty($member_info) || !is_array($member_info)) {
+            return;
+        }
+        session('is_login', '1');
+        session('member_id', $member_info['member_id']);
+        session('member_name', $member_info['member_name']);
+        session('member_email', $member_info['member_email']);
+
+        if (!empty($member_info['member_logintime'])) {
+            $update_info = array(
+                'member_loginnum' => ($member_info['member_loginnum'] + 1),
+                'member_logintime' => TIMESTAMP,
+                'member_old_logintime' => $member_info['member_logintime'],
+                'member_login_ip' => request()->ip(),
+                'member_old_login_ip' => $member_info['member_login_ip']
+            );
+            $this->editMember(array('member_id' => $member_info['member_id']), $update_info);
+        }
+    }
+
+    /**
+     * 会员登录检查
+     *
+     */
+    public function checkloginMember()
+    {
+        if (session('is_login') == '1') {
+            @header("Location: " . url('Home/Member/index'));
+            exit();
+        }
+    }
+
+    //有效期选择
+    public function validity($usetime){
+        if($usetime == "一个月"){
+            $validitytime = strtotime('+1 month');
+        }elseif($usetime == "一季度"){
+            $validitytime = strtotime('+3 month');
+        }elseif($usetime == "半年"){
+            $validitytime = strtotime('+6 month');
+        }else{
+            $validitytime = strtotime('+12 month');
+        }
+        return $validitytime;
+    }
+
+    //查询所有公司或者未参与的公司
+    public function allcompany($gsid){
+        $where['member_status'] = 1;
+        $where['member_id'] = array('neq',$gsid);
+        return db('member')->field('member_name,member_id')->where($where)->select();
+    }
+
+    //查询所有客服
+    public function allservice(){
+        $where['member_group'] = 2;
+        $where['member_status'] = 1;
+        return db('member')->field('member_id,member_name')->where($where)->select();
+    }
+
+    //所属公司 uid--用户id
+    public function suoscompany($uid){
+        $where['member_id'] = $uid;
+        $suosid = db('member')->field('member_id')->where($where)->find();
+        $suosgsid = $suosid['member_id'];
+        if($suosid['member_id']){
+            $he['member_id'] = $suosid['member_id'];
+            $gssuos = db('member')->field('member_id')->where($he)->find();
+            $suosgsid = $gssuos['member_id'];
+        }
+        return $suosgsid;
+    }
+
+    //所属公司下的所有人员id
+    public function allsuoscompany($uid){
+        $companyid = $this->suoscompany($uid);
+        $where['member_id'] = $uid;
+        $allglylist = db('member')->where($where)->column("member_id");
+        $allglyid = implode(",",$allglylist);
+        return $allglyid.','.$uid;
+    }
+
+}

+ 63 - 0
application/common/model/Message.php

@@ -0,0 +1,63 @@
+<?php
+
+namespace app\common\model;
+
+use think\Model;
+
+class Message extends Model
+{
+    public $page_info;
+    
+    
+    /**
+     * 添加留言
+     * @param type $param
+     * @return type
+     */
+    public function addMessage($param)
+    {
+        return db('message')->insertGetId($param);
+    }
+
+    /**
+     * 删除留言
+     * @param unknown $condition
+     * @return boolean
+     */
+    public function delMessage($condition)
+    {
+        return db('message')->where($condition)->delete();
+    }
+
+    /*
+     * 回复留言
+     */
+    public function editMessage($condition, $update)
+    {
+        return db('message')->where($condition)->update($update);
+    }
+
+    /*
+     * 留言列表
+     */
+    public function getMessageList($condition, $field = '*', $page = 0, $order = 'message_addtime asc, message_id desc', $limit = '')
+    {
+        if ($limit) {
+            return db('message')->where($condition)->field($field)->order($order)->page($page)->limit($limit)->select();
+        } else {
+            $res = db('message')->where($condition)->field($field)->order($order)->paginate($page);
+            $this->page_info = $res;
+            return $res->items();
+        }
+    }
+
+    /**
+     * 取单个留言内容
+     */
+    public function getOneMessage($condition, $field = '*')
+    {
+        return db('message')->field($field)->where($condition)->find();
+    }
+}
+
+?>

+ 57 - 0
application/common/model/News.php

@@ -0,0 +1,57 @@
+<?php
+
+namespace app\common\model;
+
+use think\Model;
+
+class News extends Model
+{
+    public $page_info;
+
+    /**
+     * 新增用户
+     */
+    public function addNews($data)
+    {
+        return db('news')->insertGetId($data);
+    }
+
+    /**
+     * 编辑
+     */
+    public function editNews($condition, $data)
+    {
+        return db('news')->where($condition)->update($data);
+    }
+
+    /**
+     * 删除
+     */
+    public function delNews($condition)
+    {
+        return db('news')->where($condition)->delete();
+    }
+
+    /**
+     * 取列表
+     */
+    public function getNewsList($condition = array(),$limit='', $field = '*', $page = '', $order = 'news_order desc,news_id desc')
+    {
+        if ($page) {
+            $res = db('news')->where($condition)->field($field)->order($order)->paginate($page);
+            $this->page_info = $res;
+            return $res->items();
+        } else {
+            return db('news')->where($condition)->field($field)->order($order)->limit($limit)->select();
+        }
+    }
+
+
+    /**
+     * 取单个新闻
+     */
+    public function getOneNews($condition, $field = '*')
+    {
+        return db('news')->field($field)->where($condition)->find();
+    }
+}

+ 57 - 0
application/common/model/Pic.php

@@ -0,0 +1,57 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: Administrator
+ * Date: 2018/8/13 0013
+ * Time: 11:27
+ */
+
+namespace app\common\model;
+
+
+use think\Model;
+
+class Pic extends Model
+{
+    public function addPic($data)
+    {
+        return db('pic')->insertGetId($data);
+    }
+
+    public function editPic($condition, $data)
+    {
+        return db('pic')->where($condition)->update($data);
+    }
+
+    public function getPicList($condition, $page = '', $order = 'pic_id desc')
+    {
+        if ($page) {
+            $res = db('pic')->where($condition)->order($order)->paginate($page, false, ['query' => request()->param()]);
+            $this->page_info = $res;
+            return $res->items();
+        } else {
+            return db('pic')->where($condition)->order($order)->select();
+        }
+    }
+
+    public function delPic($condition, $attach_type)
+    {
+        switch ($attach_type) {
+            case 'cases':
+                $attach_type = ATTACH_CASES;
+                break;
+            case 'news':
+                $attach_type = ATTACH_NEWS;
+                break;
+            case 'product':
+                $attach_type = ATTACH_PRODUCT;
+            default:
+                break;
+        }
+        $casespic_list = $this->getpicList($condition);
+        foreach ($casespic_list as $key => $casespic) {
+            @unlink(BASE_UPLOAD_PATH . DS . $attach_type . DS . $casespic['pic_cover']);
+        }
+        return db('pic')->where($condition)->delete();
+    }
+}

+ 66 - 0
application/common/model/Product.php

@@ -0,0 +1,66 @@
+<?php
+
+namespace app\common\model;
+
+use think\Model;
+
+class Product extends Model
+{
+    public $page_info;
+
+    /*
+     * 新增产品
+     */
+    public function addProduct($param)
+    {
+        return db('product')->insertGetId($param);
+    }
+
+    /*
+     * 编辑产品
+     */
+    public function editProduct($condition, $update)
+    {
+        return db('product')->where($condition)->update($update);
+    }
+
+    /**
+     * 删除产品
+     * @param unknown $condition
+     * @return boolean
+     */
+    public function delProduct($condition)
+    {
+        $product_array = $this->getProductList($condition, 'product_id');
+        $productid_array = array();
+        foreach ($product_array as $value) {
+            $productid_array[] = $value['product_id'];
+            // @unlink(BASE_UPLOAD_PATH . DS . ATTACH_PRODUCT . DS . $value['product_img']);
+        }
+        return db('product')->where(array('product_id' => array('in', $productid_array)))->delete();
+    }
+
+    /*
+     * 产品列表
+     */
+    public function getProductList($condition, $field = '*', $page = 0, $order = 'product_id desc', $limit = '')
+    {
+        if ($limit) {
+            return db('product')->where($condition)->field($field)->order($order)->page($page)->limit($limit)->select();
+        } else {
+            $res = db('product')->where($condition)->field($field)->order($order)->paginate($page);
+            $this->page_info = $res;
+            return $res->items();
+        }
+    }
+
+    /**
+     * 取单个产品内容
+     */
+    public function getOneProduct($condition, $field = '*')
+    {
+        return db('product')->field($field)->where($condition)->find();
+    }
+}
+
+?>

+ 81 - 0
application/common/model/Service.php

@@ -0,0 +1,81 @@
+<?php
+namespace app\common\model;
+use think\Model;
+class Service extends Model
+{
+	public $page_info;
+
+	/**
+     * 客服管理
+     */
+    public function getServiceList($condition = array(), $field = '*', $page = 0, $order = 'service_id desc')
+    {
+        if ($page) {
+            $service_list = db('service')->where($condition)->order($order)->paginate($page, false, ['query' => request()->param()]);
+            $this->page_info = $service_list;
+            return $service_list->items();
+        } else {
+            return db('service')->where($condition)->order($order)->select();
+        }
+    }
+
+     /**
+     * 新增客服
+     */
+    public function addService($data)
+    {
+        return db('service')->insertGetId($data);
+    }
+
+    /**
+     * 编辑用户
+     */
+    public function editService($condition, $data)
+    {
+        return db('service')->where($condition)->update($data);
+    }
+
+    /**
+     * 删除用户
+     */
+    public function delService($condition)
+    {
+        return db('service')->where($condition)->delete();
+    }
+
+    /**
+     * 取单个用户
+     */
+    public function getServiceInfo($condition, $field = '*')
+    {
+        return db('service')->field($field)->where($condition)->find();
+    }
+
+    //公司下所有客服
+    public function allkef($condition, $field = '*'){
+        return db('service')->field($field)->where($condition)->select();
+    }
+
+    // /**
+    //  * 更新信息
+    //  *
+    //  * @param array $param 更新数据
+    //  * @return bool 布尔类型的返回结果
+    //  */
+    // public function updateService($param,$whe)
+    // {
+    //     if (empty($param)) {
+    //         return false;
+    //     }
+    //     if (is_array($param)) {                
+    //         $tmp = array();
+    //         $tmp['service_imgurl'] = $param;
+    //         $result = db('service')->where($whe, $k)->update($tmp);
+    //         return true;
+    //     } else {
+    //         return false;
+    //     }
+    // }
+
+
+}

+ 78 - 0
application/common/taglib/Dstaglib.php

@@ -0,0 +1,78 @@
+<?php
+
+namespace app\common\taglib;
+use think\template\TagLib;
+
+class Dstaglib extends TagLib{
+    /**
+     * 定义标签列表
+     */
+    protected $tags   =  [
+        'adv' => ['attr' => 'limit,order,where,item', 'close' => 1],
+    ];
+    
+    public function tagAdv($tag, $content) {
+        $order = !empty($tag['order']) ? $tag['order'] : ''; //排序
+        $limit = !empty($tag['limit']) ? $tag['limit'] : '1';
+        $where = !empty($tag['where']) ? $tag['where'] : ''; //查询条件
+        $item = !empty($tag['item']) ? $tag['item'] : 'item'; // 返回的变量item	
+        $key = !empty($tag['key']) ? $tag['key'] : 'key'; // 返回的变量key
+        $ap_id = !empty($tag['ap_id']) ? $tag['ap_id'] : '0'; // 返回的变量key
+        
+        $str = '<?php ';
+        $str .= '$ap_id =' . $ap_id . ';';
+        $str .= '$ad_position = db("advposition")->cache(3600)->column("ap_id,ap_name,ap_width,ap_height","ap_id");';
+        $str .= '$result = db("adv")->where("ap_id=$ap_id  and adv_enabled = 1")->order("adv_order desc")->cache(36000)->limit("' . $limit . '")->select();';
+        $str .= '
+if(!in_array($ap_id,array_keys($ad_position)) && $ap_id)
+{
+  db("advposition")->insert(array(
+         "ap_id"=>$ap_id,
+         "ap_name"=>request()->module()."/".request()->controller()."/".request()->action()."页面自动增加广告位 $ap_id ",
+  ));
+  $ad_position[$ap_id]=array();
+  \think\Cache::clear();  
+}
+
+
+$c = ' . $limit . '- count($result); //  如果要求数量 和实际数量不一样 并且编辑模式
+if($c > 0 && input("get.edit_ad"))
+{
+    for($i = 0; $i < $c; $i++) // 还没有添加广告的时候
+    {
+      $result[] = array(
+          "adv_id" => 0,
+          "adv_code" => "/public/images/not_adv.jpg",
+          "adv_link" => ADMIN_SITE_URL."/Adv/adv_add/ap_id/$ap_id.html",
+          "adv_title"   =>"暂无广告图片",
+          "not_adv" => 1,
+          "adv_target" => "_self",
+          "ap_id"   =>$ap_id,
+      );  
+    }
+}
+
+foreach($result as $' . $key . '=>$' . $item . '):       
+
+    $'.$item. '["position"] = $ad_position[$' . $item . '["ap_id"]]; 
+    $'.$item. '["adv_link"] = HOME_SITE_URL."/Advclick/Advclick/adv_id/".$' . $item . '["adv_id"].".html";
+    $'.$item. '["adv_target"] = "_blank"; 
+    if(input("get.edit_ad") && !isset($' . $item . '["not_adv"]) )
+    {
+        
+        $' . $item . '["style"] = "filter:alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity: 0.5; opacity: 0.5"; // 广告半透明的样式
+        $' . $item . '["adv_link"] = ADMIN_SITE_URL."/Adv/adv_edit/adv_id/".$' . $item . '[\'adv_id\'].".html";
+        $' . $item . '["adv_title"] = $ad_position[$' . $item . '["ap_id"]]["ap_name"]."===".$' . $item . '["adv_title"];
+        $' . $item . '["adv_target"] = "_self";
+        $' . $item . '["adv_style"] = "filter:alpha(opacity=30); -moz-opacity:0.3; -khtml-opacity: 0.3; opacity: 0.3";
+    }
+    ?>';
+        $str .= $content;
+        $str .= '<?php endforeach; ?>';
+        if (!empty($str)) {
+            return $str;
+        }
+        return;
+    }
+}
+

+ 6 - 0
application/common_global.php

@@ -0,0 +1,6 @@
+<?php
+
+define('CHARSET', 'UTF-8');
+define('MD5_KEY', 'a2382918dbb49c8643f19bc3ab90ecf9');
+
+

+ 274 - 0
application/config.php

@@ -0,0 +1,274 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+return [
+    // +----------------------------------------------------------------------
+    // | 应用设置
+    // +----------------------------------------------------------------------
+
+    // 应用命名空间
+    'app_namespace' => 'app',
+    // 应用调试模式
+    'app_debug' => false,
+    // 应用Trace
+    'app_trace' => false,
+    // 应用模式状态
+    'app_status' => '',
+    // 是否支持多模块
+    'app_multi_module' => true,
+    // 入口自动绑定模块
+    'auto_bind_module' => false,
+    // 注册的根命名空间
+    'root_namespace' => [
+        'BM'   => ROOT_PATH.'BM',
+    ],
+    // 扩展函数文件
+    'extra_file_list' => [THINK_PATH . 'helper' . EXT],
+    // 默认输出类型
+    'default_return_type' => 'html',
+    // 默认AJAX 数据返回格式,可选json xml ...
+    'default_ajax_return' => 'json',
+    // 默认JSONP格式返回的处理方法
+    'default_jsonp_handler' => 'jsonpReturn',
+    // 默认JSONP处理方法
+    'var_jsonp_handler' => 'callback',
+    // 默认时区
+    'default_timezone' => 'PRC',
+    // 是否开启多语言
+    'lang_switch_on' => true,
+    //语言列表
+    'lang_list' => ['zh-cn', 'en-us'],
+    // 默认全局过滤方法 用逗号分隔多个
+    'default_filter' => '',
+    // 默认语言
+    'default_lang' => 'zh-cn',
+    // 应用类库后缀
+    'class_suffix' => false,
+    // 控制器类后缀
+    'controller_suffix' => false,
+
+    // +----------------------------------------------------------------------
+    // | 模块设置
+    // +----------------------------------------------------------------------
+
+    // 默认模块名
+    'default_module' => 'home',
+    // 禁止访问模块
+    'deny_module_list' => ['common'],
+    // 默认控制器名
+    'default_controller' => 'Index',
+    // 默认操作名
+    'default_action' => 'index',
+    // 默认验证器
+    'default_validate' => '',
+    // 默认的空控制器名
+    'empty_controller' => 'Error',
+    // 操作方法后缀
+    'action_suffix' => '',
+    // 自动搜索控制器
+    'controller_auto_search' => false,
+
+    // +----------------------------------------------------------------------
+    // | URL设置
+    // +----------------------------------------------------------------------
+
+    // PATHINFO变量名 用于兼容模式
+    'var_pathinfo' => 's',
+    // 兼容PATH_INFO获取
+    'pathinfo_fetch' => ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL'],
+    // pathinfo分隔符
+    'pathinfo_depr' => '/',
+    // URL伪静态后缀
+    'url_html_suffix' => 'html',
+    // URL普通方式参数 用于自动生成
+    'url_common_param' => false,
+    // URL参数方式 0 按名称成对解析 1 按顺序解析
+    'url_param_type' => 0,
+    // 是否开启路由
+    'url_route_on' => true,
+    // 路由使用完整匹配
+    'route_complete_match' => false,
+    // 路由配置文件(支持配置多个)
+    'route_config_file' => ['route'],
+    // 是否强制使用路由
+    'url_route_must' => false,
+    // 域名部署
+    'url_domain_deploy' => false,
+    // 域名根,如thinkphp.cn
+    'url_domain_root' => '',
+    // 是否自动转换URL中的控制器和操作名
+    'url_convert' => true,
+    // 默认的访问控制器层
+    'url_controller_layer' => 'controller',
+    // 表单请求类型伪装变量
+    'var_method' => '_method',
+    // 表单ajax伪装变量
+    'var_ajax' => '_ajax',
+    // 表单pjax伪装变量
+    'var_pjax' => '_pjax',
+    // 是否开启请求缓存 true自动缓存 支持设置请求缓存规则
+    'request_cache' => false,
+    // 请求缓存有效期
+    'request_cache_expire' => null,
+    // 全局请求缓存排除规则
+    'request_cache_except' => [],
+
+    // +----------------------------------------------------------------------
+    // | 模板设置
+    // +----------------------------------------------------------------------
+
+    'template' => [
+        // 模板引擎类型 支持 php think 支持扩展
+        'type' => 'Think',
+        // 模板路径
+        'view_path' => '',
+        // 模板后缀
+        'view_suffix' => 'html',
+        // 模板文件名分隔符
+        'view_depr' => DS,
+        // 模板引擎普通标签开始标记
+        'tpl_begin' => '{',
+        // 模板引擎普通标签结束标记
+        'tpl_end' => '}',
+        // 标签库标签开始标记
+        'taglib_begin' => '{',
+        // 标签库标签结束标记
+        'taglib_end' => '}',
+        'taglib_pre_load'  =>  'app\common\taglib\Dstaglib',
+    ],
+
+    // 视图输出字符串内容替换
+    'view_replace_str' => [],
+    // 默认跳转页面对应的模板文件
+    'dispatch_success_tmpl' => THINK_PATH . 'tpl' . DS . 'dispatch_jump.tpl',
+    'dispatch_error_tmpl' => THINK_PATH . 'tpl' . DS . 'dispatch_jump.tpl',
+
+    // +----------------------------------------------------------------------
+    // | 异常及错误设置
+    // +----------------------------------------------------------------------
+
+    // 异常页面的模板文件
+    'exception_tmpl' => THINK_PATH . 'tpl' . DS . 'think_exception.tpl',
+
+    // 错误显示信息,非调试模式有效
+    'error_message' => '页面错误!请稍后再试~',
+    // 显示错误信息
+    'show_error_msg' => false,
+    // 异常处理handle类 留空使用 \think\exception\Handle
+    'exception_handle' => '',
+
+    // +----------------------------------------------------------------------
+    // | 日志设置
+    // +----------------------------------------------------------------------
+
+    'log' => [
+        // 日志记录方式,内置 file socket 支持扩展
+        'type' => 'File',
+        // 日志保存目录
+        'path' => LOG_PATH,
+        // 日志记录级别
+        'level' => [],
+    ],
+
+    // +----------------------------------------------------------------------
+    // | Trace设置 开启 app_trace 后 有效
+    // +----------------------------------------------------------------------
+    'trace' => [
+        // 内置Html Console 支持扩展
+        'type' => 'Html',
+    ],
+
+    // +----------------------------------------------------------------------
+    // | 缓存设置
+    // +----------------------------------------------------------------------
+
+    'cache' => [
+        // 驱动方式
+        'type' => 'File',
+        // 缓存保存目录
+        'path' => CACHE_PATH,
+        // 缓存前缀
+        'prefix' => '',
+        // 缓存有效期 0表示永久缓存
+        'expire' => 0,
+    ],
+
+    // +----------------------------------------------------------------------
+    // | 会话设置
+    // +----------------------------------------------------------------------
+
+    'session' => [
+        'id' => '',
+        // SESSION_ID的提交变量,解决flash上传跨域
+        'var_session_id' => '',
+        // SESSION 前缀
+        'prefix' => 'think',
+        // 驱动方式 支持redis memcache memcached
+        'type' => '',
+        // 是否自动开启 SESSION
+        'auto_start' => true,
+    ],
+
+    // +----------------------------------------------------------------------
+    // | Cookie设置
+    // +----------------------------------------------------------------------
+    'cookie' => [
+        // cookie 名称前缀
+        'prefix' => '',
+        // cookie 保存时间
+        'expire' => 0,
+        // cookie 保存路径
+        'path' => '/',
+        // cookie 有效域名
+        'domain' => '',
+        //  cookie 启用安全传输
+        'secure' => false,
+        // httponly设置
+        'httponly' => '',
+        // 是否使用 setcookie
+        'setcookie' => true,
+    ],
+
+    //分页配置
+    'paginate' => [
+        'type' => 'bootstrap',
+        'var_page' => 'page',
+        'list_rows' => 15,
+    ],
+    //验证码配置
+    'captcha' => [
+        // 验证码字符集合
+        'codeSet' => '2345678abcdefhijkmnpqrstuvwxyzABCDEFGHJKLMNPQRTUVWXY',
+        // 验证码字体大小(px)
+        'fontSize' => 14,
+        // 是否画混淆曲线
+        'useCurve' => false,
+        //是否添加杂点
+        'useNoise' => false,
+        // 验证码图片高度
+        'imageH' => 34,
+        // 验证码图片宽度
+        'imageW' => 96,
+        // 验证码位数
+        'length' => 4,
+        // 验证成功后是否重置
+        'reset' => true
+    ],
+    
+    //gateway注册地址
+    'GATEWAY_REGIST_ADDRESS' => '192.168.1.192:1236',
+    
+    //gateway节点
+    'GATEWAY_NODE'           => 'ws://192.168.1.192:7272',
+    
+    //文件上传目录
+    'FILE_UPLOADS_DIR'       => '/uploads/admin',
+];

+ 44 - 0
application/database.php

@@ -0,0 +1,44 @@
+<?php
+
+return [
+// 数据库类型
+'type'           => 'mysql',
+// 服务器地址
+'hostname'       => '127.0.0.1',
+// 数据库名
+'database'       => 'ds_cms',
+// 用户名
+'username'       => 'root',
+// 密码
+'password'       => 'root',
+// 端口
+'hostport'       => '3306',
+// 连接dsn
+'dsn'            => '',
+// 数据库连接参数
+'params'         => [],
+// 数据库编码默认采用utf8
+'charset'        => 'utf8',
+// 数据库表前缀
+'prefix'         => 'bm_',
+// 数据库调试模式
+'debug'          => true,
+// 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
+'deploy'         => 0,
+// 数据库读写是否分离 主从式有效
+'rw_separate'    => false,
+// 读写分离后 主服务器数量
+'master_num'     => 1,
+// 指定从服务器序号
+'slave_no'       => '',
+// 是否严格检查字段是否存在
+'fields_strict'  => true,
+// 数据集返回类型 array 数组 collection Collection对象
+'resultset_type' => 'array',
+// 是否自动写入时间戳字段
+'auto_timestamp' => false,
+// 时间字段取出后的默认时间格式
+'datetime_format' => 'Y-m-d H:i:s',
+// 是否需要进行SQL性能分析
+'sql_explain'     => false,
+];

+ 14 - 0
application/extra/queue.php

@@ -0,0 +1,14 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: yunwuxin <448901948@qq.com>
+// +----------------------------------------------------------------------
+
+return [
+    'connector' => 'Sync'
+];

+ 202 - 0
application/home/controller/Admin.php

@@ -0,0 +1,202 @@
+<?php
+
+namespace app\home\controller;
+
+use think\Lang;
+
+class Admin extends AdminControl
+{
+    public function _initialize()
+    {
+        parent::_initialize();
+        Lang::load(APP_PATH . 'home/lang/' . config('default_lang') . '/admin.lang.php');
+        
+    }
+
+    /**
+     * 管理员列表
+     * @return mixed
+     */
+    public function index()
+    {
+        $model_service = Model('service');
+        $groupid = input('post.admingroupid');
+        $title = input('post.title');
+        $condition = array();
+        if($groupid){
+            $condition['admin_group_id'] = $groupid;
+        }
+        if($title){
+            $condition['service_name'] = $title;
+        }
+        $condition['service_pid'] = session('service_pid');
+        $service_list = $model_service->getserviceList($condition, '*', 10);
+        if($service_list){
+            for ($i=0; $i < count($service_list); $i++) { 
+                $ere['group_id'] = $service_list[$i]['service_group_id'];
+                $qxzlist[] = Model('admingroup')->getOneAdmingroup($ere,$field = 'group_name');
+            }
+            $this->assign('qxzlist',$qxzlist);
+        }
+        
+        $allpower = $this->qxhans();
+        $where = array();
+        $where['suosgs'] = session('service_pid');
+        $admin_group = model('admingroup')->getAdminGroupList($where,'group_name,group_id');
+        $this->assign('admin_group', $admin_group);//管理组
+        $this->assign('allpower',$allpower);
+        $this->assign('service_list', $service_list);
+        $this->assign('show_page', $model_service->page_info->render());
+        $this->setAdminCurItem('index');
+        return $this->fetch();
+    }
+
+    /**
+     * 添加管理员
+     * @return mixed
+     */
+    public function add(){
+        $model_service = model('service');
+        $allpower = $this->qxhans();
+        $this->assign('allpower',$allpower);
+        if (!request()->isPost()) {
+            $admin_array = array('add' => 1,'service_status'=>0);
+            $condition = array();
+            $condition['suosgs'] = session('service_pid');
+            $admin_group = model('admingroup')->getAdminGroupList($condition,'group_name,group_id');
+            $onlyz = array(
+                'group_id'=>'',
+                'group_name'=>'',
+            );
+            $this->assign('onlyz',$onlyz);
+            $this->assign('admin_group', $admin_group);
+            $this->assign('admin', $admin_array);
+            return $this->fetch('form');
+        } else {
+            //上传文件保存路径
+            $upload_file = ROOT_PATH . DS . DIR_UPLOAD . DS . ATTACH_COMMON;
+            if (!empty($_FILES['service_imgurl']['name'])) {
+                $file = request()->file('service_imgurl');
+                $use_imgurl = random(2,0).time();
+                $info = $file->validate(['ext' => 'jpg,png,gif'])->move($upload_file, $use_imgurl);
+                if ($info) {
+                    $upload['service_imgurl'] = $info->getFilename();
+                } else {
+                    // 上传失败获取错误信息
+                    $this->error($file->getError());
+                }
+            }
+            if (!empty($upload['service_imgurl'])) {
+                $data['service_imgurl'] = "uploads/home/common".DS.$upload['service_imgurl'];
+            }
+
+            $update_array['service_name'] = input('post.service_name');
+            $update_array['service_password'] = input('post.service_password') ? md5(input('post.service_password')) : md5('123456');
+            $update_array['service_group_id'] = input('post.service_group_id');
+            $update_array['service_status'] = input('post.service_status');
+            $update_array['service_nickname'] = input('post.service_nickname');
+            $update_array['service_pid'] = session('service_pid');
+            $update_array['service_add_time'] = TIMESTAMP;
+
+            $result = $model_service->addService($update_array);
+            if($data && $result){
+                $where = array();
+                $where['service_id'] = $result;
+                $erre = $model_service->editService($where,$data);
+            }
+
+            if ($result) {
+                dsLayerOpenSuccess("添加成功!");
+            } else {
+                $this->error("添加失败!");
+            }
+        }
+    }
+
+    public function edit()
+    {
+        $this->assign('is_super',session('service_id'));
+        $service_id = input('param.service_id');
+        if (empty($service_id)) {
+            $this->error(lang('param_error'));
+        }
+        $model_service = Model('service');
+        if (!request()->isPost()) {
+            $condition['service_id'] = $service_id;
+            $admin_array = $model_service->getserviceInfo($condition);
+            $admin_array['add'] = 0;
+            $where = array();
+            $where['suosgs'] = session('service_pid');
+            $admin_group = model('admingroup')->getAdminGroupList($where,'group_name,group_id');
+            $ewhe = array();
+            $ewhe['group_id'] = $admin_array['service_group_id'];
+            $onlyz = model('admingroup')->getOneAdmingroup($ewhe,'group_name,group_id');
+            $suosgs = session("admin_pid");
+            $this->assign('suosgs',$suosgs);
+            $this->assign('onlyz',$onlyz);
+            $this->assign('admin_group',$admin_group);
+            $this->assign('admin', $admin_array);
+            return $this->fetch('form');
+        } else {
+            //上传文件保存路径
+            $upload_file = ROOT_PATH . DS . DIR_UPLOAD . DS . ATTACH_COMMON;
+            if (!empty($_FILES['service_imgurl']['name'])) {
+                $file = request()->file('service_imgurl');
+                $use_imgurl = random(2,0).time();
+                $info = $file->validate(['ext' => 'jpg,png,gif'])->move($upload_file, $use_imgurl);
+                if ($info) {
+                    $upload['service_imgurl'] = $info->getFilename();
+                } else {
+                    // 上传失败获取错误信息
+                    $this->error($file->getError());
+                }
+            }
+            if (!empty($upload['service_imgurl'])) {
+                $update_array['service_imgurl'] = "uploads/home/common".DS.$upload['service_imgurl'];
+            }
+
+            $update_array['service_name'] = input('post.service_name');
+            $update_array['service_status'] = input('post.service_status');
+            $update_array['service_nickname'] = input('post.service_nickname');
+            $update_array['service_group_id'] = input('post.service_group_id');
+            if (input('post.service_password')) {
+                $update_array['service_password'] = md5(input('post.service_password'));
+            }
+
+            $where = array();
+            $where['service_id'] = $service_id;
+            $result = $model_service->editService($where,$update_array);
+            if ($result) {
+                dsLayerOpenSuccess("编辑成功!");
+            } else {
+                $this->error("编辑失败!");
+            }
+        }
+    }
+
+    public function del()
+    {
+        $service_id = input('param.service_id');
+        if (empty($service_id)) {
+            $this->error(lang('param_error'));
+        }
+        $result = db('service')->delete($service_id);
+        if ($result) {
+            ds_json_encode(10000, lang('admin_del_succ'));
+        } else {
+            ds_json_encode(10001, lang('admin_del_fail'));
+        }
+    }
+
+    protected function getAdminItemList()
+    {
+        $menu_array = array(
+            array(
+                'name' => 'index', 'text' => lang('ds_manage'), 'url' => url('Admin/index')
+            ), array(
+                'name' => 'add', 'text' => lang('ds_add'), 'url' => "javascript:dsLayerOpen('".url('Admin/add')."','".lang('ds_add')."')"
+            ),
+        );
+        return $menu_array;
+    }
+}

+ 235 - 0
application/home/controller/AdminControl.php

@@ -0,0 +1,235 @@
+<?php
+
+namespace app\home\controller;
+
+use think\Controller;
+use think\Lang;
+
+class AdminControl extends Controller
+{
+
+    /**
+     * 管理员资料 name id group
+     */
+    protected $admin_info;
+
+    public function _initialize()
+    {
+        if (in_array(cookie('ds_admin_lang'), array('zh-cn', 'en-us'))) {
+            config('default_lang', cookie('ds_admin_lang'));
+        }
+        Lang::load(APP_PATH . 'home/lang/' . config('default_lang') . '.php');
+        $this->admin_info = $this->systemLogin();
+        if ($this->admin_info['service_id'] != 1) {
+            // 验证权限
+//            $this->checkPermission();
+        }
+        $this->setMenuList();
+    }
+
+    /**
+     * 取得当前管理员信息
+     *
+     * @param
+     * @return 数组类型的返回结果
+     */
+    protected final function getAdminInfo()
+    {
+        return $this->admin_info;
+    }
+
+    /**
+     * 系统后台登录验证
+     *
+     * @param
+     * @return array 数组类型的返回结果
+     */
+    protected final function systemLogin()
+    {
+        $admin_info = array(
+            'service_id' => session('service_id'),
+            'service_name' => session('service_name'),
+            'service_group_id' => session('service_group_id'),
+            'service_is_super' => session('service_is_super'),
+            'service_pid' => session('service_pid'),
+        );
+
+        if (empty($admin_info['service_id']) || empty($admin_info['service_name']) || !isset($admin_info['service_group_id'])) {
+            $this->redirect('home/Login/index');
+        }
+
+        return $admin_info;
+    }
+
+    /**
+     * 侧边栏
+     */
+    public function setMenuList()
+    {
+        $menu_list = $this->menuList();
+        //权限组单组管理(已有权限)
+        $admin_group_model = model('admingroup');
+        $group_info = $admin_group_model->getOneAdmingroup(array('group_id' => session('service_group_id')));
+        $hlimit = ds_decrypt($group_info['group_limits'], MD5_KEY . md5($group_info['group_name']));
+        $allkzq = $group_info['group_limits'] = explode('|', $hlimit);
+        for ($i=0; $i < count($allkzq); $i++) { 
+            $oallkzq[] = strtolower($allkzq[$i]);
+        }
+
+        $this->assign('gupinfo',$oallkzq);
+        $this->assign('menu_list', $menu_list);
+    }
+
+    //所有权限
+    public function qxhans(){
+        //权限组单组管理(已有权限)
+        $admin_group_model = model('admingroup');
+        $group_info = $admin_group_model->getOneAdmingroup(array('group_id' => session('service_group_id')));
+        $hlimit = ds_decrypt($group_info['group_limits'], MD5_KEY . md5($group_info['group_name']));
+        $allkzq = $group_info['group_limits'] = explode('|', $hlimit);
+        for ($i=0; $i < count($allkzq); $i++) { 
+            $oallkzq[] = strtolower($allkzq[$i]);
+        }
+
+        return $oallkzq;
+    }
+
+    /**
+     * 当前选中的栏目
+     */
+    protected function setAdminCurItem($curitem = '')
+    {
+        $this->assign('admin_item', $this->getAdminItemList());
+        $this->assign('curitem', $curitem);
+    }
+
+    /**
+     * 获取卖家栏目列表,针对控制器下的栏目
+     */
+    protected function getAdminItemList()
+    {
+        return array();
+    }
+
+    /**
+     * 侧边栏列表
+     */
+    function menuList()
+    {
+        return array(
+            'dashboard_manage' => array(
+                'name' => 'dashboard_manage',
+                'text' => lang('ds_dashboard_manage'),
+                'children' => array(
+                    'wlcome' => array(
+                        'text' => lang('ds_welcome'), 'url' => url('Wlcome/index'),
+                    ),
+                ),
+            ),
+            'setting_manage' => array(
+                'name' => 'setting_manage',
+                'text' => lang('ds_setting_manage'),
+                'children' => array(
+                    'config' => array(
+                        'text' => lang('ds_config'),
+                        'url' => url('Config/index'),
+                    ),
+                ),
+				'url' => url('Config/index'),
+				'children' => array(
+					'config' => array(
+						'text' => lang('ds_config'),
+						'url' => url('Config/index'),
+					),
+				),
+            ),
+            'personnel_manage' => array(
+                'name' => 'personnel_manage',
+                'text' => lang('ds_personnel_manage'),
+                'children' => array(
+                    'admin' => array(
+                        'text' => lang('ds_admin'),
+                        'url' => url('Admin/index'),
+                    ),
+                    'admingroup' => array(
+                        'text' => lang('ds_admin_group'),
+                        'url' => url('Admingroup/index'),
+                    ),
+                ),
+            ),
+            'content_manage' => array(
+                'name' => 'content_manage',
+                'text' => lang('ds_content_manage'),
+                'children' => array(
+                    'product' => array(
+                        'text' => "常用语",
+                        'url' => url('Product/index'),
+                    ),
+                    'News' => array(
+                        'text' => lang('ds_product'),
+                        'url' => url('News/index'),
+                    ),
+                ),
+            ),
+            'operation_manage' => array(
+                'name' => 'operation_manage',
+                'text' => lang('ds_operation_manage'),
+                'children' => array(
+                    'message' => array(
+                        'text' => lang('ds_message'),
+                        'url' => url('Message/index'),
+                    ),
+                    'Service' => array(
+                        'text' => lang('ds_service'),
+                        'url' => url('Service/index'),
+                    ),
+                    'records' => array(
+                        'text' => lang('ds_records'),
+                        'url' => url('Jobcv/index'),
+                    ),
+                    'Visitkf' => array(
+                        'text' => "访客列表",
+                        'url' => url('Visitkf/index'),
+                    ),
+                    'Glservice' => array(
+                        'text' => "客服统计",
+                        'url' => url('Glservice/index'),
+                    ),
+                ),
+            ),
+            
+        );
+    }
+
+    /**
+     * 记录系统日志
+     *
+     * @param $lang 日志语言包
+     * @param $state 1成功0失败null不出现成功失败提示
+     * @param $admin_name
+     * @param $admin_id
+     */
+    protected final function log($lang = '', $state = 1, $admin_name = '', $admin_id = 0)
+    {
+        if ($admin_name == '') {
+            $admin_name = session('service_name');
+            $admin_id = session('service_id');
+        }
+        $data = array();
+        if (is_null($state)) {
+            $state = null;
+        } else {
+            $state = $state ? '' : lang('nc_fail');
+        }
+        $data['content'] = $lang . $state;
+        $data['admin_name'] = $admin_name;
+        $data['createtime'] = TIMESTAMP;
+        $data['admin_id'] = $admin_id;
+        $data['ip'] = request()->ip();
+        $data['url'] = request()->controller() . '&' . request()->action();
+        $data['lang'] = config('default_lang');
+        return db('adminlog')->insertGetId($data);
+    }
+}
+
+?>

+ 254 - 0
application/home/controller/Admingroup.php

@@ -0,0 +1,254 @@
+<?php
+namespace app\home\controller;
+
+use think\Lang;
+
+class Admingroup extends AdminControl
+{
+    public function _initialize()
+    {
+        parent::_initialize();
+        Lang::load(APP_PATH . 'admin/lang/' . config('default_lang') . '/admingroup.lang.php');
+    }
+
+    /**
+     * 管理权限组
+     * @return mixed
+     */
+    public function index()
+    {
+        $model_admingroup = Model('admingroup');
+        $condition = array();
+        $condition['lang'] = config('default_lang');
+        $condition['suosgs'] = session('service_pid');
+        $admingroup_list = $model_admingroup->getAdminGroupList($condition,'*');
+        $allpower = $this->qxhans();
+        $this->assign('allpower',$allpower);
+        $this->assign('admin_group_list', $admingroup_list);
+        $this->setAdminCurItem('index');
+        return $this->fetch();
+    }
+
+    public function getControllers($dir) {
+        $pathList = glob($dir . '/*.php');
+        $res = [];
+        foreach($pathList as $key => $value) {
+            $res[] = basename($value, '.php');
+        }
+        return $res;
+    }
+
+    /**
+     * 添加权限组
+     * @return mixed
+     */
+    public function add()
+    {
+        if (request()->isPost()) {
+            $admin_group_model = model('admingroup');
+            //判断权限组名是否存在
+            $where['group_name'] = input('post.group_name');
+            $where['suosgs'] = session('service_pid');
+            if ($admin_group_model->getOneAdmingroup($where)) {
+                $this->error(lang('admin_group_existence'));
+            }
+            $limit_str = '';
+            if (is_array($_POST['permission'])) {
+                $limit_str = implode('|', $_POST['permission']);
+            }
+            $data['group_limits'] = ds_encrypt($limit_str, MD5_KEY . md5(input('post.group_name')));
+            $data['group_name'] = input('post.group_name');
+            $data['lang'] = config('default_lang');
+            $data['suosgs'] = session('service_pid');
+            $data['addtime'] = TIMESTAMP;
+            if ($admin_group_model->addAdminGroup($data)) {
+                $this->log(lang('ds_add') . lang('ds_admin_group') . '[' . input('post.group_name') . ']', 1);
+                dsLayerOpenSuccess(lang('admin_group_add_succ'));
+            } else {
+                $this->error(lang('admin_group_add_fail'));
+            }
+        } else {
+            $this->assign('admin_array', 'add');
+            $this->assign('limit', $this->permission());
+            $this->setAdminCurItem('add');
+            return $this->fetch('form');
+        }
+    }
+
+    public function edit()
+    {
+        $admin_group_model = model('admingroup');
+        $group_id = intval(input('param.group_id'));
+        $group_info = $admin_group_model->getOneAdmingroup(array('group_id' => $group_id));
+        if (empty($group_info)) {
+            $this->error(lang('admin_set_admin_not_exists'));
+        }
+        if (request()->isPost()) {
+            $limit_str = '';
+            if (is_array($_POST['permission'])) {
+                $limit_str = implode('|', $_POST['permission']);
+            }
+            $limit_str = ds_encrypt($limit_str, MD5_KEY . md5(input('post.group_name')));
+            $data['group_limits'] = $limit_str;
+            $data['group_name'] = input('post.group_name');
+            $update = $admin_group_model->editAdminGroup(array('group_id' => $group_id), $data);
+            if ($update) {
+                $this->log(lang('ds_edit') . lang('group_limits') . '[' . input('post.group_limits') . ']', 1);
+                dsLayerOpenSuccess(lang('admin_group_edit_succ'));
+            } else {
+                $this->error(lang('admin_group_edit_fail'));
+            }
+        } else {
+            //解析已有权限
+            $hlimit = ds_decrypt($group_info['group_limits'], MD5_KEY . md5($group_info['group_name']));
+            $group_info['group_limits'] = explode('|', $hlimit);
+            $this->assign('admin_array', 'edit');
+            $this->assign('group_info', $group_info);
+            $this->assign('limit', $this->permission());
+            $this->setAdminCurItem('edit');
+            return $this->fetch('form');
+        }
+    }
+
+    public function del()
+    {
+        $group_id = input('param.group_id');
+        if (empty($group_id)) {
+            $this->error(lang('param_error'));
+        }
+        $result = db('admingroup')->delete($group_id);
+        if ($result) {
+            ds_json_encode(10000, lang('admin_group_del_succ'));
+        } else {
+            ds_json_encode(10001, lang('admin_group_del_fail'));
+        }
+    }
+
+    /**
+     * 取得所有权限项
+     *
+     * @return array
+     */
+    private function permission()
+    {
+        $limit = $this->limitList();
+        if (is_array($limit)) {
+            foreach ($limit as $k => $v) {
+                if (is_array($v['child'])) {
+                    $tmp = array();
+                    foreach ($v['child'] as $key => $value) {
+                        $controller = (!empty($value['controller'])) ? $value['controller'] : $v['controller'];
+                        if (strpos($controller, '|') == false) {//controller参数不带|
+                            $limit[$k]['child'][$key]['action'] = rtrim($controller . '.' . str_replace('|', '|' . $controller . '.', $value['action']), '.');
+                        } else {//controller参数带|
+                            $tmp_str = '';
+                            if (empty($value['action'])) {
+                                $limit[$k]['child'][$key]['action'] = $controller;
+                            } elseif (strpos($value['action'], '|') == false) {//action参数不带|
+                                foreach (explode('|', $controller) as $v1) {
+                                    $tmp_str .= "$v1.{$value['action']}|";
+                                }
+                                $limit[$k]['child'][$key]['action'] = rtrim($tmp_str, '|');
+                            } elseif (strpos($value['action'], '|') != false && strpos($controller, '|') != false) {//action,controller都带|,交差权限
+                                foreach (explode('|', $controller) as $v1) {
+                                    foreach (explode('|', $value['action']) as $v2) {
+                                        $tmp_str .= "$v1.$v2|";
+                                    }
+                                }
+                                $limit[$k]['child'][$key]['action'] = rtrim($tmp_str, '|');
+                            }
+                        }
+                    }
+                }
+            }
+            return $limit;
+        } else {
+            return array();
+        }
+    }
+
+    /*
+    * 权限选择列表
+    */
+    function limitList()
+    {
+        $_limit = array(
+            array('name' => lang('ds_dashboard_manage'), 'child' => array(
+                array('name' => lang('ds_welcome'), 'action' => null, 'controller' => 'Wlcome'),
+                array('name' => lang('ds_welcome'), 'action' => "index", 'controller' => 'Wlcome'),
+            )),
+            array('name' => lang('ds_config'), 'child' => array(
+                array('name' => lang('ds_config'), 'action' => null, 'controller' => 'Config'),
+                array('name' => lang('ds_wzconfig'), 'action' => "index", 'controller' => 'Config'),
+                array('name' => "接入添加", 'action' => "add", 'controller' => 'Config'),
+                array('name' => "接入编辑", 'action' => "edit", 'controller' => 'Config'),
+                array('name' => "接入删除", 'action' => "del", 'controller' => 'Config'),
+            )),
+            array('name' => lang('ds_admin'), 'child' => array(
+                array('name' => lang('ds_admin'), 'action' => null, 'controller' => 'Admin'),
+                array('name' => lang('ds_gladmin'), 'action' => "index", 'controller' => 'Admin'),
+                array('name' => lang('ds_addadmin'), 'action' => "add", 'controller' => 'Admin'),
+                array('name' => lang('ds_edadmin'), 'action' => "edit", 'controller' => 'Admin'),
+                array('name' => lang('ds_dladmin'), 'action' => "del", 'controller' => 'Admin'),
+            )),
+            array('name' => lang('ds_admin_group'), 'child' => array(
+                array('name' => lang('ds_admin_group'), 'action' => null, 'controller' => 'AdminGroup'),
+                array('name' => lang('ds_admin_glgroup'), 'action' => "index", 'controller' => 'AdminGroup'),
+                array('name' => lang('ds_admin_addgroup'), 'action' => "add", 'controller' => 'AdminGroup'),
+                array('name' => lang('ds_admin_edgroup'), 'action' => "edit", 'controller' => 'AdminGroup'),
+                array('name' => lang('ds_admin_dlgroup'), 'action' => "del", 'controller' => 'AdminGroup'),
+            )),
+            array('name' => "常用语", 'child' => array(
+                array('name' => "常用语", 'action' => null, 'controller' => 'Product'),
+                array('name' => "常用语列表", 'action' => "index", 'controller' => 'Product'),
+                array('name' => "常用语添加", 'action' => 'add', 'controller' => 'Product'),
+                array('name' => "常用语编辑", 'action' => 'edit', 'controller' => 'Product'),
+                array('name' => "常用语删除", 'action' => 'del', 'controller' => 'Product'),
+            )),//常用语
+            array('name' => lang('ds_product'), 'child' => array(
+                array('name' => lang('ds_product'), 'action' => null, 'controller' => 'News'),
+                array('name' => lang('ds_product'), 'action' => "index", 'controller' => 'News'),
+                array('name' => lang('ds_addproduct'), 'action' => 'add', 'controller' => 'News'),
+                array('name' => lang('ds_edproduct'), 'action' => 'edit', 'controller' => 'News'),
+                array('name' => lang('ds_dlproduct'), 'action' => 'del', 'controller' => 'News'),
+            )),//知识库
+            array('name' => lang('ds_message'), 'child' => array(
+                array('name' => lang('ds_message'), 'action' => null, 'controller' => 'Message'),
+                array('name' => lang('ds_glmessage'), 'action' => "index", 'controller' => 'Message'),//留言表
+                array('name' => lang('ds_ckmessage'), 'action' => "reply", 'controller' => 'Message'),
+                array('name' => lang('ds_dlmessage'), 'action' => "del", 'controller' => 'Message'),
+            )),
+            array('name' => lang('ds_kfchat'), 'child' => array(
+                array('name' => lang('ds_kfchat'), 'action' => null, 'controller' => 'Service'),
+                array('name' => lang('ds_kfchat'), 'action' => "index", 'controller' => 'Service'),
+            )),//对话平台
+            array('name' => lang('ds_records'), 'child' => array(
+                array('name' => lang('ds_records'), 'action' => null, 'controller' => 'Jobcv'),
+                array('name' => lang('ds_glrecords'), 'action' => "index", 'controller' => 'Jobcv'),
+            )),//历史记录
+            array('name' => "访问列表", 'child' => array(
+                array('name' => "访问列表", 'action' => null, 'controller' => 'Visitkf'),
+                array('name' => "访问列表", 'action' => "index", 'controller' => 'Visitkf'),
+            )),//访客列表 
+            array('name' => "客服统计", 'child' => array(
+                array('name' => "客服统计", 'action' => null, 'controller' => 'Glservice'),
+                array('name' => "客服统计", 'action' => "index", 'controller' => 'Glservice'),
+            )),//客服统计
+        );
+
+        return $_limit;
+    }
+
+    protected function getAdminItemList()
+    {
+        $menu_array = array(
+            array(
+                'name' => 'index', 'text' => lang('ds_manage'), 'url' => url('Admingroup/index')
+            ), array(
+                'name' => 'add', 'text' => lang('ds_add'), 'url' => "javascript:dsLayerOpen('".url('Admingroup/add')."','".lang('ds_add')."')"
+
+            ),
+        );
+        return $menu_array;
+    }
+}

+ 124 - 0
application/home/controller/Config.php

@@ -0,0 +1,124 @@
+<?php
+
+namespace app\home\controller;
+
+use think\Lang;
+
+class Config extends AdminControl {
+
+    public function _initialize() {
+        parent::_initialize();
+        Lang::load(APP_PATH . 'home/lang/' . config('default_lang') . '/config.lang.php');
+    }
+
+    /**
+     * 接入信息管理
+     */
+    public function index()
+    {
+        $model_access = Model('Access');
+        $title = input('post.title');
+        $condition = array();
+        $condition['access_pid'] = session('service_pid');
+        if($title){
+            $condition['access_appid|access_appsecrect'] = $title;
+        }
+        $access_list = $model_access->getAccessList($condition, '*', 10);
+        $this->assign('access_list', $access_list);
+        $this->assign('show_page', $model_access->page_info->render());
+        $this->setAdminCurItem('index');
+        return $this->fetch();
+    }
+
+    /**
+     * 添加接入信息管理
+     * @return mixed
+     */
+    public function add()
+    { 
+        if (request()->isPost()) {
+            $model_access = Model('Access');
+            $data = array(
+                'access_url' => input('post.access_url'),
+                'access_status' => input('post.access_status') ? input('post.access_status'):0,
+                'access_appid' => random(22,0).time(),
+                'access_appsecrect' => random(32,0),
+                'access_pid' => session('service_pid'),//所属三方公司id
+                'access_addtime' => TIMESTAMP,
+            );
+            //添加到数据库
+            $result = $model_access->addAccess($data);
+            if ($result) {
+                dsLayerOpenSuccess("添加成功!");
+            } else {
+                $this->error("添加失败!");
+            }
+        } else {
+            $access = array(
+                'access_url' => '',
+                'access_status' => 0,
+            );
+            $model_access = Model('Access');
+            $this->assign('access',$access);
+            return $this->fetch('form');
+        }
+    }
+
+    public function edit()
+    {
+        $this->assign('is_super',session('access_id'));
+        $access_id = input('param.access_id');
+        if (empty($access_id)) {
+            $this->error(lang('param_error'));
+        }
+        $model_access = Model('Access');
+        if (!request()->isPost()) {
+            $condition['access_id'] = $access_id;
+            $access = $model_access->getAccessInfo($condition);
+            $this->assign('access', $access);
+            return $this->fetch('form');
+        } else {
+            $data = array(
+                'access_status' => input('post.access_status'),
+                'access_url' => input('post.access_url')
+            );
+            //验证数据  END
+            $result = $model_access->editAccess(array('access_id' => intval($access_id)), $data);
+            if ($result) {
+                dsLayerOpenSuccess("编辑成功!");
+            } else {
+                $this->error("编辑失败!");
+            }
+        }
+    }
+
+    public function del()
+    {
+        $access_id = input('param.access_id');
+        if (empty($access_id)) {
+            $this->error(lang('param_error'));
+        }
+        $result = db('access')->delete($access_id);
+        if ($result) {
+            ds_json_encode(10000, "删除成功!");
+        } else {
+            ds_json_encode(10001, "删除失败!");
+        }
+    }
+
+    protected function getAdminItemList()
+    {
+        $menu_array = array(
+            array(
+                'name' => 'index', 'text' => lang('ds_manage'), 'url' => url('Config/index')
+            ), array(
+                'name' => 'add', 'text' => lang('ds_add'), 'url' => "javascript:dsLayerOpen('".url('Config/add')."','".lang('ds_add')."')"
+            ),
+        );
+        return $menu_array;
+    }
+
+    
+
+
+}

+ 151 - 0
application/home/controller/Glservice.php

@@ -0,0 +1,151 @@
+<?php
+
+namespace app\home\controller;
+
+use think\Lang;
+
+class Glservice extends AdminControl
+{
+    const EXPORT_SIZE = 5000;
+
+    /**
+     * 客服统计
+     * @return mixed
+     */
+    public function index(){
+        $srwh = array();
+        $srwh['suosgs'] = session('service_pid');
+        $gskefz =Model('Admingroup')->getAdminGroupList($srwh,'group_id,group_name');//公司所有客服组
+        
+        $readok = input('post.kefu_keywords');
+        $kefuz = input('post.record_readok');
+        $model_service = Model('Service');
+        $condition = array();
+        if($readok){
+            $condition['service_name'] = $readok;
+        }
+        if($kefuz){
+            $condition['service_group_id'] = $kefuz;
+        }
+        $condition['service_pid'] = session('service_pid');
+        $kefulist = $model_service->getServiceList($condition,$field = '',10);
+        
+        if($kefulist){
+            //所属权限组
+            for ($i=0; $i < count($kefulist); $i++) { 
+                $ner['group_id'] = $kefulist[$i]['service_group_id'];
+                $sqxz[] = Model('Admingroup')->getOneAdmingroup($ner,'group_name');
+            }
+            $this->assign('sqxz',$sqxz);
+            //客服满意率
+            for ($ie=0; $ie < count($kefulist); $ie++) { 
+                $ser['sid'] = $kefulist[$ie]['service_id'];
+                $kfrate[] = Model('Chatlog')->chatlogcoRate($ser);
+            }
+            $this->assign('kfrate',$kfrate);//客服满意率
+            //客服挽留率
+            for ($i=0; $i < count($kefulist); $i++) { 
+                $wer['sid'] = $kefulist[$i]['service_id'];
+                $wlrate[] = Model('Chatlog')->chatlogDetainment($wer);
+            }
+            $this->assign('wlrate',$wlrate);
+            //客服转化率
+            for ($i=0; $i < count($kefulist); $i++) { 
+                $ler['sid'] = $kefulist[$i]['service_id'];
+                $zhrate[] = Model('Chatlog')->chatlogConversion($ler);
+            }
+            $this->assign('zhrate',$zhrate);
+        }
+
+        $this->assign('gskefz',$gskefz);
+        $this->assign('kefulist',$kefulist);
+        $this->assign('show_page', $model_service->page_info->render());
+        $this->setAdminCurItem('index');
+        return $this->fetch();
+   }
+
+    /**
+    * 导出第一步
+    */
+    public function export_step1()
+    {
+        $model_service = Model('Service');
+        $condition = array();
+        $condition['service_pid'] = session('service_pid');
+        $kefulist = $model_service->getServiceList($condition,$field = '',10);
+        $count = db('Service')->where($condition)->count();
+
+        if (!is_numeric(input('param.curpage'))) {
+            $count = db('Service')->where($condition)->count();
+            $array = array();
+            if ($count > self::EXPORT_SIZE) {    //显示下载链接
+                $page = ceil($count / self::EXPORT_SIZE);
+                for ($i = 1; $i <= $page; $i++) {
+                    $limit1 = ($i - 1) * self::EXPORT_SIZE + 1;
+                    $limit2 = $i * self::EXPORT_SIZE > $count ? $count : $i * self::EXPORT_SIZE;
+                    $array[$i] = $limit1 . ' ~ ' . $limit2;
+                }
+                $this->assign('list', $array);
+                $this->assign('murl', url('adminlog/list'));
+                return $this->fetch('excel');
+            }else{    
+                //如果数量小,直接下载
+                $data = db('Service')->where($condition)->order('service_id desc')->limit(self::EXPORT_SIZE)->select();
+                if($kefulist){
+                    for ($ie=0; $ie < count($kefulist); $ie++) { 
+                        $ser['sid'] = $kefulist[$ie]['service_id'];
+                        $kfrate[] = Model('Chatlog')->chatlogcoRate($ser);
+                    }//客服满意率
+                    for ($i=0; $i < count($kefulist); $i++) { 
+                        $wer['sid'] = $kefulist[$i]['service_id'];
+                        $wlrate[] = Model('Chatlog')->chatlogDetainment($wer);
+                    }//客服挽留率
+                    for ($i=0; $i < count($kefulist); $i++) { 
+                        $ler['sid'] = $kefulist[$i]['service_id'];
+                        $zhrate[] = Model('Chatlog')->chatlogConversion($ler);
+                    }//客服转化率
+                }
+                $this->createExcel($data,$kfrate,$wlrate,$zhrate);
+            }
+        }else{    
+            //下载
+            $limit1 = (input('param.curpage') - 1) * self::EXPORT_SIZE;
+            $limit2 = self::EXPORT_SIZE;
+            $data = db('Service')->where($condition)->order('service_id desc')->limit("{$limit1},{$limit2}")->select();
+            $this->createExcel($data);
+        }
+    }
+
+    /**
+     * 生成excel
+     *
+     * @param array $data
+     */
+    private function createExcel($data = array(),$kfrate,$wlrate,$zhrate)
+    {
+        $excel_obj = new \excel\Excel();
+        $excel_data = array();
+        //设置样式
+        $excel_obj->setStyle(array(
+            'id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')
+        ));
+        //header
+        $excel_data[0][] = array('styleid' => 's_title', 'data' => "客服名");
+        $excel_data[0][] = array('styleid' => 's_title', 'data' => "满意率(百分比)");
+        $excel_data[0][] = array('styleid' => 's_title', 'data' => "转化率(百分比)");
+        $excel_data[0][] = array('styleid' => 's_title', 'data' => "挽留率(百分比)");
+        foreach ((array)$data as $k => $v) {
+            $tmp = array();
+            $tmp[] = array('data' => $v['service_name']);
+            $tmp[] = array('data' => $kfrate[$k] .'%');
+            $tmp[] = array('data' => $wlrate[$k] .'%');
+            $tmp[] = array('data' => $zhrate[$k] .'%');
+            $excel_data[] = $tmp;
+        }
+        $excel_data = $excel_obj->charset($excel_data, CHARSET);
+        $excel_obj->addArray($excel_data);
+        $excel_obj->addWorksheet($excel_obj->charset(lang('admin_log'), CHARSET));
+        $excel_obj->generateXML($excel_obj->charset(lang('admin_log'), CHARSET) . input('param.curpage') . '-' . date('Y-m-d-H', time()));
+    }
+
+}

+ 159 - 0
application/home/controller/Index.php

@@ -0,0 +1,159 @@
+<?php
+
+namespace app\home\controller;
+
+use think\Lang;
+use think\Cache;
+
+class Index extends AdminControl
+{
+
+    public function _initialize()
+    {
+        parent::_initialize();
+        Lang::load(APP_PATH . 'home/lang/' . config('default_lang') . '/index.lang.php');
+    }
+
+    public function index()
+    {
+        $allpower = $this->qxhans();
+        $this->assign('allpower',$allpower);
+        $this->assign('admin_info', $this->getAdminInfo());
+        return $this->fetch();
+    }
+
+    /**
+     * 修改密码
+     */
+    public function modifypw()
+    {
+        if (request()->isPost()) {
+            $new_pw = trim(input('post.new_pw'));
+            $new_pw2 = trim(input('post.new_pw2'));
+            $old_pw = trim(input('post.old_pw'));
+            if ($new_pw !== $new_pw2) {
+                $this->error(lang('index_modifypw_repeat_error'));
+            }
+            $admininfo = $this->getAdminInfo();
+            //查询管理员信息
+            $service_model = model('service');
+            $admininfo = $service_model->getserviceInfo(array('service_id' => $admininfo['service_id']));
+            if (!is_array($admininfo) || count($admininfo) <= 0) {
+                $this->error(lang('index_modifypw_admin_error'));
+            }
+            //旧密码是否正确
+            if ($admininfo['service_password'] != md5($old_pw)) {
+                $this->error(lang('index_modifypw_oldpw_error'));
+            }
+            $new_pw = md5($new_pw);
+            $result = $service_model->editService(array('service_id' => $admininfo['service_id']), array('service_password' => $new_pw));
+            if ($result) {
+                session(null);
+                dsLayerOpenSuccess(lang('index_modifypw_succ'));
+            } else {
+                $this->error(lang('index_modifypw_fail'));
+            }
+        } else {
+            $this->setAdminCurItem('modifypw');
+            return $this->fetch();
+        }
+    }
+
+    /**
+     * 首页
+     * @return mixed
+     */
+    // public function welCome()
+    // {
+    //     $setup_date = config('setup_date');
+    //     $statistics['os'] = PHP_OS;
+    //     $statistics['web_server'] = $_SERVER['SERVER_SOFTWARE'];
+    //     $statistics['php_version'] = PHP_VERSION;
+    //     $statistics['sql_version'] = $this->_mysql_version();
+    //     $statistics['setup_date'] = substr($setup_date, 0, 10);
+
+    //     $statistics['domain'] = $_SERVER['HTTP_HOST'];
+    //     $statistics['ip'] = GetHostByName($_SERVER['SERVER_NAME']);
+    //     $statistics['zlib'] = function_exists('gzclose') ? 'YES' : 'NO'; //zlib
+    //     $statistics['safe_mode'] = (boolean)ini_get('safe_mode') ? 'YES' : 'NO'; //safe_mode = Off
+    //     $statistics['timezone'] = function_exists("date_default_timezone_get") ? date_default_timezone_get() : "no_timezone";
+    //     $statistics['curl'] = function_exists('curl_init') ? 'YES' : 'NO';
+    //     $statistics['fileupload'] = @ini_get('file_uploads') ? ini_get('upload_max_filesize') : 'unknown';
+    //     $statistics['max_ex_time'] = @ini_get("max_execution_time") . 's'; //脚本最大执行时间
+    //     $statistics['set_time_limit'] = function_exists("set_time_limit") ? true : false;
+    //     $statistics['memory_limit'] = ini_get('memory_limit');
+    //     $statistics['version'] = file_get_contents(APP_PATH . 'version.php');
+    //     if (function_exists("gd_info")) {
+    //         $gd = gd_info();
+    //         $statistics['gdinfo'] = $gd['GD Version'];
+    //     } else {
+    //         $statistics['gdinfo'] = lang('Unknown');
+    //     }
+
+    //     $this->assign('statistics', $statistics);
+    //     return $this->fetch('welcome');
+    // }
+
+    private function _mysql_version()
+    {
+        $version = db()->query("select version() as ver");
+        return $version[0]['ver'];
+    }
+
+    /**
+     * 修改当前语言
+     */
+    public function setLanguageCookie()
+    {
+        $language = input('param.language');
+        if ($language == config('default_lang')) {
+            $this->error(\lang('ds_language_repetition'), url('Index/index'));
+            exit();
+        }
+        setcookie("ds_admin_lang", $language, 0, '/');
+        $this->success(\lang('ds_language_switching'), url('Index/index'));
+        exit();
+    }
+
+    /**
+     * 删除缓存
+     */
+    function clear()
+    {
+        $this->delCacheFile('temp');
+        $this->delCacheFile('cache');
+        Cache::clear();
+        ds_json_encode(10000, lang('eliminate_succ'));
+        exit();
+    }
+
+    /**
+     * 删除缓存目录下的文件或子目录文件
+     *
+     * @param string $dir 目录名或文件名
+     * @return boolean
+     */
+    function delCacheFile($dir)
+    {
+        //防止删除cache以外的文件
+        if (strpos($dir, '..') !== false)
+            return false;
+        $path = RUNTIME_PATH . '/' . $dir;
+        if (is_dir($path)) {
+            $file_list = array();
+            read_file_list($path, $file_list);
+            if (!empty($file_list)) {
+                foreach ($file_list as $v) {
+                    if (basename($v) != 'index.html')
+                        @unlink($v);
+                }
+            }
+        } else {
+            if (basename($path) != 'index.html')
+                @unlink($path);
+        }
+        return true;
+    }
+
+
+}

Vissa filer visades inte eftersom för många filer har ändrats