init: 从宝塔同步到 Gitea
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
namespace app\console\controller;
|
||||
use think\Controller;
|
||||
use think\Db;
|
||||
use think\Request;
|
||||
use think\Session;
|
||||
class Scan extends Controller{
|
||||
public function create_online_token($user){
|
||||
//$ip = getIP();
|
||||
//$time = time();
|
||||
return md5($user['encrypt'].$user['password']);
|
||||
}
|
||||
|
||||
public function index(){
|
||||
// 用户信息
|
||||
$user_info = Session::get('user_info');
|
||||
$user = Db::name('user_controller')->where(array('id' => $user_info['id']))->find();
|
||||
if(!$user) exit('用户不存在');
|
||||
// 验证token
|
||||
$online_token = $this->create_online_token($user);
|
||||
$r = Db::name('user_controller')->where(array('id' => $user_info['id']))->update(array('login_token' => $online_token));
|
||||
// 获取桌子信息
|
||||
$table = Db::name('table')->where(array('id' => $user_info['table_id']))->find();
|
||||
|
||||
// 渲染参数和模板
|
||||
$this->assign('connections_url','connections_'.$table['port']);
|
||||
$this->assign('online_token',$online_token);
|
||||
$this->assign('table',$table);
|
||||
$this->assign('user',$user);
|
||||
$this->assign('websocketUrl',$table['websocket_url']);
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
public function nn_index(){
|
||||
// 用户信息
|
||||
$user_info = Session::get('user_info');
|
||||
$user = Db::name('user_controller')->where(array('id' => $user_info['id']))->find();
|
||||
if(!$user) exit('用户不存在');
|
||||
// 验证token
|
||||
$online_token = $this->create_online_token($user);
|
||||
$r = Db::name('user_controller')->where(array('id' => $user_info['id']))->update(array('login_token' => $online_token));
|
||||
// 获取桌子信息
|
||||
$table = Db::name('table')->where(array('id' => $user_info['table_id']))->find();
|
||||
|
||||
// 渲染参数和模板
|
||||
$this->assign('connections_url','connections_'.$table['port']);
|
||||
$this->assign('online_token',$online_token);
|
||||
$this->assign('table',$table);
|
||||
$this->assign('user',$user);
|
||||
$this->assign('websocketUrl',$table['ws_local_url']);
|
||||
return $this->fetch();
|
||||
}
|
||||
public function tc_index(){
|
||||
// 用户信息
|
||||
$user_info = Session::get('user_info');
|
||||
$user = Db::name('user_controller')->where(array('id' => $user_info['id']))->find();
|
||||
if(!$user) exit('用户不存在');
|
||||
// 验证token
|
||||
$online_token = $this->create_online_token($user);
|
||||
$r = Db::name('user_controller')->where(array('id' => $user_info['id']))->update(array('login_token' => $online_token));
|
||||
// 获取桌子信息
|
||||
$table = Db::name('table')->where(array('id' => $user_info['table_id']))->find();
|
||||
// 渲染参数和模板
|
||||
$this->assign('connections_url','connections_'.$table['port']);
|
||||
$this->assign('online_token',$online_token);
|
||||
$this->assign('table',$table);
|
||||
$this->assign('user',$user);
|
||||
$this->assign('websocketUrl',$table['ws_local_url']);
|
||||
return $this->fetch();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user