This commit is contained in:
Enoch 2023-01-02 19:56:44 +08:00
commit e187878b7a
3244 changed files with 260239 additions and 0 deletions

23
.env.example Normal file
View File

@ -0,0 +1,23 @@
proxy=
#Tor的Socks5代理
RedisHost=
#Redis主机名
RedisPassword=
#Redis密码
RedisPort=6379
#Redis端口
RedisDatabase=1
#Redis数据库号
ZlibraryLogin=loginzlib2vrak5zzpcocc3ouizykn6k5qecgj2tzlnab5wcbqhembyd.onion
#除非Zlib的洋葱域名改变否则无需更改
Zlibrary=bookszlibb74ugqojhzhg2a63w5i2atv5bqarulgczawnbmsb6s6qead.onion
#除非Zlib的洋葱域名改变否则无需更改
version=1.0.1
#无需更改

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.env

View File

View File

@ -0,0 +1 @@
proxy = 45.150.224.46:19100

View File

@ -0,0 +1 @@
proxy = 10.1.5.2:19100

View File

@ -0,0 +1,5 @@
proxy = 10.1.5.2:19100
redis.host = 121.228.166.201
redis.password = qi2005112
redis.port = 16379
redis.database = 17

View File

@ -0,0 +1,5 @@
proxy = 10.1.5.2:19100
redis.host = 121.228.166.201
redis.password = Qi2005112!
redis.port = 16379
redis.database = 17

View File

@ -0,0 +1,5 @@
proxy = 10.1.5.2:19100
redis.host = 121.228.166.201
redispassword = Qi2005112!
redis.port = 16379
redis.database = 17

View File

@ -0,0 +1,5 @@
proxy=10.1.5.2:19100
RedisHost=121.228.166.201
RedisPassword=Qi2005112!
RedisPort=16379
RedisDatabase=17

View File

@ -0,0 +1,7 @@
proxy=10.1.5.2:19100
RedisHost=121.228.166.201
RedisPassword=Qi2005112!
RedisPort=16379
RedisDatabase=17
ZlibraryLogin=http://loginzlib2vrak5zzpcocc3ouizykn6k5qecgj2tzlnab5wcbqhembyd.onion/
Zlibrary=http://bookszlibb74ugqojhzhg2a63w5i2atv5bqarulgczawnbmsb6s6qead.onion/

View File

@ -0,0 +1,8 @@
proxy=10.1.5.2:19100
RedisHost=121.228.166.201
RedisPassword=Qi2005112!
RedisPort=16379
RedisDatabase=17
ZlibraryLogin=http://loginzlib2vrak5zzpcocc3ouizykn6k5qecgj2tzlnab5wcbqhembyd.onion/
Zlibrary=http://bookszlibb74ugqojhzhg2a63w5i2atv5bqarulgczawnbmsb6s6qead.onion/
version=1.0.1

View File

@ -0,0 +1,8 @@
proxy=10.1.5.2:19100
RedisHost=121.228.166.201
RedisPassword=Qi2005112!
RedisPort=16379
RedisDatabase=17
ZlibraryLogin=http://loginzlib2vrak5zzpcocc3ouizykn6k5qecgj2tzlnab5wcbqhembyd.onion
Zlibrary=http://bookszlibb74ugqojhzhg2a63w5i2atv5bqarulgczawnbmsb6s6qead.onion
version=1.0.1

View File

@ -0,0 +1,8 @@
proxy=10.1.5.2:19100
RedisHost=121.228.166.201
RedisPassword=Qi2005112!
RedisPort=16379
RedisDatabase=17
ZlibraryLogin=loginzlib2vrak5zzpcocc3ouizykn6k5qecgj2tzlnab5wcbqhembyd.onion
Zlibrary=bookszlibb74ugqojhzhg2a63w5i2atv5bqarulgczawnbmsb6s6qead.onion
version=1.0.1

View File

@ -0,0 +1,8 @@
proxy=10.1.5.2:19100
RedisHost=121.228.166.201
RedisPassword=Qi2005112!
RedisPort=16379
RedisDatabase=17
ZlibraryLogin=loginzlib2vrak5zzpcocc3ouizykn6k5qecgj2tzlnab5wcbqhembyd.onion
Zlibrary=bookszlibb74ugqojhzhg2a63w5i2atv5bqarulgczawnbmsb6s6qead.onion/
version=1.0.1

View File

@ -0,0 +1,8 @@
proxy=10.1.5.2:19100
RedisHost=121.228.166.201
RedisPassword=Qi2005112!
RedisPort=16379
RedisDatabase=17
ZlibraryLogin=loginzlib2vrak5zzpcocc3ouizykn6k5qecgj2tzlnab5wcbqhembyd.onion
Zlibrary=bookszlibb74ugqojhzhg2a63w5i2atv5bqarulgczawnbmsb6s6qead.onion
version=1.0.1

View File

View File

@ -0,0 +1,15 @@
// Copyright (C) 2023 enoch@Laysense.com
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

View File

