Browse Source

共享茶室

linwu 3 months ago
parent
commit
ad88dfa62c
33 changed files with 1554 additions and 143 deletions
  1. 28 8
      api/applet/controller/AppletController.php
  2. 1 1
      api/common/Http.php
  3. 103 0
      api/teahouse/controller/TeahouseController.php
  4. 236 0
      api/teahouse/controller/UserController.php
  5. 1 0
      app/activity/controller/AdminActivityController.php
  6. 55 0
      app/teahouse/controller/AdminLockBookController.php
  7. 82 0
      app/teahouse/controller/AdminLockController.php
  8. 39 0
      app/teahouse/controller/AdminSettingController.php
  9. 64 0
      app/teahouse/controller/AdminUserController.php
  10. 26 0
      app/teahouse/model/LockBookModel.php
  11. 26 0
      app/teahouse/model/LockModel.php
  12. 29 0
      app/teahouse/model/LockUserModel.php
  13. 4 4
      applet/app.js
  14. 5 1
      applet/app.json
  15. 3 3
      applet/colorui/main.wxss
  16. 0 1
      applet/compenents/review/index.js
  17. 18 0
      applet/pages/home/home/home.js
  18. 13 1
      applet/pages/home/home/home.wxml
  19. 27 32
      applet/pages/my/home/home.js
  20. 53 51
      applet/pages/my/home/home.wxml
  21. 140 24
      applet/pages/my/home/home.wxss
  22. 1 1
      applet/pages/my/info/info.wxml
  23. 1 1
      applet/utils/util.js
  24. 1 1
      data/config/database.php
  25. 0 12
      public/.htaccess
  26. 87 0
      public/themes/admin_simpleboot3/teahouse/admin_lock/add.html
  27. 99 0
      public/themes/admin_simpleboot3/teahouse/admin_lock/edit.html
  28. 99 0
      public/themes/admin_simpleboot3/teahouse/admin_lock/index.html
  29. 91 0
      public/themes/admin_simpleboot3/teahouse/admin_lock_book/index.html
  30. 53 0
      public/themes/admin_simpleboot3/teahouse/admin_setting/index.html
  31. 67 0
      public/themes/admin_simpleboot3/teahouse/admin_user/examine.html
  32. 100 0
      public/themes/admin_simpleboot3/teahouse/admin_user/index.html
  33. 2 2
      vendor/thinkcmf/cmf/src/common.php

+ 28 - 8
api/applet/controller/AppletController.php

@@ -24,7 +24,7 @@ class AppletController extends RestBaseController
         $code   = $this->request->post('code');
         $url    = self::CODE_URL . '?appid=' . $wxappSettings['app_id'] . '&secret=' . $wxappSettings['app_secret'] . '&js_code=' . $code . '&grant_type=authorization_code';
         $header = ['content-type: application/json'];
-        $result = Http::http_post_json($url, '', $header);
+        $result = Http::http_post_json($url, [], $header);
         if (!empty($result['errcode'])) {
             $this->error($result['errmsg']);
         }
@@ -68,15 +68,35 @@ class AppletController extends RestBaseController
         $result = Http::http_post_json($url, $data, $header);
         halt($result);*/
 
-        $token = $this->_getAccessToken();
-        $url = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token={$token}";
+        $url = "https://cnapi.sciener.com/oauth2/token";
         $data = [
-            'touser' => 'oQeNu5TLNQBgPOKBoH4wK8VyAHMQ',
-            'msgtype' => 'text',
-            'text' => ['content'=>'Hello World']
+            'clientId' => '3280d286853f4588addae034f855333e',
+            'clientSecret' => 'b1a083bbd1bda2343828deddaa579f19',
+            'username' => '+86159607153161',
+            'password' => md5('qwe123456'),
         ];
-        $header = ['content-type: application/json'];
-        $result = Http::http_post_json($url, json_encode($data), $header);
+        $header = ['Content-Type: application/x-www-form-urlencoded'];
+        $result = Http::http_post_json($url, $data, $header);
+        halt($result);
+    }
+
+    public function t2()
+    {
+        $start_time = strtotime(date('Y-m-d H:00:00'));
+        $end_time   = strtotime(date('Y-m-d H:00:00').' +1 hours');
+        $now = time();
+        $url = "https://cnapi.sciener.com/v3/keyboardPwd/get";
+        $data = [
+            'clientId' => '3280d286853f4588addae034f855333e',
+            'accessToken' => 'd2abf38a91bc0238796043bb02686d34',
+            'lockId' => 19406485,
+            'keyboardPwdType' => 1,
+            'startDate' => $start_time * 1000,
+            'endDate' => $end_time * 1000,
+            'date' => $now * 1000,
+        ];
+        $header = ['Content-Type: application/x-www-form-urlencoded'];
+        $result = Http::http_post_json($url, $data, $header);
         halt($result);
     }
 

+ 1 - 1
api/common/Http.php

@@ -321,7 +321,7 @@ class Http {
         curl_setopt($oCurl, CURLOPT_URL, $url);
         curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1 );
         curl_setopt($oCurl, CURLOPT_POST,true);
-        curl_setopt($oCurl, CURLOPT_POSTFIELDS,$strPOST);
+        curl_setopt($oCurl, CURLOPT_POSTFIELDS,http_build_query($param));
         if (!empty($header)) {
             curl_setopt($oCurl, CURLOPT_HTTPHEADER, $header);
         }

+ 103 - 0
api/teahouse/controller/TeahouseController.php

@@ -0,0 +1,103 @@
+<?php
+
+namespace api\teahouse\controller;
+
+use app\teahouse\model\LockBookModel;
+use app\teahouse\model\LockModel;
+use app\teahouse\model\LockUserModel;
+use cmf\controller\RestBaseController;
+
+class TeahouseController extends RestBaseController
+{
+    public function getTeahouseList()
+    {
+        $param = $this->request->param();
+        $page  = empty($param['page']) ? 1 : $param['page'];
+        $size  = empty($param['size']) ? 10 : $param['size'];
+
+        //搜索条件
+        $list = LockModel::where('is_show', 1)->page($page, $size)->select();
+
+        //数据处理
+        if (!$list->isEmpty()) {
+            foreach ($list as $v) {
+                $v['image'] = cmf_get_image_preview_url($v['image']);
+            }
+        }
+
+        $this->success('成功', $list);
+    }
+
+    public function getTimeByDate()
+    {
+        $lock_id    = $this->request->param('lock_id');
+        $date       = $this->request->param('date');
+        $date       = str_replace(['年', '月', '日'], ['-', '-', ''], $date);
+        $date_start = strtotime($date);
+        $date_end   = strtotime($date . ' +1 day');
+        $list       = LockBookModel::where('lock_id', $lock_id)
+            ->where('start_time', '>=', $date_start)
+            ->where('end_time', '<=', $date_end)
+            ->select();
+        $res        = [];
+        if (!$list->isEmpty()) {
+            foreach ($list as $v) {
+                $res[] = date('H:i', $v['start_time']) . ' - ' . date('H:i', $v['end_time']);
+            }
+        }
+
+        $this->success('成功', $res);
+    }
+
+    public function reservation()
+    {
+        //茶室
+        $lock_id = $this->request->param('lock_id');
+        if (empty($lock_id)) {
+            $this->error('参数异常');
+        }
+        $lock = LockModel::where('id', $lock_id)->find();
+
+        //日期
+        $date = $this->request->param('date');
+        if (empty($date)) {
+            $this->error('请选择要预约的日期');
+        }
+        $date = str_replace(['年', '月', '日'], ['-', '-', ''], $date);
+
+        //时间
+        $time_list = $this->request->param('time');
+        if (empty($time_list)) {
+            $this->error('请选择要预约的时间');
+        }
+        if (count($time_list) > 3) {
+            $this->error('一次最多预约3个小时');
+        }
+
+        //爽约次数
+        $unuse = LockBookModel::where('user',  $this->user['id'])->where('is_use',2)->count();
+        if ($unuse >= 3) {
+            $this->error('您爽约和预约的总时长超过3小时,无法再预约,请联系管理员');
+        }
+
+        //添加预约信息
+        $user = LockUserModel::where('user_id', $this->user['id'])->find();
+        $now = time();
+        $relation_id = uniqid();
+        foreach ($time_list as $v) {
+            $add               = [];
+            $time              = explode('-', $v);
+            $add['lock_id']    = $lock_id;
+            $add['user_id']    = $user['user_id'];
+            $add['lock_name']  = $lock['name'];
+            $add['user_name']  = $user['name'];
+            $add['start_time'] = strtotime($date . ' ' . trim($time[0]) . ':00');
+            $add['end_time']   = strtotime($date . ' ' . trim($time[1]) . ':00');
+            $add['relation_id'] = $relation_id;
+            $add['create_time'] = $now;
+            LockBookModel::create($add);
+        }
+
+        $this->success('成功');
+    }
+}

