Browse Source

first commit

wang jun 2 years ago
commit
8d3065df5c
82 changed files with 4998 additions and 0 deletions
  1. 8 0
      .gitignore
  2. 42 0
      .travis.yml
  3. 946 0
      CHANGELOG.md
  4. 32 0
      LICENSE.txt
  5. 186 0
      README.md
  6. 1 0
      application/.htaccess
  7. 141 0
      application/admin/controller/AdminBase.php
  8. 15 0
      application/admin/controller/Home.php
  9. 106 0
      application/admin/controller/Weblogin.php
  10. 172 0
      application/admin/controller/Webuser.php
  11. 127 0
      application/admin/logic/baselogic.php
  12. 13 0
      application/admin/logic/homelogic.php
  13. 449 0
      application/admin/logic/webuserlogic.php
  14. 57 0
      application/app/logic/appointmentlogic.php
  15. 102 0
      application/app/logic/baselogic.php
  16. 145 0
      application/app/model/appointmentmodel.php
  17. 12 0
      application/command.php
  18. 233 0
      application/common.php
  19. 115 0
      application/index/controller/Appointment.php
  20. 8 0
      application/index/controller/Base.php
  21. 72 0
      application/index/controller/Index.php
  22. 103 0
      application/index/logic/appointmentlogic.php
  23. 102 0
      application/index/logic/baselogic.php
  24. 158 0
      application/index/logic/paylogic.php
  25. 405 0
      application/index/logic/wechatlogic.php
  26. 89 0
      application/index/logic/wxuserlogic.php
  27. 160 0
      application/index/model/appointmentmodel.php
  28. 106 0
      application/index/model/payordermodel.php
  29. 146 0
      application/index/model/wxusermodel.php
  30. 14 0
      application/provider.php
  31. 28 0
      application/tags.php
  32. 26 0
      build.php
  33. 33 0
      composer.json
  34. 133 0
      composer.lock
  35. 155 0
      config/app.php
  36. 25 0
      config/cache.php
  37. 20 0
      config/console.php
  38. 30 0
      config/cookie.php
  39. 64 0
      config/database.php
  40. 30 0
      config/log.php
  41. 18 0
      config/middleware.php
  42. 26 0
      config/session.php
  43. 35 0
      config/template.php
  44. 18 0
      config/trace.php
  45. 2 0
      extend/.gitignore
  46. 0 0
      public/.htaccess
  47. BIN
      public/Uploads/party/20220210/00a35edf2a5c1f3ec625371b8ef84d89.jpg
  48. BIN
      public/Uploads/party/20220210/0c7251081dfbf06677c2b049d38f6815.jpg
  49. BIN
      public/Uploads/party/20220210/0dc90c7b635b33f429344b1c53df0232.jpg
  50. BIN
      public/Uploads/party/20220210/0fb7a0ad570acaad5b21764c340e14b2.jpg
  51. BIN
      public/Uploads/party/20220210/157a38fea0e7296c745b37b4d2d51d69.jpg
  52. BIN
      public/Uploads/party/20220210/2327eb715b832fd520762985333aca8f.jpg
  53. BIN
      public/Uploads/party/20220210/35103e6b819522a641c9ce4863c9ad06.jpg
  54. BIN
      public/Uploads/party/20220210/49403f0db3ae52e068729011f5076933.jpg
  55. BIN
      public/Uploads/party/20220210/4b09d37c20805f341e6e94c56e005178.jpg
  56. BIN
      public/Uploads/party/20220210/58645eda140265c74fca38b2deb8c16e.jpg
  57. BIN
      public/Uploads/party/20220210/58f5671660f86dc788782fb67b2cc14c.jpg
  58. BIN
      public/Uploads/party/20220210/630c7d2b3faa6ca842eee79c09b1c871.jpg
  59. BIN
      public/Uploads/party/20220210/721c0927e3452c6b050d9c047f0cd361.jpg
  60. BIN
      public/Uploads/party/20220210/74b32a08781534496e877c791b95e01b.jpg
  61. BIN
      public/Uploads/party/20220210/7fa777cde3fd729c119ae2446975e570.jpg
  62. BIN
      public/Uploads/party/20220210/82275c0a11510b509b1360651be40a1f.jpg
  63. BIN
      public/Uploads/party/20220210/af903a3c565c6fc4e4b8b536f07c485b.jpg
  64. BIN
      public/Uploads/party/20220210/b81c92afe2f71a02ea6000b8914c6d1a.jpg
  65. BIN
      public/Uploads/party/20220210/c4a1fcaae4cbf7e47d0dad6717aadce0.jpg
  66. BIN
      public/Uploads/party/20220210/c7cb8c8e88daed1f4b5f3ab2a9e20286.jpg
  67. BIN
      public/Uploads/party/20220210/cc764a9849b3d86e36598f5730cad4b3.jpg
  68. BIN
      public/Uploads/party/20220210/cf37fe1c97aa6fca64efedf5a77ab6db.jpg
  69. BIN
      public/Uploads/party/20220210/d18a0fc71b84f1fb2ad98a0413ce891c.jpg
  70. BIN
      public/Uploads/party/20220210/d65e4594a6ada988d198aa13fa544c1f.jpg
  71. BIN
      public/Uploads/party/20220210/ddf823a1a76c143585ce4991a5eb848b.jpg
  72. BIN
      public/Uploads/party/20220210/f5861cc1668d6177f3c2bd5371f278d8.jpg
  73. 1 0
      public/Uploads/user/1642486568.png
  74. BIN
      public/favicon.ico
  75. 24 0
      public/index.php
  76. 0 0
      public/nginx.htaccess
  77. 2 0
      public/robots.txt
  78. 17 0
      public/router.php
  79. 2 0
      public/static/.gitignore
  80. 20 0
      route/route.php
  81. 2 0
      runtime/.gitignore
  82. 22 0
      think

+ 8 - 0
.gitignore

@@ -0,0 +1,8 @@
+/.idea
+/.vscode
+/vendor
+*.log
+thinkphp
+.env
+.DS_Store
+**/unuse

+ 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

+ 946 - 0
CHANGELOG.md