@ -0,0 +1,23 @@
proxy=
#Tor的Socks5代理
RedisHost=
#Redis主机名
RedisPassword=
#Redis密码
RedisPort=6379
#Redis端口
RedisDatabase=1
#Redis数据库号
ZlibraryLogin=loginzlib2vrak5zzpcocc3ouizykn6k5qecgj2tzlnab5wcbqhembyd.onion
#除非Zlib的洋葱域名改变否则无需更改
Zlibrary=bookszlibb74ugqojhzhg2a63w5i2atv5bqarulgczawnbmsb6s6qead.onion
#除非Zlib的洋葱域名改变否则无需更改
version=1.0.1
#无需更改

View File

View File

@ -0,0 +1 @@
.env

View File

@ -0,0 +1,15 @@
// Copyright (C) 2023 enoch@Laysense.com
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

View File

@ -0,0 +1,17 @@
<?php
namespace app\controller;
use Webman\Captcha\CaptchaBuilder;
use Respect\Validation\Validator as v;
use support\Request;
use yzh52521\EasyHttp\Response;
use yzh52521\EasyHttp\RequestException;
use yzh52521\EasyHttp\Http;
use support\Redis;
use support\View;
class File
{
public function index(Request $request)
{

View File

@ -0,0 +1,19 @@
<?php
namespace app\controller;
use Webman\Captcha\CaptchaBuilder;
use Respect\Validation\Validator as v;
use support\Request;
use yzh52521\EasyHttp\Response;
use yzh52521\EasyHttp\RequestException;
use yzh52521\EasyHttp\Http;
use support\Redis;
use support\View;
class File
{
public function check(Request $request)
{
}
}

View File

@ -0,0 +1,36 @@
<?php
namespace app\controller;
use Webman\Captcha\CaptchaBuilder;
use Respect\Validation\Validator as v;
use support\Request;
use yzh52521\EasyHttp\Response;
use yzh52521\EasyHttp\RequestException;
use yzh52521\EasyHttp\Http;
use support\Redis;
use support\View;
class File
{
public function check(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
if($key=='blank' || $id=='blank'){
return json(['code'=>509,'msg'=>'未登录']);
}
$path=$request->input('path','blank');
if($path=='blank'){
return json(['code'=>500,'msg'=>'缺少参数']);
}
$name=base64_encode($path);
$file=base_path().'/books/'.$name.'bin'
if(file_exists($file)){
return json(['code'=>200, 'msg'=>'找到文件', 'size'=>trans_byte(filesize($file))]);
}else {
return json(['code'=>201, 'msg'=>'未找到文件']);
}
}
}

View File

@ -0,0 +1,36 @@
<?php
namespace app\controller;
use Webman\Captcha\CaptchaBuilder;
use Respect\Validation\Validator as v;
use support\Request;
use yzh52521\EasyHttp\Response;
use yzh52521\EasyHttp\RequestException;
use yzh52521\EasyHttp\Http;
use support\Redis;
use support\View;
class File
{
public function check(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
if($key=='blank' || $id=='blank'){
return json(['code'=>509,'msg'=>'未登录']);
}
$path=$request->input('path','blank');
if($path=='blank'){
return json(['code'=>500,'msg'=>'缺少参数']);
}
$name=base64_encode($path);
$file=base_path().'/books/'.$name.'bin';
if(file_exists($file)){
return json(['code'=>200, 'msg'=>'找到文件', 'size'=>trans_byte(filesize($file))]);
}else {
return json(['code'=>201, 'msg'=>'未找到文件']);
}
}
}

View File

@ -0,0 +1,56 @@
<?php
namespace app\controller;
use Webman\Captcha\CaptchaBuilder;
use Respect\Validation\Validator as v;
use support\Request;
use yzh52521\EasyHttp\Response;
use yzh52521\EasyHttp\RequestException;
use yzh52521\EasyHttp\Http;
use support\Redis;
use support\View;
class File
{
public function check(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
if($key=='blank' || $id=='blank'){
return json(['code'=>509,'msg'=>'未登录']);
}
$path=$request->input('path','blank');
if($path=='blank'){
return json(['code'=>500,'msg'=>'缺少参数']);
}
$name=base64_encode($path);
$file=base_path().'/books/'.$name.'bin';
if(file_exists($file)){
return json(['code'=>200, 'msg'=>'找到文件', 'size'=>trans_byte(filesize($file))]);
}else {
return json(['code'=>201, 'msg'=>'未找到文件']);
}
}
public function download(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
if($key=='blank' || $id=='blank'){
return json(['code'=>509,'msg'=>'未登录']);
}
$path=$request->input('path','blank');
$auth=array('remix_userid'=>"$id",'remix_userkey'=>"$key",'siteLanguageV2'=>'zh','selectedSiteMode'=>'books');
$url=getenv('Zlibrary')."$path";
$head=Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,getenv('Zlibrary'))->head($url);
$size=round(($head->header('Content-Length')/1048576),2);
if($size>=40){
return json(['code'=>500,'msg'=>'文件太大了!']);
}
if($head->header('Content-Type')=='text/html; charset=UTF-8'){
return json(['code'=>404,'msg'=>'链接错误']);
}
}

View File

@ -0,0 +1,56 @@
<?php
namespace app\controller;
use Webman\Captcha\CaptchaBuilder;
use Respect\Validation\Validator as v;
use support\Request;
use yzh52521\EasyHttp\Response;
use yzh52521\EasyHttp\RequestException;
use yzh52521\EasyHttp\Http;
use support\Redis;
use support\View;
class File
{
public function check(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
if($key=='blank' || $id=='blank'){
return json(['code'=>509,'msg'=>'未登录']);
}
$path=$request->input('path','blank');
if($path=='blank'){
return json(['code'=>500,'msg'=>'缺少参数']);
}
$name=base64_encode($path);
$file=base_path().'/books/'.$name.'bin';
if(file_exists($file)){
return json(['code'=>200, 'msg'=>'找到文件', 'size'=>trans_byte(filesize($file))]);
}else {
return json(['code'=>201, 'msg'=>'未找到文件']);
}
}
public function download(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
if($key=='blank' || $id=='blank'){
return json(['code'=>509,'msg'=>'未登录']);
}
$path=$request->input('path','blank');
$auth=array('remix_userid'=>"$id",'remix_userkey'=>"$key",'siteLanguageV2'=>'zh','selectedSiteMode'=>'books');
$url=getenv('Zlibrary')."$path";
$head=Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,getenv('Zlibrary'))->head($url);
$size=round(($head->header('Content-Length')/1048576),2);
if($size>=30){
return json(['code'=>500,'msg'=>'文件太大了!']);
}
if($head->header('Content-Type')=='text/html; charset=UTF-8'){
return json(['code'=>404,'msg'=>'链接错误']);
}
}

View File

@ -0,0 +1,64 @@
<?php
namespace app\controller;
use Webman\Captcha\CaptchaBuilder;
use Respect\Validation\Validator as v;
use support\Request;
use yzh52521\EasyHttp\Response;
use yzh52521\EasyHttp\RequestException;
use yzh52521\EasyHttp\Http;
use support\Redis;
use support\View;
class File
{
public function check(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
if($key=='blank' || $id=='blank'){
return json(['code'=>509,'msg'=>'未登录']);
}
$path=$request->input('path','blank');
if($path=='blank'){
return json(['code'=>500,'msg'=>'缺少参数']);
}
$name=base64_encode($path);
$file=base_path().'/books/'.$name.'bin';
if(file_exists($file)){
return json(['code'=>200, 'msg'=>'找到文件', 'size'=>trans_byte(filesize($file))]);
}else {
return json(['code'=>201, 'msg'=>'未找到文件']);
}
}
public function download(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
if($key=='blank' || $id=='blank'){
return json(['code'=>509,'msg'=>'未登录']);
}
$path=$request->input('path','blank');
$auth=array('remix_userid'=>"$id",'remix_userkey'=>"$key",'siteLanguageV2'=>'zh','selectedSiteMode'=>'books');
$url=getenv('Zlibrary')."$path";
$get=Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,getenv('Zlibrary'))
$head=$get->head($url);
$size=round(($head->header('Content-Length')/1048576),2);
if($size>=30){
return json(['code'=>500,'msg'=>'文件太大了!']);
}
if($head->header('Content-Type')=='text/html; charset=UTF-8'){
return json(['code'=>404,'msg'=>'链接错误']);
}
$redis = Redis::connection('default');
$redis->hset('BookCache_'.base64_encode($path),'Time',time());
$redis->hset('BookCache_'.base64_encode($path),'Date',date("Y/m/d H:i:s"));
mkdir(base_path().'/books/'.date("Y/m/"),0777,true);
$filepath=base_path().'/books/'.date("Y/m/").$name.'bin';
$return=$get->get($url);
$file = fopen("$filepath","w");
}

View File

@ -0,0 +1,64 @@
<?php
namespace app\controller;
use Webman\Captcha\CaptchaBuilder;
use Respect\Validation\Validator as v;
use support\Request;
use yzh52521\EasyHttp\Response;
use yzh52521\EasyHttp\RequestException;
use yzh52521\EasyHttp\Http;
use support\Redis;
use support\View;
class File
{
public function check(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
if($key=='blank' || $id=='blank'){
return json(['code'=>509,'msg'=>'未登录']);
}
$path=$request->input('path','blank');
if($path=='blank'){
return json(['code'=>500,'msg'=>'缺少参数']);
}
$name=base64_encode($path);
$file=base_path().'/books/'.$name.'bin';
if(file_exists($file)){
return json(['code'=>200, 'msg'=>'找到文件', 'size'=>trans_byte(filesize($file))]);
}else {
return json(['code'=>201, 'msg'=>'未找到文件']);
}
}
public function download(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
if($key=='blank' || $id=='blank'){
return json(['code'=>509,'msg'=>'未登录']);
}
$path=$request->input('path','blank');
$auth=array('remix_userid'=>"$id",'remix_userkey'=>"$key",'siteLanguageV2'=>'zh','selectedSiteMode'=>'books');
$url=getenv('Zlibrary')."$path";
$get=Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,getenv('Zlibrary'));
$head=$get->head($url);
$size=round(($head->header('Content-Length')/1048576),2);
if($size>=30){
return json(['code'=>500,'msg'=>'文件太大了!']);
}
if($head->header('Content-Type')=='text/html; charset=UTF-8'){
return json(['code'=>404,'msg'=>'链接错误']);
}
$redis = Redis::connection('default');
$redis->hset('BookCache_'.base64_encode($path),'Time',time());
$redis->hset('BookCache_'.base64_encode($path),'Date',date("Y/m/d H:i:s"));
mkdir(base_path().'/books/'.date("Y/m/"),0777,true);
$filepath=base_path().'/books/'.date("Y/m/").$name.'bin';
$return=$get->get($url);
$file = fopen("$filepath","w");
}

View File

@ -0,0 +1,65 @@
<?php
namespace app\controller;
use Webman\Captcha\CaptchaBuilder;
use Respect\Validation\Validator as v;
use support\Request;
use yzh52521\EasyHttp\Response;
use yzh52521\EasyHttp\RequestException;
use yzh52521\EasyHttp\Http;
use support\Redis;
use support\View;
class File
{
public function check(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
if($key=='blank' || $id=='blank'){
return json(['code'=>509,'msg'=>'未登录']);
}
$path=$request->input('path','blank');
if($path=='blank'){
return json(['code'=>500,'msg'=>'缺少参数']);
}
$name=base64_encode($path);
$file=base_path().'/books/'.$name.'bin';
if(file_exists($file)){
return json(['code'=>200, 'msg'=>'找到文件', 'size'=>trans_byte(filesize($file))]);
}else {
return json(['code'=>201, 'msg'=>'未找到文件']);
}
}
public function download(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
if($key=='blank' || $id=='blank'){
return json(['code'=>509,'msg'=>'未登录']);
}
$path=$request->input('path','blank');
$auth=array('remix_userid'=>"$id",'remix_userkey'=>"$key",'siteLanguageV2'=>'zh','selectedSiteMode'=>'books');
$url=getenv('Zlibrary')."$path";
$get=Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,getenv('Zlibrary'));
$head=$get->head($url);
$size=round(($head->header('Content-Length')/1048576),2);
if($size>=30){
return json(['code'=>500,'msg'=>'文件太大了!']);
}
if($head->header('Content-Type')=='text/html; charset=UTF-8'){
return json(['code'=>404,'msg'=>'链接错误']);
}
$redis = Redis::connection('default');
$redis->hset('BookCache_'.base64_encode($path),'Time',time());
$redis->hset('BookCache_'.base64_encode($path),'Date',date("Y/m/d H:i:s"));
mkdir(base_path().'/books/'.date("Y/m/"),0777,true);
$filepath=base_path().'/books/'.date("Y/m/").$name.'bin';
$return=$get->get($url);
$file = fopen("$filepath","w");
}
}

View File

@ -0,0 +1,72 @@
<?php
namespace app\controller;
use Webman\Captcha\CaptchaBuilder;
use Respect\Validation\Validator as v;
use support\Request;
use yzh52521\EasyHttp\Response;
use yzh52521\EasyHttp\RequestException;
use yzh52521\EasyHttp\Http;
use support\Redis;
use support\View;
class File
{
public function check(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
if($key=='blank' || $id=='blank'){
return json(['code'=>509,'msg'=>'未登录']);
}
$path=$request->input('path','blank');
if($path=='blank'){
return json(['code'=>500,'msg'=>'缺少参数']);
}
$name=base64_encode($path);
$file=base_path().'/books/'.$name.'bin';
if(file_exists($file)){
return json(['code'=>200, 'msg'=>'找到文件', 'size'=>trans_byte(filesize($file))]);
}else {
return json(['code'=>201, 'msg'=>'未找到文件']);
}
}
public function download(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
if($key=='blank' || $id=='blank'){
return json(['code'=>509,'msg'=>'未登录']);
}
$path=$request->input('path','blank');
$auth=array('remix_userid'=>"$id",'remix_userkey'=>"$key",'siteLanguageV2'=>'zh','selectedSiteMode'=>'books');
$url=getenv('Zlibrary')."$path";
$get=Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,getenv('Zlibrary'));
$head=$get->head($url);
$size=round(($head->header('Content-Length')/1048576),2);
if($size>=30){
return json(['code'=>500,'msg'=>'文件太大了!']);
}
if($head->header('Content-Type')=='text/html; charset=UTF-8'){
return json(['code'=>404,'msg'=>'链接错误']);
}
$redis = Redis::connection('default');
$redis->hset('BookCache_'.$name,'Time',time());
$redis->hset('BookCache_'.$name,'Date',date("Y/m/d H:i:s"));
if(!is_dir(base_path().'/books/'.date("Y/m/"))){
mkdir(base_path().'/books/'.date("Y/m/"),0777,true);
}
$name=base64_encode($path);
$filepath=base_path().'/books/'.date("Y/m/").$name.'.bin';
$return=$get->get($url);
$file = fopen("$filepath","w");
fwrite($file,$return);
fclose($file);
$redis->hset('BookCache_'.$name,'Path',$filepath);
return json(['code'=>200]);
}
}

