Userphone.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php defined('BASEPATH') OR exit('No direct script access allowed');
  2. class Userphone extends Start_Controller {
  3. public function __construct(){
  4. parent::__construct();
  5. $this->load->library('session');
  6. $this->load->_model('Model_user','user');
  7. $this->load->_model('Model_nav','nav');
  8. $this->load->_model('Model_power','power');
  9. $this->load->_model('Model_shop','shop');
  10. $this->load->_model('Model_purchase','purchase');
  11. $this->load->_model('Model_warehouse','warehouse');
  12. $this->load->_model('Model_staff','staff');
  13. $this->load->_model('Model_fullorder','fullorder');
  14. $this->load->_model('Model_fullordertt','fullordertt');
  15. $this->load->_model('Model_fullordersmt','fullordersmt');
  16. }
  17. //定义方法的调用规则 获取URI第二段值
  18. public function _remap($arg,$arg_array)
  19. {
  20. if($arg == 'tc')//退出
  21. {
  22. $this->_tc();
  23. }
  24. else
  25. {
  26. $this->_index();
  27. }
  28. }
  29. //首页
  30. public function _index()
  31. {
  32. $user = $this->user->get_api($_SESSION['api']);
  33. $this->data['user'] = $user;//登录的用户信息
  34. $power = $this->power->read($user['power']);
  35. $power = $power['powerid'];
  36. //$power = explode('|',trim($power,'|'));字符串转数组
  37. $dataa = $this->nav->find_all('type=1','*','px asc');
  38. $datab = $this->nav->find_all('type=2','*','px asc');
  39. $datac = $this->nav->find_all('type=3','*','sort asc');
  40. $an = array();
  41. foreach ($dataa as $key=>$value)
  42. {
  43. foreach ($datab as $ke=>$va)
  44. {
  45. if($va['class'] == $value['id'])
  46. {
  47. foreach ($datac as $k=>$v)
  48. {
  49. if($v['class'] == $va['id'])
  50. {
  51. if(strstr($power,'|'.$v['id'].'|')==true)
  52. {
  53. $v['url'] = ($v['link'] != '')?$v['link']:$v['url'];
  54. $va['cn'][]=$v;
  55. }
  56. }
  57. }
  58. if(strstr($power,'|'.$va['id'].'|')==true)
  59. {
  60. $va['url'] = ($va['link'] != '')?$va['link']:$va['url'];
  61. $value['bn'][]=$va;
  62. }
  63. }
  64. }//循环出二级导航航
  65. if(strstr($power,'|'.$value['id'].'|')==true)
  66. {
  67. $an[] = $value;
  68. }
  69. }
  70. //print_r($an);
  71. $this->data['data'] = $an;
  72. $this->data['ip'] = $this->input->ip_address();
  73. if($user['userid'] == 'app123')
  74. {
  75. $this->_Template('phone/p_usauser',$this->data);
  76. }
  77. else
  78. {
  79. $this->_Template('phone/p_user',$this->data);
  80. }
  81. }
  82. //退出
  83. public function _tc()
  84. {
  85. $this->session->sess_destroy();
  86. header("Location:/phone/");
  87. }
  88. }