49 lines
1.7 KiB
PHP
49 lines
1.7 KiB
PHP
<?php
|
|
namespace app\console\controller;
|
|
use think\Controller;
|
|
use think\Session;
|
|
use think\Request;
|
|
use think\Db;
|
|
use waybill\WayBill;
|
|
use think\Lang;
|
|
class Dn Extends Common{
|
|
public function create_online_token($user){
|
|
$ip = getIP();
|
|
$time = time();
|
|
return md5($ip.$time.$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(Lang::get('userNotExit'));
|
|
$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();
|
|
$memo = Db::name('memo')->where('table_id',$table['id'])->where('position',['=',2],['=',3],'or')->where('status',1)->order('id desc')->limit(1)->find();
|
|
if($table['scene_limit_money']){
|
|
$scene_limit_money = explode('-', $table['scene_limit_money']);
|
|
}else{
|
|
$scene_limit_money = array(0,0);
|
|
}
|
|
// 获取语言包信息
|
|
$langType = cookie('think_var');
|
|
$lang = Lang::get();
|
|
$lang = json_encode($lang);
|
|
|
|
// 渲染参数和模板
|
|
$this->assign('scene_limit_money',$scene_limit_money);
|
|
$this->assign('memo',$memo);
|
|
$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']);
|
|
$this->assign('langType',$langType);
|
|
$this->assign('lang',$lang);
|
|
if($table['is_scavenging'] == 1){
|
|
return $this->fetch('/dn/index_auto');
|
|
}else{
|
|
return $this->fetch();
|
|
}
|
|
}
|
|
} |