View File

@ -0,0 +1,74 @@
<?php
namespace app\controller;
use Webman\Captcha\CaptchaBuilder;
use Respect\Validation\Validator as v;
use support\Request;
use yzh52521\EasyHttp\Response;
use yzh52521\EasyHttp\RequestException;
use yzh52521\EasyHttp\Http;
use support\Redis;
use support\View;
class File
{
public function check(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
if($key=='blank' || $id=='blank'){
return json(['code'=>509,'msg'=>'未登录']);
}
$path=$request->input('path','blank');
if($path=='blank'){
return json(['code'=>500,'msg'=>'缺少参数']);
}
$name=base64_encode($path);
$file=base_path().'/books/'.$name.'bin';
if(file_exists($file)){
return json(['code'=>200, 'msg'=>'找到文件', 'size'=>trans_byte(filesize($file))]);
}else {
return json(['code'=>201, 'msg'=>'未找到文件']);
}
}
public function download(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
if($key=='blank' || $id=='blank'){
return json(['code'=>509,'msg'=>'未登录']);
}
$path=$request->input('path','blank');
$auth=array('remix_userid'=>"$id",'remix_userkey'=>"$key",'siteLanguageV2'=>'zh','selectedSiteMode'=>'books');
$url=getenv('Zlibrary')."$path";
$get=Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,getenv('Zlibrary'));
$head=$get->head($url);
$size=round(($head->header('Content-Length')/1048576),2);
if($size>=30){
return json(['code'=>500,'msg'=>'文件太大了!']);
}
if($head->header('Content-Type')=='text/html; charset=UTF-8'){
return json(['code'=>404,'msg'=>'链接错误']);
}
$redis = Redis::connection('default');
$redis->hset('BookCache_'.$name,'Time',time());
$redis->hset('BookCache_'.$name,'Date',date("Y/m/d H:i:s"));
if(!is_dir(base_path().'/books/'.date("Y/m/"))){
mkdir(base_path().'/books/'.date("Y/m/"),0777,true);
}
$name=base64_encode($path);
$filepath=base_path().'/books/'.date("Y/m/").$name.'.bin';
$return=$get->get($url);
$file = fopen("$filepath","w");
fwrite($file,$return);
fclose($file);
$redis->hset('BookCache_'.$name,'Path',$filepath);
$redis->hset('BookCache_'.$name,'Size',$size);
$redis->hset('BookCache_'.$name,'Status','OK');
return json(['code'=>200]);
}
}

