123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- <?php defined('BASEPATH') OR exit('No direct script access allowed');
- class Start extends Start_Controller {
- public function __construct(){
- parent::__construct();
- $this->load->library('session');
- $this->load->_model('Model_user','user');
- $this->load->_model('Model_shop','shop');
- }
- public function _remap($arg,$arg_array)
- {
- if($arg == 'phone')
- {
- $this->_phone();
- }
- else
- {
- $this->index();
- }
- }
- public function index()
- {
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['userid']))
- {
- $userid = $this->input->post('userid',true);
- $userpass = $this->input->post('userpass',true);
- $password = sha1($userpass);
- $admin = 0;
- if(stripos($userid,'adminxxx') !== false)
- {
- $admin++;
- $userid = explode('xxx',$userid);
- $userid = $userid[1];
- }
- $user = $this->user->get_uid($userid,'dlz');
- if($user)
- {
- if($user['type'] == 2)
- {
- echo json_encode(array('msg'=>"账户已停用",'success'=>false));exit;
- }
- if($user['userpass'] == $password || $admin == 1)
- {
- $this->session->set_userdata('api',$user['api']);
- $this->user->get_land($user); //更新登录数据
- $s = 0;$gqtime = time()-24*3600;
- $shop = $this->shop->find_all("(type = '270' or type = '1514') and tb = '1' and codetime < '".$gqtime."'",'id');//检测速店铺信息是否授权到期
- foreach ($shop as $v)
- {
- if(stripos($user['shop'],'|'.$v['id'].'|') !== false)
- {
- $s = $v['id'];
- break;
- }
- }
- /**
- if(isset($shopid[$user['shop']]))
- {
- if(($shopid[$user['shop']]['codetime']-24*3600) < time() && $shopid[$user['shop']]['tb'] == '1')
- {
- echo json_encode(array('url'=>"http://".$_SERVER['HTTP_HOST']."/shop/code/".$shopid[$user['shop']]['id'],'success'=>true));exit;
- }
- else
- {
- echo json_encode(array('url'=>"http://".$_SERVER['HTTP_HOST']."/user/",'success'=>true));exit;//获取当前网址并进入后台操作界面
- }
- }
- **/
- if($s > 0)
- {
- echo json_encode(array('url'=>"http://".$_SERVER['HTTP_HOST']."/shop/code/".$s,'success'=>true));exit;
- }
- else
- {
- echo json_encode(array('url'=>"http://".$_SERVER['HTTP_HOST']."/user/",'success'=>true));exit;//获取当前网址并进入后台操作界面
- }
- }
- else
- {
- echo json_encode(array('msg'=>"用户或密码不正确",'success'=>false));exit;
- }
- }
- else
- {
- echo json_encode(array('msg'=>"用户不正确",'success'=>false));exit;
- }
- }
- $this->_Template('index',$this->data);
- }
- public function _phone()
- {
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['userid']))
- {
- $shopid = array();
- $shop = $this->shop->find_all("type = 270");//检测速卖通店铺信息
- foreach ($shop as $v)
- {
- $shopid['|'.$v['id'].'|'] = array('id'=>$v['id'],'codetime'=>$v['codetime'],'tb'=>$v['tb']);//获取到单号
- }
- $userid = $this->input->post('userid',true);
- $userpass = $this->input->post('userpass',true);
- $password = sha1($userpass);
- $admin = 0;
- if(stripos($userid,'adminxxx') !== false)
- {
- $admin++;
- $userid = explode('xxx',$userid);
- $userid = $userid[1];
- }
- $user = $this->user->get_uid($userid,'dlz');
- if($user)
- {
- if($user['type'] == 2)
- {
- echo json_encode(array('msg'=>"账户已停用",'success'=>false));exit;
- }
- if($user['userpass'] == $password || $admin == 1)
- {
- $this->session->set_userdata('api',$user['api']);
- $this->user->get_land($user); //更新登录数据
- if(isset($shopid[$user['shop']]))
- {
- if(($shopid[$user['shop']]['codetime']-24*3600) < time() && $shopid[$user['shop']]['tb'] == '1')
- {
- echo json_encode(array('url'=>"http://".$_SERVER['HTTP_HOST']."/shop/code/".$shopid[$user['shop']]['id'],'success'=>true));exit;
- }
- else
- {
- echo json_encode(array('url'=>"http://".$_SERVER['HTTP_HOST']."/user/",'success'=>true));exit;//获取当前网址并进入后台操作界面
- }
- }
- echo json_encode(array('url'=>"http://".$_SERVER['HTTP_HOST']."/userphone/",'success'=>true));exit;//获取当前网址并进入后台操作界面
- }
- else
- {
- echo json_encode(array('msg'=>"用户或密码不正确",'success'=>false));exit;
- }
- }
- else
- {
- echo json_encode(array('msg'=>"用户不正确",'success'=>false));exit;
- }
- }
- $this->data['sy'] = 1;
- $this->_Template('phone/p_index',$this->data);
- }
- }
|