暫無描述
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

VertifyManageBehavior.php 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. namespace weapp\Systemdoctor\behavior\home;
  3. use think\Config;
  4. use app\common\model\Weapp;
  5. /**
  6. * 行为扩展
  7. */
  8. class VertifyManageBehavior
  9. {
  10. protected static $actionName;
  11. protected static $controllerName;
  12. protected static $moduleName;
  13. protected static $method;
  14. /**
  15. * 构造方法
  16. * @param Request $request Request对象
  17. * @access public
  18. */
  19. public function __construct()
  20. {
  21. !isset(self::$moduleName) && self::$moduleName = request()->module();
  22. !isset(self::$controllerName) && self::$controllerName = request()->controller();
  23. !isset(self::$actionName) && self::$actionName = request()->action();
  24. !isset(self::$method) && self::$method = strtoupper(request()->method());
  25. }
  26. /**
  27. * 模块初始化
  28. * @param array $params 传入参数
  29. * @access public
  30. */
  31. public function moduleInit(&$params)
  32. {
  33. // 获取插件信息
  34. $weapp = Weapp::get(array('code' => 'Systemdoctor'));
  35. // 判断插件是否启用
  36. if (intval($weapp->status) !== 1) {
  37. return true;
  38. }
  39. // 获取插件配置信息
  40. $row = json_decode($weapp->data, true);
  41. $baseConfig = Config::get("captcha");
  42. if (!empty($row)) {
  43. foreach ($row['captcha'] as $key => $val) {
  44. if ('default' == $key) {
  45. $baseConfig[$key] = array_merge($baseConfig[$key], $val);
  46. } else {
  47. $baseConfig[$key]['is_on'] = $val['is_on'];
  48. $baseConfig[$key]['config'] = array_merge($baseConfig['default'], $val['config']);
  49. }
  50. }
  51. }
  52. Config::set('captcha', $baseConfig);
  53. }
  54. /**
  55. * 操作开始执行
  56. * @param array $params 传入参数
  57. * @access public
  58. */
  59. public function actionBegin(&$params)
  60. {
  61. }
  62. /**
  63. * 视图内容过滤
  64. * @param array $params 传入参数
  65. * @access public
  66. */
  67. public function viewFilter(&$params)
  68. {
  69. }
  70. /**
  71. * 应用结束
  72. * @param array $params 传入参数
  73. * @access public
  74. */
  75. public function appEnd(&$params)
  76. {
  77. }
  78. }