View File

@ -0,0 +1,75 @@
<?php
namespace app\controller;
use Webman\Captcha\CaptchaBuilder;
use Respect\Validation\Validator as v;
use support\Request;
use yzh52521\EasyHttp\Response;
use yzh52521\EasyHttp\RequestException;
use yzh52521\EasyHttp\Http;
use support\Redis;
use support\View;
class File
{
public function check(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
if($key=='blank' || $id=='blank'){
return json(['code'=>509,'msg'=>'未登录']);
}
$path=$request->input('path','blank');
if($path=='blank'){
return json(['code'=>500,'msg'=>'缺少参数']);
}
$name=base64_encode($path);
$file=base_path().'/books/'.$name.'bin';
if(file_exists($file)){
return json(['code'=>200, 'msg'=>'找到文件', 'size'=>trans_byte(filesize($file))]);
}else {
return json(['code'=>201, 'msg'=>'未找到文件']);
}
}
public function download(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
if($key=='blank' || $id=='blank'){
return json(['code'=>509,'msg'=>'未登录']);
}
$path=$request->input('path','blank');
$auth=array('remix_userid'=>"$id",'remix_userkey'=>"$key",'siteLanguageV2'=>'zh','selectedSiteMode'=>'books');
$url=getenv('Zlibrary')."$path";
$get=Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,getenv('Zlibrary'));
$head=$get->head($url);
$size=round(($head->header('Content-Length')/1048576),2);
if($size>=30){
return json(['code'=>500,'msg'=>'文件太大了!']);
}
if($head->header('Content-Type')=='text/html; charset=UTF-8'){
return json(['code'=>404,'msg'=>'链接错误']);
}
$redis = Redis::connection('default');
$redis->hset('BookCache_'.$name,'Time',time());
$redis->hset('BookCache_'.$name,'Date',date("Y/m/d H:i:s"));
$redis->hset('BookCache_'.$name,'Status','Downloading');
if(!is_dir(base_path().'/books/'.date("Y/m/"))){
mkdir(base_path().'/books/'.date("Y/m/"),0777,true);
}
$name=base64_encode($path);
$filepath=base_path().'/books/'.date("Y/m/").$name.'.bin';
$return=$get->get($url);
$file = fopen("$filepath","w");
fwrite($file,$return);
fclose($file);
$redis->hset('BookCache_'.$name,'Path',$filepath);
$redis->hset('BookCache_'.$name,'Size',$size);
$redis->hset('BookCache_'.$name,'Status','OK');
return json(['code'=>200]);
}
}