+ 236 - 0
api/teahouse/controller/UserController.php

@@ -0,0 +1,236 @@
+<?php
+
+namespace api\teahouse\controller;
+
+use api\common\Http;
+use app\teahouse\model\LockBookModel;
+use app\teahouse\model\LockModel;
+use app\teahouse\model\LockUserModel;
+use cmf\controller\RestBaseController;
+
+class UserController extends RestBaseController
+{
+    public function checkQualification()
+    {
+        $user_id = $this->getUserId();
+        $user    = LockUserModel::where('user_id', $user_id)->find();
+
+        if (!empty($user) && $user['status'] == 2) {
+            $this->success();
+        }
+
+        $this->error('');
+    }
+
+    public function getUserInfo()
+    {
+        $user_id = $this->getUserId();
+        $user    = LockUserModel::where('user_id', $user_id)->find();
+
+        $this->success('', $user);
+    }
+
+    public function editUserInfo()
+    {
+        $user_id = $this->getUserId();
+        $info    = $this->request->post();
+
+        $user = LockUserModel::where('user_id', $user_id)->find();
+        if (empty($user)) {
+            $info['user_id']     = $user_id;
+            $info['create_time'] = time();
+            LockUserModel::create($info);
+        } else {
+            $info['status'] = 1;
+            LockUserModel::where('user_id', $user_id)->update($info);
+        }
+
+        $this->success();
+    }
+
+    public function getBookList()
+    {
+        $param = $this->request->param();
+        $page  = empty($param['page']) ? 1 : $param['page'];
+        $size  = empty($param['size']) ? 10 : $param['size'];
+
+        //搜索条件
+        $list = LockBookModel::where('user_id', $this->getUserId())
+            ->page($page, $size)
+            ->order('id desc')
+            ->select();
+
+        if (!$list->isEmpty()) {
+            $time = time();
+            foreach ($list as $v) {
+                if ($v['start_time'] > $time) {
+                    $v['status']      = 1;
+                    $v['status_name'] = '未开始';
+                } elseif ($v['start_time'] <= $time && $v['end_time'] >= $time) {
+                    $v['status']      = 2;
+                    $v['status_name'] = '进行中';
+                } else {
+                    if ($v['is_use'] == 1) {
+                        $v['status']      = 3;
+                        $v['status_name'] = '已完成';
+                    } else {
+                        $v['status']      = 4;
+                        $v['status_name'] = '爽约';
+                    }
+                }
+                $v['date'] = date('Y年m月d日', $v['start_time']);
+                $v['time'] = date('H:i', $v['start_time']) . ' - ' . date('H:i', $v['end_time']);
+            }
+        }
+
+        $this->success('', $list);
+    }
+
+    public function showPassword()
+    {
+        $id   = $this->request->param('id');
+        $book = LockBookModel::where('id', $id)->where('user_id', $this->getUserId())->find();
+        if (empty($book)) {
+            $this->error('该预约不存在');
+        }
+        $time = time();
+        if ($time < $book['start_time']) {
+            $this->error('预约未开始');
+        }
+        if ($time > $book['end_time']) {
+            $this->error('预约已结束');
+        }
+        if (!empty($book['password'])) {
+            $this->success('成功', ['password' => $book['password']]);
+        }
+
+        $password = $this->_getLockPassword($id);
+        $this->success('成功', ['password' => $password]);
+    }
+
+    public function refreshPassword()
+    {
+        $id   = $this->request->param('id');
+        $book = LockBookModel::where('id', $id)->where('user_id', $this->getUserId())->find();
+        if (empty($book)) {
+            $this->error('该预约不存在');
+        }
+        $time = time();
+        if ($time < $book['start_time']) {
+            $this->error('预约未开始');
+        }
+        if ($time > $book['end_time']) {
+            $this->error('预约已结束');
+        }
+
+        $password = $this->_getLockPassword($id);
+        $this->success('成功', ['password' => $password]);
+    }
+
+    private function _getLockPassword($id)
+    {
+        $book = LockBookModel::where('id', $id)->where('user_id', $this->getUserId())->find();
+        if (empty($book)) {
+            $this->error('该预约不存在');
+        }
+
+        //锁信息
+        $lock = LockModel::find($book['lock_id']);
+        if (empty($lock) || empty($lock['lock_id'])) {
+            $this->error('锁不存在或配置有误,请联系管理员');
+        }
+        $teahouse_setting = cmf_get_option('teahouse_setting');
+
+        //获取锁密码的基础信息
+        $lock_id    = $lock['lock_id'];
+        $token      = $this->_getLockToken();
+        $clientId   = $teahouse_setting['clientId'];
+        $start_time = $book['start_time'];
+        $end_time   = $book['end_time'];
+        $now        = time();
+
+        //获取锁密码
+        $url    = "https://cnapi.sciener.com/v3/keyboardPwd/get";
+        $data   = [
+            'clientId'        => $clientId,
+            'accessToken'     => $token,
+            'lockId'          => $lock_id,
+            'keyboardPwdType' => 1,
+            'startDate'       => $start_time * 1000,
+            'endDate'         => $end_time * 1000,
+            'date'            => $now * 1000,
+        ];
+        $header = ['Content-Type: application/x-www-form-urlencoded'];
+        $result = Http::http_post_json($url, $data, $header);
+        if (!empty($result['errcode'])) {
+            $this->error('获取密码失败,请联系管理员。' . $result['description']);
+        }
+
+        //保存密码
+        $book->password = $result['keyboardPwd'];
+        $book->save();
+        LockBookModel::where('relation_id', $book['relation_id'])->update(['is_use' => 1]);
+
+        return $result['keyboardPwd'];
+    }
+
+    private function _getLockToken()
+    {
+        $teahouse_token = cmf_get_option('teahouse_token');
+        if (empty($teahouse_token)) {
+            return $this->_getLockTokenFirst();
+        }
+
+        $teahouse_token = cmf_get_option('teahouse_token');
+        if ($teahouse_token['expires_in'] < time()) {
+            return $this->_getLockTokenByRefresh();
+        }
+
+        return $teahouse_token['access_token'];
+    }
+
+    private function _getLockTokenFirst()
+    {
+        $url              = "https://cnapi.sciener.com/oauth2/token";
+        $teahouse_setting = cmf_get_option('teahouse_setting');
+        if (empty($teahouse_setting)) {
+            $this->error('门锁配置错误,请联系管理员');
+        }
+        $data   = [
+            'clientId'     => $teahouse_setting['clientId'],
+            'clientSecret' => $teahouse_setting['clientSecret'],
+            'username'     => $teahouse_setting['username'],
+            'password'     => md5($teahouse_setting['password']),
+        ];
+        $header = ['Content-Type: application/x-www-form-urlencoded'];
+        $result = Http::http_post_json($url, $data, $header);
+        if (!empty($result['errcode'])) {
+            $this->error('门锁配置错误,请联系管理员。' . $result['description']);
+        }
+        cmf_set_option('teahouse_token', $result);
+        return $result['access_token'];
+    }
+
+    private function _getLockTokenByRefresh()
+    {
+        $url              = "https://cnapi.sciener.com/oauth2/token";
+        $teahouse_setting = cmf_get_option('teahouse_setting');
+        if (empty($teahouse_setting)) {
+            $this->error('门锁配置错误,请联系管理员');
+        }
+        $teahouse_token = cmf_get_option('teahouse_token');
+        $data           = [
+            'clientId'      => $teahouse_setting['clientId'],
+            'clientSecret'  => $teahouse_setting['clientSecret'],
+            'grant_type'    => 'refresh_token',
+            'refresh_token' => $teahouse_token['refresh_token'],
+        ];
+        $header         = ['Content-Type: application/x-www-form-urlencoded'];
+        $result         = Http::http_post_json($url, $data, $header);
+        if (!empty($result['errcode'])) {
+            $this->error('门锁配置错误,请联系管理员。' . $result['description']);
+        }
+        cmf_set_option('teahouse_token', $result);
+        return $result['access_token'];
+    }
+}

