<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Login extends CI_Controller {

    function __construct() {
        parent::__construct();
        //todo:判断用户是否登录
        //$this->permission->is_admin();
        //$this->output->enable_profiler(TRUE);
        $this->load->model('User_model');
    }

    public function index() {
        $security_code = $this->input->get('security_code');
        $vei_sn = $this->input->get('vei_sn');
        if (!empty($security_code) && !empty($vei_sn)) {
            $user_info_wu_id = $this->User_model->check_login($security_code);
            if (!empty($user_info_wu_id)) {
                $user_info = $this->User_model->get_user_info($user_info_wu_id);
                //地接社代码转换，防止手动输入代码跳转操作其他社数据
                $user_info->LMI_VEI_SN=($vei_sn + 233) / 457 - 211;
                $this->session->set_userdata('session_admin', $user_info);
                echo $user_info->LMI_VEI_SN;
                echo 'ok';
                return TRUE;
            }
        }
        echo 'false';
        return FALSE;
    }

}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */