AdminIndexController.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2013-2014 http://www.thinkcmf.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Author: Dean <zxxjjforever@163.com>
  8. // +----------------------------------------------------------------------
  9. namespace plugins\wxapp\controller; //Demo插件英文名,改成你的插件英文就行了
  10. use cmf\controller\PluginAdminBaseController;
  11. class AdminIndexController extends PluginAdminBaseController
  12. {
  13. public function _initialize()
  14. {
  15. $adminId = cmf_get_current_admin_id();//获取后台管理员id,可判断是否登录
  16. if (!empty($adminId)) {
  17. $this->assign("admin_id", $adminId);
  18. } else {
  19. $this->error('未登录');
  20. }
  21. }
  22. /**
  23. * 小程序管理
  24. * @adminMenu(
  25. * 'name' => '小程序管理',
  26. * 'parent' => 'admin/Plugin/default',
  27. * 'display'=> true,
  28. * 'hasView'=> true,
  29. * 'order' => 10000,
  30. * 'icon' => '',
  31. * 'remark' => '小程序管理',
  32. * 'param' => ''
  33. * )
  34. */
  35. public function index()
  36. {
  37. $wxappSettings = cmf_get_option('wxapp_settings');
  38. $wxapps = empty($wxappSettings['wxapps']) ? [] : $wxappSettings['wxapps'];
  39. $defaultWxapp = empty($wxappSettings['default']) ? [] : $wxappSettings['default'];
  40. $this->assign('wxapps', $wxapps);
  41. $this->assign('default_wxapp', $defaultWxapp);
  42. return $this->fetch('/admin_index');
  43. }
  44. }