Files

58 lines
1.0 KiB
PHP

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Logout
*/
class Logout extends CI_Controller
{
private $CI;
function __construct()
{
$this->CI = & get_instance();
}
function main()
{
if ( ! $this->CI->input->post_get('token')) {
$this->CI->apilib->make_error("토큰 값이 넘어오지 않았습니다");
}
$token = $this->CI->input->post_get('token');
$app_id = (int) trim($this->CI->input->post_get('app_id'));
if (empty($app_id)) {
$this->CI->apilib->make_error("어플 아이디가 넘어오지 않았습니다");
}
$sessionuser = $this->CI->User_model->get_by_token($app_id, $token);
$updatedata = array(
'user_token' => '',
);
$upwhere = array(
'app_id' => $app_id,
'user_token' => $token,
);
$this->CI->User_model->update('', $updatedata, $upwhere);
$arr = array(
'result' => 'ok',
'token' => $token,
'app_id' => $app_id,
);
return $arr;
}
}