View File

@ -0,0 +1,79 @@
<?php
namespace app\controller;
use Webman\Captcha\CaptchaBuilder;
use Respect\Validation\Validator as v;
use support\Request;
use yzh52521\EasyHttp\Response;
use yzh52521\EasyHttp\RequestException;
use yzh52521\EasyHttp\Http;
use support\Redis;
use support\View;
class File
{
public function check(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
if($key=='blank' || $id=='blank'){
return json(['code'=>509,'msg'=>'未登录']);
}
$path=$request->input('path','blank');
if($path=='blank'){
return json(['code'=>500,'msg'=>'缺少参数']);
}
$name=base64_encode($path);
$redis = Redis::connection('default');
$file=base_path().'/books/'.$name.'bin';
if($redis->exist('BookCache_'.$name)){
if($redis->hget('BookCache_'.$name,'Status')=='OK'){
return json(['code'=>200, 'msg'=>'找到文件', 'size'=>$redis->hget('BookCache_'.$name,'Size')]);
}else{
return json(['code'=>202,'msg'=>'文件下载中'])
}
}else {
return json(['code'=>201, 'msg'=>'未找到文件']);
}
}
public function download(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
if($key=='blank' || $id=='blank'){
return json(['code'=>509,'msg'=>'未登录']);
}
$path=$request->input('path','blank');
$auth=array('remix_userid'=>"$id",'remix_userkey'=>"$key",'siteLanguageV2'=>'zh','selectedSiteMode'=>'books');
$url=getenv('Zlibrary')."$path";
$get=Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,getenv('Zlibrary'));
$head=$get->head($url);
$size=round(($head->header('Content-Length')/1048576),2);
if($size>=30){
return json(['code'=>500,'msg'=>'文件太大了!']);
}
if($head->header('Content-Type')=='text/html; charset=UTF-8'){
return json(['code'=>404,'msg'=>'链接错误']);
}
$redis = Redis::connection('default');
$redis->hset('BookCache_'.$name,'Time',time());
$redis->hset('BookCache_'.$name,'Date',date("Y/m/d H:i:s"));
$redis->hset('BookCache_'.$name,'Status','Downloading');
if(!is_dir(base_path().'/books/'.date("Y/m/"))){
mkdir(base_path().'/books/'.date("Y/m/"),0777,true);
}
$name=base64_encode($path);
$filepath=base_path().'/books/'.date("Y/m/").$name.'.bin';
$return=$get->get($url);
$file = fopen("$filepath","w");
fwrite($file,$return);
fclose($file);
$redis->hset('BookCache_'.$name,'Path',$filepath);
$redis->hset('BookCache_'.$name,'Size',$size);
$redis->hset('BookCache_'.$name,'Status','OK');
return json(['code'=>200]);
}
}

