parent
7536c8695b
commit
32ca1132f2
@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
namespace app\index\controller;
|
||||||
|
|
||||||
|
use think\Controller;
|
||||||
|
use think\Db;
|
||||||
|
use \app\index\model\Option;
|
||||||
|
use \app\index\model\User;
|
||||||
|
use \app\index\model\Aria2;
|
||||||
|
use think\Session;
|
||||||
|
|
||||||
|
|
||||||
|
class RemoteDownload extends Controller{
|
||||||
|
|
||||||
|
public $userObj;
|
||||||
|
|
||||||
|
public function _initialize(){
|
||||||
|
$this->userObj = new User(cookie('user_id'),cookie('login_key'));
|
||||||
|
if(!$this->userObj->loginStatus){
|
||||||
|
echo "Bad request";
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function checkPerimission($permissionId){
|
||||||
|
$permissionData = $this->userObj->groupData["aria2"];
|
||||||
|
if(explode(",",$permissionData)[$permissionId] != "1"){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addUrl(){
|
||||||
|
if(!$this->checkPerimission(0)){
|
||||||
|
return json(['error'=>1,'message'=>'您当前的无用户无法执行此操作']);
|
||||||
|
}
|
||||||
|
$aria2Options = Option::getValues(["aria2"]);
|
||||||
|
$aria2 = new Aria2($aria2Options);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
namespace app\index\model;
|
||||||
|
|
||||||
|
use think\Model;
|
||||||
|
use think\Db;
|
||||||
|
|
||||||
|
class Aria2 extends Model{
|
||||||
|
|
||||||
|
|
||||||
|
public function __construct($options){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
Loading…
Reference in new issue