|
@@ -10,7 +10,7 @@ class Common extends CI_Controller {
|
|
|
parent::__construct();
|
|
|
$this->load->model('User_model');
|
|
|
$this->response = $this->config->config['response_en'];
|
|
|
-
|
|
|
+
|
|
|
$version = 1;
|
|
|
$this->session->set_userdata('version', $version);
|
|
|
$this->version = $version;
|
|
@@ -27,6 +27,10 @@ class Common extends CI_Controller {
|
|
|
if(empty($client_key)) exit(json_result('0003', $this->response['0003']));
|
|
|
if(empty($username) || empty($password)) exit(json_result('0100', $this->response['0100']));
|
|
|
$password = md5($password);
|
|
|
+
|
|
|
+ if(empty($os) && empty($code)) exit(json_result('0105', $this->response['0105']));
|
|
|
+ if (empty($os) && !isset($_SESSION['login_code'])) exit(json_result('0106',$this->response['0106']));
|
|
|
+ if (empty($os) && $_SESSION['login_code'] != $code) exit(json_result('0107',$this->response['0107']));
|
|
|
|
|
|
$user = $this->User_model->get_one(array('username'=>$username,'role'=>$role));
|
|
|
if(!empty($user)) {
|
|
@@ -153,6 +157,42 @@ class Common extends CI_Controller {
|
|
|
exit(json_result('0000', $this->response['0000'], ['list'=>$data]));
|
|
|
}
|
|
|
|
|
|
+ public function get_code_image(){
|
|
|
+ $type = intval($this->input->post('type',true));
|
|
|
+
|
|
|
+ $this->load->helper('captcha');
|
|
|
+
|
|
|
+ if (!file_exists('../upload')) mkdir('../upload');
|
|
|
+ if (!file_exists('../upload/image')) mkdir('../upload/image');
|
|
|
+ if (!file_exists('../upload/image/code')) mkdir('../upload/image/code');
|
|
|
+ $url = '/upload/image/code';
|
|
|
+ $code = rand(1000,9999);
|
|
|
+ $vals = array(
|
|
|
+ 'word' => $code,
|
|
|
+ 'img_path' => '../upload/image/code/',
|
|
|
+ 'img_url' => $url,
|
|
|
+ 'img_width' => 120,
|
|
|
+ 'font_path' => '../file/font/PingFangRegular.ttf',
|
|
|
+ 'img_height' => 36,
|
|
|
+ 'expiration' => 600,
|
|
|
+ 'word_length' => 4,
|
|
|
+ 'font_size' => 20,
|
|
|
+ 'img_id' => 'Imageid',
|
|
|
+ );
|
|
|
+
|
|
|
+ $cap = create_captcha($vals);
|
|
|
+ $filename = $cap['filename'];
|
|
|
+ $url .= '/'.$filename;
|
|
|
+ $this->load->library('session');
|
|
|
+ if ($type == 0) {
|
|
|
+ $this->session->set_userdata('login_code', $code);
|
|
|
+ }else {
|
|
|
+ $this->session->set_userdata('password_code', $code);
|
|
|
+ }
|
|
|
+
|
|
|
+ exit(json_result('0000',$this->response['0000'],array('path'=>base_url($url))));
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
// 批量导入
|
|
|
function test(){
|