87 lines
2.5 KiB
PHP
87 lines
2.5 KiB
PHP
<?php
|
|
/**
|
|
* @Created by PhpStorm.
|
|
* @Author:Soar
|
|
* @Time:2023/12/18 13:42
|
|
*/
|
|
|
|
namespace app\index\controller;
|
|
|
|
use app\common\controller\Frontend;
|
|
use app\common\library\Auth;
|
|
use app\index\service\ScreenService;
|
|
use think\Session;
|
|
|
|
class Wrj extends Frontend
|
|
{
|
|
protected $noNeedLogin = '*';
|
|
protected $noNeedLoginLive = '*';
|
|
protected $noNeedRight = '*';
|
|
protected $layout = '';
|
|
protected $match_id;
|
|
|
|
public function _initialize()
|
|
{
|
|
$auth = Auth::instance();
|
|
parent::_initialize();
|
|
$this->screemService = new ScreenService();
|
|
}
|
|
|
|
// public function index(){
|
|
// return $this->view->fetch();
|
|
// }
|
|
|
|
public function live()
|
|
{
|
|
|
|
$id = $this->request->param("match_id");
|
|
if (empty($id)) {
|
|
$this->error("非法请求");
|
|
}
|
|
$this->auth->setMatchId($id);
|
|
if (!$this->screemService->verifyScreen(['match_id' => $id, 'type' => "screen"])) {
|
|
// 判断是否登陆
|
|
if (!Session::has("screen_ranking{$id}")) {
|
|
$this->match_id = $id;
|
|
$this->error("请先登录!", url('wrj/login', ['match_id' => $id]));
|
|
}
|
|
}
|
|
|
|
$screen_info = $this->screemService->getScreenInfo([
|
|
'match_id' => $id,
|
|
'type' => "screen"
|
|
]);
|
|
$this->view->assign("match_id", $id);
|
|
$this->view->assign('screeninfo', $screen_info);
|
|
return $this->view->fetch('index');
|
|
}
|
|
|
|
public function login()
|
|
{
|
|
if ($this->request->isPost()) {
|
|
$data['look_pwd'] = $this->request->post("password");
|
|
|
|
if (empty($data['look_pwd'])) {
|
|
$this->error("密码不能为空!");
|
|
} elseif (empty($this->request->param("match_id"))) {
|
|
$this->error("非法请求");
|
|
}
|
|
|
|
$data['match_id'] = $this->request->param("match_id");
|
|
$data['type'] = 'screen';
|
|
|
|
if ($this->screemService->verifyScreen($data)) {
|
|
Session::set("screen_ranking{$data['match_id']}", true);
|
|
$this->success("登陆成功!", 'https://www.fpvone.cn/index/wrj/live?match_id='.$data['match_id']);
|
|
// header('location:https://www.fpvone.cn/index/wrj/live?match_id='.$data['match_id']);
|
|
} else {
|
|
$this->error("密码错误!");
|
|
}
|
|
}
|
|
$id = $this->request->param("match_id");
|
|
if (empty($id)) {
|
|
$this->error("非法请求");
|
|
}
|
|
return $this->view->fetch();
|
|
}
|
|
} |