初始化代码
This commit is contained in:
37
application/anchor/controller/Common.php
Normal file
37
application/anchor/controller/Common.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace app\anchor\controller;
|
||||
|
||||
use think\Controller;
|
||||
use think\Request;
|
||||
use think\Db;
|
||||
|
||||
class Common extends Controller
|
||||
{
|
||||
public $uid;
|
||||
public function initialize()
|
||||
{
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
|
||||
// ajaxReturn(301, '系统维护');
|
||||
$login_token = input('login_token', 0);
|
||||
$reslut = model('User')->check_login_token($login_token);
|
||||
if ($reslut['code'] == 201) {
|
||||
return ajaxReturn(301, $reslut['msg'], $reslut['data']);
|
||||
} else {
|
||||
$this->uid = $reslut['data'];
|
||||
}
|
||||
add_operation(3, $this->uid); //用户行为日志
|
||||
}
|
||||
public function check_login_status()
|
||||
{
|
||||
$user_name = Db::name("user")->where(array("uid" => $this->uid))->value("user_name");
|
||||
$data['data'] = $user_name;
|
||||
ajaxReturn(1, '登录成功', $data);
|
||||
}
|
||||
public function get_menu_list()
|
||||
{
|
||||
$data = model('SystemMenu')->getSystemInit($this->uid);
|
||||
return json($data);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user