CheckAdmin.php 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. namespace WY\app\controller\derpay;
  3. use WY\app\libs\Controller;
  4. use WY\app\Config;
  5. if (!defined('WY_ROOT')) {
  6. exit;
  7. }
  8. class CheckAdmin extends Controller
  9. {
  10. public $dir = '/derpay/';
  11. public $action;
  12. function __construct()
  13. {
  14. $houtaipath = Config::db()['path'];
  15. $dir = $houtaipath;
  16. $this->dir ="/".$dir."/";
  17. parent::__construct();
  18. $this->tpl = 'view/admin/';
  19. if (!isset($this->action[1]) || isset($this->action[1]) && $this->action[1] != 'login' && $this->action[1] != 'sigin') {
  20. if (!$this->session->get('login_adminname')) {
  21. $this->res->redirect($this->dir . 'login');
  22. }
  23. }
  24. $this->setConfig = new Config();
  25. $this->nav = $this->model()->select()->from('navcog')->fetchRow();
  26. $this->nav = $this->nav ? json_decode($this->nav['content']) : array();
  27. if ($this->session->get('login_adminname')) {
  28. $limits = $this->model()->select('limits')->from('admin')->where(array('fields' => 'adminname=?', 'values' => array($this->session->get('login_adminname'))))->fetchRow();
  29. if (!$limits) {
  30. $this->res->redirect($this->dir . 'logout');
  31. exit;
  32. }
  33. $limits = json_decode($limits['limits'], true);
  34. $limits += array('login' => '安全退出');
  35. if (isset($this->action[1]) && !array_key_exists($this->action[1], $limits)) {
  36. $this->put('woodyapp.php', array('title' => '无权限操作', 'msg' => '当前您没有此权限'));
  37. exit;
  38. }
  39. }
  40. }
  41. public function menu()
  42. {
  43. return array('用户管理' => array('users' => '用户列表', 'usercfo' => '代收款登记', 'userlogs' => '登录日志', 'usership' => '用户结算', 'userpay' => '付款记录'), '订单管理' => array('orders' => '订单列表', 'ordersua' => '商户统计', 'ordersca' => '通道统计', 'ordersha' => '代理统计'), '代理管理' => array('agent' => '代理列表', 'agentlogs' => '登录日志', 'agentship' => '代理结算', 'agentpay' => '付款记录'), '通道管理' => array('acp' => '接入信息', 'acl' => '接入网关', 'acc' => '通道列表', 'acw' => '通用网关', 'acb' => '网银列表'), '文章管理' => array('arcate' => '文章分类', 'arlist' => '文章列表'), '系统管理' => array('admins' => '管理员列表', 'pwd' => '修改密码', 'logs' => '登录日志', 'set' => '系统设置', 'cog' => '导航设置', 'mailtpl' => '邮件模板', 'ordernotify' => '通知记录', 'bd' => '补发订单'));
  44. }
  45. public function getSubMenu($menu, $cur = '')
  46. {
  47. $list = '';
  48. if (array_key_exists($menu, $this->menu())) {
  49. foreach ($this->menu()[$menu] as $key => $val) {
  50. $current = isset($cur) && $cur == $key ? ' class="current"' : '';
  51. $list .= '<dd' . $current . '><a href="' . $this->dir . $key . '">' . $val . '</a></dd>';
  52. }
  53. }
  54. return $list;
  55. }
  56. }
  57. ?>