+ 1 - 0
app/activity/controller/AdminActivityController.php

@@ -117,6 +117,7 @@ class AdminActivityController extends AdminBaseController
             $this->error('该活动已有活动回顾,无法删除');
         }
 
+        $info->delete();
         $this->success('删除成功');
     }
 

+ 55 - 0
app/teahouse/controller/AdminLockBookController.php

@@ -0,0 +1,55 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: 小夏 < 449134904@qq.com>
+// +----------------------------------------------------------------------
+namespace app\teahouse\controller;
+
+use app\teahouse\model\LockBookModel;
+use cmf\controller\AdminBaseController;
+
+class AdminLockBookController extends AdminBaseController
+{
+    public function index()
+    {
+        $param = $this->request->param();
+
+        //搜索条件
+        $where = [];
+        if (!empty($param['lock_name'])) {
+            $where[] = ['lock_name', 'like', "%{$param['lock_name']}%"];
+        }
+        if (!empty($param['user_name'])) {
+            $where[] = ['user_name', 'like', "%{$param['user_name']}%"];
+        }
+        if (!empty($param['is_use'])) {
+            $where[] = ['is_use', '=', $param['is_use']];
+        }
+
+        $list = LockBookModel::where($where)
+            ->append(['is_use_text'])
+            ->order('id desc')
+            ->paginate(10, false, ['query' => $param]);
+
+        $this->assign('is_use', isset($param['is_use']) ? $param['is_use'] : 0);
+        $this->assign('lock_name', isset($param['lock_name']) ? $param['lock_name'] : '');
+        $this->assign('user_name', isset($param['user_name']) ? $param['user_name'] : '');
+        $this->assign('list', $list->items());
+        $this->assign('page', $list->render());
+
+        return $this->fetch();
+    }
+
+    public function setStatus()
+    {
+        $ids = $this->request->param('ids');
+        LockBookModel::update(['is_use' => 1], ['id' => $ids]);
+        $this->success('操作成功');
+    }
+}
+

+ 82 - 0
app/teahouse/controller/AdminLockController.php

@@ -0,0 +1,82 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: 小夏 < 449134904@qq.com>
+// +----------------------------------------------------------------------
+namespace app\teahouse\controller;
+
+use app\teahouse\model\LockModel;
+use cmf\controller\AdminBaseController;
+
+class AdminLockController extends AdminBaseController
+{
+    public function index()
+    {
+        $param = $this->request->param();
+
+        //搜索条件
+        $where = [];
+        if (!empty($param['keyword'])) {
+            $where[] = ['name', 'like', "%{$param['keyword']}%"];
+        }
+        if (!empty($param['is_show'])) {
+            $where[] = ['is_show', '=', $param['is_show']];
+        }
+
+        $list = LockModel::where($where)
+            ->append(['is_show_text'])
+            ->paginate(10, false, ['query' => $param]);
+
+        $this->assign('is_show', isset($param['is_show']) ? $param['is_show'] : 0);
+        $this->assign('keyword', isset($param['keyword']) ? $param['keyword'] : '');
+        $this->assign('list', $list->items());
+        $this->assign('page', $list->render());
+
+        return $this->fetch();
+    }
+
+    public function add()
+    {
+        return $this->fetch();
+    }
+
+    public function addPost()
+    {
+        if ($this->request->isPost()) {
+            $data = $this->request->post();
+            LockModel::create($data);
+            $this->success('添加成功!', url('index'));
+        }
+    }
+
+    public function edit()
+    {
+        $id   = $this->request->param('id', 0, 'intval');
+        $info = LockModel::get($id);
+        $this->assign('info', $info);
+
+        return $this->fetch();
+    }
+
+    public function editPost()
+    {
+        if ($this->request->isPost()) {
+            $data = $this->request->post();
+            LockModel::update($data, ['id' => $data['id']]);
+            $this->success('编辑成功!', url('index'));
+        }
+    }
+
+    public function delete()
+    {
+        $id = $this->request->param('id', 0, 'intval');
+        LockModel::destroy($id);
+        $this->success('删除成功');
+    }
+}
+

+ 39 - 0
app/teahouse/controller/AdminSettingController.php

@@ -0,0 +1,39 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: 小夏 < 449134904@qq.com>
+// +----------------------------------------------------------------------
+namespace app\teahouse\controller;
+
+use cmf\controller\AdminBaseController;
+use think\Validate;
+
+class AdminSettingController extends AdminBaseController
+{
+    public function index()
+    {
+        $setting = cmf_get_option('teahouse_setting');
+        $this->assign($setting);
+        return $this->fetch();
+    }
+
+    public function indexPost()
+    {
+        $post = array_map('trim', $this->request->param());
+
+        if (in_array('', $post) && !empty($post['teahouse_setting'])) {
+            $this->error("不能留空!");
+        }
+
+        cmf_set_option('teahouse_setting', $post);
+
+        $this->success("保存成功!");
+    }
+
+}
+

+ 64 - 0
app/teahouse/controller/AdminUserController.php

@@ -0,0 +1,64 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: 小夏 < 449134904@qq.com>
+// +----------------------------------------------------------------------
+namespace app\teahouse\controller;
+
+use app\teahouse\model\LockBookModel;
+use app\teahouse\model\LockUserModel;
+use cmf\controller\AdminBaseController;
+
+class AdminUserController extends AdminBaseController
+{
+    public function index()
+    {
+        $param = $this->request->param();
+
+        //搜索条件
+        $where = [];
+        if (!empty($param['name'])) {
+            $where[] = ['name', 'like', "%{$param['name']}%"];
+        }
+        if (!empty($param['mobile'])) {
+            $where[] = ['mobile', 'like', "%{$param['mobile']}%"];
+        }
+        if (!empty($param['status'])) {
+            $where[] = ['status', '=', $param['status']];
+        }
+
+        $list = LockUserModel::where($where)
+            ->append(['sex_text', 'status_text'])
+            ->order('status asc')
+            ->paginate(10, false, ['query' => $param]);
+
+        $this->assign('status', isset($param['status']) ? $param['status'] : 0);
+        $this->assign('name', isset($param['name']) ? $param['name'] : '');
+        $this->assign('mobile', isset($param['mobile']) ? $param['mobile'] : '');
+        $this->assign('list', $list->items());
+        $this->assign('page', $list->render());
+
+        return $this->fetch();
+    }
+
+    public function examine()
+    {
+        $ids = $this->request->param('ids');
+        return $this->fetch('', ['ids' => $ids]);
+    }
+
+    public function setStatus()
+    {
+        $ids     = $this->request->param('ids');
+        $status  = $this->request->param('status');
+        $comment = $this->request->param('comment', '');
+        LockUserModel::update(['status' => $status, 'comment' => $comment], ['id' => $ids]);
+        $this->success('操作成功');
+    }
+}
+

+ 26 - 0
app/teahouse/model/LockBookModel.php

@@ -0,0 +1,26 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author:kane < chengjin005@163.com>
+// +----------------------------------------------------------------------
+namespace app\teahouse\model;
+
+use think\Model;
+
+class LockBookModel extends Model
+{
+    public static $IS_USE = [
+        1 => "到场",
+        2 => "未到场",
+    ];
+
+    public function getIsUseTextAttr($value, $data)
+    {
+        return self::$IS_USE[$data['is_use']];
+    }
+}

+ 26 - 0
app/teahouse/model/LockModel.php

@@ -0,0 +1,26 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author:kane < chengjin005@163.com>
+// +----------------------------------------------------------------------
+namespace app\teahouse\model;
+
+use think\Model;
+
+class LockModel extends Model
+{
+    public static $IS_SHOW = [
+        1 => "显示",
+        2 => "隐藏",
+    ];
+
+    public function getIsShowTextAttr($value, $data)
+    {
+        return self::$IS_SHOW[$data['is_show']];
+    }
+}

+ 29 - 0
app/teahouse/model/LockUserModel.php

