feat: 移动端访问首页自动跳转 mobile/login

This commit is contained in:
2026-04-20 00:04:17 +08:00
parent 2b4d3e9880
commit 76c421679f

View File

@@ -1,62 +1,67 @@
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); <?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Home extends CI_Controller { class Home extends CI_Controller {
public function __construct(){ public function __construct(){
parent::__construct(); parent::__construct();
$this->common_model->checkpurview(); $this->common_model->checkpurview();
$this->jxcsys = $this->session->userdata('jxcsys'); $this->jxcsys = $this->session->userdata('jxcsys');
} }
public function index(){ public function index(){
//add by michen 20170820 for 修改登录异常 begin // 2026-04-20 add: 移动端自动跳转
if(!strstr($_SERVER['REQUEST_URI'], 'home/index')) $ua = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
redirect('home/index', 'refresh'); if (preg_match('/(iPhone|iPad|iPod|Android|Mobile|BlackBerry|IEMobile|Opera Mini)/i', $ua)) {
//add by michen 20170820 for 修改登录异常 end redirect('mobile/login', 'refresh');
$data['uid'] = $this->jxcsys['uid']; }
$data['name'] = $this->jxcsys['name']; //add by michen 20170820 for 修改登录异常 begin
$data['roleid'] = 0; if(!strstr($_SERVER['REQUEST_URI'], 'home/index'))
$data['username'] = $this->jxcsys['username']; redirect('home/index', 'refresh');
$data['system'] = $this->common_model->get_option('system'); //add by michen 20170820 for 修改登录异常 end
$data['rights'] = $this->common_model->get_admin_rights(); $data['uid'] = $this->jxcsys['uid'];
$this->load->view('index',$data); $data['name'] = $this->jxcsys['name'];
} $data['roleid'] = 0;
$data['username'] = $this->jxcsys['username'];
public function main(){ $data['system'] = $this->common_model->get_option('system');
$this->load->view('main'); $data['rights'] = $this->common_model->get_admin_rights();
} $this->load->view('index',$data);
}
public function set_password(){ public function main(){
$data = str_enhtml($this->input->post(NULL,TRUE)); $this->load->view('main');
if (is_array($data)&&count($data)>0) { }
$info['userpwd'] = md5($data['newPassword']);
$info['mobile'] = $data['buyerMobile'];
$info['name'] = $data['buyerName']; public function set_password(){
$this->mysql_model->get_count('admin','(uid<>'.$this->jxcsys['uid'].') and mobile='.$info['mobile'].'') >0 && str_alert(-1,'该手机号已被使用,请更换手机号码'); $data = str_enhtml($this->input->post(NULL,TRUE));
$sql = $this->mysql_model->update('admin',$info,'(uid='.$this->jxcsys['uid'].')'); if (is_array($data)&&count($data)>0) {
if ($sql) { $info['userpwd'] = md5($data['newPassword']);
$this->common_model->logs('密码修改成功 UID'.$this->jxcsys['uid'].' 真实姓名改为:'.$info['name']); $info['mobile'] = $data['buyerMobile'];
str_alert(200,'密码修改成功'); $info['name'] = $data['buyerName'];
} $this->mysql_model->get_count('admin','(uid<>'.$this->jxcsys['uid'].') and mobile='.$info['mobile'].'') >0 && str_alert(-1,'该手机号已被使用,请更换手机号码');
str_alert(-1,'设置独立密码失败,请稍候重试!'); $sql = $this->mysql_model->update('admin',$info,'(uid='.$this->jxcsys['uid'].')');
} else { if ($sql) {
$data = $this->mysql_model->get_rows('admin','(uid='.$this->jxcsys['uid'].')'); $this->common_model->logs('密码修改成功 UID'.$this->jxcsys['uid'].' 真实姓名改为:'.$info['name']);
$this->load->view('set_password',$data); str_alert(200,'密码修改成功');
} }
} str_alert(-1,'设置独立密码失败,请稍候重试!');
} else {
$data = $this->mysql_model->get_rows('admin','(uid='.$this->jxcsys['uid'].')');
public function Services(){ $this->load->view('set_password',$data);
die('jQuery110202928952066617039_1430920204305({"status":200,"msg":"success","data":[{"msgid":"20000000122" }
,"msglinkcolor":"d9254a","msglink":"","msgtitle":"售后热线服务时间临时调整通知5.6-5.8>>"},{"msgid":"20000000119" }
,"msglinkcolor":"d9254a","msglink":"index.html","msgtitle"
:"推荐送ipad mini购买就返利>>"},{"msgid":"20000000115","msglinkcolor":"d9254a","msglink":"","msgtitle":">>"},{"msgid":"20000000068","msglinkcolor":"d9254a","msglink":"","msgtitle":">
>"}]})'); public function Services(){
die('jQuery110202928952066617039_1430920204305({"status":200,"msg":"success","data":[{"msgid":"20000000122"
} ,"msglinkcolor":"d9254a","msglink":"","msgtitle":"售后热线服务时间临时调整通知5.6-5.8>>"},{"msgid":"20000000119"
,"msglinkcolor":"d9254a","msglink":"index.html","msgtitle"
} :"推荐送ipad mini购买就返利>>"},{"msgid":"20000000115","msglinkcolor":"d9254a","msglink":"","msgtitle":">>"},{"msgid":"20000000068","msglinkcolor":"d9254a","msglink":"","msgtitle":">
>"}]})');
/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */ }
}
/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */