1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <?php defined('BASEPATH') OR exit('No direct script access allowed');
- class Userphone extends Start_Controller {
- public function __construct(){
- parent::__construct();
- $this->load->library('session');
- $this->load->_model('Model_user','user');
- $this->load->_model('Model_nav','nav');
- $this->load->_model('Model_power','power');
- $this->load->_model('Model_shop','shop');
- $this->load->_model('Model_purchase','purchase');
- $this->load->_model('Model_warehouse','warehouse');
- $this->load->_model('Model_staff','staff');
- $this->load->_model('Model_fullorder','fullorder');
- $this->load->_model('Model_fullordertt','fullordertt');
- $this->load->_model('Model_fullordersmt','fullordersmt');
- }
- //定义方法的调用规则 获取URI第二段值
- public function _remap($arg,$arg_array)
- {
- if($arg == 'tc')//退出
- {
- $this->_tc();
- }
- else
- {
- $this->_index();
- }
- }
- //首页
- public function _index()
- {
- $user = $this->user->get_api($_SESSION['api']);
- $this->data['user'] = $user;//登录的用户信息
- $power = $this->power->read($user['power']);
- $power = $power['powerid'];
- //$power = explode('|',trim($power,'|'));字符串转数组
- $dataa = $this->nav->find_all('type=1','*','px asc');
- $datab = $this->nav->find_all('type=2','*','px asc');
- $datac = $this->nav->find_all('type=3','*','sort asc');
- $an = array();
- foreach ($dataa as $key=>$value)
- {
- foreach ($datab as $ke=>$va)
- {
- if($va['class'] == $value['id'])
- {
- foreach ($datac as $k=>$v)
- {
- if($v['class'] == $va['id'])
- {
- if(strstr($power,'|'.$v['id'].'|')==true)
- {
- $v['url'] = ($v['link'] != '')?$v['link']:$v['url'];
- $va['cn'][]=$v;
- }
- }
- }
- if(strstr($power,'|'.$va['id'].'|')==true)
- {
- $va['url'] = ($va['link'] != '')?$va['link']:$va['url'];
- $value['bn'][]=$va;
- }
- }
- }//循环出二级导航航
- if(strstr($power,'|'.$value['id'].'|')==true)
- {
- $an[] = $value;
- }
- }
- //print_r($an);
- $this->data['data'] = $an;
- $this->data['ip'] = $this->input->ip_address();
- if($user['userid'] == 'app123')
- {
- $this->_Template('phone/p_usauser',$this->data);
- }
- else
- {
- $this->_Template('phone/p_user',$this->data);
- }
- }
- //退出
- public function _tc()
- {
- $this->session->sess_destroy();
- header("Location:/phone/");
- }
- }
|