@@ -0,0 +1,29 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author:kane < chengjin005@163.com>
+// +----------------------------------------------------------------------
+namespace app\teahouse\model;
+
+use think\Model;
+
+class LockUserModel extends Model
+{
+    public static $SEX = ['未知', '男', '女'];
+    public static $STATUS = [1 => '待审核', 2 => '通过', 3 => '拒绝'];
+
+    public function getSexTextAttr($value, $data)
+    {
+        return self::$SEX[$data['sex']];
+    }
+
+    public function getStatusTextAttr($value, $data)
+    {
+        return self::$STATUS[$data['status']];
+    }
+}

+ 4 - 4
applet/app.js

@@ -2,10 +2,10 @@
 App({
   globalData: {
     title: '晋爱人才',
-    // http_host: 'http://bd.jarc.com/',
-    http_host: 'http://jarc.jucai.gov.cn/',
-    // api_host: 'http://bd.jarc.com/api/',
-    api_host: 'https://jarc.jucai.gov.cn/api/',
+    http_host: 'http://bd.jarc.com/',
+    // http_host: 'http://jarc.jucai.gov.cn/',
+    api_host: 'http://bd.jarc.com/api/',
+    // api_host: 'https://jarc.jucai.gov.cn/api/',
   },
   onLaunch: function() {
     var self = this;

+ 5 - 1
applet/app.json

@@ -28,7 +28,11 @@
     "pages/webview/recuperate/recuperate",
     "pages/my/score/score",
     "pages/my/agreement/service",
-    "pages/my/agreement/privacy"
+    "pages/my/agreement/privacy",
+    "pages/teahouse/register/register",
+    "pages/teahouse/home/home",
+    "pages/teahouse/detail/detail",
+    "pages/teahouse/log/log"
   ],
   "window": {
     "navigationStyle": "custom",

+ 3 - 3
applet/colorui/main.wxss

@@ -9,17 +9,17 @@
 /* ==================
         初始化
  ==================== */
-page {
+ page {
 	/* Color 可以自定义相关配色 */
 	/* var属性兼容性 --> https://www.caniuse.com/#feat=css-variables */
 	/* 标准色 */
-	--red: #e60012;
+	--red: #e54d42;
 	--orange: #f37b1d;
 	--yellow: #fbbd08;
 	--olive: #8dc63f;
 	--green: #39b54a;
 	--cyan: #1cbbb4;
-	--blue: #01315f;
+	--blue: #0081ff;
 	--purple: #6739b6;
 	--mauve: #9c26b0;
 	--pink: #e03997;

+ 0 - 1
applet/compenents/review/index.js

@@ -25,7 +25,6 @@ Component({
    */
   methods: {
     toDetail(e) {
-      console.log(e);
       wx.navigateTo({
         url: '/pages/activity/reviewdetail/reviewdetail?id=' + e.currentTarget.dataset.id,
       })

+ 18 - 0
applet/pages/home/home/home.js

@@ -76,4 +76,22 @@ Page({
       url: '/pages/business/home/home',
     })
   },
+  toRob() {
+    wx.switchTab({
+      url: '/pages/rob/home/home',
+    })
+  },
+  toTeahouse() {
+    app.get('teahouse/user/checkQualification',function(res){
+      //茶室页
+      wx.navigateTo({
+        url: '/pages/teahouse/home/home',
+      })
+    },true,function() {
+      //注册页
+      wx.navigateTo({
+        url: '/pages/teahouse/register/register',
+      })
+    });
+  },
 })

+ 13 - 1
applet/pages/home/home/home.wxml

@@ -29,7 +29,7 @@
 </view>
 
 <!-- 导航栏 -->
-<view class="cu-list grid col-3 no-border">
+<view class="cu-list grid col-4 no-border">
   <view class="cu-item" bindtap="toList" data-tab="0">
     <view>
       <image src="/common/images/index/article.png" style="width:72rpx;height:72rpx;"></image>
@@ -48,6 +48,12 @@
     </view>
     <text style="color:#221815;font-size:28rpx;">码上服务</text>
   </view>
+  <view class="cu-item" bindtap="toRob">
+    <view>
+      <image src="/common/images/index/activity.png" style="width:72rpx;height:72rpx;"></image>
+    </view>
+    <text style="color:#221815;font-size:28rpx;">抢票</text>
+  </view>
   <view class="cu-item" bindtap="toList" data-tab="1">
     <view>
       <image src="/common/images/index/activity.png" style="width:72rpx;height:72rpx;"></image>
@@ -66,6 +72,12 @@
     </view>
     <text style="color:#221815;font-size:28rpx;">人才疗休养</text>
   </view>
+  <view class="cu-item" bindtap="toTeahouse">
+    <view>
+      <image src="/common/images/index/review.png" style="width:72rpx;height:72rpx;"></image>
+    </view>
+    <text style="color:#221815;font-size:28rpx;">共享茶室</text>
+  </view>
 </view>
 
 <!-- 活动列表 -->

+ 27 - 32
applet/pages/my/home/home.js

@@ -71,40 +71,35 @@ Page({
       }
     })
   },
-  uploadAvatar() {
+  uploadAvatar(e) {
     let self = this;
-    wx.chooseImage({
-      count: 1,
-      sizeType: ['original'],
+    const { avatarUrl } = e.detail;
+    wx.showLoading({
+      mask: true,
+    });
+    var token = wx.getStorageSync('token');
+    wx.uploadFile({
+      url: app.globalData.api_host + 'user/profile/avatarUpload',
+      filePath: avatarUrl,
+      name: 'file',
+      header: { 'X-Requested-With': 'XMLHttpRequest' , 'XX-Device-Type': 'wxapp' , 'XX-Token': token},
       success(res) {
-        wx.showLoading({
-          mask: true,
-        });
-        var token = wx.getStorageSync('token');
-        wx.uploadFile({
-          url: app.globalData.api_host + 'user/profile/avatarUpload',
-          filePath: res.tempFilePaths[0],
-          name: 'file',
-          header: { 'X-Requested-With': 'XMLHttpRequest' , 'XX-Device-Type': 'wxapp' , 'XX-Token': token},
-          success(res) {
-            var json = JSON.parse(res.data)
-            if (json.code == 1) {
-              wx.hideLoading();
-              self.setData({"userInfo.avatar": json.data});
-              app.globalData.userInfo = self.data.userInfo;
-            } else {
-              wx.showToast({
-                title: '上传失败,请重试',
-                icon: 'none'
-              });
-            }
-          },
-          fail() {
-            wx.showToast({
-              title: '上传失败,请重试',
-              icon: 'none'
-            });
-          }
+        var json = JSON.parse(res.data)
+        if (json.code == 1) {
+          wx.hideLoading();
+          self.setData({"userInfo.avatar": json.data});
+          app.globalData.userInfo = self.data.userInfo;
+        } else {
+          wx.showToast({
+            title: '上传失败,请重试',
+            icon: 'none'
+          });
+        }
+      },
+      fail() {
+        wx.showToast({
+          title: '上传失败,请重试',
+          icon: 'none'
         });
       }
     });

+ 53 - 51
applet/pages/my/home/home.wxml

@@ -1,33 +1,35 @@
 <cu-custom bgColor="bg-lw-header">
-	<view slot="content">我的</view>
+  <view slot="content">我的</view>
 </cu-custom>
 
 <view class="userinfo">
-	<view class="userinfo-left">
-		<view class="cu-avatar round" wx:if="{{!userInfo.avatar}}">
-			<text class="cuIcon-people"></text>
-		</view>
-		<view class="cu-avatar round" wx:else bindtap="uploadAvatar" style="background-image:url({{userInfo.avatar}});"></view>
-		<view class="namebox">
-			<block wx:if="{{!userInfo.user_nickname}}">
-				<button class="cu-btn" open-type="getUserInfo" wx:if="{{!getUserInfo}}" bindgetuserinfo="getUserInfo">点击登录</button>
-				<button class="cu-btn" wx:if="{{getUserInfo}}" bindtap="getUserProfile">点击登录</button>
-			</block>
-			<block wx:else>
-				<view class="userinfo-content" bindtap="getUserProfile">
-					{{userInfo.user_nickname}}
-					<text class="cuIcon-refresh lg text-white"></text>
-				</view>
+  <view class="userinfo-left">
+    <button class="avatar-wrapper" style="width:124rpx;height:124rpx;margin:0;padding:0;" open-type="chooseAvatar" bind:chooseavatar="uploadAvatar">
+      <view class="cu-avatar round" wx:if="{{!userInfo.avatar}}">
+        <text class="cuIcon-people"></text>
+      </view>
+      <view class="cu-avatar round" wx:else style="background-image:url({{userInfo.avatar}});"></view>
+    </button>
+    <view class="namebox">
+      <block wx:if="{{!userInfo.user_nickname}}">
+        <button class="cu-btn" open-type="getUserInfo" wx:if="{{!getUserInfo}}" bindgetuserinfo="getUserInfo">点击登录</button>
+        <button class="cu-btn" wx:if="{{getUserInfo}}" bindtap="getUserProfile">点击登录</button>
+      </block>
+      <block wx:else>
+        <view class="userinfo-content" bindtap="getUserProfile">
+          {{userInfo.user_nickname}}
+          <text class="cuIcon-refresh lg text-white"></text>
+        </view>
         <view class="userinfo-id">id:{{userInfo.id}}</view>
         <view class="userinfo-id" bindtap="toScore">积分:{{userInfo.score}}</view>
-			</block>
-		</view>
-	</view>
-	<view class="userinfo-right" bindtap="toInfo">
-		<image src="/common/images/person.png"></image>
-		<text>个人信息</text>
-		<text class="cuIcon-right"></text>
-	</view>
+      </block>
+    </view>
+  </view>
+  <view class="userinfo-right" bindtap="toInfo">
+    <image src="/common/images/person.png"></image>
+    <text>个人信息</text>
+    <text class="cuIcon-right"></text>
+  </view>
 </view>
 
 <view class="option">
@@ -42,31 +44,31 @@
 </view>
 
 <view class="cu-list center-menu menu card-menu">
-	<view class="cu-item arrow" bindtap="toRob">
-		<view class="content">
-        <image src="/common/images/rob.png" class="png" mode="aspectFit"></image>
-			<text class="text-black">我的抢票</text>
-		</view>
-	</view>
-	<view class="cu-item arrow" bindtap="toFeedback">
-		<view class="content">
-        <image src="/common/images/feedback.png" class="png" mode="aspectFit"></image>
-			<text class="text-black">意见反馈</text>
-		</view>
-	</view>
-	<view class="cu-item arrow" bindtap="toBind">
-		<view class="content">
-        <image src="/common/images/bind.png" class="png" mode="aspectFit"></image>
-			<text class="text-black">绑定聚才网帐号</text>
-		</view>
-		<view class="action">
-			<text class="text-grey text-sm">{{userInfo.jucai_id ? '已绑定' : '未绑定'}}</text>
-		</view>
-	</view>
-	<button class="cu-item arrow btn" open-type="contact">
-		<view class="content">
-        <image src="/common/images/service.png" class="png" mode="aspectFit"></image>
-			<text class="text-black">联系客服</text>
-		</view>
-	</button>
+  <view class="cu-item arrow" bindtap="toRob">
+    <view class="content">
+      <image src="/common/images/rob.png" class="png" mode="aspectFit"></image>
+      <text class="text-black">我的抢票</text>
+    </view>
+  </view>
+  <view class="cu-item arrow" bindtap="toFeedback">
+    <view class="content">
+      <image src="/common/images/feedback.png" class="png" mode="aspectFit"></image>
+      <text class="text-black">意见反馈</text>
+    </view>
+  </view>
+  <view class="cu-item arrow" bindtap="toBind">
+    <view class="content">
+      <image src="/common/images/bind.png" class="png" mode="aspectFit"></image>
+      <text class="text-black">绑定聚才网帐号</text>
+    </view>
+    <view class="action">
+      <text class="text-grey text-sm">{{userInfo.jucai_id ? '已绑定' : '未绑定'}}</text>
+    </view>
+  </view>
+  <button class="cu-item arrow btn" open-type="contact">
+    <view class="content">
+      <image src="/common/images/service.png" class="png" mode="aspectFit"></image>
+      <text class="text-black">联系客服</text>
+    </view>
+  </button>
 </view>

+ 140 - 24
applet/pages/my/home/home.wxss

@@ -1,30 +1,146 @@
-.userinfo {width:750rpx;height:347rpx;background-image: url('https://jarc.jucai.gov.cn/static/images/my_header.jpg');background-size: 100% 100%; display: flex;padding:0 20rpx;}
-.userinfo .userinfo-left {width:470rpx;height:240rpx;display: flex;align-items: center;}
-.userinfo .userinfo-left .cu-avatar {width: 124rpx;height: 124rpx;font-size: 3em;}
-.userinfo .userinfo-left .namebox {color:white;margin-left:20rpx;}
-.userinfo .userinfo-left .namebox .cu-btn {width:180rpx;height:50rpx;background-color: #01315f;color:white;}
-.userinfo .userinfo-left .namebox .userinfo-content {height: 80rpx;line-height: 90rpx;font-size:36rpx;}
-.userinfo .userinfo-left .namebox .userinfo-id {height:40rpx;font-size:28rpx;} 
-.userinfo .userinfo-right {width:220rpx;height:240rpx;display: flex;align-items: center;justify-content: space-between;}
-.userinfo .userinfo-right image {width:60rpx;height: 60rpx;}
-.userinfo .userinfo-right text {color:white;font-size:28rpx;}
-
-.option {position: relative;width: 690rpx;margin-left:30rpx;height:220rpx;background-color: white;border-radius: 20rpx;border:2rpx solid #d3d3d3;top: -110rpx;display: flex;align-items: center;justify-content: center;}
-.option .option-item {flex:1;display: flex;justify-content: center;align-items: center;flex-direction: column;}
-.option .option-item image {width:90rpx;height:90rpx;}
-.option .option-item view {font-size:28rpx;margin-top:20rpx;color:#1f1f1f;}
-
-.my-menu {width:670rpx;margin-left:40rpx;height:100rpx;line-height: 100rpx;margin-top:30rpx;display: block;text-align: center;}
-.my-menu image {float:left;margin-top:20rpx;}
-.my-menu text {color:white;font-size:30rpx;margin-left:-60rpx;}
-.my-auth {margin-top: 50rpx;}
-
-.center-menu {border:2rpx solid #d3d3d3;margin-top:-80rpx;}
-.cu-list.menu>.cu-item .content>image {margin-top: -14rpx;margin-right:30rpx;}
-.cu-item.btn{    
+.userinfo {
+  width: 750rpx;
+  height: 347rpx;
+  background-image: url('https://jarc.jucai.gov.cn/static/images/my_header.jpg');
+  background-size: 100% 100%;
+  display: flex;
+  padding: 0 20rpx;
+}
+
+.userinfo .userinfo-left {
+  width: 470rpx;
+  height: 240rpx;
+  display: flex;
+  align-items: center;
+}
+
+.userinfo .userinfo-left .cu-avatar {
+  width: 124rpx;
+  height: 124rpx;
+  font-size: 3em;
+}
+
+.userinfo .userinfo-left .namebox {
+  color: white;
+  margin-left: 20rpx;
+}
+
+.userinfo .userinfo-left .namebox .cu-btn {
+  width: 180rpx;
+  height: 50rpx;
+  background-color: #01315f;
+  color: white;
+}
+
+.userinfo .userinfo-left .namebox .userinfo-content {
+  height: 80rpx;
+  line-height: 90rpx;
+  font-size: 36rpx;
+}
+
+.userinfo .userinfo-left .namebox .userinfo-id {
+  height: 40rpx;
+  font-size: 28rpx;
+}
+
+.userinfo .userinfo-right {
+  width: 220rpx;
+  height: 240rpx;
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+}
+
+.userinfo .userinfo-right image {
+  width: 60rpx;
+  height: 60rpx;
+}
+
+.userinfo .userinfo-right text {
+  color: white;
+  font-size: 28rpx;
+}
+
+.option {
+  position: relative;
+  width: 690rpx;
+  margin-left: 30rpx;
+  height: 220rpx;
+  background-color: white;
+  border-radius: 20rpx;
+  border: 2rpx solid #d3d3d3;
+  top: -110rpx;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
+
+.option .option-item {
+  flex: 1;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  flex-direction: column;
+}
+
+.option .option-item image {
+  width: 90rpx;
+  height: 90rpx;
+}
+
+.option .option-item view {
+  font-size: 28rpx;
+  margin-top: 20rpx;
+  color: #1f1f1f;
+}
+
+.my-menu {
+  width: 670rpx;
+  margin-left: 40rpx;
+  height: 100rpx;
+  line-height: 100rpx;
+  margin-top: 30rpx;
+  display: block;
+  text-align: center;
+}
+
+.my-menu image {
+  float: left;
+  margin-top: 20rpx;
+}
+
+.my-menu text {
+  color: white;
+  font-size: 30rpx;
+  margin-left: -60rpx;
+}
+
+.my-auth {
+  margin-top: 50rpx;
+}
+
+.center-menu {
+  border: 2rpx solid #d3d3d3;
+  margin-top: -80rpx;
+}
+
+.cu-list.menu>.cu-item .content>image {
+  margin-top: -14rpx;
+  margin-right: 30rpx;
+}
+
+.cu-item.btn {
   width: 100%;
   padding: 0 30rpx;
   line-height: normal;
   font-weight: normal;
   text-align: left;
+}
+
+.avatar-wrapper {
+  width: 124rpx;
+  height: 124rpx;
+  padding: 0;
+  margin: 0;
+  background: none;
 }

+ 1 - 1
applet/pages/my/info/info.wxml

@@ -8,7 +8,7 @@
 	</view> -->
 	<view class="cu-form-group margin-top">
 		<view class="title"><text class="text-red">*</text> 昵称</view>
-		<input placeholder="请输入昵称" value="{{userInfo.user_nickname}}" bindinput="vmodel" data-value="user_nickname"></input>
+		<input type="nickname" placeholder="请输入昵称" value="{{userInfo.user_nickname}}" bindinput="vmodel" data-value="user_nickname"></input>
 	</view>
 	<view class="cu-form-group">
 		<view class="title"><text class="text-red">*</text> 姓名</view>

+ 1 - 1
applet/utils/util.js

@@ -15,5 +15,5 @@ const formatNumber = n => {
 }
 
 module.exports = {
-  formatTime: formatTime
+  formatTime: formatTime,
 }

+ 1 - 1
data/config/database.php

@@ -13,7 +13,7 @@ return [
     // 用户名
     'username' => 'root',
     // 密码
-    'password' => '',
+    'password' => 'root',
     // 端口
     'hostport' => '3306',
     // 数据库编码默认采用utf8

+ 0 - 12
public/.htaccess

@@ -1,12 +0,0 @@
-<IfModule mod_rewrite.c>
-  Options +FollowSymlinks -Multiviews
-  RewriteEngine On
-
-  RewriteCond %{REQUEST_FILENAME} !-d
-  RewriteCond %{REQUEST_FILENAME} !-f
-  RewriteRule ^api/?(.*)$ api.php?s=$1 [QSA,PT,L]
-
-  RewriteCond %{REQUEST_FILENAME} !-d
-  RewriteCond %{REQUEST_FILENAME} !-f
-  RewriteRule ^(.*)$ index.php?s=$1 [QSA,PT,L]
-</IfModule>

+ 87 - 0
public/themes/admin_simpleboot3/teahouse/admin_lock/add.html

@@ -0,0 +1,87 @@
+<include file="public@header"/>
+<style type="text/css">
+    .pic-list li {
+        margin-bottom: 5px;
+    }
+</style>
+</head>
+<body>
+<div class="wrap js-check-wrap">
+    <ul class="nav nav-tabs">
+        <li><a href="{:url('AdminLock/index')}">茶室列表</a></li>
+        <li class="active"><a href="{:url('AdminLock/add')}">添加茶室</a></li>
+    </ul>
+    <form action="{:url('AdminLock/addPost')}" method="post" class="form-horizontal js-ajax-form margin-top-20">
+        <div class="row">
+            <div class="col-md-9">
+                <table class="table table-bordered">
+                    <tr>
+                        <th>茶室名<span class="form-required">*</span></th>
+                        <td>
+                            <input class="form-control" type="text" name="name"
+                                   id="name" required value="" placeholder="请输入茶室名"/>
+                        </td>
+                    </tr>
+                    <tr>
+                        <th>锁ID<span class="form-required">*</span></th>
+                        <td><input class="form-control" type="text" name="lock_id" id="lock_id" value=""
+                                   required placeholder="请输入锁ID"></td>
+                    </tr>
+                    <tr>
+                        <th>地址<span class="form-required">*</span></th>
+                        <td><input class="form-control" type="text" name="address" id="address" value=""
+                                   required placeholder="请输入地址"></td>
+                    </tr>
+                    <tr>
+                        <th>备注</th>
+                        <td>
+                            <textarea class="form-control" name="comment" style="height: 50px;"
+                                      placeholder="请填写备注"></textarea>
+                        </td>
+                    </tr>
+                </table>
+                <div class="form-group">
+                    <div class="col-sm-offset-2 col-sm-10">
+                        <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('ADD')}</button>
+                        <a class="btn btn-default" href="{:url('AdminLock/index')}">{:lang('BACK')}</a>
+                    </div>
+                </div>
+            </div>
+            <div class="col-md-3">
+                <table class="table table-bordered">
+                    <tr>
+                        <th><b>缩略图</b>(建议284*150)</th>
+                    </tr>
+                    <tr>
+                        <td>
+                            <div style="text-align: center;">
+                                <input type="hidden" name="image" id="thumbnail" value="">
+                                <a href="javascript:uploadOneImage('图片上传','#thumbnail');">
+                                    <img src="__TMPL__/public/assets/images/default-thumbnail.png"
+                                         id="thumbnail-preview"
+                                         width="135" style="cursor: pointer"/>
+                                </a>
+                            </div>
+                        </td>
+                    </tr>
+                    <tr>
+                        <th><b>状态<span class="form-required">*</span></b></th>
+                    </tr>
+                    <tr>
+                        <td>
+                            <label class="radio-inline">
+                                <input type="radio" name="is_show" value="1" checked> 显示
+                            </label>
+                            <label class="radio-inline">
+                                <input type="radio" name="is_show" value="2"> 隐藏
+                            </label>
+                        </td>
+                    </tr>
+                </table>
+            </div>
+        </div>
+    </form>
+</div>
+<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
+</body>
+</html>

+ 99 - 0
public/themes/admin_simpleboot3/teahouse/admin_lock/edit.html

@@ -0,0 +1,99 @@
+<include file="public@header"/>
+<style type="text/css">
+    .pic-list li {
+        margin-bottom: 5px;
+    }
+</style>
+</head>
+<body>
+<div class="wrap js-check-wrap">
+    <ul class="nav nav-tabs">
+        <li><a href="{:url('AdminLock/index')}">茶室列表</a></li>
+        <li><a href="{:url('AdminLock/add')}">添加茶室</a></li>
+        <li class="active"><a href="javascript:;">编辑茶室</a></li>
+    </ul>
+    <form action="{:url('AdminLock/editPost')}" method="post" class="form-horizontal js-ajax-form margin-top-20">
+        <input type="hidden" name="id" value="{$info.id}">
+        <div class="row">
+            <div class="col-md-9">
+                <table class="table table-bordered">
+                    <tr>
+                        <th>茶室名<span class="form-required">*</span></th>
+                        <td>
+                            <input class="form-control" type="text" name="name"
+                                   id="name" required value="{$info.name}" placeholder="请输入茶室名"/>
+                        </td>
+                    </tr>
+                    <tr>
+                        <th>锁ID<span class="form-required">*</span></th>
+                        <td><input class="form-control" type="text" name="lock_id" id="lock_id" value="{$info.lock_id}"
+                                   required placeholder="请输入锁ID"></td>
+                    </tr>
+                    <tr>
+                        <th>地址<span class="form-required">*</span></th>
+                        <td><input class="form-control" type="text" name="address" id="address" value="{$info.address}"
+                                   required placeholder="请输入地址"></td>
+                    </tr>
+                    <tr>
+                        <th>备注</th>
+                        <td>
+                            <textarea class="form-control" name="comment" style="height: 50px;"
+                                      placeholder="请填写备注">{$info.comment}</textarea>
+                        </td>
+                    </tr>
+                </table>
+                <div class="form-group">
+                    <div class="col-sm-offset-2 col-sm-10">
+                        <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('EDIT')}</button>
+                        <a class="btn btn-default" href="{:url('AdminLock/index')}">{:lang('BACK')}</a>
+                    </div>
+                </div>
+            </div>
+            <div class="col-md-3">
+                <table class="table table-bordered">
+                    <tr>
+                        <th><b>缩略图</b>(建议284*150)</th>
+                    </tr>
+                    <tr>
+                        <td>
+                            <div style="text-align: center;">
+                                <input type="hidden" name="image" id="thumbnail" value="{$info.image}">
+                                <a href="javascript:uploadOneImage('图片上传','#thumbnail');">
+                                    <if condition="empty($info.image)">
+                                        <img src="__TMPL__/public/assets/images/default-thumbnail.png"
+                                             id="thumbnail-preview"
+                                             width="135" style="cursor: pointer"/>
+                                        <else/>
+                                        <img src="{:cmf_get_image_preview_url($info.image)}"
+                                             id="thumbnail-preview"
+                                             width="135" style="cursor: pointer"/>
+                                    </if>
+                                </a>
+                            </div>
+                        </td>
+                    </tr>
+                    <tr>
+                        <th><b>状态<span class="form-required">*</span></b></th>
+                    </tr>
+                    <tr>
+                        <td>
+                            <label class="radio-inline">
+                                <input type="radio" name="is_show" value="1"
+                                <eq name="info.is_show" value="1">checked</eq>
+                                > 显示
+                            </label>
+                            <label class="radio-inline">
+                                <input type="radio" name="is_show" value="2"
+                                <eq name="info.is_show" value="2">checked</eq>
+                                > 隐藏
+                            </label>
+                        </td>
+                    </tr>
+                </table>
+            </div>
+        </div>
+    </form>
+</div>
+<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
+</body>
+</html>

+ 99 - 0
public/themes/admin_simpleboot3/teahouse/admin_lock/index.html

@@ -0,0 +1,99 @@
+<include file="public@header"/>
+</head>
+<body>
+<div class="wrap js-check-wrap">
+    <ul class="nav nav-tabs">
+            <li class="active"><a href="javascript:;">茶室列表</a></li>
+            <li><a href="{:url('add')}">添加茶室</a></li>
+    </ul>
+    <form class="well form-inline margin-top-20" method="post" action="{:url('AdminLock/index')}">
+        状态:
+        <select class="form-control" name="is_show" style="width: 140px;">
+            <option value=''>全部</option>
+            <option value='1' <eq name="is_show" value="1">selected</eq>>显示</option>
+            <option value='2' <eq name="is_show" value="2">selected</eq>>隐藏</option>
+        </select> &nbsp;&nbsp;
+        关键字:
+        <input type="text" class="form-control" name="keyword" style="width: 200px;"
+               value="{$keyword|default=''}" placeholder="请输入关键字...">
+        <input type="submit" class="btn btn-primary" value="搜索"/>
+        <a class="btn btn-danger" href="{:url('AdminLock/index')}">清空</a>
+    </form>
+    <form class="js-ajax-form" action="" method="post">
+        <table class="table table-hover table-bordered table-list">
+            <thead>
+            <tr>
+                <th width="15">
+                    <label>
+                        <input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
+                    </label>
+                </th>
+                <th width="50">ID</th>
+                <th width="200">茶室名称</th>
+                <th width="80">主图</th>
+                <th width="50">锁ID</th>
+                <th width="200">地址</th>
+                <th width="120">状态</th>
+                <th width="95">操作</th>
+            </tr>
+            </thead>
+            <foreach name="list" item="vo">
+                <tr>
+                    <td>
+                        <input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids"
+                               value="{$vo.id}" title="ID:{$vo.id}">
+                    </td>
+                    <td><b>{$vo.id}</b></td>
+                    <td>{$vo.name}</td>
+                    <td>
+                        <notempty name="vo.image">
+                            <a href="javascript:parent.imagePreviewDialog('{:cmf_get_image_preview_url($vo.image)}');">
+                                <i class="fa fa-photo fa-fw"></i>
+                            </a>
+                            <else/>
+                            <i class="fa fa-close fa-fw"></i>
+                        </notempty>
+                    </td>
+                    <td>{$vo.lock_id}</td>
+                    <td>{$vo.address}</td>
+                    <td>{$vo.is_show_text}</td>
+                    <td>
+                        <a class="btn btn-xs btn-primary" href="{:url('AdminLock/edit',array('id'=>$vo['id']))}">编辑</a>
+                        <a class="btn btn-xs btn-danger js-ajax-delete"
+                           href="{:url('AdminLock/delete',array('id'=>$vo['id']))}">删除</a>
+                    </td>
+                </tr>
+            </foreach>
+        </table>
+        <ul class="pagination">{$page|default=''}</ul>
+    </form>
+</div>
+<script src="__STATIC__/js/admin.js"></script>
+<script>
+    function reloadPage(win) {
+        win.location.reload();
+    }
+    $('.set_status').click(function () {
+        var status = $(this).data('status');
+        var arr = [];
+        $('input[name="ids"]:checked').each(function(i){
+            arr[i] = $(this).val();
+        });
+
+        Wind.css('layer');
+        Wind.use("layer", function () {
+            if (arr.length === 0) {
+                layer.msg('请选择一条记录');
+                return false;
+            }
+
+            $.post('{:url("setStatus")}',{ids:arr,status:status},function(data){
+                reloadPage(window);
+            },'json')
+        });
+
+        return false;
+    });
+</script>
+</body>
+</html>

+ 91 - 0
public/themes/admin_simpleboot3/teahouse/admin_lock_book/index.html

@@ -0,0 +1,91 @@
+<include file="public@header"/>
+</head>
+<body>
+<div class="wrap js-check-wrap">
+    <ul class="nav nav-tabs">
+            <li class="active"><a href="javascript:;">茶室预约列表</a></li>
+    </ul>
+    <form class="well form-inline margin-top-20" method="post" action="{:url('AdminLockBook/index')}">
+        状态:
+        <select class="form-control" name="is_use" style="width: 140px;">
+            <option value=''>全部</option>
+            <option value='1' <eq name="is_use" value="1">selected</eq>>到场</option>
+            <option value='2' <eq name="is_use" value="2">selected</eq>>未到场</option>
+        </select> &nbsp;&nbsp;
+        茶室名:
+        <input type="text" class="form-control" name="lock_name" style="width: 200px;"
+               value="{$lock_name|default=''}" placeholder="请输入茶室名...">
+        用户名:
+        <input type="text" class="form-control" name="user_name" style="width: 200px;"
+               value="{$user_name|default=''}" placeholder="请输入用户名...">
+        <input type="submit" class="btn btn-primary" value="搜索"/>
+        <a class="btn btn-danger" href="{:url('AdminLockBook/index')}">清空</a>
+    </form>
+    <form class="js-ajax-form" action="" method="post">
+        <div class="table-actions">
+            <button class="btn btn-primary btn-sm set_status">置为到场</button>
+        </div>
+        <table class="table table-hover table-bordered table-list">
+            <thead>
+            <tr>
+                <th width="15">
+                    <label>
+                        <input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
+                    </label>
+                </th>
+                <th width="50">ID</th>
+                <th width="200">茶室名称</th>
+                <th width="120">用户名</th>
+                <th width="200">开始时间</th>
+                <th width="200">结束时间</th>
+                <th width="200">预约时间</th>
+                <th width="120">状态</th>
+            </tr>
+            </thead>
+            <foreach name="list" item="vo">
+                <tr>
+                    <td>
+                        <input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids"
+                               value="{$vo.id}" title="ID:{$vo.id}">
+                    </td>
+                    <td><b>{$vo.id}</b></td>
+                    <td>{$vo.lock_name}</td>
+                    <td>{$vo.user_name}</td>
+                    <td>{:date('Y-m-d H:i:s',$vo['start_time'])}</td>
+                    <td>{:date('Y-m-d H:i:s',$vo['end_time'])}</td>
+                    <td>{:date('Y-m-d H:i:s',$vo['create_time'])}</td>
+                    <td>{$vo.is_use_text}</td>
+                </tr>
+            </foreach>
+        </table>
+        <ul class="pagination">{$page|default=''}</ul>
+    </form>
+</div>
+<script src="__STATIC__/js/admin.js"></script>
+<script>
+    function reloadPage(win) {
+        win.location.reload();
+    }
+    $('.set_status').click(function () {
+        var arr = [];
+        $('input[name="ids"]:checked').each(function(i){
+            arr[i] = $(this).val();
+        });
+
+        Wind.css('layer');
+        Wind.use("layer", function () {
+            if (arr.length === 0) {
+                layer.msg('请选择一条记录');
+                return false;
+            }
+
+            $.post('{:url("setStatus")}',{ids:arr},function(data){
+                reloadPage(window);
+            },'json')
+        });
+
+        return false;
+    });
+</script>
+</body>
+</html>

+ 53 - 0
public/themes/admin_simpleboot3/teahouse/admin_setting/index.html

@@ -0,0 +1,53 @@
+<include file="public@header"/>
+</head>
+<body>
+<div class="wrap">
+    <ul class="nav nav-tabs">
+        <li class="active"><a href="{:url('admin_setting/index')}">门锁账号</a></li>
+    </ul>
+    <form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('Teahouse/admin_setting/indexPost')}">
+        <div class="form-group">
+            <label for="clientId" class="col-sm-2 control-label">
+                <span class="form-required">*</span>clientId
+            </label>
+            <div class="col-md-6 col-sm-10">
+                <input type="text" class="form-control" id="clientId" name="clientId" value="{$clientId|default=''}">
+            </div>
+        </div>
+        <div class="form-group">
+            <label for="clientSecret" class="col-sm-2 control-label">
+                <span class="form-required">*</span>clientSecret
+            </label>
+            <div class="col-md-6 col-sm-10">
+                <input type="text" class="form-control" id="clientSecret" name="clientSecret" value="{$clientSecret|default=''}">
+            </div>
+        </div>
+        <div class="form-group">
+            <label for="username" class="col-sm-2 control-label">
+                <span class="form-required">*</span>用户名
+            </label>
+            <div class="col-md-6 col-sm-10">
+                <input type="text" class="form-control" id="username" name="username" value="{$username|default=''}">
+            </div>
+        </div>
+        <div class="form-group">
+            <label for="password" class="col-sm-2 control-label">
+                <span class="form-required">*</span>密码
+            </label>
+            <div class="col-md-6 col-sm-10">
+                <input type="text" class="form-control" id="password" name="password" value="{$password|default=''}">
+            </div>
+        </div>
+        <div class="form-group">
+            <div class="col-sm-offset-2 col-sm-10">
+                <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('SAVE')}</button>
+            </div>
+        </div>
+    </form>
+</div>
+<script src="__STATIC__/js/admin.js"></script>
+<script>
+
+</script>
+</body>
+</html>

+ 67 - 0
public/themes/admin_simpleboot3/teahouse/admin_user/examine.html

@@ -0,0 +1,67 @@
+<include file="public@header"/>
+<style type="text/css">
+    .pic-list li {
+        margin-bottom: 5px;
+    }
+</style>
+</head>
+<body>
+<div class="wrap js-check-wrap">
+    <form action="{:url('AdminArticle/addPost')}" method="post" id="form"
+          class="form-horizontal js-ajax-form margin-top-20">
+        <input type="hidden" name="ids" value="{$ids}">
+        <div class="row">
+            <div class="col-md-12">
+                <table class="table table-bordered">
+                    <tr>
+                        <th>状态<span class="form-required">*</span></th>
+                        <td>
+                            <label class="radio-inline">
+                                <input type="radio" name="status" value="2" checked> 审核通过
+                            </label>
+                            <label class="radio-inline">
+                                <input type="radio" name="status" value="3"> 审核不通过
+                            </label>
+                        </td>
+                    </tr>
+                    <tr>
+                        <th>备注</th>
+                        <td>
+                            <textarea class="form-control" name="comment" style="height: 50px;"
+                                      placeholder="请填写摘要"></textarea>
+                        </td>
+                    </tr>
+                </table>
+                <div class="form-group">
+                    <div class="col-sm-offset-2 col-sm-10">
+                        <button type="submit" class="btn btn-primary js-submit">提交</button>
+                        <button class="btn btn-default">关闭</button>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </form>
+</div>
+<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
+<script type="text/javascript">
+    $(function () {
+        Wind.css('layer');
+        Wind.use("layer", function () {
+            $('.js-submit').click(function (e) {
+                e.preventDefault();
+                let form = $('#form').serialize();
+                $.post("{:url('setStatus')}", form, function (data) {
+                    layer.msg(data.msg);
+                    if (data.code == 1) {
+                        setTimeout(() => {
+                            parent.location.reload();
+                        }, 2000);
+                    }
+                }, 'json')
+                return false;
+            });
+        });
+    });
+</script>
+</body>
+</html>

+ 100 - 0
public/themes/admin_simpleboot3/teahouse/admin_user/index.html

@@ -0,0 +1,100 @@
+<include file="public@header"/>
+</head>
+<body>
+<div class="wrap js-check-wrap">
+    <ul class="nav nav-tabs">
+            <li class="active"><a href="javascript:;">资格申请列表</a></li>
+    </ul>
+    <form class="well form-inline margin-top-20" method="post" action="{:url('AdminUser/index')}">
+        状态:
+        <select class="form-control" name="status" style="width: 140px;">
+            <option value=''>全部</option>
+            <option value='1' <eq name="status" value="1">selected</eq>>待审核</option>
+            <option value='2' <eq name="status" value="2">selected</eq>>通过</option>
+            <option value='3' <eq name="status" value="3">selected</eq>>拒绝</option>
+        </select> &nbsp;&nbsp;
+        姓名:
+        <input type="text" class="form-control" name="name" style="width: 200px;"
+               value="{$name|default=''}" placeholder="请输入姓名...">
+        手机号:
+        <input type="text" class="form-control" name="mobile" style="width: 200px;"
+               value="{$mobile|default=''}" placeholder="请输入手机号...">
+        <input type="submit" class="btn btn-primary" value="搜索"/>
+        <a class="btn btn-danger" href="{:url('AdminUser/index')}">清空</a>
+    </form>
+    <form class="js-ajax-form" action="" method="post">
+        <div class="table-actions">
+            <button class="btn btn-primary btn-sm set_status">审核</button>
+        </div>
+        <table class="table table-hover table-bordered table-list">
+            <thead>
+            <tr>
+                <th width="15">
+                    <label>
+                        <input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
+                    </label>
+                </th>
+                <th width="100">姓名</th>
+                <th width="50">性别</th>
+                <th width="120">手机号</th>
+                <th width="180">身份证</th>
+                <th width="180">单位</th>
+                <th width="120">职务</th>
+                <th width="150">类型</th>
+                <th width="50">状态</th>
+                <th width="150">申请时间</th>
+                <th width="200">审核备注</th>
+            </tr>
+            </thead>
+            <foreach name="list" item="vo">
+                <tr>
+                    <td>
+                        <input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids"
+                               value="{$vo.id}" title="ID:{$vo.id}">
+                    </td>
+                    <td><b>{$vo.name}</b></td>
+                    <td>{$vo.sex_text}</td>
+                    <td>{$vo.mobile}</td>
+                    <td>{$vo.idcard}</td>
+                    <td>{$vo.company}</td>
+                    <td>{$vo.job}</td>
+                    <td>{$vo.type}</td>
+                    <td>{$vo.status_text}</td>
+                    <td>{:date('Y-m-d H:i:s',$vo['create_time'])}</td>
+                    <td>{$vo.comment}</td>
+                </tr>
+            </foreach>
+        </table>
+        <ul class="pagination">{$page|default=''}</ul>
+    </form>
+</div>
+<script src="__STATIC__/js/admin.js"></script>
+<script>
+    function reloadPage(win) {
+        win.location.reload();
+    }
+    $('.set_status').click(function () {
+        Wind.css('layer');
+        Wind.use("layer", function () {
+            var arr = [];
+            $('input[name="ids"]:checked').each(function(i){
+                arr[i] = $(this).val();
+            });
+            if (arr.length == 0) {
+                layer.msg('请选择数据');
+                return false;
+            }
+            layer.open({
+                title:'审核',
+                type: 2,
+                skin: 'layui-layer-rim', //加上边框
+                area: ['800px', '400px'], //宽高
+                content: "{:url('examine')}?ids="+arr.join()
+            });
+        })
+
+        return false;
+    });
+</script>
+</body>
+</html>

+ 2 - 2
vendor/thinkcmf/cmf/src/common.php

@@ -536,8 +536,8 @@ function cmf_get_option($key)
         }
     }
 
-    $optionValue = cache('cmf_options_' . $key);
-
+//    $optionValue = cache('cmf_options_' . $key);
+    $optionValue = '';
     if (empty($optionValue)) {
         $optionValue = Db::name('option')->where('option_name', $key)->value('option_value');
         if (!empty($optionValue)) {