View File

@ -0,0 +1,79 @@
<?php
namespace app\controller;
use Webman\Captcha\CaptchaBuilder;
use Respect\Validation\Validator as v;
use support\Request;
use yzh52521\EasyHttp\Response;
use yzh52521\EasyHttp\RequestException;
use yzh52521\EasyHttp\Http;
use support\Redis;
use support\View;
class File
{
public function check(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
if($key=='blank' || $id=='blank'){
return json(['code'=>509,'msg'=>'未登录']);
}
$path=$request->input('path','blank');
if($path=='blank'){
return json(['code'=>500,'msg'=>'缺少参数']);
}
$name=base64_encode($path);
$redis = Redis::connection('default');
$file=base_path().'/books/'.$name.'bin';
if($redis->exist('BookCache_'.$name)){
if($redis->hget('BookCache_'.$name,'Status')=='OK'){
return json(['code'=>200, 'msg'=>'找到文件', 'size'=>$redis->hget('BookCache_'.$name,'Size')]);
}else{
return json(['code'=>202,'msg'=>'文件下载中'])
}
}else {
return json(['code'=>201, 'msg'=>'未找到文件']);
}
}
public function download(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
if($key=='blank' || $id=='blank'){
return json(['code'=>509,'msg'=>'未登录']);
}
$path=$request->input('path','blank');
$auth=array('remix_userid'=>"$id",'remix_userkey'=>"$key",'siteLanguageV2'=>'zh','selectedSiteMode'=>'books');
$url=getenv('Zlibrary')."$path";
$get=Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,getenv('Zlibrary'));
$head=$get->head($url);
$size=round(($head->header('Content-Length')/1048576),2);
if($size>=30){
return json(['code'=>500,'msg'=>'文件太大了!']);
}
if($head->header('Content-Type')=='text/html; charset=UTF-8'){
return json(['code'=>404,'msg'=>'链接错误']);
}
$redis = Redis::connection('default');
$redis->hset('BookCache_'.$name,'Time',time());
$redis->hset('BookCache_'.$name,'Date',date("Y/m/d H:i:s"));
$redis->hset('BookCache_'.$name,'Status','Downloading');
if(!is_dir(base_path().'/books/'.date("Y/m/"))){
mkdir(base_path().'/books/'.date("Y/m/"),0777,true);
}
$name=base64_encode($path);
$filepath=base_path().'/books/'.date("Y/m/").$name.'.bin';
$return=$get->get($url);
$file = fopen("$filepath","w");
fwrite($file,$return);
fclose($file);
$redis->hset('BookCache_'.$name,'Path',$filepath);
$redis->hset('BookCache_'.$name,'Size',$size);
$redis->hset('BookCache_'.$name,'Status','OK');
return json(['code'=>200]);
}
}