@@ -0,0 +1,946 @@
+## V5.1.41 LTS(2021-1-11)
+
+本版本为PHP8兼容更新
+
+## V5.1.40 LTS(2020-10-09)
+本版本为常规更新,主要包括:
+* 改进redis驱动`has`方法
+* 修正XA事务
+* 修正`HasManyThrough`关联
+* 增加mysql json类型字段->>方式获取支持
+* 改进路由加载 避免加载编辑器临时文件影响
+* 修复关联模型的属性直接附加到当前模型,当关联模型字段名为name时获取的值为模型的属性name值
+* 修复多态关联预加载`field`无效
+* 改进Collection类的`column`方法的PHP兼容性问题
+* 改进mysql驱动
+* 改进`parseclosure`方法
+* SoftDelete删除条件做空判断
+* 改进验证类`append`方法
+
+## V5.1.39 LTS(2019-11-18)
+
+本次更新为常规更新,主要包括:
+
+* 修正`memcached`驱动
+* 改进`HasManyThrough`关联查询
+* 改进`Request`类`isJson`方法
+* 改进关联查询
+* 改进`redis`驱动
+* 增加 Model类`getWhere`方法对复合主键的支持
+* 改进`newQuery`方法
+* 改进闭包查询的参数绑定
+* 修正`Validate`
+* 修复某些情况下URL会多一个冒号
+* 调整composer.json
+* 修复使用`Cache::clear()`时,报错缓存文件不存在问题
+* 使用File类的unlink方法进行文件删除
+* 改进`paraseData`方法
+* 修正image验证方法
+* 改进Url生成
+* 改进空操作对数字的支持
+* 改进一处PHP7.4兼容性问题
+
+## V5.1.38 LTS(2019-8-8)
+
+本次更新为常规更新,主要包括:
+
+* `Request`类增加`isJson`方法
+* 改进浮点型查询
+* 修正关联查询关联外键为空的查询错误
+* 远程一对多支持关联统计和预载入查询
+* 远程一对多关联支持`has`/`hasWhere`查询
+* 优化`parseIn`解析
+* 改进`parseLike`查询
+* 改进Url生成
+* 改进模型的`toArray`方法
+* 修正`notIn`查询
+* 改进`JSON`字段查询
+* 改进Controller类`display`/`fetch`方法返回`ViewResponse`对象
+* 改进`param`方法
+* 改进`mysql`驱动`getExplain`方法
+* 改进时间查询
+* 改进模型关联的`has`/`hasWhere`方法对软删除的支持
+* 修正社区反馈的BUG
+
+## V5.1.37 LTS(2019-5-26)
+
+本次更新为常规更新,主要更新如下:
+
+* 改进关联数据更新
+* 修正关联动态获取器
+* 改进`redis`驱动 
+* 修复验证规则里面出现二维数组时的错误
+* 改进跨域请求支持
+* 完善模型`hidden`方法对关联属性的支持
+* 改进`where`查询方法传入`Query`对象的支持`bind`数据
+* 改进数据集对象的`load`方法
+* 修正缓存类`clear`方法对`tag`的支持
+
+## V5.1.36 LTS(2019-4-28)
+
+本次更新为常规更新,主要更新如下:
+
+* 修正`chunk`方法一处异常抛出的错误
+* 修正模型输出的`visible`
+* 改进环境变量加载
+* 改进命令行日志的`level`配置支持
+* 修复设置有缓存前缀时,无法清空缓存标签的问题
+* HasMony对象`saveAll`方法兼容`Collection`格式参数格式
+* 修正`whereOr`查询使用字符串的问题
+* 改进`dateFormat`设置对写入数据的影响
+* 修正查询缓存
+* 记住指定的跳转地址
+* 改进软删除
+* 改进聚合查询SQL去除limit 1
+* 改进缓存驱动
+
+## V5.1.35 LTS(2019-3-2)
+
+本次主要为常规更新,修正了一些反馈的问题。
+
+* 修正验证类自定义验证方法执行两次的问题
+* 模型增加`isEmpty`方法用于判断是否空模型
+* 改进获取器对`append`的支持
+* 修正一对多关联的`withCount`自关联问题
+* facade类注释调整
+* 改进关联属性的`visible`和`hidden`判断
+* 修正路由分组的`MISS`路由
+* 改进pgsql.sql
+
+## V5.1.34 LTS(2019-1-30)
+
+本次更新为常规更新,修正了一些反馈的问题。
+
+* 改进Request类的`has`方法,支持`patch`
+* 改进`unique`验证的多条件支持
+* 修复自定义上传验证,检测文件大小
+* 改进`in`查询支持表达式
+* 改进路由的`getBind`方法
+* 改进验证类的错误信息获取
+* 改进`response`助手函数默认值
+* 修正mysql的`regexp`查询
+* 改进模型类型强制转换写入对`Expression`对象的支持
+
+## V5.1.33 LTS(2019-1-16)
+
+* 修复路由中存在多个相同替换的正则BUG
+* 修正whereLike查询
+* join方法支持参数绑定
+* 改进union方法
+* 修正多对多关联的attach方法
+* 改进验证类的正则规则自定义
+* 改进Request类method方法
+* 改进File日志类型的CLI日志写入
+* 改进文件日志time_format配置对JSON格式的支持
+
+## V5.1.32 LTS(2018-12-24)
+
+本次主要为常规更新,修正了一些反馈的问题。
+
+
+* 改进多对多关联的`attach`方法 
+* 改进聚合查询的`field`处理
+* 改进关联的`save`方法
+* 修正模型`exists`方法返回值
+* 改进时间字段写入和输出
+* 改进控制器中间件的调用
+* 改进路由变量替换的性能
+* 改进缓存标签的处理机制
+
+## V5.1.31 LTS (2018-12-9)
+
+本次版本包含一个安全更新,建议升级。
+
+* 改进`field`方法
+* 改进`count`方法返回类型
+* `download`函数增加在浏览器中显示文件功能
+* 修正多对多模型的中间表数据写入
+* 改进`sqlsrv`驱动支持多个Schemas模式查询
+* 统一助手函数与\think\response\Download函数文件过期时间
+* 完善关联模型的`save`方法 增加`make`方法仅创建对象不保存
+* 修改条件表达式对静态变量的支持
+* 修正控制器名获取
+* 改进view方法的`field`解析
+
+## V5.1.30 LTS(2018-11-30)
+
+该版本为常规更新,修正了一些社区反馈的问题。
+
+主要更新如下:
+
+* 改进查询类的`execute`方法
+* 判断路由规则定义添加对请求类型的判断
+* 修复`orderRaw`异常
+* 修正 `optimize:autoload`指令
+* 改进软删除的`destroy`方法造成重复执行事件的问题
+* 改进验证类对扩展验证规则 始终验证 不管是否`require`
+* 修复自定义验证`remove`所有规则的异常
+* 改进时间字段的自动写入支持微秒数据
+* 改进`Connection`类的`getrealsql`方法
+* 修正`https`地址的URL生成
+* 修复 `array_walk_recursive` 在低于PHP7.1消耗内部指针问题
+* 改进手动参数绑定使用
+* 改进聚合查询方法的`field`参数支持`Expression`
+
+## V5.1.29 LTS(2018-11-11)
+
+该版本主要改进了参数绑定的解析问题和提升性能,并修正了一些反馈的问题。
+
+* 改进手动参数绑定
+* 修正MISS路由的分组参数无效问题
+* 行为支持对象的方法
+* 修正全局查询范围
+* 改进`belongsto`关联的`has`方法
+* 改进`hasMany`关联
+* 改进模型观察者多次注册的问题
+* 改进`query`类的默认查询参数处理
+* 修正`parseBetween`解析方法
+* 改进路由地址生成的本地域名支持
+* 改进参数绑定的实际URL解析性能
+* 改进`Env`类的`getEnv`和`get`方法
+* 改进模板缓存的生成优化
+* 修复验证类的多语言支持
+* 修复自定义场景验证`remove`规则异常
+* File类添加是否自动补全扩展名的选项
+* 改进`strpos`对子串是否存在的判断
+* 修复`choice`无法用值选择第一个选项问题
+* 验证器支持多维数组取值验证
+* 改进解析`extend`和`block`标签的正则
+
+## V5.1.28 LTS(2018-10-29)
+
+该版本主要修正了上一个版本存在的一些问题,并改进了关联查询
+
+* 改进聚合查询方法的字段支持DISTINCT
+* 改进定义路由后url函数的端口生成
+* 改进控制器中间件对`swoole`等的支持
+* 改进Log类`save`方法
+* 改进验证类的闭包验证参数
+* 多对多关联支持指定中间表数据的名称
+* 关联聚合查询支持闭包方式指定聚合字段
+* 改进Lang类`get`方法
+* 多对多关联增加判断关联数据是否存在的方法
+* 改进关联查询使用`fetchsql`的情况
+* 改进修改器的是否已经执行判断
+* 增加`afterWith`和`beforeWith`验证规则 用于比较日期字段
+
+## V5.1.27 LTS(2018-10-22)
+
+该版本主要修正了路由绑定的参数,改进了修改器的执行多次问题,并正式宣布为LTS版本!
+
+
+* 修正路由绑定的参数丢失问题
+* 修正路由别名的参数获取
+* 改进修改器会执行多次的问题
+
+## V5.1.26(2018-10-12)
+
+该版本主要修正了上一个版本的一些问题,并改进了全局查询范围的支持,同时包含了一个安全更新。
+
+
+* 修正单一模块下注解路由无效的问题
+* 改进数据库的聚合查询的字段处理
+* 模型类增加`globalScope`属性定义 用于指定全局的查询范围
+* 模型的`useGlobalScope`方法支持传入数组 用于指定当前查询需要使用的全局查询范围
+* 改进数据集的`order`方法对数字类型的支持
+* 修正上一个版本`order`方法解析的一处BUG
+* 排序字段不合法或者错误的时候抛出异常
+* 改进`Request`类的`file`方法对上传文件的错误判断
+
+##  V5.1.25(2018-9-21)
+
+该版本主要改进了查询参数绑定的性能和对浮点型的支持,以及一些细节的完善。
+
+* 修正一处命令行问题
+* 改进`Socketlog`日志驱动,支持自定义默认展开日志类别
+* 修正`MorphMany`一处bug
+* 跳转到上次记住的url,并支持默认值
+* 改进模型的异常提示
+* 改进参数绑定对浮点型的支持
+* 改进`order`方法解析
+* 改进`json`字段数据的自动编码
+* 改进日志`log_write`可能造成的日志写入死循环
+* Log类增加`log_level`行为标签位置,用于对某个类型的日志进行处理
+* Route类增加`clear`方法清空路由规则
+* 分布式数据库配置支持使用数组
+* 单日志文件也支持`max_files`参数
+* 改进查询参数绑定的性能
+* 改进别名路由的URL后缀参数检测
+* 控制器前置方法和控制器中间件的`only`和`except`定义不区分大小写
+
+## V5.1.24(2018-9-5)
+
+该版本主要增加了命令行的表格输出功能,并增加了查看路由定义的指令,以及修正了社区的一些反馈问题。
+
+* 修正`Request`类的`file`方法
+* 修正路由的`cache`方法
+* 修正路由缓存的一处问题
+* 改进上传文件获取的异常处理
+* 改进`fetchCollection`方法支持传入数据集类名
+* 修正多级控制器的注解路由生成
+* 改进`Middleware`类`clear`方法
+* 增加`route:list`指令用于[查看定义的路由](752690) 并支持排序
+* 命令行增加`Table`输出类
+* `Command`类增加`table`方法用于输出表格
+* 改进搜索器查询方法支持别名定义
+* 命令行配置增加`auto_path`参数用于定义自动载入的命令类路径
+* 增加`make:command`指令用于[快速生成指令](354146)
+* 改进`make:controller`指令对操作方法后缀的支持
+* 改进命令行的定义文件支持索引数组 用于指令对象的惰性加载
+* 改进`value`和`column`方法对后续查询结果的影响
+* 改进`RuleName`类的`setRule`方法
+
+## V5.1.23(2018-8-23)
+
+该版本主要改进了数据集对象的处理,增加了`findOrEmpty`方法,并且修正了一些社区反馈的BUG。
+
+* 数据集类增加`diff`/`intersect`方法用于获取差集和交集(默认根据主键值比较)
+* 数据集类增加`order`方法支持指定字段排序
+* 数据集类增加`map`方法使用回调函数处理数据并返回新的数据集对象
+* Db增加`allowEmpty`方法允许`find`方法在没有数据的时候返回空数组或者空模型对象而不是null
+* Db增加`findOrEmpty`方法
+* Db增加`fetchCollection`方法用于指定查询返回数据集对象
+* 改进`order`方法的数组方式解析,增强安全性
+* 改进`withSearch`方法,支持第三个参数传入字段前缀标识,用于多表查询字段搜索
+* 修正`optimize:route`指令开启类库后缀后的注解路由生成
+* 修正redis缓存及session驱动
+* 支持指定`Yaconf`的独立配置文件
+* 增加`yaconf`助手函数用于配置文件
+
+
+## V5.1.22(2018-8-9)
+
+该版本主要增加了模型搜索器和`withJoin`方法,完善了模型输出和对`Yaconf`的支持,修正了一些社区反馈的BUG。
+
+* 改进一对一关联的`table`识别问题
+* 改进内置`Facade`类
+* 增加`withJoin`方法支持`join`方式的[一对一关联](一对一关联.md)查询
+* 改进`join`预载入查询的空数据问题
+* 改进`Config`类的`load`方法支持快速加载配置文件
+* 改进`execute`方法和事务的断线重连
+* 改进`memcache`驱动的`has`方法
+* 模型类支持定义[搜索器](搜索器.md)方法
+* 完善`Config`类对`Yaconf`的支持
+* 改进模型的`hidden/visible/append/withAttr`方法,支持在[查询前后调用](数组访问.md),以及支持数据集对象
+* 数据集对象增加`where`方法根据字段或者关联数据[过滤数据](模型数据集.md)
+* 改进AJAX请求的`204`判断
+
+
+## V5.1.21(2018-8-2)
+
+该版本主要增加了下载响应对象和数组查询对象的支持,并修正了一些社区反馈的问题。
+
+* 改进核心对象的无用信息调试输出
+* 改进模型的`isRelationAttr`方法判断
+* 模型类的`get`和`all`方法并入Db类
+* 增加[下载响应对象](文件下载.md)和`download`助手函数
+* 修正别名路由配置定义读取
+* 改进`resultToModel`方法
+* 修正开启类库后缀后的注解路由生成
+* `Response`类增加`noCache`快捷方法
+* 改进路由对象在`Swoole`/`Workerman`下面参数多次合并问题
+* 修正路由`ajax`/`pjax`参数后路由变量无法正确获取的问题
+* 增加清除中间件的方法
+* 改进依赖注入的参数规范自动识别(便于对接前端小写+下划线规范)
+* 改进`hasWhere`的数组条件的字段判断
+* 增加[数组查询对象](高级查询.md)`Where`支持(喜欢数组查询的福音)
+* 改进多对多关联的闭包支持
+
+## V5.1.20(2018-7-25)
+
+该版本主要增加了Db和模型的动态获取器的支持,并修正了一些已知问题。
+
+* Db类添加[获取器支持](703981)
+* 支持模型及关联模型字段[动态定义获取器](354046)
+* 动态获取器支持`JSON`字段
+* 改进路由的`before`行为执行(匹配后执行)
+*  `Config`类支持`Yaconf`
+* 改进Url生成的端口问题
+* Request类增加`setUrl`和`setBaseUrl`方法
+* 改进页面trace的信息显示
+* 修正`MorphOne`关联
+* 命令行添加[查看版本指令](703994)
+
+## V5.1.19 (2018-7-13)
+
+该版本是一个小幅改进版本,针对`Swoole`和`Workerman`的`Cookie`支持做了一些改进,并修正了一些已知的问题。
+
+
+* 改进query类`delete`方法对软删除条件判断
+* 修正分表查询的软删除问题
+* 模型查询的时候同时传入`table`和`name`属性
+* 容器类增加`IteratorAggregate`和`Countable`接口支持
+* 路由分组支持对下面的资源路由统一设置`only/except/vars`参数
+* 改进Cookie类更好支持扩展
+* 改进Request类`post`方法
+* 改进模型自关联的自动识别
+* 改进Request类对`php://input`数据的处理
+
+
+## V5.1.18 (2018-6-30)
+
+该版本主要完善了对`Swoole`和`Workerman`的`HttpServer`运行支持,改进`Request`类,并修正了一些已知的问题。
+
+* 改进关联`append`方法的处理
+* 路由初始化和检测方法分离
+* 修正`destroy`方法强制删除
+* `app_init`钩子位置移入`run`方法
+* `think-swoole`扩展更新到2.0版本
+* `think-worker`扩展更新到2.0版本
+* 改进Url生成的域名自动识别
+* `Request`类增加`setPathinfo`方法和`setHost`方法
+* `Request`类增加`withGet`/`withPost`/`withHeader`/`withServer`/`withCookie`/`withEnv`方法进行赋值操作
+* Route类改进`host`属性的获取
+* 解决注解路由配置不生效的问题
+* 取消Test日志驱动,改为使用`close`设置关闭全局日志写入
+* 修正路由的`response`参数
+* 修正204响应输出的判断
+
+## V5.1.17 (2018-6-18)
+
+该版本主要增加了控制器中间件的支持,改进了路由功能,并且修正了社区反馈的一些问题。
+
+* 修正软删除的`delete`方法
+* 修正Query类`Count`方法
+* 改进多对多`detach`方法
+* 改进Request类`Session`方法
+* 增加控制器中间件支持
+* 模型类增加`jsonAssoc`属性用于定义json数据是否返回数组
+* 修正Request类`method`方法的请求伪装
+* 改进静态路由的匹配
+* 分组首页路由自动完整匹配
+* 改进sqlsrv的`column`方法
+* 日志类的`apart_level`配置支持true自动生成对应类型的日志文件
+* 改进`204`输出判断
+* 修正cli下页面输出的BUG
+* 验证类使用更高效的`ctype`验证机制
+* 改进Request类`cookie`方法
+* 修正软删除的`withTrashed`方法
+* 改进多态一对多的预载入查询
+* 改进Query类`column`方法的缓存读取
+* Query类增加`whereBetweenTimeField`方法
+* 改进分组下多个相同路由规则的合并匹配问题
+* 路由类增加`getRule`/`getRuleList`方法获取定义的路由
+
+## V5.1.16 (2018-6-7)
+
+该版本主要修正了社区反馈的一些问题,并对Request类做了进一步规范和优化。
+
+* 改进Session类的`boot`方法
+* App类的初始化方法可以单独执行
+* 改进Request类的`param`方法
+* 改进资源路由的变量替换
+* Request类增加`__isset`方法
+* 改进`useGlobalScope`方法对软删除的影响
+* 修正命令行调用
+* 改进Cookie类`init`方法
+* 改进多对多关联删除的返回值
+* 一对多关联写入支持`replace`
+* 路由增加`filter`检测方法,用于通过请求参数检测路由是否匹配
+* 取消Request类`session/env/server`方法的`filter`参数
+* 改进关联的指定属性输出
+* 模型删除操作删除后不清空对象数据仅作标记
+* 调整模型的`save`方法返回值为布尔值
+* 修正Request类`isAjax`方法
+* 修正中间件的模块配置读取
+* 取消Request类的请求变量的设置功能
+* 取消请求变量获取的默认修饰符
+* Request类增加`setAction/setModule/setController`方法
+* 关联模型的`delete`方法调用Query类
+* 改进URL生成的域名识别
+* 改进URL检测对已定义路由的域名判断
+* 模型类增加`isExists`和`isForce`方法
+* 软删除的`destroy`和`restore`方法返回值调整为布尔值
+
+## V5.1.15 (2018-6-1)
+
+该版本主要改进了路由缓存的性能和缓存方式设置,增加了JSON格式文件日志的支持,并修正了社区反馈的一些问题。
+
+* 容器类增加`exists`方法 仅判断是否存在对象实例
+* 取消配置类的`autoload`方法
+* 改进路由缓存大小提高性能
+* 改进Dispatch类`init`方法
+* 增加`make:validate`指令生成验证器类
+* Config类`get`方法支持默认值参数
+* 修正字段缓存指令
+* 改进App类对`null`数据的返回
+* 改进模型类的`__isset`方法判断
+* 修正`Query`类的`withAggregate`方法
+* 改进`RuleItem`类的`setRuleName`方法
+* 修正依赖注入和参数的冲突问题
+* 修正Db类对第三方驱动的支持
+* 修正模型类查询对象问题
+* 修正File缓存驱动的`has`方法
+* 修正资源路由嵌套
+* 改进Request类对`$_SERVER`变量的读取
+* 改进请求缓存处理
+* 路由缓存支持指定单独的缓存方式和参数
+* 修正资源路由的中间件多次执行问题
+* 修正`optimize:config`指令
+* 文件日志支持`JSON`格式日志保存
+* 修正Db类`connect`方法
+* 改进Log类`write`方法不会自动写入之前日志
+* 模型的关联操作默认启用事务
+* 改进软删除的事件响应
+
+## V5.1.14 (2018-5-18)
+
+该版本主要对底层容器进行了一些优化改进,并增加了路由缓存功能,可以进一步提升路由性能。
+
+* 依赖注入的对象参数传入改进
+* 改进核心类的容器实例化
+* 改进日期字段的读取
+* 改进验证类的`getScene`方法
+* 模型的`create`方法和`save`方法支持`replace`操作
+* 改进`Db`类的调用机制
+* App类调整为容器类
+* 改进容器默认绑定
+* `Loader`类增加工厂类的实例化方法
+* 增加路由变量默认规则配置参数
+* 增加路由缓存设计
+* 错误处理机制改进
+* 增加清空路由缓存指令
+
+
+## V5.1.13 (2018-5-11)
+
+该版本主要增加了MySQL的XA事务支持,模型事件支持观察者,以及对Facade类的改进。
+
+* 改进自动缓存
+* 改进Url生成
+* 修正数据缓存
+* 修正`value`方法的缓存
+* `join`方法和`view`方法的条件支持使用`Expression`对象
+* 改进驱动的`parseKey`方法
+* 改进Request类`host`方法和`domain`方法对端口的处理
+* 模型增加`withEvent`方法用于控制当前操作是否需要执行模型事件
+* 模型`setInc/setDec`方法支持更新事件
+* 模型添加`before_restore/after_restore`事件
+* 增加模型事件观察者
+* 路由增加`mobile`方法设置是否允许手机访问
+* 数据库XA事务支持
+* 改进索引数组查询对`IN`查询的支持
+* 修正`invokeMethod`方法
+* 修正空数据写入返回值的BUG
+* redis驱动支持`predis`
+* 改进`parseData`方法
+* 改进模块加载
+* App类初始化方法调整
+* 改进数组查询对表达式`Expression`对象支持
+* 改进闭包的依赖注入调用
+* 改进多对多关联的中间表模型更新
+* 增加容器中对象的自定义实例化
+
+## V5.1.12 (2018-4-25)
+
+该版本主要改进了主从查询的及时性,并支持动态设置请求数据。
+
+* 支持动态设置请求数据
+* 改进`comment`方法解析
+* 修正App类`__unset`方法
+* 改进url生成的域名绑定
+* 改进主从查询的及时性
+* 修正`value`的数据缓存功能
+* 改进分页类的集合对象方法调用
+* 改进Db类的代码提示
+* SQL日志增加主从标记
+
+## V5.1.11 (2018-4-19)
+
+该版本为安全和修正版本,改进了JSON查询的参数绑定问题和容器类对象实例获取,并包含一处可能的安全隐患,建议更新。
+
+* 支持指定JSON数据查询的字段类型
+* 修正`selectInsert`方法
+* `whereColumn`方法支持数组方式
+* 改进容器类`make`方法
+* 容器类`delete`方法支持数组
+* 改进`composer`自动加载
+* 改进模板引擎
+* 修正`like`查询的一处安全隐患
+
+## V5.1.10 (2018-4-16)
+
+该版本为修正版本,修正上一个版本的一些BUG,并增强了`think clear`指令。
+
+* 改进`orderField`方法
+* 改进`exists`查询
+* 修改cli模式入口文件位置计算
+* 修正`null`查询
+* 改进`parseTime`方法
+* 修正关联预载入查询
+* 改进`mysql`驱动
+* 改进`think clear`指令 支持 `-c -l -r `选项
+* 改进路由规则对`/`结尾的支持
+
+## V5.1.9 (2018-4-12)
+
+该版本主要是一些改进和修正,并包含一个安全更新,是一个推荐更新版本。
+
+* 默认模板渲染规则支持配置保持操作方法名
+* 改进`Request`类的`ip`方法
+* 支持模型软删除字段的默认值定义
+* 改进路由变量规则对中文的支持
+* 使用闭包查询的时候使用`cache(true)` 抛出异常提示
+* 改进`Loader`类`loadComposerAutoloadFiles`方法
+* 改进查询方法安全性
+* 修正路由地址中控制器名驼峰问题
+* 调整上一个版本的`module_init`和`app_begin`的钩子顺序问题
+* 改进CLI命令行执行的问题
+* 修正社区反馈的其它问题
+
+## V5.1.8 (2018-4-5)
+
+该版本主要改进了中间件的域名和模块支持,并同时修正了几个已知问题。
+
+* 增加`template.auto_rule` 参数设置默认模板渲染的操作名自动转换规则
+* 默认模板渲染规则改由视图驱动实现
+* 修正路由标识定义
+* 修正控制器路由方法
+* 改进Request类`ip`方法支持自定义代理IP参数
+* 路由注册中间件支持数组方式别名
+* 改进命令行执行下的`composer`自动加载
+* 添加域名中间件注册支持
+* 全局中间件支持模块定义文件
+* Log日志配置支持`close`参数可以全局关闭日志写入
+* 中间件方法中捕获`HttpResponseException`异常
+* 改进中间件的闭包参数传入
+* 改进分组路由的延迟解析
+* 改进URL生成对域名绑定的支持
+* 改进文件缓存和文件日志驱动的并发支持
+
+## V5.1.7 (2018-3-28)
+
+该版本主要修正了路由的一些问题,并改进了查询的安全性。
+
+* 支持`middleware`配置文件预先定义中间件别名方便路由调用
+* 修正资源路由
+* 改进`field`方法 自动识别`fieldRaw`
+* 增加`Expression`类
+* Query类增加`raw`方法
+* Query类的`field`/ `order` 和` where`方法都支持使用`raw`表达式查询
+* 改进`inc/dec`查询 支持批量更新
+* 改进路由分组
+* 改进Response类`create`方法
+* 改进composer自动加载
+* 修正域名路由的`append`方法
+* 修正操作方法的初始化方法获取不到问题
+
+## V5.1.6 (2018-3-26)
+
+该版本主要改进了路由规则的匹配算法,大幅提升了路由性能。并正式引入了中间件的支持,可以在路由中定义或者全局定义。另外包含了一个安全更新,是一个建议更新版本。
+
+* 改进URL生成对路由`ext`方法的支持
+* 改进查询缓存对不同数据库相同表名的支持
+* 改进composer自动加载的性能
+* 改进空路由变量对默认参数的影响
+* mysql的`json`字段查询支持多级
+* Query类增加`option`方法
+* 优化路由匹配
+* 修复验证规则数字键名丢失问题
+* 改进路由Url生成
+* 改进一对一关联预载入查询
+* Request类增加`rootDomain`方法
+* 支持API资源控制器生成 `make:controller --api`
+* 优化Template类的标签解析
+* 容器类增加删除和清除对象实例的方法
+* 修正MorphMany关联的`eagerlyMorphToMany`方法一处错误
+* Container类的异常捕获改进
+* Domain对象支持`bind`方法
+* 修正分页参数
+* 默认模板的输出规则不受URL影响
+* 注解路由支持多级控制器
+* Query类增加`getNumRows`方法获取前次操作影响的记录数
+* 改进查询条件的性能
+* 改进模型类`readTransform`方法对序列化类型的处理
+* Log类增加`close`方法可以临时关闭当前请求的日志写入
+* 文件日志方式增加自动清理功能(设置`max_files`参数)
+* 修正Query类的`getPk`方法
+* 修正模板缓存的布局开关问题
+* 修正Query类`select`方法的缓存
+* 改进input助手函数
+* 改进断线重连的信息判断
+* 改进正则验证方法
+* 调整语言包的加载顺序 放到`app_init`之前
+* controller类`fetch`方法改为`final`
+* 路由地址中的变量支持使用`<var>`方式
+* 改进XMLResponse 支持传入编码过的xml内容
+* 修正Query类`view`方法的数组表名支持
+* 改进路由的模型闭包绑定
+* 改进分组变量规则的继承
+* 改进`cli-server`模式下的`composer`自动加载
+* 路由变量规则异常捕获
+* 引入中间件支持
+* 路由定义增加`middleware`方法
+* 增加生成中间件指令`make:middleware` 
+* 增加全局中间件定义支持
+* 改进`optimize:config`指令对全局中间件的支持
+* 改进config类`has`方法
+* 改进时间查询的参数绑定
+* 改进`inc/dec/exp`查询的安全性
+
+
+## V5.1.5 (2018-1-31)
+
+该版本主要增强了数据库的JSON查询,并支持JSON字段的聚合查询,改进了一些性能问题,修正了路由的一些BUG,主要更新如下:
+
+* 改进数据集查询对`JSON`数据的支持
+* 改进聚合查询对`JSON`字段的支持
+* 模型类增加`getOrFail`方法
+* 改进数据库驱动的`parseKey`方法
+* 改进Query类`join`方法的自关联查询
+* 改进数据查询不存在不生成查询缓存
+* 增加`run`命令行指令启动内置服务器
+* `Request`类`pathinfo`方法改进对`cli-server`支持
+* `Session`类增加`use_lock`配置参数设置是否启用锁机制
+* 优化`File`缓存自动生成空目录的问题
+* 域名及分组路由支持`append`方法传递隐式参数
+* 改进日志的并发写入问题
+* 改进`Query`类的`where`方法支持传入`Query`对象
+* 支持设置单个日志文件的文件名
+* 修正路由规则的域名条件约束 
+* `Request`类增加`subDomain`方法用于获取当前子域名
+* `Response`类增加`allowCache`方法控制是否允许请求缓存
+* `Request`类增加`sendData`方法便于扩展
+* 改进`Env`类不依赖`putenv`方法
+* 改进控制台`trace`显示错误
+* 改进`MorphTo`关联
+* 改进完整路由匹配后带斜线访问出错的情况
+* 改进路由的多级分组问题
+* 路由url地址生成支持多级分组
+* 改进路由Url生成的`url_convert`参数的影响
+* 改进`miss`和`auto`路由内部解析
+* 取消预载入关联查询缓存功能
+
+## V5.1.4 (2018-1-19)
+
+该版本主要增强了数据库和模型操作,主要更新如下:
+
+* 支持设置 `deleteTime`属性为`false` 关闭软删除
+* 模型增加`getError`方法
+* 改进Query类的`getTableFields`/`getFieldsType`方法 支持表名自动获取
+* 模型类`toCollection`方法增加参数指定数据集类
+* 改进`union`查询
+* 关联预载入`with`方法增加缓存参数
+* 改进模型类的`get`和`all`方法的缓存 支持关联缓存
+* 支持`order by field`操作
+* 改进`insertAll`分批写入
+* 改进`json`字段数据支持
+* 增加JSON数据的模型对象化操作
+* 改进路由`ext`参数检测 
+* 修正`rule`方法的`method`参数使用 `get|post` 方式注册路由的问题
+
+## V5.1.3 (2018-1-12)
+
+该版本主要改进了路由及调整函数加载顺序,主要更新如下:
+
+* 增加`env`助手函数;
+* 增加`route`助手函数;
+* 增加视图路由方法;
+* 增加路由重定向方法;
+* 路由默认区分最后的目录斜杆(支持设置不区分);
+* 调整公共文件和配置文件的加载顺序(可以在配置文件中直接使用助手函数);
+* 视图类增加`filter`方法设置输出过滤;
+* `view`助手函数增加`filter`参数;
+* 改进缓存生成指令;
+* Session类的`get`方法支持获取多级;
+* Request类`only`方法支持指定默认值;
+* 改进路由分组;
+* 修正使用闭包查询的时候自动数据缓存出错的情况;
+* 废除`view_filter`钩子位置;
+* 修正分组下面的资源路由;
+* 改进session驱动;
+
+## V5.1.2 (2018-1-8)
+
+该版本改进了配置类及数据库类,主要更新如下:
+
+* 修正嵌套路由分组;
+* 修正自定义模板标签界定符后表达式语法出错的情况;
+* 修正自关联的多次调用问题;
+* 修正数组查询的`null`条件查询;
+* 修正Query类的`order`及`field`的一处可能的BUG;
+* 配置参数设置支持三级;
+* 配置对象支持`ArrayAccess`;
+* App类增加`path`方法用于设置应用目录;
+* 关联定义增加`selfRelation`方法用于设置是否为自关联;
+
+## V5.1.1 (2018-1-3)
+
+修正一些反馈的BUG,包括:
+
+* 修正Cookie类存取数组的问题
+* 修正Controller的`fetch`方法
+* 改进跨域请求
+* 修正`insertAll`方法
+* 修正`chunk`方法
+
+## V5.1.0 (2018-1-1)
+
+主要更新如下:
+
+* 增加注解路由支持
+* 路由支持跨域请求设置
+* 增加`app_dispatch`钩子位置
+* 修正多对多关联的`detach`方法
+* 修正软删除的`destroy`方法
+* Cookie类`httponly`参数默认为false
+* 日志File驱动增加`single`参数配置记录同一个文件(不按日期生成)
+* 路由的`ext`和`denyExt`方法支持不传任何参数
+* 改进模型的`save`方法对`oracle`的支持
+* Query类的`insertall`方法支持配合`data`和`limit`方法
+* 增加`whereOr`动态查询支持
+* 日志的ip地址记录改进
+* 模型`saveAll`方法支持`isUpdate`方法
+* 改进`Pivot`模型的实例化操作
+* 改进Model类的`data`方法
+* 改进多对多中间表模型类
+* 模型增加`force`方法强制更新所有数据
+* Hook类支持设置入口方法名称
+* 改进验证类
+* 改进`hasWhere`查询的数据重复问题
+* 模型的`saveall`方法返回数据集对象
+* 改进File缓存的`clear`方法
+* 缓存添加统一的序列化机制
+* 改进泛三级域名的绑定
+* 改进泛域名的传值和取值
+* Request类增加`panDomain`方法
+* 改进废弃字段判断
+* App类增加`create`方法用于实例化应用类库
+* 容器类增加`has`方法
+* 改进多数据库切换连接
+* 改进断线重连的异常捕获
+* 改进模型类`buildQuery`方法
+* Query类增加`unionAll`方法
+* 关联统计功能增强(支持Sum/Max/Min/Avg)
+* 修正延迟写入
+* chunk方法支持复合主键
+* 改进JSON类型的写入
+* 改进Mysql的insertAll方法
+* Model类`save`方法改进复合主键包含自增的情况
+* 改进Query类`inc`和`dec`方法的关键字处理
+* File缓存inc和dec方法保持原来的有效期
+* 改进redis缓存的有效期判断
+* 增加checkRule方法用于单独数据的多个验证规则
+* 修正setDec方法的延迟写入
+* max和min方法增加force参数
+* 二级配置参数区分大小写
+* 改进join方法自关联的问题
+* 修正关联模型自定义表名的情况
+* Query类增加getFieldsType和getTableFields方法
+* 取消视图替换功能及view_replace_str配置参数
+* 改进域名绑定模块后的额外路由规则问题
+* 改进mysql的insertAll方法
+* 改进insertAll方法写入json字段数据的支持
+* 改进redis长连接多编号库的情况
+
+## RC3版本(2017-11-6)
+
+主要更新如下:
+
+* 改进redis驱动的`get`方法
+* 修正Query类的`alias`方法
+* `File`类错误信息支持多语言
+* 修正路由的额外参数解析
+* 改进`whereTime`方法
+* 改进Model类`getAttr`方法
+* 改进App类的`controller`和`validate`方法支持多层
+* 改进`HasManyThrough`类
+* 修正软删除的`restore`方法
+* 改进`MorpthTo`关联
+* 改进数据库驱动类的`parseKey`方法
+* 增加`whereField`动态查询方法
+* 模型增加废弃字段功能
+* 改进路由的`after`行为检查和`before`行为机制
+* 改进路由分组的检查
+* 修正mysql的`json`字段查询
+* 取消Connection类的`quote`方法
+* 改进命令行的支持
+* 验证信息支持多语言
+* 修正路由模型绑定
+* 改进参数绑定类型对枚举类型的支持
+* 修正模板的`{$Think.version} `输出
+* 改进模板`date`函数解析
+* 改进`insertAll`方法支持分批执行
+* Request类`host`方法支持反向代理
+* 改进`JumpResponse`支持区分成功和错误模板
+* 改进开启类库后缀后的关联外键自动识别问题
+* 修正一对一关联的JOIN方式预载入查询问题
+* Query类增加`hidden`方法
+
+## RC2版本(2017-10-17)
+
+主要更新如下:
+
+* 修正视图查询
+* 修正资源路由
+* 修正`HasMany`关联 修正`where`方法的闭包查询
+* 一对一关联绑定属性到父模型后 关联属性不再保留
+* 修正应用的命令行配置文件读取
+* 改进`Connection`类的`getCacheKey`方法
+* 改进文件上传的非法图像异常
+* 改进验证类的`unique`规则
+* Config类`get`方法支持获取一级配置
+* 修正count方法对`fetchSql`的支持
+* 修正mysql驱动对`socket`支持
+* 改进Connection类的`getRealSql`方法
+* 修正`view`助手函数
+* Query类增加`leftJoin` `rightJoin` 和 `fullJoin`方法
+* 改进app_namespace的获取
+* 改进`append`方法对一对一`bind`属性的支持
+* 改进关联的`saveall`方法的返回值
+* 路由标识设置异常修复
+* 改进Route类`rule`方法
+* 改进模型的`table`属性设置
+* 改进composer autofile的加载顺序
+* 改进`exception_handle`配置对闭包的支持
+* 改进app助手函数增加参数
+* 改进composer的加载路径判断
+* 修正路由组合变量的URL生成
+* 修正路由URL生成
+* 改进`whereTime`查询并支持扩展规则
+* File类的`move`方法第二个参数支持`false`
+* 改进Config类
+* 改进缓存类`remember`方法
+* 惯例配置文件调整 Url类当普通模式参数的时候不做`urlencode`处理
+* 取消`ROOT_PATH`和`APP_PATH`常量定义 如需更改应用目录 自己重新定义入口文件
+* 增加`app_debug`的`Env`获取
+* 修正泛域名绑定
+* 改进查询表达式的解析机制
+* mysql增加`regexp`查询表达式 支持正则查询
+* 改进查询表达式的异常判断
+* 改进model类的`destroy`方法
+* 改进Builder类 取消`parseValue`方法
+* 修正like查询的参数绑定问题
+* console和start文件移出核心纳入应用库
+* 改进Db类主键删除方法
+* 改进泛域名绑定模块
+* 取消`BIND_MODULE`常量 改为在入口文件使用`bind`方法设置
+* 改进数组查询
+* 改进模板渲染的异常处理
+* 改进控制器基类的架构方法参数
+* 改进Controller类的`success`和`error`方法
+* 改进对浏览器`JSON-Handle`插件的支持
+* 优化跳转模板的移动端显示
+* 修正模型查询的`chunk`方法对时间字段的支持
+* 改进trace驱动
+* Collection类增加`push`方法
+* 改进Redis Session驱动
+* 增加JumpResponse驱动
+
+
+## RC1(2017-9-8)
+
+主要新特性为:
+
+* 引入容器和Facade支持
+* 依赖注入完善和支持更多场景
+* 重构的(对象化)路由
+* 配置和路由目录独立
+* 取消系统常量
+* 助手函数增强
+* 类库别名机制
+* 模型和数据库增强
+* 验证类增强
+* 模板引擎改进
+* 支持PSR-3日志规范
+* RC1版本取消了5.0多个字段批量数组查询的方式

