demo.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkAdmin
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2014~2021 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: https://thinkadmin.top
  8. // +----------------------------------------------------------------------
  9. // | 开源协议 ( https://mit-license.org )
  10. // +----------------------------------------------------------------------
  11. // | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
  12. // | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
  13. // +----------------------------------------------------------------------
  14. use think\admin\service\SystemService;
  15. invoke(function (\think\App $app) {
  16. /*! 非开发环境,清理限制文件 */
  17. if (!SystemService::instance()->checkRunMode('dev')) {
  18. @unlink("{$app->getBasePath()}admin/controller/api/Update.php");
  19. @unlink("{$app->getBasePath()}admin/route/demo.php");
  20. @rmdir("{$app->getBasePath()}admin/route");
  21. return;
  22. }
  23. /*! 演示环境禁止操作路由绑定 */
  24. if (SystemService::instance()->checkRunMode('demo')) {
  25. $app->route->post('index/pass', function () {
  26. return json(['code' => 0, 'info' => '演示环境禁止修改用户密码!']);
  27. });
  28. $app->route->post('config/system', function () {
  29. return json(['code' => 0, 'info' => '演示环境禁止修改系统配置!']);
  30. });
  31. $app->route->post('config/storage', function () {
  32. return json(['code' => 0, 'info' => '演示环境禁止修改系统配置!']);
  33. });
  34. $app->route->post('menu/index', function () {
  35. return json(['code' => 0, 'info' => '演示环境禁止给菜单排序!']);
  36. });
  37. $app->route->post('menu/add', function () {
  38. return json(['code' => 0, 'info' => '演示环境禁止添加菜单!']);
  39. });
  40. $app->route->post('menu/edit', function () {
  41. return json(['code' => 0, 'info' => '演示环境禁止编辑菜单!']);
  42. });
  43. $app->route->post('menu/state', function () {
  44. return json(['code' => 0, 'info' => '演示环境禁止禁用菜单!']);
  45. });
  46. $app->route->post('menu/remove', function () {
  47. return json(['code' => 0, 'info' => '演示环境禁止删除菜单!']);
  48. });
  49. $app->route->post('user/pass', function () {
  50. return json(['code' => 0, 'info' => '演示环境禁止修改用户密码!']);
  51. });
  52. }
  53. });