View File

@ -0,0 +1,79 @@
<?php
namespace app\controller;
use Webman\Captcha\CaptchaBuilder;
use Respect\Validation\Validator as v;
use support\Request;
use yzh52521\EasyHttp\Response;
use yzh52521\EasyHttp\RequestException;
use yzh52521\EasyHttp\Http;
use support\Redis;
use support\View;
class File
{
public function check(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
if($key=='blank' || $id=='blank'){
return json(['code'=>509,'msg'=>'未登录']);
}
$path=$request->input('path','blank');
if($path=='blank'){
return json(['code'=>500,'msg'=>'缺少参数']);
}
$name=base64_encode($path);
$redis = Redis::connection('default');
$file=base_path().'/books/'.$name.'bin';
if($redis->exist('BookCache_'.$name)){
if($redis->hget('BookCache_'.$name,'Status')=='OK'){
return json(['code'=>200, 'msg'=>'找到文件', 'size'=>$redis->hget('BookCache_'.$name,'Size')]);
}else{
return json(['code'=>202,'msg'=>'文件下载中']);
}
}else {
return json(['code'=>201, 'msg'=>'未找到文件']);
}
}
public function download(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
if($key=='blank' || $id=='blank'){
return json(['code'=>509,'msg'=>'未登录']);
}
$path=$request->input('path','blank');
$auth=array('remix_userid'=>"$id",'remix_userkey'=>"$key",'siteLanguageV2'=>'zh','selectedSiteMode'=>'books');
$url=getenv('Zlibrary')."$path";
$get=Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,getenv('Zlibrary'));
$head=$get->head($url);
$size=round(($head->header('Content-Length')/1048576),2);
if($size>=30){
return json(['code'=>500,'msg'=>'文件太大了!']);
}
if($head->header('Content-Type')=='text/html; charset=UTF-8'){
return json(['code'=>404,'msg'=>'链接错误']);
}
$redis = Redis::connection('default');
$redis->hset('BookCache_'.$name,'Time',time());
$redis->hset('BookCache_'.$name,'Date',date("Y/m/d H:i:s"));
$redis->hset('BookCache_'.$name,'Status','Downloading');
if(!is_dir(base_path().'/books/'.date("Y/m/"))){
mkdir(base_path().'/books/'.date("Y/m/"),0777,true);
}
$name=base64_encode($path);
$filepath=base_path().'/books/'.date("Y/m/").$name.'.bin';
$return=$get->get($url);
$file = fopen("$filepath","w");
fwrite($file,$return);
fclose($file);
$redis->hset('BookCache_'.$name,'Path',$filepath);
$redis->hset('BookCache_'.$name,'Size',$size);
$redis->hset('BookCache_'.$name,'Status','OK');
return json(['code'=>200]);
}
}

View File

@ -0,0 +1,82 @@
<?php
namespace app\controller;
use Webman\Captcha\CaptchaBuilder;
use Respect\Validation\Validator as v;
use support\Request;
use yzh52521\EasyHttp\Response;
use yzh52521\EasyHttp\RequestException;
use yzh52521\EasyHttp\Http;
use support\Redis;
use support\View;
class File
{
public function check(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
$path=$request->input('path','blank');
if($key=='blank' || $id=='blank'){
return json(['code'=>509,'msg'=>'未登录或参数错误']);
}
$name=base64_encode($path);
$redis = Redis::connection('default');
$file=base_path().'/books/'.$name.'bin';
if($redis->exist('BookCache_'.$name)){
if($redis->hget('BookCache_'.$name,'Status')=='OK'){
return json(['code'=>200, 'msg'=>'找到文件', 'size'=>$redis->hget('BookCache_'.$name,'Size')]);
}else{
return json(['code'=>202,'msg'=>'文件下载中']);
}
}else {
return json(['code'=>201, 'msg'=>'未找到文件']);
}
}
public function download(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
$path=$request->input('path','blank');
if($key=='blank' || $id=='blank'){
return json(['code'=>509,'msg'=>'未登录或参数错误']);
}
$auth=array('remix_userid'=>"$id",'remix_userkey'=>"$key",'siteLanguageV2'=>'zh','selectedSiteMode'=>'books');
$url=getenv('Zlibrary')."$path";
$get=Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,getenv('Zlibrary'));
$head=$get->head($url);
$size=round(($head->header('Content-Length')/1048576),2);
if($size>=30){
return json(['code'=>500,'msg'=>'文件太大了!']);
}
if($head->header('Content-Type')=='text/html; charset=UTF-8'){
return json(['code'=>404,'msg'=>'链接错误']);
}
$redis = Redis::connection('default');
$redis->hset('BookCache_'.$name,'Time',time());
$redis->hset('BookCache_'.$name,'Date',date("Y/m/d H:i:s"));
$redis->hset('BookCache_'.$name,'Status','Downloading');
if(!is_dir(base_path().'/books/'.date("Y/m/"))){
mkdir(base_path().'/books/'.date("Y/m/"),0777,true);
}
$name=base64_encode($path);
$filepath=base_path().'/books/'.date("Y/m/").$name.'.bin';
$return=$get->get($url);
$file = fopen("$filepath","w");
fwrite($file,$return);
fclose($file);
$redis->hset('BookCache_'.$name,'Path',$filepath);
$redis->hset('BookCache_'.$name,'Size',$size);
$redis->hset('BookCache_'.$name,'Status','OK');
return json(['code'=>200]);
}
public function download(Request $request)
{
}
}