+ 32 - 0
LICENSE.txt

@@ -0,0 +1,32 @@
+
+ThinkPHP遵循Apache2开源协议发布,并提供免费使用。
+版权所有Copyright © 2006-2018 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.

+ 186 - 0
README.md

@@ -0,0 +1,186 @@
+![](https://box.kancloud.cn/5a0aaa69a5ff42657b5c4715f3d49221) 
+
+ThinkPHP 5.1(LTS版本) —— 12载初心,你值得信赖的PHP框架
+===============
+
+[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/top-think/framework/badges/quality-score.png?b=5.1)](https://scrutinizer-ci.com/g/top-think/framework/?branch=5.1)
+[![Build Status](https://travis-ci.org/top-think/framework.svg?branch=master)](https://travis-ci.org/top-think/framework)
+[![Total Downloads](https://poser.pugx.org/topthink/framework/downloads)](https://packagist.org/packages/topthink/framework)
+[![Latest Stable Version](https://poser.pugx.org/topthink/framework/v/stable)](https://packagist.org/packages/topthink/framework)
+[![PHP Version](https://img.shields.io/badge/php-%3E%3D5.6-8892BF.svg)](http://www.php.net/)
+[![License](https://poser.pugx.org/topthink/framework/license)](https://packagist.org/packages/topthink/framework)
+
+ThinkPHP5.1对底层架构做了进一步的改进,减少依赖,其主要特性包括:
+
+ + 采用容器统一管理对象
+ + 支持Facade
+ + 注解路由支持
+ + 路由跨域请求支持
+ + 配置和路由目录独立
+ + 取消系统常量
+ + 助手函数增强
+ + 类库别名机制
+ + 增加条件查询
+ + 改进查询机制
+ + 配置采用二级
+ + 依赖注入完善
+ + 支持`PSR-3`日志规范
+ + 中间件支持(V5.1.6+)
+ + Swoole/Workerman支持(V5.1.18+)
+
+
+> ThinkPHP5的运行环境要求PHP5.6以上,兼容PHP8.0。
+
+## 安装
+
+使用composer安装
+
+~~~
+composer create-project topthink/think tp
+~~~
+
+启动服务
+
+~~~
+cd tp
+php think run
+~~~
+
+然后就可以在浏览器中访问
+
+~~~
+http://localhost:8000
+~~~
+
+更新框架
+~~~
+composer update topthink/framework
+~~~
+
+
+## 在线手册
+
++ [完全开发手册](https://www.kancloud.cn/manual/thinkphp5_1/content)
++ [升级指导](https://www.kancloud.cn/manual/thinkphp5_1/354155) 
+
+
+## 官方服务
+
++ [应用服务市场](https://market.topthink.com/)
++ [ThinkAPI——统一API服务](https://docs.topthink.com/think-api) 
+
+## 目录结构
+
+初始的目录结构如下:
+
+~~~
+www  WEB部署目录(或者子目录)
+├─application           应用目录
+│  ├─common             公共模块目录(可以更改)
+│  ├─module_name        模块目录
+│  │  ├─common.php      模块函数文件
+│  │  ├─controller      控制器目录
+│  │  ├─model           模型目录
+│  │  ├─view            视图目录
+│  │  └─ ...            更多类库目录
+│  │
+│  ├─command.php        命令行定义文件
+│  ├─common.php         公共函数文件
+│  └─tags.php           应用行为扩展定义文件
+│
+├─config                应用配置目录
+│  ├─module_name        模块配置目录
+│  │  ├─database.php    数据库配置
+│  │  ├─cache           缓存配置
+│  │  └─ ...            
+│  │
+│  ├─app.php            应用配置
+│  ├─cache.php          缓存配置
+│  ├─cookie.php         Cookie配置
+│  ├─database.php       数据库配置
+│  ├─log.php            日志配置
+│  ├─session.php        Session配置
+│  ├─template.php       模板引擎配置
+│  └─trace.php          Trace配置
+│
+├─route                 路由定义目录
+│  ├─route.php          路由定义
+│  └─...                更多
+│
+├─public                WEB目录(对外访问目录)
+│  ├─index.php          入口文件
+│  ├─router.php         快速测试文件
+│  └─.htaccess          用于apache的重写
+│
+├─thinkphp              框架系统目录
+│  ├─lang               语言文件目录
+│  ├─library            框架类库目录
+│  │  ├─think           Think类库包目录
+│  │  └─traits          系统Trait目录
+│  │
+│  ├─tpl                系统模板目录
+│  ├─base.php           基础定义文件
+│  ├─console.php        控制台入口文件
+│  ├─convention.php     框架惯例配置文件
+│  ├─helper.php         助手函数文件
+│  ├─phpunit.xml        phpunit配置文件
+│  └─start.php          框架入口文件
+│
+├─extend                扩展类库目录
+├─runtime               应用的运行时目录(可写,可定制)
+├─vendor                第三方类库目录(Composer依赖库)
+├─build.php             自动生成定义文件(参考)
+├─composer.json         composer 定义文件
+├─LICENSE.txt           授权说明文件
+├─README.md             README 文件
+├─think                 命令行入口文件
+~~~
+
+> 可以使用php自带webserver快速测试
+> 切换到根目录后,启动命令:php think run
+
+## 命名规范
+
+`ThinkPHP5`遵循PSR-2命名规范和PSR-4自动加载规范,并且注意如下规范:
+
+### 目录和文件
+
+*   目录不强制规范,驼峰和小写+下划线模式均支持;
+*   类库、函数文件统一以`.php`为后缀;
+*   类的文件名均以命名空间定义,并且命名空间的路径和类库文件所在路径一致;
+*   类名和类文件名保持一致,统一采用驼峰法命名(首字母大写);
+
+### 函数和类、属性命名
+
+*   类的命名采用驼峰法,并且首字母大写,例如 `User`、`UserType`,默认不需要添加后缀,例如`UserController`应该直接命名为`User`;
+*   函数的命名使用小写字母和下划线(小写字母开头)的方式,例如 `get_client_ip`;
+*   方法的命名使用驼峰法,并且首字母小写,例如 `getUserName`;
+*   属性的命名使用驼峰法,并且首字母小写,例如 `tableName`、`instance`;
+*   以双下划线“__”打头的函数或方法作为魔法方法,例如 `__call` 和 `__autoload`;
+
+### 常量和配置
+
+*   常量以大写字母和下划线命名,例如 `APP_PATH`和 `THINK_PATH`;
+*   配置参数以小写字母和下划线命名,例如 `url_route_on` 和`url_convert`;
+
+### 数据表和字段
+
+*   数据表和字段采用小写加下划线方式命名,并注意字段名不要以下划线开头,例如 `think_user` 表和 `user_name`字段,不建议使用驼峰和中文作为数据表字段命名。
+
+## 参与开发
+
+请参阅 [ThinkPHP5 核心框架包](https://github.com/top-think/framework)。
+
+## 版权信息
+
+ThinkPHP遵循Apache2开源协议发布,并提供免费使用。
+
+本项目包含的第三方源码和二进制文件之版权信息另行标注。
+
+版权所有Copyright © 2006-2018 by ThinkPHP (http://thinkphp.cn)
+
+All rights reserved。
+
+ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。
+
+更多细节参阅 [LICENSE.txt](LICENSE.txt)

+ 1 - 0
application/.htaccess

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

+ 141 - 0
application/admin/controller/AdminBase.php

@@ -0,0 +1,141 @@
+<?php
+namespace app\admin\controller;
+
+use app\admin\logic\webuserlogic;
+use think\Controller;
+
+class AdminBase extends Controller
+{
+    protected $param;
+    protected $webuserid;
+    protected function initialize()
+    {
+        $url = request()->baseUrl();
+        $urlarr = array_filter(explode('/', strtolower($url)));
+        $url = $urlarr[3] . "/" . $urlarr[4];
+        $ischeck = true;
+        $ignorelist = $this->getignoreurl();
+        foreach ($ignorelist as $key => $value) {
+            if ($url == $value) {
+                $ischeck = false;
+            }
+        }
+        if ($ischeck) {
+            $this->checkToken();
+        }
+
+        $functionname = $urlarr[4];
+        $this->checkrules($functionname);
+
+    }
+    private function getignoreurl()
+    {
+        $list = [
+            'weblogin/login',
+            'weblogin/queryinfobytoken',
+        ];
+        return $list;
+    }
+    /**
+     * 校验token
+     * 20220107
+     * wj
+     */
+    private function checkToken()
+    {
+        $l_w = new webuserlogic();
+        $token = request()->server('HTTP_TOKEN');
+        $param = ['token' => $token];
+        $result = $l_w->queryinfobytoken($param);
+        if (1 != $result['status']) {
+            $str = backjson2(0, '登录失效', $result['data']);
+            exit($str);
+        }
+        $data = $result['data'];
+        $this->webuserid = $data['id'];
+    }
+    /**
+     * 设置请求数据规则
+     * 20220107
+     * wj
+     */
+    protected function setrules()
+    {
+        $list = [];
+        return $list;
+    }
+    /**
+     * 校验请求数据
+     * name 变量名
+     * title 名称
+     * regex 正则
+     * require 必填
+     * type 类型
+     * 20220107
+     * wj
+     */
+    protected function checkrules($functionname)
+    {
+        $param = request()->param();
+        $rules = $this->setrules();
+        if (isset($rules[$functionname])) {
+            try {
+                $list = $rules[$functionname];
+                $namelist = array_column($list, 'name');
+                if (count($namelist) != count($list) || count($list) != count(array_filter($namelist))) {
+                    throw new \Exception("规则name设置错误");
+                }
+                $titlelist = array_column($list, 'title');
+                if (count($titlelist) != count($list) || count($list) != count(array_filter($titlelist))) {
+                    throw new \Exception("规则title设置错误");
+                }
+                foreach ($list as $key => $value) {
+                    $name = $value['name'];
+                    $title = $value['title'];
+                    //必填
+                    if ($value['require']) {
+                        if (!isset($param[$name])) {
+                            throw new \Exception($title . '未填');
+                        }
+                    }
+                    if (!isset($param[$name])) {
+                        continue;
+                    }
+                    $paramvalue = $param[$name];
+                    //类型
+                    if (isset($value['type'])) {
+                        $tpe = $value['type'];
+                        switch ($tpe) {
+                            case 'string':
+                                if (!is_string($paramvalue) || empty($paramvalue)) {
+                                    throw new \Exception($title . '格式错误');
+                                }
+                                break;
+                            case 'numeric':
+                                if (!is_numeric($paramvalue)) {
+                                    throw new \Exception($title . '格式错误');
+                                }
+                                break;
+                            case 'array':
+                                if (!is_array($paramvalue)) {
+                                    throw new \Exception($title . '格式错误');
+                                }
+                                break;
+                        }
+                    }
+                    //正则
+                    if (isset($value['regex'])) {
+                        $regex = $value['regex'];
+                        if (preg_match($regex, $paramvalue)) {
+                            throw new \Exception($title . '正则格式错误');
+                        }
+                    }
+                }
+            } catch (\Exception $e) {
+                $str = backjson2(0, $e->getMessage());
+                exit($str);
+            }
+        }
+        $this->param = $param;
+    }
+}

+ 15 - 0
application/admin/controller/Home.php

@@ -0,0 +1,15 @@
+<?php
+/*
+ * @Author: wang jun
+ * @Date: 2021-11-09 09:39:05
+ * @Last Modified by: wang jun
+ * @Last Modified time: 2022-01-18 13:29:22
+ */
+namespace app\admin\controller;
+
+use think\Controller;
+
+class Home extends AdminBase
+{
+
+}

+ 106 - 0
application/admin/controller/Weblogin.php

@@ -0,0 +1,106 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: sicilon_IT
+ * Date: 2020/1/22
+ * Time: 22:16
+ */
+namespace app\admin\controller;
+
+use app\admin\logic\webuserlogic;
+use app\admin\logic\webuserloglogic;
+use think\Controller;
+use think\facade\Log;
+
+class Weblogin extends AdminBase
+{
+    /**
+     * 设置请求数据规则
+     * 20220107
+     * wj
+     */
+    protected function setrules()
+    {
+        $list = [
+            'login' => [
+                ['name' => 'userName', 'title' => '用户名', 'require' => true, 'type' => 'string'],
+                ['name' => 'password', 'title' => '密码', 'require' => true, 'type' => 'string'],
+            ],
+            'loginout' => [
+                ['name' => 'token', 'title' => 'token', 'require' => true, 'type' => 'string'],
+            ],
+            'queryinfobytoken' => [
+                ['name' => 'token', 'title' => 'token', 'require' => true, 'type' => 'string'],
+            ],
+        ];
+        return $list;
+    }
+    /**
+     * 后台登录
+     * 20211116
+     * wj
+     **/
+    public function login()
+    {
+        $userinfo = request()->param();
+        $wm = new webuserlogic();
+        $l_wul = new webuserloglogic();
+        $result = $wm->userlogin($userinfo['userName'], $userinfo['password']);
+        $logData = ['type' => 1, 'tablename' => 'webuser'];
+        if (1 == $result['status']) {
+            $logData['wuid'] = $result['data']['id'];
+            $logData['node'] = "登录成功";
+            $result1 = $l_wul->addlog($logData);
+            log::info($result1);
+            return backjson2(200, '登录成功', $result['data']);
+        } else {
+            $logData['node'] = "登录失败:" . $result['msg'];
+            $result1 = $l_wul->addlog($logData);
+            log::info($result1);
+            return backjson2(0, $result['msg']);
+        }
+    }
+
+    /***
+     * 后台退出
+     * 20211116
+     * wj
+     */
+    public function loginout()
+    {
+        $param = request()->param();
+        $logData = [
+            'type' => 1,
+            'tablename' => 'webuser',
+            'token' => $param['token'],
+            'node' => '退出',
+        ];
+        $m_w = new webuserlogic();
+        $l_wul = new webuserloglogic();
+        $result = $l_wul->addlog($logData);
+        if (1 === $result['status']) {
+            $result = $m_w->updateToken();
+            if (1 != $result['status']) {
+                return backjson2(0, $result['msg']);
+            }
+            return backjson2(200, '操作成功');
+        } else {
+            return backjson2(0, '操作失败');
+        }
+    }
+
+    /***
+     * 根据token获取用户信息
+     */
+    public function queryinfobytoken()
+    {
+        $param = request()->param();
+        $wm = new webuserlogic();
+        $result = $wm->queryinfobytoken($param);
+        if (1 == $result['status']) {
+            return backjson2(200, '登录成功', $result['data']);
+        } else {
+            return backjson2(0, $result['msg']);
+        }
+    }
+}

+ 172 - 0
application/admin/controller/Webuser.php

@@ -0,0 +1,172 @@
+<?php
+/*
+ * @Author: wang jun
+ * @Date: 2021-10-30 16:54:46
+ * @Last Modified by: wang jun
+ * @Last Modified time: 2021-11-10 16:47:23
+ */
+namespace app\admin\controller;
+
+use app\admin\logic\webuserlogic;
+use app\admin\logic\webuserloglogic;
+use think\Controller;
+
+class Webuser extends AdminBase
+{
+    /**
+     * 设置请求数据规则
+     * 20220107
+     * wj
+     */
+    protected function setrules()
+    {
+        $list = [
+            'newinfo' => [
+                ['name' => 'name', 'title' => '用户名', 'require' => true, 'type' => 'string'],
+            ],
+            'updateisactive' => [
+                ['name' => 'id', 'title' => 'id', 'require' => true, 'type' => 'numeric'],
+                ['name' => 'isactive', 'title' => '可用状态', 'require' => true, 'type' => 'numeric'],
+            ],
+            'updatepasswd' => [
+                ['name' => 'name', 'title' => '用户名', 'require' => true, 'type' => 'string'],
+                ['name' => 'password', 'title' => '密码', 'require' => true, 'type' => 'string'],
+            ],
+            'saveuserrole' => [
+                ['name' => 'access', 'title' => '权限组标志名', 'require' => true, 'type' => 'string'],
+                ['name' => 'uid', 'title' => '用户id', 'require' => true, 'type' => 'numeric'],
+            ],
+        ];
+        return $list;
+    }
+    /**
+     * 创建web用户
+     */
+    public function newinfo()
+    {
+        $param = request()->param();
+        $t_wu = new webuserlogic();
+        $result = $t_wu->newwebuser($param);
+        if (1 != $result['status']) {
+            return backjson2(0, $result['msg']);
+        } else {
+            return backjson2(200, "操作成功", $result['data']);
+        }
+    }
+    /**
+     * 改用户状态
+     * 20211103
+     * wj
+     */
+    public function updateisactive()
+    {
+        $param = request()->param();
+        $t_wu = new webuserlogic();
+        $result = $t_wu->updateisactive($param);
+        if (1 != $result['status']) {
+            return backjson2(0, $result['msg']);
+        } else {
+            return backjson2(200, "操作成功", $result['data']);
+        }
+    }
+    /**
+     * 获取列表
+     * 20211103
+     * wj
+     */
+    public function getalllist()
+    {
+        $param = request()->param();
+        $t_wu = new webuserlogic();
+        $result = $t_wu->getalllist($param);
+        if (1 != $result['status']) {
+            return backjson2(0, $result['msg']);
+        } else {
+            return backjson2(200, "操作成功", $result['data']);
+        }
+    }
+
+    /**
+     * 编辑用户信息
+     * 20211103
+     * wj
+     */
+    public function editwebuser()
+    {
+        $param = request()->param();
+        $t_wu = new webuserlogic();
+        $result = $t_wu->editwebuser($param);
+        if (1 != $result['status']) {
+            return backjson2(0, $result['msg']);
+        } else {
+            return backjson2(200, "操作成功", $result['data']);
+        }
+    }
+
+    /**
+     * 修改用户密码
+     * 20211108
+     * wj
+     */
+    public function updatepasswd()
+    {
+        $param = request()->param();
+        $t_wu = new webuserlogic();
+        $result = $t_wu->updatepasswd($param);
+        if (1 != $result['status']) {
+            return backjson2(0, $result['msg']);
+        } else {
+            return backjson2(200, "操作成功", $result['data']);
+        }
+    }
+
+    /**
+     * 获取用户信息
+     * 20211110
+     * wj
+     */
+    public function searchUserInfo()
+    {
+        $param = request()->param();
+        $t_wu = new webuserlogic();
+        $result = $t_wu->searchUserInfo($param);
+        if (1 != $result['status']) {
+            return backjson2(0, $result['msg']);
+        } else {
+            return backjson2(200, "查询成功", $result['data']);
+        }
+    }
+
+    /**
+     * 保存用户设置
+     * 20211110
+     * wj
+     */
+    public function saveuserrole()
+    {
+        $param = request()->param();
+        $t_wu = new webuserlogic();
+        $result = $t_wu->saveuserrole($param);
+        if (1 != $result['status']) {
+            return backjson2(0, $result['msg']);
+        } else {
+            return backjson2(200, "操作成功", $result['data']);
+        }
+    }
+    /**
+     * 获取用户日志
+     * 20211223
+     * wj
+     */
+    public function getlogs()
+    {
+        $param = request()->param();
+        $l_wl = new webuserloglogic();
+        $result = $l_wl->getlistbywhere($param);
+        if (1 != $result['status']) {
+            return backjson2(0, $result['msg']);
+        } else {
+            return backjson2(200, "操作成功", $result['data']);
+        }
+    }
+}

+ 127 - 0
application/admin/logic/baselogic.php

@@ -0,0 +1,127 @@
+<?php
+/*
+ * @Author: wang jun
+ * @Date: 2022-01-18 11:12:23
+ * @Last Modified by: wang jun
+ * @Last Modified time: 2022-01-19 15:58:46
+ * 微信类
+ */
+namespace app\admin\logic;
+
+use think\facade\Log;
+
+class baselogic
+{
+    /**
+     * 根据配置验证param
+     * wj
+     * 20220119
+     * [[name=>'',title=>'',type=>'',regex=>"",require=>booler]]
+     */
+    protected function checkparam($functionname, $arr)
+    {
+        $param = $arr;
+        $rules = $this->setrules();
+        if (isset($rules[$functionname])) {
+            try {
+                $list = $rules[$functionname];
+                $namelist = array_column($list, 'name');
+                if (count($namelist) != count($list) || count($list) != count(array_filter($namelist))) {
+                    throw new \Exception("规则name设置错误");
+                }
+                $titlelist = array_column($list, 'title');
+                if (count($titlelist) != count($list) || count($list) != count(array_filter($titlelist))) {
+                    throw new \Exception("规则title设置错误");
+                }
+                foreach ($list as $key => $value) {
+                    $name = $value['name'];
+                    $title = $value['title'];
+                    //必填
+                    if (isset($value['require']) && $value['require']) {
+                        if (!isset($param[$name])) {
+                            throw new \Exception($title . '未填');
+                        }
+                    }
+                    if (!$value['require']) {
+                        if (!isset($param[$name])) {
+                            if (isset($value['default'])) {
+                                $param[$name] = $value['default'];
+                            }
+                        }
+                        continue;
+                    }
+                    $paramvalue = $param[$name];
+                    //类型
+                    if (isset($value['type']) && $paramvalue != "") {
+                        $tpe = $value['type'];
+                        switch ($tpe) {
+                            case 'string':
+                                if (!is_string($paramvalue) || empty($paramvalue)) {
+                                    throw new \Exception($title . '格式错误');
+                                }
+                                break;
+                            case 'numeric':
+                                if (!is_numeric($paramvalue)) {
+                                    throw new \Exception($title . '格式错误');
+                                }
+                                break;
+                            case 'array':
+                                if (!is_array($paramvalue)) {
+                                    throw new \Exception($title . '格式错误');
+                                }
+                                break;
+                            case 'datetime':
+                                if (!isDate($paramvalue, 'Y-m-d H:i:s')) {
+                                    throw new \Exception($title . '格式错误');
+                                }
+                                break;
+                            case 'date':
+                                if (!isDate($paramvalue, 'Y-m-d')) {
+                                    throw new \Exception($title . '格式错误');
+                                }
+                                break;
+                        }
+                    }
+                    //正则
+                    if (isset($value['regex']) && $paramvalue != "") {
+                        $regex = $value['regex'];
+                        if (!preg_match($regex, $paramvalue)) {
+                            throw new \Exception($title . '正则格式错误');
+                        }
+                    }
+                }
+                return backarr(1, 'success', $param);
+            } catch (\Exception $e) {
+                $msg = $e->getMessage();
+                Log::error($msg);
+                return backarr(0, "请求错误");
+            }
+        }
+        return backarr(1, 'success', $param);
+    }
+    /**
+     * 设置请求参数验证规则
+     *
+     * @return void
+     */
+    protected function setrules()
+    {
+        return [];
+    }
+    /**
+     * 过滤空数组
+     *
+     * @return void
+     */
+    protected function filterarray($arr)
+    {
+        $newArr = [];
+        foreach ($arr as $key => $value) {
+            if (is_string($value) && $value == "") {
+                continue;
+            }
+            $newArr[$key] = $value;
+        }
+        return $newArr;
+    }
+}

+ 13 - 0
application/admin/logic/homelogic.php

@@ -0,0 +1,13 @@
+<?php
+/*
+ * @Author: wang jun
+ * @Date: 2022-01-18 11:12:23
+ * @Last Modified by: wang jun
+ * @Last Modified time: 2022-01-19 15:51:59
+ */
+namespace app\admin\logic;
+
+class homelogic extends baselogic
+{
+
+}

+ 449 - 0
application/admin/logic/webuserlogic.php

@@ -0,0 +1,449 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: sicilon_IT
+ * Date: 2020/1/22
+ * Time: 21:19
+ */
+namespace app\admin\logic;
+
+use app\admin\model\rolesmodel;
+use app\admin\model\roleusermodel;
+use app\admin\model\webusermodel;
+use think\facade\Log;
+
+class webuserlogic
+{
+    public function getlogininfo($lname, $lpwd)
+    {
+        $webusertable = new webusermodel();
+        $userinfo = $webusertable->getlogininfo($lname, $lpwd);
+        //var_dump($userinfo);
+        return $userinfo;
+    }
+    /**
+     * 校验登录 并修改token
+     */
+    public function userlogin($lname, $lpwd, $updateToken = true)
+    {
+        $m_wu = new webusermodel();
+        $userinfo = $m_wu->getlogininfomd5($lname, $lpwd);
+        if (empty($userinfo)) {
+            return backarr(0, '无用户信息');
+        }
+        $token = $userinfo['token'];
+        if ($updateToken) {
+            $result = $this->updateToken($userinfo['id']);
+            if (1 != $result['status']) {
+                return $result;
+            }
+        }
+        $token = $result['data']['token'];
+        return backarr(1, '登录成功', ['token' => $token, 'id' => $userinfo['id']]);
+    }
+    /**
+     * 用户登出
+     * 改用户token
+     * 20211204
+     * wj
+     */
+    public function updateToken($uid = 0)
+    {
+        $m_wu = new webusermodel();
+        $m_r = new rolesmodel();
+        $m_ru = new roleusermodel();
+        $rwhere = ['name' => '普通用户', 'is_active' => 1];
+        $rid = 0; //不改token组id
+        $userinfo = [];
+        $rinfo = $m_r->getInfo($rwhere);
+        if (!empty($rinfo)) {
+            $rid = $rinfo['id'];
+        }
+        if (empty($uid)) {
+            $token = request()->server('HTTP_TOKEN');
+            if (empty($token)) {
+                return backarr(0, "无token数据");
+            }
+            $where = ['token' => $token];
+            $field = ['id', 'user_name', 'token'];
+            $userinfo = $m_wu->getInfo($where, $field);
+        } else {
+            $where = ['id' => $uid];
+            $field = ['id', 'user_name', 'token'];
+            $userinfo = $m_wu->getInfo($where);
+        }
+        if (empty($userinfo)) {
+            return backarr(0, "无用户信息");
+        }
+        $ruwhere = ['uid' => $userinfo['id']];
+        $ruinfo = $m_ru->getInfo($ruwhere);
+        $changeToken = true;
+        if (!empty($ruinfo) && !empty($rid)) {
+            if ($ruinfo['rid'] == $rid) {
+                $changeToken = false;
+            }
+        }
+        if ($changeToken) {
+            $token = $this->getToken($userinfo['user_name']);
+            $updateData = [
+                'token' => $token,
+            ];
+            $where = ['id' => $userinfo['id']];
+            $row = $m_wu->updateinfo($where, $updateData);
+            if (empty($row)) {
+                log::info($userinfo['user_name'] . " token 修改失败");
+                return backarr(0, "token 修改失败");
+            }
+        } else {
+            $token = $userinfo['token'];
+        }
+        return backarr(1, "操作成功", ['uid' => $userinfo['id'], 'token' => $token]);
+    }
+    /***
+     * 获取用户token
+     */
+    private function getToken($username)
+    {
+        $str = md5(uniqid(md5(microtime(true)), true));
+        $token = sha1($str . $username);
+        return $token;
+    }
+    /**
+     * 获取用户信息 权限组名 和头像 待改
+     * 20211101
+     * wj
+     */
+    public function queryinfobytoken($arr)
+    {
+        if (!isset($arr['token']) || empty($arr['token'])) {
+            return backarr(0, "请求错误");
+        }
+        $defaultData = [
+            //'access' => 'admin',
+            'avatar' => 'https://file.iviewui.com/dist/a0e88e83800f138b94d2414621bd9704.png',
+        ];
+        $token = $arr['token'];
+        $m_wu = new webusermodel();
+        $where = ['token' => $token];
+        $field = ['id', 'user_name'];
+        $userinfo = $m_wu->getInfo($where, $field);
+        if (empty($userinfo)) {
+            return backarr(0, "无用户数据");
+        }
+        //获取权限组名
+        $m_ru = new roleusermodel();
+        $ruwhere = [
+            'uid' => $userinfo['id'],
+        ];
+        $ruinfo = $m_ru->getInfo($ruwhere);
+        if (!empty($ruinfo)) {
+            $rwhere = [
+                'id' => $ruinfo['rid'],
+                'is_active' => 1,
+            ];
+            $m_r = new rolesmodel();
+            $rinfo = $m_r->getInfo($rwhere);
+            if ($rinfo) {
+                $userinfo['access'] = $rinfo['flag_bit'];
+            }
+        }
+        if (!isset($userinfo['access'])) {
+            $userinfo['access'] = "";
+        }
+        if (empty($userinfo)) {
+            return backarr(0, "无数据");
+        } else {
+            $userinfo = array_merge($defaultData, $userinfo->toArray());
+            return backarr(1, "查询成功", $userinfo);
+        }
+    }
+
+    /***
+     * 获取用户信息 通过id
+     * 20211103
+     * wj
+     */
+    public function queryinfobyid($arr)
+    {
+        $id = $arr['id'];
+        $m_wu = new webusermodel();
+        $where = ['id' => $id];
+        $fields = ['id', 'user_name', 'email', 'create_date', 'isactive', 'create_id'];
+        $userinfo = $m_wu->getInfo($where, $fields);
+        if (empty($userinfo)) {
+            return backarr(0, "无数据");
+        }
+        if (!empty($userinfo['create_id'])) {
+            $where = ['id' => $userinfo['create_id']];
+            $createinfo = $m_wu->getInfo($where, ['user_name']);
+            $userinfo['create_user_name'] = $createinfo['user_name'];
+        }
+        return backarr(1, "查询成功", $userinfo);
+    }
+
+    public function queryinfowitchsetting($id)
+    {
+        $m_wu = new webusermodel();
+        $m_ru = new roleusermodel();
+        $where = ['id' => $id];
+        $fields = ['id', 'user_name', 'email', 'create_date', 'isactive', 'create_id'];
+        $userinfo = $m_wu->getInfo($where, $fields);
+        if (empty($userinfo)) {
+            return backarr(0, "无数据");
+        }
+        if (!empty($userinfo['create_id'])) {
+            $where = ['id' => $userinfo['create_id']];
+            $createinfo = $m_wu->getInfo($where, ['user_name']);
+            $userinfo['create_user_name'] = $createinfo['user_name'];
+        }
+        $userinfo['setting'] = ['access' => '', 'access_name' => ''];
+        $roleinfo = $m_ru->getinfoforuser($id);
+        if ($roleinfo) {
+            $roleinfo = $roleinfo[0];
+            $setting = [
+                'access' => $roleinfo['flag_bit'],
+                'access_name' => $roleinfo['name'],
+            ];
+            $userinfo['setting'] = $setting;
+        }
+
+        return backarr(1, "查询成功", $userinfo);
+    }
+
+    public function editwebuser($arr)
+    {
+        if (isset($arr['id']) && !empty($arr['id'])) {
+            $result = $this->updatewebuserinfo($arr);
+        } else {
+            $result = $this->newwebuser($arr);
+        }
+        return $result;
+    }
+    /**
+     * 新建web用户
+     * 登录名不可重复
+     */
+    public function newwebuser($arr)
+    {
+        $name = $arr['name'];
+        $m_wu = new webusermodel();
+        $where = ['user_name' => $name];
+        $userinfo = $m_wu->getInfo($where);
+        if ($userinfo) {
+            return backarr(0, "用户已存在");
+        }
+        $insertData = [];
+        $insertData['user_name'] = $name;
+        $insertData['user_password'] = md5($name . $arr['password']);
+        $insertData['token'] = $this->getToken($name);
+        $insertData['create_date'] = date('Y-m-d H:i:s');
+        $insertData['create_id'] = $arr['userid'];
+        if (isset($arr['email']) && !empty($arr['email'])) {
+            $insertData['email'] = $arr['email'];
+        }
+        $id = $m_wu->insertData($insertData);
+        if (empty($id)) {
+            return backarr(0, "操作失败");
+        }
+        return backarr(1, "操作成功", ['id' => $id]);
+    }
+    /***
+     * 改用户信息
+     * 20211103
+     * wj
+     * 仅改用户邮箱
+     */
+    public function updatewebuserinfo($arr)
+    {
+        $id = $arr['id'];
+        $m_wu = new webusermodel();
+        $where = ['id' => $id];
+        $userinfo = $m_wu->getInfo($where);
+        if (empty($userinfo)) {
+            return backarr(0, "用户不存在");
+        }
+        $updateData = [];
+        if (isset($arr['email']) && !empty($arr['email'])) {
+            $updateData['email'] = $arr['email'];
+        }
+        if (!empty($updateData)) {
+            $row = $m_wu->updateinfo($where, $updateData);
+            if (empty($row)) {
+                return backarr(0, "操作失败");
+            }
+            return backarr(1, "操作成功", ['id' => $id]);
+        }
+        return backarr(0, "无修改数据");
+    }
+    /***
+     * 改用户密码
+     * 20211103
+     * wj
+     */
+    public function updatepasswd($arr)
+    {
+        $fillfields = [
+            'name', 'password',
+        ];
+        foreach ($fillfields as $key => $value) {
+            if (!isset($arr[$value]) || empty($arr[$value])) {
+                return backarr(0, "请求错误");
+            }
+        }
+        $m_wu = new webusermodel();
+        $name = trim($arr['name']);
+        $password = trim($arr['password']);
+        $where = ['user_name' => $name];
+        $userinfo = $m_wu->getInfo($where);
+        if (empty($userinfo)) {
+            return backarr(0, "用户不存在");
+        }
+        $updateData = [
+            'user_password' => md5($name . $password),
+            'token' => $this->getToken($name),
+        ];
+        $id = $userinfo['id'];
+        $where = ['id' => $id];
+        $row = $m_wu->updateinfo($where, $updateData);
+        if (empty($row)) {
+            return backarr(0, "操作失败");
+        }
+        return backarr(1, "操作成功", ['id' => $id]);
+    }
+
+    /***
+     * 改用户状态
+     * 20211103
+     * wj
+     */
+    public function updateisactive($arr)
+    {
+        $id = $arr['id'];
+        $isactive = $arr['isactive'];
+        $m_wu = new webusermodel();
+        $where = ['id' => $id];
+        $userinfo = $m_wu->getInfo($where);
+        if (empty($userinfo)) {
+            return backarr(0, "用户不存在");
+        }
+        //默认 isactive 0
+        $isactive = in_array($isactive, [0, 1]) ? $isactive : 0;
+        $updateData = ['isactive' => $isactive];
+        $row = $m_wu->updateinfo($where, $updateData);
+        if (empty($row)) {
+            return backarr(0, "操作失败");
+        }
+        return backarr(1, "操作成功", ['id' => $id]);
+    }
+
+    /***
+     * 获取用户列表
+     * 20211103
+     * wj
+     */
+    public function getalllist($arr)
+    {
+        $searchData = [];
+        if (isset($arr['userName']) && !empty($arr['userName'])) {
+            $searchData['user_name'] = ['like', '%' . $arr['userName'] . '%'];
+        }
+        if (isset($arr['isactive']) && in_array($arr['isactive'], [0, 1]) && is_numeric($arr['isactive'])) {
+            $searchData['isactive'] = $arr['isactive'];
+        }
+        $m_wu = new webusermodel();
+        $count = $m_wu->getList($searchData, 'count');
+        if ($count <= 0) {
+            return backarr(0, "无数据");
+        }
+        $page = !isset($arr['page']) || empty($arr['page']) ? 1 : $arr['page'];
+        $size = !isset($arr['size']) || empty($arr['size']) ? 10 : $arr['size'];
+        $fields = ['id'];
+        $list = $m_wu->getList($searchData, $fields, $page, $size);
+        foreach ($list as $key => &$value) {
+            $result = $this->queryinfowitchsetting($value['id']);
+            if (1 != $result['status']) {
+                return backarr(0, $result['msg']);
+            }
+            $list[$key] = $result['data'];
+        }
+        $data = [
+            'count' => $count,
+            'list' => $list->toArray(),
+        ];
+        return backarr(1, "查询成功", $data);
+    }
+
+    /**
+     * 按照id查用户信息
+     * 20211110
+     * wj
+     */
+    public function searchUserInfo($arr)
+    {
+        $id = 0;
+        if (isset($arr['id']) && !empty($arr['id'])) {
+            $id = $arr['id'];
+        }
+        if (empty($id)) {
+            return backarr(0, "无数据");
+        }
+        $result = $this->queryinfowitchsetting($id);
+        return $result;
+    }
+
+    /**
+     * 保存用户和用户组关系
+     * 20211110
+     * wj
+     */
+    public function saveuserrole($arr)
+    {
+        $fillfields = ['access', 'uid'];
+        foreach ($fillfields as $key => $value) {
+            if (!isset($arr[$value]) || !isset($arr[$value])) {
+                return backarr(0, "请求错误");
+            }
+        }
+
+        $m_r = new rolesmodel();
+        $m_wu = new webusermodel();
+        $m_ru = new roleusermodel();
+
+        $userid = $arr['uid'];
+        $access = $arr['access'];
+
+        $mrinfo = $m_r->getInfo(['flag_bit' => $access, 'is_active' => 1]);
+        if (empty($mrinfo)) {
+            return backarr(0, "无权限组");
+        }
+
+        $wuinfo = $m_wu->getInfo(['id' => $userid]);
+        if (empty($wuinfo)) {
+            return backarr(0, "用户不存在");
+        }
+        $ruinfo = $m_ru->getInfo(['uid' => $userid]);
+        if (empty($ruinfo)) {
+            $insertData = [
+                'uid' => $userid,
+                'rid' => $mrinfo['id'],
+            ];
+            $id = $m_ru->insertData($insertData);
+        } else {
+            $ruwhere = ['id' => $ruinfo['id']];
+            $updateData = [
+                'rid' => $mrinfo['id'],
+            ];
+            $row = $m_ru->updateinfo($ruwhere, $updateData);
+            if ($row <= 0) {
+                $id = 0;
+            } else {
+                $id = $ruinfo['id'];
+            }
+        }
+
+        if (empty($id)) {
+            return backarr(0, "操作失败");
+        }
+        return backarr(1, "操作成功", ['id' => $id]);
+    }
+}

+ 57 - 0
application/app/logic/appointmentlogic.php

@@ -0,0 +1,57 @@
+<?php
+namespace app\app\logic;
+
+use app\index\model\appointmentmodel;
+
+/**
+ * 登记记录表
+ *
+ * @author wj
+ * @date 2022-07-22
+ */
+class appointmentlogic extends baselogic
+{
+    /**
+     * 设置请求数据规则
+     * 20220107
+     * wj
+     */
+    protected function setrules()
+    {
+        $list = [
+            'getlastinfo' => [
+                ['name' => 'code', 'title' => '申请编码', 'require' => true, 'type' => 'string'],
+            ],
+            /*'saveinfo' => [
+        ['name' => 'openid', 'title' => 'openid', 'require' => true, 'type' => 'string'],
+        ['name' => 'union_id', 'title' => 'union_id', 'require' => false, 'type' => 'string'],
+        ['name' => 'nick_name', 'title' => '昵称', 'require' => true, 'type' => 'string'],
+        ['name' => 'avatar_url', 'title' => '头像', 'require' => false, 'type' => 'string'],
+        ['name' => 'gender', 'title' => '性别', 'require' => false, 'type' => 'string'],
+        ['name' => 'province', 'title' => '省', 'require' => false, 'type' => 'string'],
+        ['name' => 'city', 'title' => '市', 'require' => false, 'type' => 'string'],
+        ['name' => 'country', 'title' => '县', 'require' => false, 'type' => 'string'],
+        ['name' => 'tel', 'title' => '手机号', 'require' => false, 'type' => 'string'],
+        ['name' => 'address', 'title' => '地址', 'require' => false, 'type' => 'string'],
+        ],*/
+        ];
+        return $list;
+    }
+    /**
+     * 获取用户当日申请最后一条数据
+     *
+     * @param  [type] $arr
+     * @return void
+     * @author wj
+     * @date 2022-07-22
+     */
+    public function getlastinfo($arr)
+    {
+        $m_a = new appointmentmodel();
+        $info = $m_a->getlastinfo($arr);
+        if (empty($info)) {
+            return backarr(0, "无申请数据");
+        }
+        return backarr(1, "查询成功", $info);
+    }
+}

+ 102 - 0
application/app/logic/baselogic.php

@@ -0,0 +1,102 @@
+<?php
+/*
+ * @Author: wang jun
+ * @Date: 2022-01-18 11:12:23
+ * @Last Modified by: wang jun
+ * @Last Modified time: 2022-01-19 15:58:46
+ * 微信类
+ */
+namespace app\app\logic;
+
+use think\facade\Log;
+
+class baselogic
+{
+    /**
+     * 根据配置验证param
+     * wj
+     * 20220119
+     * [[name=>'',title=>'',type=>'',regex=>"",require=>booler]]
+     */
+    protected function checkparam($functionname, $arr)
+    {
+        $param = $arr;
+        $rules = $this->setrules();
+        if (isset($rules[$functionname])) {
+            try {
+                $list = $rules[$functionname];
+                $namelist = array_column($list, 'name');
+                if (count($namelist) != count($list) || count($list) != count(array_filter($namelist))) {
+                    throw new \Exception("规则name设置错误");
+                }
+                $titlelist = array_column($list, 'title');
+                if (count($titlelist) != count($list) || count($list) != count(array_filter($titlelist))) {
+                    throw new \Exception("规则title设置错误");
+                }
+                foreach ($list as $key => $value) {
+                    $name = $value['name'];
+                    $title = $value['title'];
+                    //必填
+                    if (isset($value['require']) && $value['require']) {
+                        if (!isset($param[$name])) {
+                            throw new \Exception($title . '未填');
+                        }
+                    }
+                    if (!$value['require']) {
+                        if (!isset($param[$name])) {
+                            if (isset($value['default'])) {
+                                $param[$name] = $value['default'];
+                            }
+                        }
+                        continue;
+                    }
+
+                    $paramvalue = $param[$name];
+                    //类型
+                    if (isset($value['type'])) {
+                        $tpe = $value['type'];
+                        switch ($tpe) {
+                            case 'string':
+                                if (!is_string($paramvalue) || empty($paramvalue)) {
+                                    throw new \Exception($title . '格式错误');
+                                }
+                                break;
+                            case 'numeric':
+                                if (!is_numeric($paramvalue)) {
+                                    throw new \Exception($title . '格式错误');
+                                }
+                                break;
+                            case 'array':
+                                if (!is_array($paramvalue)) {
+                                    throw new \Exception($title . '格式错误');
+                                }
+                                break;
+                        }
+                    }
+                    //正则
+                    if (isset($value['regex'])) {
+                        $regex = $value['regex'];
+                        if (!preg_match($regex, $paramvalue)) {
+                            throw new \Exception($title . '正则格式错误');
+                        }
+                    }
+                }
+                return backarr(1, 'success', $param);
+            } catch (\Exception $e) {
+                $msg = $e->getMessage();
+                Log::error($msg);
+                return backarr(0, "请求错误");
+            }
+        }
+        return backarr(1, 'success', $param);
+    }
+    /**
+     * 设置请求参数验证规则
+     *
+     * @return void
+     */
+    protected function setrules()
+    {
+        return [];
+    }
+}

+ 145 - 0
application/app/model/appointmentmodel.php

@@ -0,0 +1,145 @@
+<?php
+namespace app\index\model;
+
+use think\Model;
+
+/**
+ * 登记记录表
+ *
+ * @author wj
+ * @date 2022-07-22
+ */
+class appointmentmodel extends Model
+{
+    public function insertData($data)
+    {
+        if (!isset($data['oprdate']) || empty($data['oprdate']) || !is_string($data['oprdate'])) {
+            $data['oprdate'] = date("Y-m-d H:i:s");
+        }
+        if (isset($data['id'])) {
+            unset($data['id']);
+        }
+        $data = $this->formatData($data);
+        if (empty($data)) {
+            return false;
+        }
+        $id = $this->insertGetId($data);
+        return $id ? $id : false;
+    }
+
+    /**
+     * 校验入库数据
+     * 20220119
+     */
+    private function formatData($data)
+    {
+        $useData = [];
+        $fields = $this->getTableFields();
+        foreach ($data as $key => $value) {
+            if (in_array($key, $fields)) {
+                $useData[$key] = $value;
+            }
+        }
+        return $useData;
+    }
+    public function getInfo($where, $field = "*", $row = true)
+    {
+        $info = $this->field($field)->where($where);
+        if ($row) {
+            $info = $info->find();
+        } else {
+            $info = $info->select();
+        }
+        return empty($info) ? false : $info;
+    }
+
+    public function updateinfo($where, $updateData)
+    {
+        $row = $this->where($where)->update($updateData);
+        return empty($row) ? false : $row;
+    }
+
+    public function deleteinfo($where)
+    {
+        $row = $this->where($where)->delete();
+        return empty($row) ? false : $row;
+    }
+
+    public function getList($where = [], $field = "*", $page = 1, $size = 10, $order = "id desc", $group = "", $row = false)
+    {
+        $sqlObj = $this->where($where);
+        if ("count" != $field) {
+            $sqlObj = $sqlObj->field($field)->order($order)->group($group)->page($page, $size);
+            if ($row) {
+                $data = $sqlObj->find();
+            } else {
+                $data = $sqlObj->select();
+            }
+        } else {
+            $data = $sqlObj = $sqlObj->count();
+        }
+        return $data;
+    }
+
+    /**
+     * 根据id获取信息
+     * wj
+     * 20220118
+     */
+    public function getinfobyid($id)
+    {
+        $where = ['id' => $id];
+        $info = $this->where($where)->find();
+        return $info;
+    }
+    /**
+     * 根据code获取信息
+     * wj
+     * 20220118
+     */
+    public function getinfobycode($code)
+    {
+        $where = ['code' => $code];
+        $info = $this->where($where)->find();
+        return $info ? $info : false;
+    }
+    /**
+     * 根据id修改数据
+     * wj
+     * 20220118
+     */
+    public function updatebyid($id, $updateData)
+    {
+        $where = ['id' => $id];
+        $updateData = $this->formatData($updateData);
+        if (empty($updateData)) {
+            return false;
+        }
+        $row = $this->where($where)->update($updateData);
+        return $row;
+    }
+
+    /**
+     * 获取最后一条可用数据
+     *
+     * @param  [type] $wid
+     * @return void
+     * @author wj
+     * @date 2022-07-22
+     */
+    public function getlastinfo($where)
+    {
+        $usewhere = ['isuse' => 0, 'ispay' => 1, 'oprdate' => ['>=', date("Y-m-d 00:00:00")]];
+        if (isset($where['wid'])) {
+            $usewhere['wid'] = $where['wid'];
+        }
+        if (isset($where['openid'])) {
+            $usewhere['openid'] = $where['openid'];
+        }
+        if (isset($where['code'])) {
+            $usewhere['code'] = $where['openid'];
+        }
+        $info = $this->where($usewhere)->find();
+        return $info ? $info : false;
+    }
+}

+ 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 [];

+ 233 - 0
application/common.php

@@ -0,0 +1,233 @@
+<?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@gmail.com>
+// +----------------------------------------------------------------------
+
+// 应用公共文件
+
+/*微信小程序用
+ * code 成功
+ * 20210927
+ * wj
+ */
+function backjson($code, $data)
+{
+    $jsonData = [
+        'code' => $code,
+        'resultData' => $data,
+    ];
+    return json_encode($jsonData, 320);
+}
+/*app用
+ * 20210927
+ * wj
+ */
+function backjson2($code, $msg = "", $data = [])
+{
+    $jsonData = [
+        'code' => $code,
+        'msg' => $msg,
+        'data' => $data,
+    ];
+    return json_encode($jsonData, 320);
+}
+/* 内部使用
+ * 20210927
+ * wj
+ */
+function backarr($status, $msg = "", $data = [])
+{
+    $backData = [
+        'status' => $status,
+        'msg' => $msg,
+        'data' => $data,
+    ];
+    return $backData;
+}
+/***
+ * 获取单号
+ * wj
+ * 20210911
+ */
+function createOrderNo()
+{
+    $ordrNo = date("YmdHis") . rand(0, 1000);
+    return $ordrNo;
+}
+/***
+ * 获取随机字符串
+ * wj
+ * 20210911
+ */
+function getRandomStrings($str = "")
+{
+    $str .= time();
+    return md5($str);
+}
+/***
+ * 判断是否为日期
+ * wj
+ * 20211013
+ */
+function isDate($date, $foramt)
+{
+    $date1 = $date;
+    $time = strtotime($date1);
+    if (!$time) {
+        return false;
+    }
+    $date2 = date($foramt, $time);
+    return $date1 == $date2;
+}
+
+//curl请求
+function requestCurl($url, $method = "get", $data = '', $header = [], $second = 10)
+{
+    $method = strtoupper($method);
+    $method = in_array($method, ['GET', 'POST']) ? $method : 'GET';
+
+    $ch = curl_init();
+    //设置超时
+    curl_setopt($ch, CURLOPT_TIMEOUT, $second);
+    curl_setopt($ch, CURLOPT_URL, $url);
+    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
+
+    //要求结果为字符串且输出到屏幕上
+    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+
+    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); //严格校验2
+    //设置header
+    curl_setopt($ch, CURLOPT_HEADER, false);
+    if (!empty($header)) {
+        curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
+    }
+    if ('POST' == $method) {
+        //$data = json_encode($data, JSON_UNESCAPED_UNICODE);
+        curl_setopt($ch, CURLOPT_POST, true);
+        if (is_array($data)) {
+            curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data, ''));
+        }
+        if (is_string($data)) {
+            curl_setopt($ch, CURLOPT_POSTFIELDS, $data); // Post提交的数据包
+        }
+    }
+    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //禁止 cURL 验证对等证书
+    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); //是否检测服务器的域名与证书上的是否一致
+    //运行curl
+    $data = curl_exec($ch);
+    if (curl_errno($ch)) { //出错则显示错误信息
+        $error = curl_error($ch);
+        curl_close($ch);
+        return $error;
+    } else {
+        curl_close($ch);
+        return $data;
+    }
+}
+function arry_string($data)
+{
+    if (!is_array($data)) {
+        return false;
+    }
+    $usedata = [];
+    foreach ($data as $key => $value) {
+        if (!is_string($value) && !is_numeric($value)) {
+            return false;
+        }
+        $usedata[] = $key . '=' . $value;
+    }
+    $str = implode('&', $usedata);
+    return $str;
+}
+
+//根据身份证获取性别
+function getGenderBySfzid($sfzid)
+{
+    $gender = false;
+    switch (mb_strlen($sfzid)) {
+        case 15:
+            $genderNum = substr($sfzid, 14, 1);
+            break;
+        case 18:
+            $genderNum = substr($sfzid, 16, 1);
+            break;
+    }
+    if (($genderNum % 2) === 0) {
+        $gender = "女";
+    } else {
+        $gender = "男";
+    }
+    return $gender;
+}
+function getGenderByAge($sfzid)
+{
+    $birthday = substr($sfzid, 6, 8);
+    $bmd = substr($birthday, 4, 4);
+    $byear = substr($birthday, 0, 4);
+    $strtoday = date('Ymd');
+    $md = substr($strtoday, 4, 4);
+    $year = substr($strtoday, 0, 4);
+    $age = intval($year) - intval($byear);
+    if ($md < $bmd) {
+        $age = $age - 1;
+    }
+    return $age;
+}
+//获取身份证结束时间
+function getSfzend($sfzenddate)
+{
+    if (is_numeric($sfzenddate)) {
+        if (isDate($sfzenddate, "Ymd")) {
+            $strenddate = $sfzenddate;
+            $strendmonth = substr($strenddate, 4, 2);
+            $strendyear = substr($strenddate, 0, 4);
+            $strendday = substr($strenddate, 6, 2);
+            $sfzenddate = $strendyear . '-' . $strendmonth . '-' . $strendday;
+        } else {
+            $sfzenddate = '2050-12-31';
+        }
+    } else {
+        $sfzenddate = false;
+    }
+    return $sfzenddate;
+}
+//为cp后台请求验证token
+/*function checkToken()
+{
+$l_w = new app\index\logic\webmanger();
+$token = request()->server('HTTP_TOKEN');
+$param = ['token' => $token];
+$result = $l_w->queryinfobytoken($param);
+if (1 != $result['status']) {
+$str = backjson2(0, '登录失效', $result['data']);
+exit($str);
+}
+}*/
+//判断是否是手机号
+function isMoblid($tel)
+{
+    if (preg_match("/^1[3-9]{1}\d{9}$/", $tel)) {
+        return true;
+    } else {
+        return false;
+    }
+}
+//获取httpsurl
+function getselfurl($name)
+{
+    $env = config('env');
+    $sellurl = config('selfurl');
+    $urllist = isset($sellurl[$env]) ? $sellurl[$env] : $sellurl['pro'];
+    $defaultname = "default";
+    if (empty($name)) {
+        $name = $defaultname;
+    }
+    return isset($urllist[$name]) ? $urllist[$name] : $urllist[$defaultname];
+}

+ 115 - 0
application/index/controller/Appointment.php

@@ -0,0 +1,115 @@
+<?php
+/*
+ * @Author: wang jun
+ * @Date: 2022-01-18 10:57:14
+ * @Last Modified by: wang jun
+ * @Last Modified time: 2022-01-19 10:38:56
+ * 微信类
+ */
+namespace app\index\controller;
+
+use app\index\logic\appointmentlogic;
+use app\index\logic\paylogic;
+use app\index\logic\wechatlogic;
+use app\index\logic\wxuserlogic;
+use think\Controller;
+use think\Db;
+use think\Log;
+
+class Appointment extends Base
+{
+    /**
+     * 新建申请
+     *
+     * @return void
+     * @author wj
+     * @date 2022-07-23
+     */
+    public function newinfo()
+    {
+        $param = request()->post();
+        Db::startTrans();
+        try {
+            $l_wu = new wxuserlogic();
+            $result = $l_wu->saveinfo($param);
+            if ($result['status']) {
+                throw new \Exception($result['msg']);
+            }
+            $wudata = $result['data'];
+            $wid = $wudata['id'];
+            $param['wid'] = $wid;
+            $l_a = new appointmentlogic();
+            $result = $l_a->newinfo($param);
+            if (!$result['status']) {
+                throw new \Exception($result['msg']);
+            }
+            $adata = $result['data'];
+            $returnData = [
+                'aid' => $adata['id'],
+            ];
+            Db::commit();
+            return backjson(1, $returnData);
+        } catch (\Exception $e) {
+            Db::rollback();
+            return backjson(0, $e->getMessage());
+        }
+    }
+    /**
+     * 支付核酸检测费用 仅小程序支付
+     *
+     * @return void
+     * @author wj
+     * @date 2022-07-23
+     */
+    public function payorder()
+    {
+        $param = request()->post();
+        $l_p = new paylogic();
+        $result = $l_p->getappointmentorderforxcx($param);
+        if (empty($result['status'])) {
+            return backjson(0, $result['msg']);
+        }
+        $orderData = $result['data'];
+        $l_wechat = new wechatlogic();
+        $result = $l_wechat->createorder($orderData);
+        if (empty($result['status'])) {
+            return backjson(0, $result['msg']);
+        }
+        $returnData = $result['data'];
+        return $returnData;
+    }
+    /**
+     * 支付回调
+     *
+     * @return void
+     * @author wj
+     * @date 2022-07-23
+     */
+    public function pay_call_back()
+    {
+        $headerinfo = request()->instance()->header();
+        log::info($headerinfo);
+        $reurnData = [
+            "return_code" => "SUCCESS",
+            "return_msg" => "OK",
+        ];
+        log::info('into callback');
+        $data = file_get_contents('php://input');
+        $backdata = (array) simplexml_load_string($data, 'SimpleXMLElement', LIBXML_NOCDATA);
+        $l_p = new paylogic();
+        $reulst = $l_p->handleorder($backdata);
+        if (empty($reulst['status'])) {
+            $reurnData = [
+                "return_code" => "FAIL",
+                "return_msg" => $reulst['msg'],
+            ];
+        } else {
+            $reurnData = [
+                "return_code" => "SUCCESS",
+                "return_msg" => $reulst['msg'],
+            ];
+        }
+        $l_wechat = new wechatlogic();
+        $l_wechat->paybackxml($reurnData);
+    }
+}

+ 8 - 0
application/index/controller/Base.php

@@ -0,0 +1,8 @@
+<?php
+namespace app\index\controller;
+
+use think\Controller;
+
+class Base extends Controller
+{
+}

+ 72 - 0
application/index/controller/Index.php

@@ -0,0 +1,72 @@
+<?php
+/*
+ * @Author: wang jun
+ * @Date: 2022-01-18 10:57:14
+ * @Last Modified by: wang jun
+ * @Last Modified time: 2022-01-19 10:38:56
+ * 微信类
+ */
+namespace app\index\controller;
+
+use app\index\logic\wechatlogic;
+use think\Controller;
+
+class Index extends Base
+{
+    public function index()
+    {
+        echo "acidhospital";
+    }
+    /**
+     * 获取openid
+     * 20220118
+     * wj
+     * code 必填
+     */
+    public function getOpenid()
+    {
+        $param = request()->param();
+        $l_w = new wechatlogic();
+        $result = $l_w->getOpenid($param);
+        if (1 != $result['status']) {
+            return backjson(0, $result['msg']);
+        } else {
+            return backjson(200, $result['data']);
+        }
+    }
+    /**
+     * 保存二维码
+     * 20220118
+     * wj
+     * scene page 必填
+     */
+    public function create_qrcode()
+    {
+        $param = request()->param();
+        $l_w = new wechatlogic();
+        $result = $l_w->create_qrcode($param);
+        if (1 != $result['status']) {
+            return backjson(0, $result['msg']);
+        } else {
+            return backjson(200, $result['data']);
+        }
+    }
+    /**
+     * 保存并下载二维码 
+     * 20220118
+     * wj
+     * scene page 必填
+     */
+    /*public function down_qrcode()
+    {
+        $param = request()->param();
+        $l_w = new wechatlogic();
+        $result = $l_w->create_qrcode($param);
+        if (1 != $result['status']) {
+            return backjson(0, $result['msg']);
+        }
+        $data = $result['data'];
+        $path = $data['path'];
+    }*/
+
+}

+ 103 - 0
application/index/logic/appointmentlogic.php

@@ -0,0 +1,103 @@
+<?php
+namespace app\index\logic;
+
+use app\index\model\appointmentmodel;
+use app\index\model\wxusermodel;
+
+/**
+ * 登记记录表
+ *
+ * @author wj
+ * @date 2022-07-22
+ */
+class appointmentlogic extends baselogic
+{
+    /**
+     * 设置请求数据规则
+     * 20220107
+     * wj
+     */
+    protected function setrules()
+    {
+        $list = [
+            'getlastinfo' => [
+                ['name' => 'sfzid', 'title' => '身份证', 'require' => true, 'type' => 'string'],
+            ],
+            'newinfo' => [
+                ['name' => 'wid', 'title' => '用户id', 'require' => true, 'type' => 'numeric'],
+                ['name' => 'gps_lng', 'title' => '经度', 'require' => false, 'type' => 'numeric', 'default' => ''],
+                ['name' => 'gps_lat', 'title' => '纬度', 'require' => false, 'type' => 'numeric', 'default' => ''],
+                ['name' => 'signurl', 'title' => '签名', 'require' => true, 'type' => 'string'],
+            ],
+        ];
+        return $list;
+    }
+    /**
+     * 获取用户当日申请最后一条数据
+     *
+     * @param  [type] $arr
+     * @return void
+     * @author wj
+     * @date 2022-07-22
+     */
+    public function getlastinfo($arr)
+    {
+        $result = $this->checkparam(__FUNCTION__, $arr);
+        if (1 != $result['status']) {
+            return $result;
+        }
+        $data = $result['data'];
+        $m_a = new appointmentmodel();
+        $info = $m_a->getlastinfo($data);
+        if (empty($info)) {
+            return backarr(0, "无申请数据");
+        }
+        return backarr(1, "查询成功", $info);
+    }
+    /**
+     * 新建用户申请数据
+     *
+     * @param  [type] $arr
+     * @return void
+     * @author wj
+     * @date 2022-07-22
+     */
+    public function newinfo($arr)
+    {
+        $result = $this->checkparam(__FUNCTION__, $arr);
+        if (1 != $result['status']) {
+            return $result;
+        }
+        $data = $result['data'];
+        $wid = $data['wid'];
+        $gps_lng = $data['gps_lng'];
+        $gps_lat = $data['gps_lat'];
+        $m_a = new appointmentmodel();
+        $m_u = new wxusermodel();
+        $info = $m_u->getinfobyid($wid, '*');
+        if (empty($info)) {
+            return backarr(0, "无用户数据");
+        }
+        $insertData = [
+            'wid' => $info['id'],
+            'openid' => $info['openid'],
+            'name' => $info['real_name'],
+            'sfzid' => $info['sfzid'],
+            'telno' => $info['telno'],
+            'oprdate' => date('Y-m-d H:i:s'),
+            'isuse' => 0,
+            'ispay' => 0,
+        ];
+        if (empty($gps_lng) && is_numeric($gps_lng)) {
+            $insertData['gps_lng'] = $gps_lng;
+        }
+        if (empty($gps_lat) && is_numeric($gps_lat)) {
+            $insertData['gps_lat'] = $gps_lat;
+        }
+        $id = $m_a->insertData($insertData);
+        if (empty($id)) {
+            return backarr(0, "添加失败");
+        }
+        return backarr(1, "添加成功", ['id' => $id]);
+    }
+}

+ 102 - 0
application/index/logic/baselogic.php

@@ -0,0 +1,102 @@
+<?php
+/*
+ * @Author: wang jun
+ * @Date: 2022-01-18 11:12:23
+ * @Last Modified by: wang jun
+ * @Last Modified time: 2022-01-19 15:58:46
+ * 微信类
+ */
+namespace app\index\logic;
+
+use think\facade\Log;
+
+class baselogic
+{
+    /**
+     * 根据配置验证param
+     * wj
+     * 20220119
+     * [[name=>'',title=>'',type=>'',regex=>"",require=>booler]]
+     */
+    protected function checkparam($functionname, $arr)
+    {
+        $param = $arr;
+        $rules = $this->setrules();
+        if (isset($rules[$functionname])) {
+            try {
+                $list = $rules[$functionname];
+                $namelist = array_column($list, 'name');
+                if (count($namelist) != count($list) || count($list) != count(array_filter($namelist))) {
+                    throw new \Exception("规则name设置错误");
+                }
+                $titlelist = array_column($list, 'title');
+                if (count($titlelist) != count($list) || count($list) != count(array_filter($titlelist))) {
+                    throw new \Exception("规则title设置错误");
+                }
+                foreach ($list as $key => $value) {
+                    $name = $value['name'];
+                    $title = $value['title'];
+                    //必填
+                    if (isset($value['require']) && $value['require']) {
+                        if (!isset($param[$name])) {
+                            throw new \Exception($title . '未填');
+                        }
+                    }
+                    if (!$value['require']) {
+                        if (!isset($param[$name])) {
+                            if (isset($value['default'])) {
+                                $param[$name] = $value['default'];
+                            }
+                        }
+                        continue;
+                    }
+
+                    $paramvalue = $param[$name];
+                    //类型
+                    if (isset($value['type'])) {
+                        $tpe = $value['type'];
+                        switch ($tpe) {
+                            case 'string':
+                                if (!is_string($paramvalue) || empty($paramvalue)) {
+                                    throw new \Exception($title . '格式错误');
+                                }
+                                break;
+                            case 'numeric':
+                                if (!is_numeric($paramvalue)) {
+                                    throw new \Exception($title . '格式错误');
+                                }
+                                break;
+                            case 'array':
+                                if (!is_array($paramvalue)) {
+                                    throw new \Exception($title . '格式错误');
+                                }
+                                break;
+                        }
+                    }
+                    //正则
+                    if (isset($value['regex'])) {
+                        $regex = $value['regex'];
+                        if (!preg_match($regex, $paramvalue)) {
+                            throw new \Exception($title . '正则格式错误');
+                        }
+                    }
+                }
+                return backarr(1, 'success', $param);
+            } catch (\Exception $e) {
+                $msg = $e->getMessage();
+                Log::error($msg);
+                return backarr(0, "请求错误");
+            }
+        }
+        return backarr(1, 'success', $param);
+    }
+    /**
+     * 设置请求参数验证规则
+     *
+     * @return void
+     */
+    protected function setrules()
+    {
+        return [];
+    }
+}

+ 158 - 0
application/index/logic/paylogic.php

@@ -0,0 +1,158 @@
+<?php
+namespace app\index\logic;
+
+use app\index\model\appointmentmodel;
+use app\index\model\payordermodel;
+use think\Db;
+use think\Log;
+
+/**
+ * 支付
+ *
+ * @author wj
+ * @date 2022-07-22
+ */
+class paylogic extends baselogic
+{
+    /**
+     * 设置请求数据规则
+     * 20220107
+     * wj
+     */
+    protected function setrules()
+    {
+        $list = [
+            'getappointmentorder' => [
+                ['name' => 'aid', 'title' => '申请单id', 'require' => true, 'type' => 'numeric'], //以元为单位
+                ['name' => 'openid', 'title' => 'openid', 'require' => true, 'type' => 'string'],
+                ['name' => 'total_fee', 'title' => '支付费用', 'require' => true, 'type' => 'numeric'], //以元为单位
+            ],
+        ];
+        return $list;
+    }
+    /**
+     * 创建小程序申请订单
+     *
+     * @return void
+     * @author wj
+     * @date 2022-07-22
+     */
+    public function getappointmentorderforxcx($arr)
+    {
+        $result = $this->checkparam(__FUNCTION__, $arr);
+        if (1 != $result['status']) {
+            return $result;
+        }
+        $data = $result['data'];
+        $openid = $data['openid'];
+        $aid = $data['aid'];
+        $totalfee = bcmul($data['total_fee'], 1000, 0);
+
+        $m_a = new appointmentmodel();
+        $where = [
+            'id' => $aid,
+            'openid' => $openid,
+        ];
+        $ainfo = $m_a->getInfo($where);
+        if (empty($ainfo)) {
+            return backarr(0, "无申请数据");
+        }
+        $body = "核酸检测费用";
+        $out_trade_no = createOrderNo();
+        $notify_url = getselfurl('dev') . "index/appointment/pay_call_back";
+        $trade_type = 'JSAPI';
+        $orderinfo = [
+            'openid' => $openid,
+            'total_fee' => $totalfee,
+            'body' => $body,
+            'out_trade_no' => $out_trade_no,
+            'notify_url' => $notify_url,
+            'trade_type' => $trade_type,
+            'wid' => $ainfo['wid'],
+            'appointent_id' => $aid,
+        ];
+        return $orderinfo;
+    }
+    /**
+     * 处理支付回调
+     *
+     * @return void
+     * @author wj
+     * @date 2022-07-23
+     */
+    public function handleorder($arr)
+    {
+        Db::startTrans();
+        try {
+            $orderstatus = 8;
+            $ispay = 0;
+            if (array_key_exists('trade_state', $arr)) {
+                $paystatus = $arr['trade_state'];
+            } else {
+                $paystatus = $arr['result_code'];
+            }
+            if ("SUCCESS" == $paystatus) {
+                $orderstatus = 3;
+                $ispay = 1;
+            }
+            $l_p = new payordermodel();
+            $outorderno = $arr['out_trade_no'];
+            $orderInfo = $l_p->getorderinfobyoutorderno($outorderno);
+            if (empty($orderInfo)) {
+                $msg = "orderNo:[" . $outorderno . "]" . "无对应订单号";
+                throw new \Exception($msg);
+            }
+            if (3 == $orderInfo['orderstatus'] && 1 == $orderInfo['ispay']) {
+                Db::rollback();
+                $msg = "orderNo:[" . $outorderno . "]" . "已缴费";
+                return backarr(1, $msg);
+            }
+            $updateData = [
+                'outorderno' => $orderInfo['outorderno'],
+                'wid' => $orderInfo['wid'],
+                'openid' => $orderInfo['openid'],
+                'orderstatus' => $orderstatus,
+                'ispay' => $ispay,
+                'is_reat_back' => 1,
+            ];
+            if (isset($arr['transaction_id']) && !empty($arr['transaction_id'])) {
+                $updateData['transaction_id'] = $arr['transaction_id'];
+            }
+            $row = $l_p->updateinfobyid($orderInfo['id'], $updateData);
+            if (empty($row)) {
+                $msg = "orderNo:[" . $outorderno . "]修改失败";
+                throw new \Exception($msg);
+            }
+            $ordertype = $orderInfo['order_type'];
+            switch ($ordertype) {
+                case 1:
+                    $appointentid = $orderInfo['appointent_id'];
+                    $m_a = new appointmentmodel();
+                    $ainfo = $m_a->getInfo(['id' => $appointentid, 'is_pay' => 0]);
+                    if (empty($ainfo)) {
+                        $msg = "申请单id:[" . $appointentid . "]不存在";
+                        throw new \Exception($msg);
+                    }
+                    $code = $outorderno . "|" . date("YmdHis");
+                    $aupdateData = [
+                        'is_pay' => 1,
+                        'payorderno' => $outorderno,
+                        'code' => $code,
+                    ];
+                    $row = $ainfo->update(['id' => $appointentid], $aupdateData);
+                    if (empty($row)) {
+                        $msg = "申请单id:[" . $appointentid . "]修改失败";
+                        throw new \Exception($msg);
+                    }
+                    break;
+            }
+            Db::commit();
+            Log::info("commit");
+            return backarr(1, "处理完成", ['id' => $orderInfo['id']]);
+        } catch (\Exception $e) {
+            Db::rollback();
+            log::info("rollback");
+            return backarr(0, $e->getMessage());
+        }
+    }
+}

+ 405 - 0
application/index/logic/wechatlogic.php

@@ -0,0 +1,405 @@
+<?php
+/*
+ * @Author: wang jun
+ * @Date: 2022-01-18 11:12:23
+ * @Last Modified by: wang jun
+ * @Last Modified time: 2022-01-19 10:38:13
+ * 微信类
+ */
+namespace app\index\logic;
+
+use app\index\model\payordermodel;
+use app\index\model\wxusermodel;
+use \think\Log;
+
+class wechatlogic extends baselogic
+{
+    /**
+     * 设置请求数据规则
+     * 20220107
+     * wj
+     */
+    protected function setrules()
+    {
+        $list = [
+            'getOpenid' => [
+                ['name' => 'code', 'title' => 'code', 'require' => true, 'type' => 'string'],
+            ],
+            'create_qrcode' => [
+                ['name' => 'scene', 'title' => 'scene', 'require' => true, 'type' => 'string'],
+                ['name' => 'page', 'title' => 'page', 'require' => true, 'type' => 'string'],
+                ['name' => 'width', 'title' => 'width', 'require' => true, 'type' => 'numeric'],
+                ['name' => 'dir', 'title' => '文件夹', 'require' => false, 'type' => 'string', 'default' => ""],
+            ],
+            'createorder' => [
+                ['name' => 'openid', 'title' => 'openid', 'require' => true, 'type' => 'string'],
+                ['name' => 'total_fee', 'title' => '支付费用', 'require' => true, 'type' => 'numeric'], //以分为单位
+                ['name' => 'body', 'title' => '支付说明', 'require' => true, 'type' => 'string'],
+                ['name' => 'out_trade_no', 'title' => '商户支付单号', 'require' => true, 'type' => 'string'],
+                ['name' => 'notify_url', 'title' => '回调地址', 'require' => true, 'type' => 'string'],
+                ['name' => 'trade_type', 'title' => 'trade_type', 'require' => true, 'type' => 'string'],
+                ['name' => 'wid', 'title' => 'wid', 'require' => true, 'type' => 'numeric'],
+            ],
+        ];
+        return $list;
+    }
+    /**
+     * 获取小程序配置信息
+     *
+     * @return void
+     * @author wj
+     * @date 2022-07-22
+     */
+    public function getselfwxconfig()
+    {
+        $config = [
+            'appid' => 'wx47d6be96fb2d466c',
+            'appSecret' => 'c0252b0cea090a1f3fb41ea7c71d55d6',
+        ];
+        return $config;
+    }
+    /**
+     * 获取商户配置信息
+     *
+     * @return void
+     * @author wj
+     * @date 2022-07-22
+     */
+    public function getpayconfig()
+    {
+        $config = [
+            'mchid' => '1618582831', //零散务工工会
+            'key' => 'e8b1ae8576eef64f09ebb9c9a6964cae', //商户号key
+        ];
+        return $config;
+    }
+    private function curl_get($url, &$httpCode = 0)
+    {
+        $ch = curl_init();
+        curl_setopt($ch, CURLOPT_URL, $url);
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+
+        //不做证书校验,部署在linux环境下请改为true
+        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
+        $file_contents = curl_exec($ch);
+        $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
+        curl_close($ch);
+        return $file_contents;
+    }
+
+    private function getAccessToken()
+    {
+        $config = $this->getselfwxconfig();
+        $appid = $config['appid'];
+        $appSecret = $config['appSecret'];
+        $url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" . $appid . "&secret=" . $appSecret;
+        $result = $this->curl_get($url);
+        $wxResult = json_decode($result, true);
+        return $wxResult;
+    }
+
+    //开启curl post请求
+    private function sendCmd($url, $data)
+    {
+        $curl = curl_init(); // 启动一个CURL会话
+        curl_setopt($curl, CURLOPT_URL, $url); // 要访问的地址
+        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检测
+        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2); // 从证书中检查SSL加密算法是否存在
+        curl_setopt($curl, CURLOPT_HTTPHEADER, array('Expect:')); //解决数据包大不能提交
+        curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); // 使用自动跳转
+        curl_setopt($curl, CURLOPT_AUTOREFERER, 1); // 自动设置Referer
+        curl_setopt($curl, CURLOPT_POST, 1); // 发送一个常规的Post请求
+        curl_setopt($curl, CURLOPT_POSTFIELDS, $data); // Post提交的数据包
+        curl_setopt($curl, CURLOPT_TIMEOUT, 30); // 设置超时限制防止死循
+        curl_setopt($curl, CURLOPT_HEADER, 0); // 显示返回的Header区域内容
+        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // 获取的信息以文件流的形式返回
+
+        $tmpInfo = curl_exec($curl); // 执行操作
+        if (curl_errno($curl)) {
+            echo 'Errno' . curl_error($curl);
+        }
+        curl_close($curl); // 关键CURL会话
+        return $tmpInfo; // 返回数据
+    }
+
+    /**
+     * 获取openid
+     * 20220118
+     * wj
+     * code 必填
+     */
+    public function getOpenid($arr)
+    {
+        $result = $this->checkparam(__FUNCTION__, $arr);
+        if (1 != $result['status']) {
+            return $result;
+        }
+        $data = $result['data'];
+        $code = $data['code'];
+        $config = $this->getselfwxconfig();
+        $appid = $config['appid'];
+        $appSecret = $config['appSecret'];
+        $wxUrl = 'https://api.weixin.qq.com/sns/jscode2session?appid=%s&secret=%s&js_code=%s&grant_type=authorization_code';
+        $getUrl = sprintf($wxUrl, $appid, $appSecret, $code);
+        $result = $this->curl_get($getUrl);
+        $wxResult = json_decode($result, true);
+        Log::info($wxResult);
+        if (empty($wxResult)) {
+            return backarr(0, "无返回数据");
+        }
+        $logfail = array_key_exists('errcode', $wxResult);
+        if ($logfail) {
+            return backarr(0, 'error', $logfail['errmsg']);
+        }
+        $openid = $wxResult['openid'];
+        $data = ['openid' => $openid];
+        if (isset($wxResult['unionid'])) {
+            $unionid = $wxResult['unionid'];
+            $m_wu = new wxusermodel();
+            $result = $m_wu->updateunionidbyopenid($openid, $unionid);
+            if (empty($result['status'])) {
+                return backarr(0, $result['msg']);
+            }
+        }
+        return backarr(1, 'success', $data);
+    }
+
+    //获得二维码
+    public function create_qrcode($arr)
+    {
+        $result = $this->checkparam(__FUNCTION__, $arr);
+        if (1 != $result['status']) {
+            return $result;
+        }
+        $data = $result['data'];
+        $scene = $data['scene'];
+        $width = $data['width'];
+        $page = $data['page'];
+        $dir = $data['dir'];
+
+        $qr_path = "./Uploads/";
+        if (empty($dir)) {
+            $dir = 'default';
+        }
+        $uploaddir = $qr_path . 'qrcode/' . $dir . "/";
+        $getdir = '/Uploads/qrcode/' . $dir . "/";
+        if (!file_exists($uploaddir)) {
+            mkdir($uploaddir, 0700, true); //判断保存目录是否存在,不存在自动生成文件目录
+        }
+        $filename = time() . '.png';
+        $file = $uploaddir . $filename;
+        $getdir .= $filename;
+
+        $access = $this->getAccessToken();
+        $access_token = $access['access_token'];
+        $url = 'https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=' . $access_token;
+        $qrcode = array(
+            'scene' => $scene, //二维码所带参数
+            'width' => $width,
+            'page' => $page, //二维码跳转路径(要已发布小程序)
+            'auto_color' => true,
+        );
+        $result = $this->sendCmd($url, json_encode($qrcode)); //请求微信接口
+        Log::info($result);
+        $errcode = json_decode($result, true)['errcode'];
+        $errmsg = json_decode($result, true)['errmsg'];
+        if ($errcode) {
+            return backarr(0, $errmsg);
+        }
+        $res = file_put_contents($file, $result); //将微信返回的图片数据流写入文件
+        if ($res === false) {
+            return backarr(0, '生成二维码失败');
+        } else {
+            $path = getselfurl('default') . $getdir;
+            return backarr(1, 'success', ['path' => $path]);
+        }
+    }
+    /**
+     * 创建支付订单 统一下单接口
+     *
+     * @param  [type] $arr
+     * @return void
+     * @author wj
+     * @date 2022-07-22
+     */
+    public function createorder($arr)
+    {
+        $result = $this->checkparam(__FUNCTION__, $arr);
+        if (1 != $result['status']) {
+            return $result;
+        }
+        $data = $result['data'];
+        $openid = $data['openid'];
+        $total_fee = $data['total_fee'];
+        $body = $data['body'];
+        $out_trade_no = $data['out_trade_no'];
+        $notify_url = $data['notify_url'];
+        $trade_type = $data['trade_type'];
+        $wid = $data['wid'];
+        $appointentid = $data['appointent_id'];
+
+        $payconfig = $this->getpayconfig();
+        $mchid = $payconfig['mchid'];
+        $key = $payconfig['key'];
+        $nonce_str = getRandomStrings($mchid);
+        $config = $this->getselfwxconfig();
+        $appid = $config['appid'];
+        $data = [
+            'appid' => $appid,
+            'mch_id' => $mchid,
+            'nonce_str' => $nonce_str,
+            'openid' => $openid,
+            'body' => $body,
+            'out_trade_no' => $out_trade_no,
+            'total_fee' => $total_fee,
+            'spbill_create_ip' => '8.8.8.8',
+            'notify_url' => $notify_url,
+            'trade_type' => $trade_type,
+        ];
+        $url = "https://api.mch.weixin.qq.com/pay/unifiedorder";
+
+        ksort($data);
+        $sign_str = $this->ToUrlParams($data);
+        $sign_str = $sign_str . "&key=" . $key;
+        $data['sign'] = strtoupper(md5($sign_str));
+        $xml = $this->arrayToXml($data);
+        log::info($xml);
+        $r = $this->postXmlCurl($xml, $url, true);
+        log::info($r);
+        $result = json_decode($this->xml_to_json($r));
+        log::info($result); //保留这个做记录,以便出错后查询
+        //var_dump($result);
+
+        if ($result->return_code == 'SUCCESS') {
+            $sdata['appId'] = $appid;
+            $sdata['timeStamp'] = time();
+            $sdata['nonceStr'] = md5(time() . rand() . rand() . $openid);
+            $sdata['package'] = "prepay_id=" . $result->prepay_id;
+            $sdata['signType'] = "MD5";
+
+            $payorder['openid'] = $openid;
+            $payorder['prepay_id'] = $result->prepay_id;
+            $payorder['create_date'] = date('Y-m-d H:i:s');
+            $payorder['payfee'] = $data['total_fee'];
+            $payorder['outorderno'] = $data['out_trade_no'];
+            $payorder['order_type'] = 1;
+            $payorder['wid'] = $wid;
+            $payorder['appointent_id'] = $appointentid;
+
+            $l_po = new payordermodel();
+            $poid = $l_po->insertData($payorder);
+            if (empty($poid)) {
+                return backarr(0, '订单创建失败');
+            }
+
+            ksort($sdata);
+            $sign_str = $this->ToUrlParams($sdata);
+            $sign_str = $sign_str . "&key=" . $key;
+            $sdata['paySign'] = strtoupper(md5($sign_str));
+            $sdata['outorderno'] = $data['out_trade_no'];
+            return backarr(1, '订单创建成功', json_encode($sdata));
+        }
+    }
+    /*
+     *   用于微信支付转换认证的信息用的
+     *   by:leoyi
+     *   date:2018-4-8
+     */
+    public function ToUrlParams($data)
+    {
+        $buff = "";
+        foreach ($data as $k => $v) {
+            if ($k != "sign" && $v != "" && !is_array($v)) {
+                $buff .= $k . "=" . $v . "&";
+            }
+        }
+
+        $buff = trim($buff, "&");
+        return $buff;
+    }
+    /*
+     *   微信支付-数组转xml
+     *   by:leoyi
+     *   date:2018-4-8
+     */
+    public function arrayToXml($arr)
+    {
+        $xml = "<xml>";
+        foreach ($arr as $key => $val) {
+            if (is_numeric($val)) {
+                $xml .= "<" . $key . ">" . $val . "</" . $key . ">";
+            } else {
+                $xml .= "<" . $key . "><![CDATA[" . $val . "]]></" . $key . ">";
+            }
+        }
+        $xml .= "</xml>";
+        return $xml;
+    }
+    /*
+     *   微信支付-数组转xml
+     *   by:leoyi
+     *   date:2018-4-8
+     */
+    public function xml_to_json($xmlstring)
+    {
+        return json_encode($this->xml_to_array($xmlstring), JSON_UNESCAPED_UNICODE);
+    }
+    /*
+     * 把xml转换成array
+     * by:leoyi
+     * Date:2018-4-11
+     */
+    public function xml_to_array($xml)
+    {
+        //return ((array) simplexml_load_string($xmlstring));
+        return simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
+
+        //return json_decode(xml_to_json($xmlstring));
+    }
+    /**
+     * 用户post方法请求xml信息用的 支付用
+     * @author write by leoyi 2018-04-8
+     */
+    public function postXmlCurl($xml, $url, $useCert = false, $second = 10)
+    {
+        $ch = curl_init();
+        //设置超时
+        curl_setopt($ch, CURLOPT_TIMEOUT, $second);
+        curl_setopt($ch, CURLOPT_URL, $url);
+        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); //严格校验2
+        //设置header
+        curl_setopt($ch, CURLOPT_HEADER, false);
+        //要求结果为字符串且输出到屏幕上
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+        curl_setopt($ch, CURLOPT_POST, true);
+        curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
+        //运行curl
+        $data = curl_exec($ch);
+        //返回结果
+        if ($data) {
+            curl_close($ch);
+            return $data;
+        } else {
+            $error = curl_errno($ch);
+            curl_close($ch);
+            return $error;
+        }
+    }
+    /**
+     * 微信回调返回信息
+     *
+     * @param  [type] $data
+     * @return void
+     * @author wj
+     * @date 2022-07-23
+     */
+    public function paybackxml($data)
+    {
+        $xmlback = $this->arrayToXml($data);
+        Log::info('返回信息');
+        Log::info($xmlback);
+        exit($xmlback);
+    }
+}

+ 89 - 0
application/index/logic/wxuserlogic.php

@@ -0,0 +1,89 @@
+<?php
+namespace app\index\logic;
+
+use app\index\model\wxusermodel;
+
+/**
+ * 微信用户类
+ *
+ * @author wj
+ * @date 2022-07-22
+ */
+class wxuserlogic extends baselogic
+{
+    /**
+     * 设置请求数据规则
+     * 20220107
+     * wj
+     */
+    protected function setrules()
+    {
+        $list = [
+            /*'getinfobyopenid' => [
+            ['name' => 'openid', 'title' => 'openid', 'require' => true, 'type' => 'string'],
+            ],*/
+            'saveinfo' => [
+                ['name' => 'openid', 'title' => 'openid', 'require' => true, 'type' => 'string'],
+                ['name' => 'sfzid', 'title' => '身份证号', 'require' => true, 'type' => 'string'],
+                ['name' => 'real_name', 'title' => '真实姓名', 'require' => true, 'type' => 'string'],
+
+                ['name' => 'union_id', 'title' => 'union_id', 'require' => false, 'type' => 'string'],
+                ['name' => 'nick_name', 'title' => '昵称', 'require' => false, 'type' => 'string'],
+                ['name' => 'avatar_url', 'title' => '头像', 'require' => false, 'type' => 'string'],
+                ['name' => 'gender', 'title' => '性别', 'require' => false, 'type' => 'string'],
+                ['name' => 'province', 'title' => '省', 'require' => false, 'type' => 'string'],
+                ['name' => 'city', 'title' => '市', 'require' => false, 'type' => 'string'],
+                ['name' => 'country', 'title' => '县', 'require' => false, 'type' => 'string'],
+                ['name' => 'tel', 'title' => '手机号', 'require' => false, 'type' => 'string'],
+                ['name' => 'address', 'title' => '地址', 'require' => false, 'type' => 'string'],
+            ],
+        ];
+        return $list;
+    }
+    /**
+     * 根据openid获取信息
+     *
+     * @param  [type] $arr
+     * @return void
+     * @author wj
+     * @date 2022-07-22
+     */
+    /*public function getinfobyopenid($arr)
+    {
+    $result = $this->checkparam(__FUNCTION__, $arr);
+    if (1 != $result['status']) {
+    return $result;
+    }
+    $data = $result['data'];
+    $openid = $data['openid'];
+    $m_wu = new wxusermodel();
+    $info = $m_wu->getinfobyopenid($openid);
+    if (empty($info)) {
+    return backarr(0, "无用户信息");
+    }
+    return backarr(1, "success", $info);
+    }*/
+    /**
+     * 保存用户信息
+     *
+     * @param  [type] $arr
+     * @return void
+     * @author wj
+     * @date 2022-07-22
+     */
+    public function saveinfo($arr)
+    {
+        $result = $this->checkparam(__FUNCTION__, $arr);
+        if (1 != $result['status']) {
+            return $result;
+        }
+        $data = $result['data'];
+
+        $m_wu = new wxusermodel();
+        $id = $m_wu->insertData($data);
+        if (empty($id)) {
+            return backarr(0, "添加失败");
+        }
+        return backarr(1, "添加成功", ['id' => $id]);
+    }
+}

+ 160 - 0
application/index/model/appointmentmodel.php

@@ -0,0 +1,160 @@
+<?php
+namespace app\index\model;
+
+use think\Model;
+
+/**
+ * 登记记录表
+ *
+ * @author wj
+ * @date 2022-07-22
+ */
+class appointmentmodel extends Model
+{
+    public function insertData($data)
+    {
+        if (!isset($data['oprdate']) || empty($data['oprdate']) || !is_string($data['oprdate'])) {
+            $data['oprdate'] = date("Y-m-d H:i:s");
+        }
+        if (isset($data['id'])) {
+            unset($data['id']);
+        }
+        $data = $this->formatData($data);
+        if (empty($data)) {
+            return false;
+        }
+        $id = $this->insertGetId($data);
+        return $id ? $id : false;
+    }
+
+    /**
+     * 校验入库数据
+     * 20220119
+     */
+    private function formatData($data)
+    {
+        $useData = [];
+        $fields = $this->getTableFields();
+        foreach ($data as $key => $value) {
+            if (in_array($key, $fields)) {
+                $useData[$key] = $value;
+            }
+        }
+        return $useData;
+    }
+    public function getInfo($where, $field = "*", $row = true)
+    {
+        $info = $this->field($field)->where($where);
+        if ($row) {
+            $info = $info->find();
+        } else {
+            $info = $info->select();
+        }
+        return empty($info) ? false : $info;
+    }
+
+    public function updateinfo($where, $updateData)
+    {
+        $row = $this->where($where)->update($updateData);
+        return empty($row) ? false : $row;
+    }
+
+    public function deleteinfo($where)
+    {
+        $row = $this->where($where)->delete();
+        return empty($row) ? false : $row;
+    }
+
+    public function getList($where = [], $field = "*", $page = 1, $size = 10, $order = "id desc", $group = "", $row = false)
+    {
+        $sqlObj = $this->where($where);
+        if ("count" != $field) {
+            $sqlObj = $sqlObj->field($field)->order($order)->group($group)->page($page, $size);
+            if ($row) {
+                $data = $sqlObj->find();
+            } else {
+                $data = $sqlObj->select();
+            }
+        } else {
+            $data = $sqlObj = $sqlObj->count();
+        }
+        return $data;
+    }
+
+    /**
+     * 根据id获取信息
+     * wj
+     * 20220118
+     */
+    public function getinfobyid($id)
+    {
+        $where = ['id' => $id];
+        $info = $this->where($where)->find();
+        return $info;
+    }
+    /**
+     * 根据code获取信息
+     * wj
+     * 20220118
+     */
+    public function getinfobycode($code)
+    {
+        $where = ['code' => $code];
+        $info = $this->where($where)->find();
+        return $info ? $info : false;
+    }
+    /**
+     * 根据id修改数据
+     * wj
+     * 20220118
+     */
+    public function updatebyid($id, $updateData)
+    {
+        $where = ['id' => $id];
+        $updateData = $this->formatData($updateData);
+        if (empty($updateData)) {
+            return false;
+        }
+        $row = $this->where($where)->update($updateData);
+        return $row;
+    }
+
+    /**
+     * 获取最后一条可用数据
+     *
+     * @param  [type] $wid
+     * @return void
+     * @author wj
+     * @date 2022-07-22
+     */
+    public function getlastinfo($where)
+    {
+        $usewhere = ['isuse' => 0, 'ispay' => 1, 'oprdate' => ['>=', date("Y-m-d 00:00:00")]];
+        if (isset($where['wid'])) {
+            $usewhere['wid'] = $where['wid'];
+        }
+        if (isset($where['openid'])) {
+            $usewhere['openid'] = $where['openid'];
+        }
+        if (isset($where['code'])) {
+            $usewhere['code'] = $where['openid'];
+        }
+        if (isset($where['sfzid'])) {
+            $usewhere['sfzid'] = $where['sfzid'];
+        }
+        $info = $this->where($usewhere)->find();
+        return $info ? $info : false;
+    }
+    /**
+     * 获取申请编码
+     *
+     * @return void
+     * @author wj
+     * @date 2022-07-22
+     */
+    public function createcode($str)
+    {
+        $code = substr($str, 0, 4) . date("YmdHis");
+        return $code;
+    }
+}

+ 106 - 0
application/index/model/payordermodel.php

@@ -0,0 +1,106 @@
+<?php
+namespace app\index\model;
+
+use think\Model;
+
+class payordermodel extends Model
+{
+    public function insertData($data)
+    {
+        if (!isset($data['create_date']) || empty($data['create_date']) || !is_string($data['create_date'])) {
+            $data['create_date'] = date("Y-m-d H:i:s");
+        }
+        if (isset($data['id'])) {
+            unset($data['id']);
+        }
+        $data = $this->formatData($data);
+        if (empty($data)) {
+            return false;
+        }
+        $id = $this->insertGetId($data);
+        return $id ? $id : false;
+    }
+
+    /**
+     * 校验入库数据
+     * 20220119
+     */
+    private function formatData($data)
+    {
+        $useData = [];
+        $fields = $this->getTableFields();
+        foreach ($data as $key => $value) {
+            if (in_array($key, $fields)) {
+                $useData[$key] = $value;
+            }
+        }
+        return $useData;
+    }
+    public function getInfo($where, $field = "*", $row = true)
+    {
+        $info = $this->field($field)->where($where);
+        if ($row) {
+            $info = $info->find();
+        } else {
+            $info = $info->select();
+        }
+        return empty($info) ? false : $info;
+    }
+
+    public function updateinfo($where, $updateData)
+    {
+        $row = $this->where($where)->update($updateData);
+        return empty($row) ? false : $row;
+    }
+
+    public function deleteinfo($where)
+    {
+        $row = $this->where($where)->delete();
+        return empty($row) ? false : $row;
+    }
+
+    public function getList($where = [], $field = "*", $page = 1, $size = 10, $order = "id desc", $group = "", $row = false)
+    {
+        $sqlObj = $this->where($where);
+        if ("count" != $field) {
+            $sqlObj = $sqlObj->field($field)->order($order)->group($group)->page($page, $size);
+            if ($row) {
+                $data = $sqlObj->find();
+            } else {
+                $data = $sqlObj->select();
+            }
+        } else {
+            $data = $sqlObj = $sqlObj->count();
+        }
+        return $data;
+    }
+    /**
+     * 根据商户订单号获取订单信息
+     *
+     * @param  [type] $outorderno
+     * @return void
+     * @author wj
+     * @date 2022-07-23
+     */
+    public function getorderinfobyoutorderno($outorderno)
+    {
+        $where = ['outorderno' => $outorderno];
+        $info = $this->where($where)->find();
+        return $info ? $info : false;
+    }
+    /**
+     * 根据id改数据
+     *
+     * @param  [type] $id
+     * @param  [type] $updateData
+     * @return void
+     * @author wj
+     * @date 2022-07-23
+     */
+    public function updateinfobyid($id, $updateData)
+    {
+        $where = ['id' => $id];
+        $row = $this->where($where)->upate($updateData);
+        return $row ? $row : false;
+    }
+}

+ 146 - 0
application/index/model/wxusermodel.php

@@ -0,0 +1,146 @@
+<?php
+namespace app\index\model;
+
+use think\Model;
+
+class wxusermodel extends Model
+{
+    public function insertData($data)
+    {
+        if (!isset($data['create_date']) || empty($data['create_date']) || !is_string($data['create_date'])) {
+            $data['create_date'] = date("Y-m-d H:i:s");
+        }
+        if (isset($data['id'])) {
+            unset($data['id']);
+        }
+        $data = $this->formatData($data);
+        if (empty($data)) {
+            return false;
+        }
+        $id = $this->insertGetId($data);
+        return $id ? $id : false;
+    }
+
+    /**
+     * 校验入库数据
+     * 20220119
+     */
+    private function formatData($data)
+    {
+        $useData = [];
+        $fields = $this->getTableFields();
+        foreach ($data as $key => $value) {
+            if (in_array($key, $fields)) {
+                $useData[$key] = $value;
+            }
+        }
+        return $useData;
+    }
+    public function getInfo($where, $field = "*", $row = true)
+    {
+        $info = $this->field($field)->where($where);
+        if ($row) {
+            $info = $info->find();
+        } else {
+            $info = $info->select();
+        }
+        return empty($info) ? false : $info;
+    }
+
+    public function updateinfo($where, $updateData)
+    {
+        $row = $this->where($where)->update($updateData);
+        return empty($row) ? false : $row;
+    }
+
+    public function deleteinfo($where)
+    {
+        $row = $this->where($where)->delete();
+        return empty($row) ? false : $row;
+    }
+
+    public function getList($where = [], $field = "*", $page = 1, $size = 10, $order = "id desc", $group = "", $row = false)
+    {
+        $sqlObj = $this->where($where);
+        if ("count" != $field) {
+            $sqlObj = $sqlObj->field($field)->order($order)->group($group)->page($page, $size);
+            if ($row) {
+                $data = $sqlObj->find();
+            } else {
+                $data = $sqlObj->select();
+            }
+        } else {
+            $data = $sqlObj = $sqlObj->count();
+        }
+        return $data;
+    }
+
+    /**
+     * 根据id获取信息
+     * wj
+     * 20220118
+     */
+    public function getinfobyid($id, $field = false)
+    {
+        $defaultfield = ['id', 'open_id', 'union_id', 'nick_name', 'avatar_url', 'gender', 'province', 'city', 'country', 'tel', 'address', 'create_date', 'real_name'];
+        $field = $field ? $field : $defaultfield;
+        $where = ['id' => $id];
+        $info = $this->where($where)->$field()->find();
+        return $info;
+    }
+    /**
+     * 根据id修改数据
+     * wj
+     * 20220118
+     */
+    public function updatebyid($id, $updateData)
+    {
+        $where = ['id' => $id];
+        $updateData = $this->formatData($updateData);
+        if (empty($updateData)) {
+            return false;
+        }
+        $row = $this->where($where)->update($updateData);
+        return $row;
+    }
+    /**
+     * 根据openid修改unionid
+     *
+     * @param  [type] $openid
+     * @return void
+     * @author wj
+     * @date 2022-07-22
+     */
+    public function updateunionidbyopenid($openid, $unionid)
+    {
+        $where = ['openid' => $openid];
+        $info = $this->where($where)->find();
+        if (!empty($info)) {
+            $id = $info['id'];
+            if ($info['unionid'] != $unionid) {
+                $updateData = ['unionid' => $unionid];
+                $row = $this->where(['id' => $id])->update($updateData);
+                if (empty($row)) {
+                    return backarr(0, '用户unionid修改失败');
+                }
+            }
+        }
+        return backarr(1, '操作成功');
+    }
+    /**
+     * 根据openid获取数据
+     *
+     * @param  [type] $openid
+     * @return void
+     * @author wj
+     * @date 2022-07-22
+     */
+    public function getinfobyopenid($openid, $field = false)
+    {
+        $defaultfield = ['id', 'open_id', 'union_id', 'nick_name', 'avatar_url', 'gender', 'province', 'city', 'country', 'tel', 'address', 'create_date', 'real_name'];
+        $field = $field ? $field : $defaultfield;
+        $where = ['openid' => $openid];
+        $info = $this->where($where)->field($field)->find();
+        return $info ? $info : false;
+    }
+}

+ 14 - 0
application/provider.php

@@ -0,0 +1,14 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+// 应用容器绑定定义
+return [
+];

+ 28 - 0
application/tags.php

@@ -0,0 +1,28 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+// 应用行为扩展定义文件
+return [
+    // 应用初始化
+    'app_init'     => [],
+    // 应用开始
+    'app_begin'    => [],
+    // 模块初始化
+    'module_init'  => [],
+    // 操作开始执行
+    'action_begin' => [],
+    // 视图内容过滤
+    'view_filter'  => [],
+    // 日志写入
+    'log_write'    => [],
+    // 应用结束
+    'app_end'      => [],
+];

+ 26 - 0
build.php

@@ -0,0 +1,26 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+return [
+    // 生成应用公共文件
+    '__file__' => ['common.php'],
+
+    // 定义demo模块的自动生成 (按照实际定义的文件名生成)
+    'demo'     => [
+        '__file__'   => ['common.php'],
+        '__dir__'    => ['behavior', 'controller', 'model', 'view'],
+        'controller' => ['Index', 'Test', 'UserType'],
+        'model'      => ['User', 'UserType'],
+        'view'       => ['index/index'],
+    ],
+
+    // 其他更多的模块定义
+];

+ 33 - 0
composer.json

@@ -0,0 +1,33 @@
+{
+    "name": "topthink/think",
+    "description": "the new thinkphp framework",
+    "type": "project",
+    "keywords": [
+        "framework",
+        "thinkphp",
+        "ORM"
+    ],
+    "homepage": "http://thinkphp.cn/",
+    "license": "Apache-2.0",
+    "authors": [
+        {
+            "name": "liu21st",
+            "email": "liu21st@gmail.com"
+        }
+    ],
+    "require": {
+        "php": ">=5.6.0",
+        "topthink/framework": "5.1.*"
+    },
+    "autoload": {
+        "psr-4": {
+            "app\\": "application"
+        }
+    },
+    "extra": {
+        "think-path": "thinkphp"
+    },
+    "config": {
+        "preferred-install": "dist"
+    }
+}

+ 133 - 0
composer.lock

@@ -0,0 +1,133 @@
+{
+    "_readme": [
+        "This file locks the dependencies of your project to a known state",
+        "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
+        "This file is @generated automatically"
+    ],
+    "content-hash": "296bd8a1d28e39d56dcd80ce7be249f3",
+    "packages": [
+        {
+            "name": "topthink/framework",
+            "version": "v5.1.41",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/top-think/framework.git",
+                "reference": "7137741a323a4a60cfca334507cd1812fac91bb2"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/top-think/framework/zipball/7137741a323a4a60cfca334507cd1812fac91bb2",
+                "reference": "7137741a323a4a60cfca334507cd1812fac91bb2",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "php": ">=5.6.0",
+                "topthink/think-installer": "2.*"
+            },
+            "require-dev": {
+                "johnkary/phpunit-speedtrap": "^1.0",
+                "mikey179/vfsstream": "~1.6",
+                "phpdocumentor/reflection-docblock": "^2.0",
+                "phploc/phploc": "2.*",
+                "phpunit/phpunit": "^5.0|^6.0",
+                "sebastian/phpcpd": "2.*",
+                "squizlabs/php_codesniffer": "2.*"
+            },
+            "type": "think-framework",
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "Apache-2.0"
+            ],
+            "authors": [
+                {
+                    "name": "liu21st",
+                    "email": "liu21st@gmail.com"
+                },
+                {
+                    "name": "yunwuxin",
+                    "email": "448901948@qq.com"
+                }
+            ],
+            "description": "the new thinkphp framework",
+            "homepage": "http://thinkphp.cn/",
+            "keywords": [
+                "framework",
+                "orm",
+                "thinkphp"
+            ],
+            "support": {
+                "issues": "https://github.com/top-think/framework/issues",
+                "source": "https://github.com/top-think/framework/tree/v5.1.41"
+            },
+            "time": "2021-01-11T02:51:29+00:00"
+        },
+        {
+            "name": "topthink/think-installer",
+            "version": "v2.0.5",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/top-think/think-installer.git",
+                "reference": "38ba647706e35d6704b5d370c06f8a160b635f88"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/top-think/think-installer/zipball/38ba647706e35d6704b5d370c06f8a160b635f88",
+                "reference": "38ba647706e35d6704b5d370c06f8a160b635f88",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "composer-plugin-api": "^1.0||^2.0"
+            },
+            "require-dev": {
+                "composer/composer": "^1.0||^2.0"
+            },
+            "type": "composer-plugin",
+            "extra": {
+                "class": "think\\composer\\Plugin"
+            },
+            "autoload": {
+                "psr-4": {
+                    "think\\composer\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "Apache-2.0"
+            ],
+            "authors": [
+                {
+                    "name": "yunwuxin",
+                    "email": "448901948@qq.com"
+                }
+            ],
+            "support": {
+                "issues": "https://github.com/top-think/think-installer/issues",
+                "source": "https://github.com/top-think/think-installer/tree/v2.0.5"
+            },
+            "time": "2021-01-14T12:12:14+00:00"
+        }
+    ],
+    "packages-dev": [],
+    "aliases": [],
+    "minimum-stability": "stable",
+    "stability-flags": [],
+    "prefer-stable": false,
+    "prefer-lowest": false,
+    "platform": {
+        "php": ">=5.6.0"
+    },
+    "platform-dev": [],
+    "plugin-api-version": "2.1.0"
+}

+ 155 - 0
config/app.php

@@ -0,0 +1,155 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+// +----------------------------------------------------------------------
+// | 应用设置
+// +----------------------------------------------------------------------
+
+return [
+    // 应用名称
+    'app_name' => '',
+    // 应用地址
+    'app_host' => '',
+    // 应用调试模式
+    'app_debug' => true,
+    // 应用Trace
+    'app_trace' => false,
+    // 是否支持多模块
+    'app_multi_module' => true,
+    // 入口自动绑定模块
+    'auto_bind_module' => false,
+    // 注册的根命名空间
+    'root_namespace' => [],
+    // 默认输出类型
+    'default_return_type' => 'html',
+    // 默认AJAX 数据返回格式,可选json xml ...
+    'default_ajax_return' => 'json',
+    // 默认JSONP格式返回的处理方法
+    'default_jsonp_handler' => 'jsonpReturn',
+    // 默认JSONP处理方法
+    'var_jsonp_handler' => 'callback',
+    // 默认时区
+    'default_timezone' => 'Asia/Shanghai',
+    // 是否开启多语言
+    'lang_switch_on' => false,
+    // 默认全局过滤方法 用逗号分隔多个
+    'default_filter' => '',
+    // 默认语言
+    'default_lang' => 'zh-cn',
+    // 应用类库后缀
+    'class_suffix' => false,
+    // 控制器类后缀
+    'controller_suffix' => false,
+
+    // +----------------------------------------------------------------------
+    // | 模块设置
+    // +----------------------------------------------------------------------
+
+    // 默认模块名
+    'default_module' => 'index',
+    // 禁止访问模块
+    'deny_module_list' => ['common'],
+    // 默认控制器名
+    'default_controller' => 'Index',
+    // 默认操作名
+    'default_action' => 'index',
+    // 默认验证器
+    'default_validate' => '',
+    // 默认的空模块名
+    'empty_module' => '',
+    // 默认的空控制器名
+    'empty_controller' => 'Error',
+    // 操作方法前缀
+    'use_action_prefix' => false,
+    // 操作方法后缀
+    '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' => '/',
+    // HTTPS代理标识
+    'https_agent_name' => '',
+    // IP代理获取标识
+    'http_agent_ip' => 'X-REAL-IP',
+    // URL伪静态后缀
+    'url_html_suffix' => 'html',
+    // URL普通方式参数 用于自动生成
+    'url_common_param' => false,
+    // URL参数方式 0 按名称成对解析 1 按顺序解析
+    'url_param_type' => 0,
+    // 是否开启路由延迟解析
+    'url_lazy_route' => false,
+    // 是否强制使用路由
+    'url_route_must' => false,
+    // 合并路由规则
+    'route_rule_merge' => false,
+    // 路由是否完全匹配
+    'route_complete_match' => false,
+    // 使用注解路由
+    'route_annotation' => 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' => [],
+    // 是否开启路由缓存
+    'route_check_cache' => false,
+    // 路由缓存的Key自定义设置(闭包),默认为当前URL和请求类型的md5
+    'route_check_cache_key' => '',
+    // 路由缓存类型及参数
+    'route_cache_option' => [],
+
+    // 默认跳转页面对应的模板文件
+    'dispatch_success_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl',
+    'dispatch_error_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl',
+
+    // 异常页面的模板文件
+    'exception_tmpl' => Env::get('think_path') . 'tpl/think_exception.tpl',
+
+    // 错误显示信息,非调试模式有效
+    'error_message' => '页面错误!请稍后再试~',
+    // 显示错误信息
+    'show_error_msg' => false,
+    // 异常处理handle类 留空使用 \think\exception\Handle
+    'exception_handle' => '',
+    'env' => 'dev', //'pro'
+    'selfurl' => [
+        'dev' => [
+            'default' => 'https://app.tjzhxx.cn:41443',
+        ],
+        'pro' => [
+            'default' => 'https://app.tjzhxx.cn:40443',
+        ],
+    ],
+
+];

+ 25 - 0
config/cache.php

@@ -0,0 +1,25 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+// +----------------------------------------------------------------------
+// | 缓存设置
+// +----------------------------------------------------------------------
+
+return [
+    // 驱动方式
+    'type'   => 'File',
+    // 缓存保存目录
+    'path'   => '',
+    // 缓存前缀
+    'prefix' => '',
+    // 缓存有效期 0表示永久缓存
+    'expire' => 0,
+];

+ 20 - 0
config/console.php

@@ -0,0 +1,20 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+// +----------------------------------------------------------------------
+// | 控制台配置
+// +----------------------------------------------------------------------
+return [
+    'name'      => 'Think Console',
+    'version'   => '0.1',
+    'user'      => null,
+    'auto_path' => env('app_path') . 'command' . DIRECTORY_SEPARATOR,
+];

+ 30 - 0
config/cookie.php

@@ -0,0 +1,30 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+// +----------------------------------------------------------------------
+// | Cookie设置
+// +----------------------------------------------------------------------
+return [
+    // cookie 名称前缀
+    'prefix'    => '',
+    // cookie 保存时间
+    'expire'    => 0,
+    // cookie 保存路径
+    'path'      => '/',
+    // cookie 有效域名
+    'domain'    => '',
+    //  cookie 启用安全传输
+    'secure'    => false,
+    // httponly设置
+    'httponly'  => '',
+    // 是否使用 setcookie
+    'setcookie' => true,
+];

+ 64 - 0
config/database.php

@@ -0,0 +1,64 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+return [
+    // 数据库类型
+    'type' => 'mysql',
+    // 服务器地址
+    'hostname' => '42.193.106.113',
+    // 'hostname' => '127.0.0.1',
+    // 数据库名
+    'database' => 'acidhospital',
+    // 用户名
+    'username' => 'root',
+    // 密码
+    'password' => 'zhonghui0123',
+    // 端口
+    'hostport' => '3306',
+    // 连接dsn
+    'dsn' => '',
+    // 数据库连接参数
+    'params' => [],
+    // 数据库编码默认采用utf8
+    'charset' => 'utf8mb4',
+    // 数据库表前缀
+    'prefix' => '',
+    // 数据库调试模式
+    'debug' => true,
+    // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
+    'deploy' => 0,
+    // 数据库读写是否分离 主从式有效
+    'rw_separate' => false,
+    // 读写分离后 主服务器数量
+    'master_num' => 1,
+    // 指定从服务器序号
+    'slave_no' => '',
+    // 自动读取主库数据
+    'read_master' => false,
+    // 是否严格检查字段是否存在
+    'fields_strict' => true,
+    // 数据集返回类型
+    'resultset_type' => 'array',
+    // 自动写入时间戳字段
+    'auto_timestamp' => false,
+    // 时间字段取出后的默认时间格式
+    'datetime_format' => 'Y-m-d H:i:s',
+    // 是否需要进行SQL性能分析
+    'sql_explain' => false,
+    // Builder类
+    'builder' => '',
+    // Query类
+    'query' => '\\think\\db\\Query',
+    // 是否需要断线重连
+    'break_reconnect' => false,
+    // 断线标识字符串
+    'break_match_str' => [],
+];

+ 30 - 0
config/log.php

@@ -0,0 +1,30 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+// +----------------------------------------------------------------------
+// | 日志设置
+// +----------------------------------------------------------------------
+return [
+    // 日志记录方式,内置 file socket 支持扩展
+    'type'        => 'File',
+    // 日志保存目录
+    'path'        => '',
+    // 日志记录级别
+    'level'       => [],
+    // 单文件日志写入
+    'single'      => false,
+    // 独立日志级别
+    'apart_level' => [],
+    // 最大日志文件数量
+    'max_files'   => 0,
+    // 是否关闭日志写入
+    'close'       => false,
+];

+ 18 - 0
config/middleware.php

@@ -0,0 +1,18 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+// +----------------------------------------------------------------------
+// | 中间件配置
+// +----------------------------------------------------------------------
+return [
+    // 默认中间件命名空间
+    'default_namespace' => 'app\\http\\middleware\\',
+];

+ 26 - 0
config/session.php

@@ -0,0 +1,26 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+// +----------------------------------------------------------------------
+// | 会话设置
+// +----------------------------------------------------------------------
+
+return [
+    'id'             => '',
+    // SESSION_ID的提交变量,解决flash上传跨域
+    'var_session_id' => '',
+    // SESSION 前缀
+    'prefix'         => 'think',
+    // 驱动方式 支持redis memcache memcached
+    'type'           => '',
+    // 是否自动开启 SESSION
+    'auto_start'     => true,
+];

+ 35 - 0
config/template.php

@@ -0,0 +1,35 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+// +----------------------------------------------------------------------
+// | 模板设置
+// +----------------------------------------------------------------------
+
+return [
+    // 模板引擎类型 支持 php think 支持扩展
+    'type'         => 'Think',
+    // 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法
+    'auto_rule'    => 1,
+    // 模板路径
+    'view_path'    => '',
+    // 模板后缀
+    'view_suffix'  => 'html',
+    // 模板文件名分隔符
+    'view_depr'    => DIRECTORY_SEPARATOR,
+    // 模板引擎普通标签开始标记
+    'tpl_begin'    => '{',
+    // 模板引擎普通标签结束标记
+    'tpl_end'      => '}',
+    // 标签库标签开始标记
+    'taglib_begin' => '{',
+    // 标签库标签结束标记
+    'taglib_end'   => '}',
+];

+ 18 - 0
config/trace.php

@@ -0,0 +1,18 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+// +----------------------------------------------------------------------
+// | Trace设置 开启 app_trace 后 有效
+// +----------------------------------------------------------------------
+return [
+    // 内置Html Console 支持扩展
+    'type' => 'Html',
+];

+ 2 - 0
extend/.gitignore

@@ -0,0 +1,2 @@
+*
+!.gitignore

+ 0 - 0
public/.htaccess


BIN
public/Uploads/party/20220210/00a35edf2a5c1f3ec625371b8ef84d89.jpg


BIN
public/Uploads/party/20220210/0c7251081dfbf06677c2b049d38f6815.jpg


BIN
public/Uploads/party/20220210/0dc90c7b635b33f429344b1c53df0232.jpg


BIN
public/Uploads/party/20220210/0fb7a0ad570acaad5b21764c340e14b2.jpg


BIN
public/Uploads/party/20220210/157a38fea0e7296c745b37b4d2d51d69.jpg


BIN
public/Uploads/party/20220210/2327eb715b832fd520762985333aca8f.jpg


BIN
public/Uploads/party/20220210/35103e6b819522a641c9ce4863c9ad06.jpg


BIN
public/Uploads/party/20220210/49403f0db3ae52e068729011f5076933.jpg


BIN
public/Uploads/party/20220210/4b09d37c20805f341e6e94c56e005178.jpg


BIN
public/Uploads/party/20220210/58645eda140265c74fca38b2deb8c16e.jpg


BIN
public/Uploads/party/20220210/58f5671660f86dc788782fb67b2cc14c.jpg


BIN
public/Uploads/party/20220210/630c7d2b3faa6ca842eee79c09b1c871.jpg


BIN
public/Uploads/party/20220210/721c0927e3452c6b050d9c047f0cd361.jpg


BIN
public/Uploads/party/20220210/74b32a08781534496e877c791b95e01b.jpg


BIN
public/Uploads/party/20220210/7fa777cde3fd729c119ae2446975e570.jpg


BIN
public/Uploads/party/20220210/82275c0a11510b509b1360651be40a1f.jpg


BIN
public/Uploads/party/20220210/af903a3c565c6fc4e4b8b536f07c485b.jpg


BIN
public/Uploads/party/20220210/b81c92afe2f71a02ea6000b8914c6d1a.jpg


BIN
public/Uploads/party/20220210/c4a1fcaae4cbf7e47d0dad6717aadce0.jpg


BIN
public/Uploads/party/20220210/c7cb8c8e88daed1f4b5f3ab2a9e20286.jpg


BIN
public/Uploads/party/20220210/cc764a9849b3d86e36598f5730cad4b3.jpg


BIN
public/Uploads/party/20220210/cf37fe1c97aa6fca64efedf5a77ab6db.jpg


BIN
public/Uploads/party/20220210/d18a0fc71b84f1fb2ad98a0413ce891c.jpg


BIN
public/Uploads/party/20220210/d65e4594a6ada988d198aa13fa544c1f.jpg


BIN
public/Uploads/party/20220210/ddf823a1a76c143585ce4991a5eb848b.jpg


BIN
public/Uploads/party/20220210/f5861cc1668d6177f3c2bd5371f278d8.jpg


+ 1 - 0
public/Uploads/user/1642486568.png

@@ -0,0 +1 @@
+{"errcode":41030,"errmsg":"invalid page rid: 61e65b27-79c97ec1-1099d199"}

BIN
public/favicon.ico


+ 24 - 0
public/index.php

@@ -0,0 +1,24 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006-2018 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+// [ 应用入口文件 ]
+namespace think;
+
+define('DS', DIRECTORY_SEPARATOR);
+defined('APP_PATH') or define('APP_PATH', dirname($_SERVER['SCRIPT_FILENAME']) . DS);
+defined('ROOT_PATH') or define('ROOT_PATH', dirname(realpath(APP_PATH)) . DS);
+// 加载基础文件
+require __DIR__ . '/../thinkphp/base.php';
+
+// 支持事先使用静态方法设置Request对象和Config对象
+
+// 执行应用并响应
+Container::get('app')->run()->send();

+ 0 - 0
public/nginx.htaccess


+ 2 - 0
public/robots.txt

@@ -0,0 +1,2 @@
+User-agent: *
+Disallow:

+ 17 - 0
public/router.php

@@ -0,0 +1,17 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+// $Id$
+
+if (is_file($_SERVER["DOCUMENT_ROOT"] . $_SERVER["SCRIPT_NAME"])) {
+    return false;
+} else {
+    require __DIR__ . "/index.php";
+}

+ 2 - 0
public/static/.gitignore

@@ -0,0 +1,2 @@
+*
+!.gitignore

+ 20 - 0
route/route.php

@@ -0,0 +1,20 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+Route::get('think', function () {
+    return 'hello,ThinkPHP5!';
+});
+
+Route::get('hello/:name', 'index/hello');
+
+return [
+
+];

+ 2 - 0
runtime/.gitignore

@@ -0,0 +1,2 @@
+*
+!.gitignore

+ 22 - 0
think

@@ -0,0 +1,22 @@
+#!/usr/bin/env php
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006-2018 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: yunwuxin <448901948@qq.com>
+// +----------------------------------------------------------------------
+
+namespace think;
+
+// 加载基础文件
+require __DIR__ . '/thinkphp/base.php';
+
+// 应用初始化
+Container::get('app')->path(__DIR__ . '/application/')->initialize();
+
+// 控制台初始化
+Console::init();