View File

@ -0,0 +1,97 @@
<?php
namespace app\controller;
use Webman\Captcha\CaptchaBuilder;
use Respect\Validation\Validator as v;
use support\Request;
use yzh52521\EasyHttp\Response;
use yzh52521\EasyHttp\RequestException;
use yzh52521\EasyHttp\Http;
use support\Redis;
use support\View;
class File
{
public function check(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
$path=$request->input('path','blank');
if($key=='blank' || $id=='blank'){
return json(['code'=>509,'msg'=>'未登录或参数错误']);
}
$name=base64_encode($path);
$redis = Redis::connection('default');
if($redis->exist('BookCache_'.$name)){
if($redis->hget('BookCache_'.$name,'Status')=='OK'){
return json(['code'=>200, 'msg'=>'找到文件', 'size'=>$redis->hget('BookCache_'.$name,'Size')]);
}else{
return json(['code'=>202,'msg'=>'文件下载中']);
}
}else {
return json(['code'=>201, 'msg'=>'未找到文件']);
}
}
public function download(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
$path=$request->input('path','blank');
if($key=='blank' || $id=='blank'){
return json(['code'=>509,'msg'=>'未登录或参数错误']);
}
$auth=array('remix_userid'=>"$id",'remix_userkey'=>"$key",'siteLanguageV2'=>'zh','selectedSiteMode'=>'books');
$url=getenv('Zlibrary')."$path";
$get=Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,getenv('Zlibrary'));
$head=$get->head($url);
$size=round(($head->header('Content-Length')/1048576),2);
if($size>=30){
return json(['code'=>500,'msg'=>'文件太大了!']);
}
if($head->header('Content-Type')=='text/html; charset=UTF-8'){
return json(['code'=>404,'msg'=>'链接错误']);
}
$redis = Redis::connection('default');
$name=base64_encode($path);
$redis->hset('BookCache_'.$name,'Time',time());
$redis->hset('BookCache_'.$name,'Date',date("Y/m/d H:i:s"));
$redis->hset('BookCache_'.$name,'Status','Downloading');
if(!is_dir(base_path().'/books/'.date("Y/m/"))){
mkdir(base_path().'/books/'.date("Y/m/"),0777,true);
}
$filepath=base_path().'/books/'.date("Y/m/").$name.'.bin';
$return=$get->get($url);
$file = fopen("$filepath","w");
fwrite($file,$return);
fclose($file);
$redis->hset('BookCache_'.$name,'Path',$filepath);
$redis->hset('BookCache_'.$name,'Size',$size);
$redis->hset('BookCache_'.$name,'Status','OK');
return json(['code'=>200]);
}
public function get(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
$path=$request->input('path','blank');
if($key=='blank' || $id=='blank'){
return json(['code'=>509,'msg'=>'未登录或参数错误']);
}
$redis = Redis::connection('default');
$name=base64_encode($path);
if($redis->exist('BookCache_'.$name)){
if($redis->hget('BookCache_'.$name,'Status')=='OK'){
return response()->download($redis->hget('BookCache_'.$name,'Path'));
}else{
return json(['code'=>202,'msg'=>'文件仍在下载中']);
}
}else {
return json(['code'=>201, 'msg'=>'未找到文件']);
}
}
}

View File

@ -0,0 +1,99 @@
<?php
namespace app\controller;
use Webman\Captcha\CaptchaBuilder;
use Respect\Validation\Validator as v;
use support\Request;
use yzh52521\EasyHttp\Response;
use yzh52521\EasyHttp\RequestException;
use yzh52521\EasyHttp\Http;
use support\Redis;
use support\View;
class File
{
public function check(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
$path=$request->input('path','blank');
if($key=='blank' || $id=='blank'){
return json(['code'=>509,'msg'=>'未登录或参数错误']);
}
$name=base64_encode($path);
$redis = Redis::connection('default');
if($redis->exist('BookCache_'.$name)){
if($redis->hget('BookCache_'.$name,'Status')=='OK'){
return json(['code'=>200, 'msg'=>'找到文件', 'size'=>$redis->hget('BookCache_'.$name,'Size')]);
}else{
return json(['code'=>202,'msg'=>'文件下载中']);
}
}else {
return json(['code'=>201, 'msg'=>'未找到文件']);
}
}
public function download(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
$path=$request->input('path','blank');
if($key=='blank' || $id=='blank'){
return json(['code'=>509,'msg'=>'未登录或参数错误']);
}
$auth=array('remix_userid'=>"$id",'remix_userkey'=>"$key",'siteLanguageV2'=>'zh','selectedSiteMode'=>'books');
$url=getenv('Zlibrary')."