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')."$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);
$filerealname=explode('"',explode(";",$head->header('Content-Disposition'))[1])[1];
$redis->hset('BookCache_'.$name,'Path',$filepath);
$redis->hset('BookCache_'.$name,'Size',$size);
$redis->hset('BookCache_'.$name,'Name',$filerealname);
$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')."$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);
$filerealname=explode('"',explode(";",$head->header('Content-Disposition'))[1])[1];
$redis->hset('BookCache_'.$name,'Path',$filepath);
$redis->hset('BookCache_'.$name,'Size',$size);
$redis->hset('BookCache_'.$name,'Name',$filerealname);
$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'),$redis->hget('BookCache_'.$name,'Name'));
}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'),'name'=>$redis->hget('BookCache_'.$name,'Name')]);
}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);
$filerealname=explode('"',explode(";",$head->header('Content-Disposition'))[1])[1];
$redis->hset('BookCache_'.$name,'Path',$filepath);
$redis->hset('BookCache_'.$name,'Size',$size);
$redis->hset('BookCache_'.$name,'Name',$filerealname);
$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'),$redis->hget('BookCache_'.$name,'Name'));
}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'),'name'=>$redis->hget('BookCache_'.$name,'Name')]);
}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);
$filerealname=explode('"',explode(";",$head->header('Content-Disposition'))[1])[1];
$redis->hset('BookCache_'.$name,'Path',$filepath);
$redis->hset('BookCache_'.$name,'Size',$size);
$redis->hset('BookCache_'.$name,'Name',$filerealname);
$redis->hset('BookCache_'.$name,'Status','OK');
return json(['code'=>200,'name'=>"$filerealname",'size'=>"$size"]);
}
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'),$redis->hget('BookCache_'.$name,'Name'));
}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->exists('BookCache_'.$name)){
if($redis->hget('BookCache_'.$name,'Status')=='OK'){
return json(['code'=>200, 'msg'=>'找到文件', 'size'=>$redis->hget('BookCache_'.$name,'Size'),'name'=>$redis->hget('BookCache_'.$name,'Name')]);
}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);
$filerealname=explode('"',explode(";",$head->header('Content-Disposition'))[1])[1];
$redis->hset('BookCache_'.$name,'Path',$filepath);
$redis->hset('BookCache_'.$name,'Size',$size);
$redis->hset('BookCache_'.$name,'Name',$filerealname);
$redis->hset('BookCache_'.$name,'Status','OK');
return json(['code'=>200,'name'=>"$filerealname",'size'=>"$size"]);
}
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->exists('BookCache_'.$name)){
if($redis->hget('BookCache_'.$name,'Status')=='OK'){
return response()->download($redis->hget('BookCache_'.$name,'Path'),$redis->hget('BookCache_'.$name,'Name'));
}else{
return json(['code'=>202,'msg'=>'文件仍在下载中']);
}
}else {
return json(['code'=>201, 'msg'=>'未找到文件']);
}
}
}

View File

@ -0,0 +1,100 @@
<?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->exists('BookCache_'.$name)){
if($redis->hget('BookCache_'.$name,'Status')=='OK'){
return json(['code'=>200, 'msg'=>'找到文件', 'size'=>$redis->hget('BookCache_'.$name,'Size'),'name'=>$redis->hget('BookCache_'.$name,'Name')]);
}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);
echo($size);
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);
$filerealname=explode('"',explode(";",$head->header('Content-Disposition'))[1])[1];
$redis->hset('BookCache_'.$name,'Path',$filepath);
$redis->hset('BookCache_'.$name,'Size',$size);
$redis->hset('BookCache_'.$name,'Name',$filerealname);
$redis->hset('BookCache_'.$name,'Status','OK');
return json(['code'=>200,'name'=>"$filerealname",'size'=>"$size"]);
}
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->exists('BookCache_'.$name)){
if($redis->hget('BookCache_'.$name,'Status')=='OK'){
return response()->download($redis->hget('BookCache_'.$name,'Path'),$redis->hget('BookCache_'.$name,'Name'));
}else{
return json(['code'=>202,'msg'=>'文件仍在下载中']);
}
}else {
return json(['code'=>201, 'msg'=>'未找到文件']);
}
}
}

View File

@ -0,0 +1,100 @@
<?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->exists('BookCache_'.$name)){
if($redis->hget('BookCache_'.$name,'Status')=='OK'){
return json(['code'=>200, 'msg'=>'找到文件', 'size'=>$redis->hget('BookCache_'.$name,'Size'),'name'=>$redis->hget('BookCache_'.$name,'Name')]);
}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((number_format($head->header('Content-Length'))/1048576),2);
echo($size);
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);
$filerealname=explode('"',explode(";",$head->header('Content-Disposition'))[1])[1];
$redis->hset('BookCache_'.$name,'Path',$filepath);
$redis->hset('BookCache_'.$name,'Size',$size);
$redis->hset('BookCache_'.$name,'Name',$filerealname);
$redis->hset('BookCache_'.$name,'Status','OK');
return json(['code'=>200,'name'=>"$filerealname",'size'=>"$size"]);
}
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->exists('BookCache_'.$name)){
if($redis->hget('BookCache_'.$name,'Status')=='OK'){
return response()->download($redis->hget('BookCache_'.$name,'Path'),$redis->hget('BookCache_'.$name,'Name'));
}else{
return json(['code'=>202,'msg'=>'文件仍在下载中']);
}
}else {
return json(['code'=>201, 'msg'=>'未找到文件']);
}
}
}

View File

@ -0,0 +1,101 @@
<?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->exists('BookCache_'.$name)){
if($redis->hget('BookCache_'.$name,'Status')=='OK'){
return json(['code'=>200, 'msg'=>'找到文件', 'size'=>$redis->hget('BookCache_'.$name,'Size'),'name'=>$redis->hget('BookCache_'.$name,'Name')]);
}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);
$ContentLength=(int)$head->header('Content-Length');
$size=round(($ContentLength/1048576),2);
echo($size);
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);
$filerealname=explode('"',explode(";",$head->header('Content-Disposition'))[1])[1];
$redis->hset('BookCache_'.$name,'Path',$filepath);
$redis->hset('BookCache_'.$name,'Size',$size);
$redis->hset('BookCache_'.$name,'Name',$filerealname);
$redis->hset('BookCache_'.$name,'Status','OK');
return json(['code'=>200,'name'=>"$filerealname",'size'=>"$size"]);
}
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->exists('BookCache_'.$name)){
if($redis->hget('BookCache_'.$name,'Status')=='OK'){
return response()->download($redis->hget('BookCache_'.$name,'Path'),$redis->hget('BookCache_'.$name,'Name'));
}else{
return json(['code'=>202,'msg'=>'文件仍在下载中']);
}
}else {
return json(['code'=>201, 'msg'=>'未找到文件']);
}
}
}

View File

@ -0,0 +1,101 @@
<?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->exists('BookCache_'.$name)){
if($redis->hget('BookCache_'.$name,'Status')=='OK'){
return json(['code'=>200, 'msg'=>'找到文件', 'size'=>$redis->hget('BookCache_'.$name,'Size'),'name'=>$redis->hget('BookCache_'.$name,'Name')]);
}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";
echo($url);
$get=Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,getenv('Zlibrary'));
$head=$get->head($url);
$ContentLength=(int)$head->header('Content-Length');
$size=round(($ContentLength/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);
$filerealname=explode('"',explode(";",$head->header('Content-Disposition'))[1])[1];
$redis->hset('BookCache_'.$name,'Path',$filepath);
$redis->hset('BookCache_'.$name,'Size',$size);
$redis->hset('BookCache_'.$name,'Name',$filerealname);
$redis->hset('BookCache_'.$name,'Status','OK');
return json(['code'=>200,'name'=>"$filerealname",'size'=>"$size"]);
}
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->exists('BookCache_'.$name)){
if($redis->hget('BookCache_'.$name,'Status')=='OK'){
return response()->download($redis->hget('BookCache_'.$name,'Path'),$redis->hget('BookCache_'.$name,'Name'));
}else{
return json(['code'=>202,'msg'=>'文件仍在下载中']);
}
}else {
return json(['code'=>201, 'msg'=>'未找到文件']);
}
}
}

View File

@ -0,0 +1,101 @@
<?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->exists('BookCache_'.$name)){
if($redis->hget('BookCache_'.$name,'Status')=='OK'){
return json(['code'=>200, 'msg'=>'找到文件', 'size'=>$redis->hget('BookCache_'.$name,'Size'),'name'=>$redis->hget('BookCache_'.$name,'Name')]);
}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='http://'.getenv('Zlibrary')."$path";
echo($url);
$get=Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,getenv('Zlibrary'));
$head=$get->head($url);
$ContentLength=(int)$head->header('Content-Length');
$size=round(($ContentLength/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);
$filerealname=explode('"',explode(";",$head->header('Content-Disposition'))[1])[1];
$redis->hset('BookCache_'.$name,'Path',$filepath);
$redis->hset('BookCache_'.$name,'Size',$size);
$redis->hset('BookCache_'.$name,'Name',$filerealname);
$redis->hset('BookCache_'.$name,'Status','OK');
return json(['code'=>200,'name'=>"$filerealname",'size'=>"$size"]);
}
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->exists('BookCache_'.$name)){
if($redis->hget('BookCache_'.$name,'Status')=='OK'){
return response()->download($redis->hget('BookCache_'.$name,'Path'),$redis->hget('BookCache_'.$name,'Name'));
}else{
return json(['code'=>202,'msg'=>'文件仍在下载中']);
}
}else {
return json(['code'=>201, 'msg'=>'未找到文件']);
}
}
}

View File

@ -0,0 +1,100 @@
<?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->exists('BookCache_'.$name)){
if($redis->hget('BookCache_'.$name,'Status')=='OK'){
return json(['code'=>200, 'msg'=>'找到文件', 'size'=>$redis->hget('BookCache_'.$name,'Size'),'name'=>$redis->hget('BookCache_'.$name,'Name')]);
}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='http://'.getenv('Zlibrary')."$path";
$get=Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,getenv('Zlibrary'));
$head=$get->head($url);
$ContentLength=(int)$head->header('Content-Length');
$size=round(($ContentLength/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);
$filerealname=explode('"',explode(";",$head->header('Content-Disposition'))[1])[1];
$redis->hset('BookCache_'.$name,'Path',$filepath);
$redis->hset('BookCache_'.$name,'Size',$size);
$redis->hset('BookCache_'.$name,'Name',$filerealname);
$redis->hset('BookCache_'.$name,'Status','OK');
return json(['code'=>200,'name'=>"$filerealname",'size'=>"$size"]);
}
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->exists('BookCache_'.$name)){
if($redis->hget('BookCache_'.$name,'Status')=='OK'){
return response()->download($redis->hget('BookCache_'.$name,'Path'),$redis->hget('BookCache_'.$name,'Name'));
}else{
return json(['code'=>202,'msg'=>'文件仍在下载中']);
}
}else {
return json(['code'=>201, 'msg'=>'未找到文件']);
}
}
}

View File

@ -0,0 +1,100 @@
<?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->exists('BookCache_'.$name)){
if($redis->hget('BookCache_'.$name,'Status')=='OK'){
return json(['code'=>200, 'msg'=>'找到文件', 'size'=>$redis->hget('BookCache_'.$name,'Size'),'name'=>$redis->hget('BookCache_'.$name,'Name')]);
}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='http://'.getenv('Zlibrary')."$path";
$get=Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,getenv('Zlibrary'));
$head=$get->head($url);
$ContentLength=(int)$head->header('Content-Length');
$size=round(($ContentLength/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)->body();
$file = fopen("$filepath","w");
fwrite($file,$return);
fclose($file);
$filerealname=explode('"',explode(";",$head->header('Content-Disposition'))[1])[1];
$redis->hset('BookCache_'.$name,'Path',$filepath);
$redis->hset('BookCache_'.$name,'Size',$size);
$redis->hset('BookCache_'.$name,'Name',$filerealname);
$redis->hset('BookCache_'.$name,'Status','OK');
return json(['code'=>200,'name'=>"$filerealname",'size'=>"$size"]);
}
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->exists('BookCache_'.$name)){
if($redis->hget('BookCache_'.$name,'Status')=='OK'){
return response()->download($redis->hget('BookCache_'.$name,'Path'),$redis->hget('BookCache_'.$name,'Name'));
}else{
return json(['code'=>202,'msg'=>'文件仍在下载中']);
}
}else {
return json(['code'=>201, 'msg'=>'未找到文件']);
}
}
}

View File

@ -0,0 +1,101 @@
<?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->exists('BookCache_'.$name)){
if($redis->hget('BookCache_'.$name,'Status')=='OK'){
return json(['code'=>200, 'msg'=>'找到文件', 'size'=>$redis->hget('BookCache_'.$name,'Size'),'name'=>$redis->hget('BookCache_'.$name,'Name')]);
}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='http://'.getenv('Zlibrary')."$path";
$get=Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,getenv('Zlibrary'));
$head=$get->head($url);
$ContentLength=(int)$head->header('Content-Length');
$size=round(($ContentLength/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)->body();
$file = fopen("$filepath","w");
fwrite($file,$return);
fclose($file);
$filerealname=explode('"',explode(";",$head->header('Content-Disposition'))[1])[1];
$redis->hset('BookCache_'.$name,'Path',$filepath);
$redis->hset('BookCache_'.$name,'Size',$size);
$redis->hset('BookCache_'.$name,'Name',$filerealname);
$redis->hset('BookCache_'.$name,'Status','OK');
return json(['code'=>200,'name'=>"$filerealname",'size'=>"$size"]);
}
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->exists('BookCache_'.$name)){
if($redis->hget('BookCache_'.$name,'Status')=='OK'){
$redis->hset('BookCache_'.$name,'LastDown',time());
return response()->download($redis->hget('BookCache_'.$name,'Path'),$redis->hget('BookCache_'.$name,'Name'));
}else{
return json(['code'=>202,'msg'=>'文件仍在下载中']);
}
}else {
return json(['code'=>201, 'msg'=>'未找到文件']);
}
}
}

View File

@ -0,0 +1,24 @@
<?php
namespace app\controller;
use support\Request;
class IndexController
{
public function index(Request $request)
{
return response('hello webman');
}
public function view(Request $request)
{
return view('index/view', ['name' => 'webman']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,24 @@
<?php
namespace app\controller;
use support\Request;
class IndexController
{
public function index(Request $request)
{
return response('hello webman');
}
public function login(Request $request)
{
return view('login');
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace app\controller;
use support\Request;
class IndexController
{
public function index(Request $request)
{
return response('hello webman');
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
return view('login');
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace app\controller;
use support\Request;
class IndexController
{
public function index(Request $request)
{
return response('hello webman');
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
return view('login');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,41 @@
<?php
namespace app\controller;
use Webman\Captcha\CaptchaBuilder;
use support\Request;
class IndexController
{
public function index(Request $request)
{
return response('hello webman');
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
return view('login');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,42 @@
<?php
namespace app\controller;
use Webman\Captcha\CaptchaBuilder;
use Respect\Validation\Validator as v;
use support\Request;
class IndexController
{
public function index(Request $request)
{
return response('hello webman');
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
return view('login');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,73 @@
<?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;
class IndexController
{
public function index(Request $request)
{
return response('hello webman');
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('username','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
return view('login');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

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;
class IndexController
{
public function index(Request $request)
{
return response('hello webman');
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('username','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url=getenv('ZlibraryLogin').'rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
print_r($return);
return view('login');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

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;
class IndexController
{
public function index(Request $request)
{
return response('hello webman');
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url=getenv('ZlibraryLogin').'rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
print_r($return);
return view('login');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,85 @@
<?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;
class IndexController
{
public function index(Request $request)
{
return response('hello webman');
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url=getenv('ZlibraryLogin').'rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
print_r($return);
if(!empty($return->errors)){
return json(['code' => 502, 'msg' => '登陆失败:']);
}
return view('login');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,85 @@
<?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;
class IndexController
{
public function index(Request $request)
{
return response('hello webman');
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url=getenv('ZlibraryLogin').'rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
print_r($return);
if(isset($return->response->validationError)){
return json(['code' => 502, 'msg' => 'Zlib登陆失败:'.$return->response->message]);
}
return view('login');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,94 @@
<?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;
class IndexController
{
public function index(Request $request)
{
return response('hello webman');
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url=getenv('ZlibraryLogin').'rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
print_r($return);
if(isset($return->response->validationError)){
return json(['code' => 502, 'msg' => 'Zlib登陆失败:'.$return->response->message]);
}
$url=parse_url($return->response->params)['query'];
$queryParts = explode('&', $url);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return json(['code'=>200,'msg'=>'登陆成功','userid'=>$params['remix_userid']])->cookie('id', $params['remix_userid'],7200,'/')->cookie('key', $params['remix_userkey'],7200,'/');
return view('login');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,92 @@
<?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;
class IndexController
{
public function index(Request $request)
{
return response('hello webman');
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url=getenv('ZlibraryLogin').'rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
print_r($return);
if(isset($return->response->validationError)){
return json(['code' => 502, 'msg' => 'Zlib登陆失败:'.$return->response->message]);
}
$url=parse_url($return->response->params)['query'];
$queryParts = explode('&', $url);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return json(['code'=>200,'msg'=>'登陆成功','userid'=>$params['remix_userid']])->cookie('id', $params['remix_userid'],7200,'/')->cookie('key', $params['remix_userkey'],7200,'/');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,92 @@
<?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;
class IndexController
{
public function index(Request $request)
{
return response('hello webman');
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url=getenv('ZlibraryLogin').'rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
print_r($return);
if(isset($return->response->validationError)){
return json(['code' => 502, 'msg' => 'Zlib登陆失败:'.$return->response->message]);
}
$url=parse_url($return->response->params)['query'];
$queryParts = explode('&', $url);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return json(['code'=>200,'msg'=>'登陆成功','userid'=>$params['remix_userid']])->cookie('id', $params['remix_userid'],43200,'/')->cookie('key', $params['remix_userkey'],43200,'/');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,96 @@
<?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;
class IndexController
{
public function index(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
if($id=='blank' || $key='blank'){
return redirect('/login');
}
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url=getenv('ZlibraryLogin').'rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
print_r($return);
if(isset($return->response->validationError)){
return json(['code' => 502, 'msg' => 'Zlib登陆失败:'.$return->response->message]);
}
$url=parse_url($return->response->params)['query'];
$queryParts = explode('&', $url);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return json(['code'=>200,'msg'=>'登陆成功','userid'=>$params['remix_userid']])->cookie('id', $params['remix_userid'],43200,'/')->cookie('key', $params['remix_userkey'],43200,'/');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,95 @@
<?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;
class IndexController
{
public function index(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
if($id=='blank' || $key='blank'){
return redirect('/login');
}
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url=getenv('ZlibraryLogin').'rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
if(isset($return->response->validationError)){
return json(['code' => 502, 'msg' => 'Zlib登陆失败:'.$return->response->message]);
}
$url=parse_url($return->response->params)['query'];
$queryParts = explode('&', $url);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return json(['code'=>200,'msg'=>'登陆成功','userid'=>$params['remix_userid']])->cookie('id', $params['remix_userid'],43200,'/')->cookie('key', $params['remix_userkey'],43200,'/');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,96 @@
<?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;
class IndexController
{
public function index(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
$route=$request->get('route','/')
if($id=='blank' || $key='blank'){
return redirect('/login');
}
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url=getenv('ZlibraryLogin').'rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
if(isset($return->response->validationError)){
return json(['code' => 502, 'msg' => 'Zlib登陆失败:'.$return->response->message]);
}
$url=parse_url($return->response->params)['query'];
$queryParts = explode('&', $url);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return json(['code'=>200,'msg'=>'登陆成功','userid'=>$params['remix_userid']])->cookie('id', $params['remix_userid'],43200,'/')->cookie('key', $params['remix_userkey'],43200,'/');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,96 @@
<?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;
class IndexController
{
public function index(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
$route=$request->get('route','')
if($id=='blank' || $key='blank'){
return redirect('/login');
}
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url=getenv('ZlibraryLogin').'rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
if(isset($return->response->validationError)){
return json(['code' => 502, 'msg' => 'Zlib登陆失败:'.$return->response->message]);
}
$url=parse_url($return->response->params)['query'];
$queryParts = explode('&', $url);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return json(['code'=>200,'msg'=>'登陆成功','userid'=>$params['remix_userid']])->cookie('id', $params['remix_userid'],43200,'/')->cookie('key', $params['remix_userkey'],43200,'/');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,93 @@
<?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;
class IndexController
{
public function index(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
$route=$request->get('route','');
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url=getenv('ZlibraryLogin').'rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
if(isset($return->response->validationError)){
return json(['code' => 502, 'msg' => 'Zlib登陆失败:'.$return->response->message]);
}
$url=parse_url($return->response->params)['query'];
$queryParts = explode('&', $url);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return json(['code'=>200,'msg'=>'登陆成功','userid'=>$params['remix_userid']])->cookie('id', $params['remix_userid'],43200,'/')->cookie('key', $params['remix_userkey'],43200,'/');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,93 @@
<?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;
class IndexController
{
public function index(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
$route=$request->get('route','/');
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url=getenv('ZlibraryLogin').'rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
if(isset($return->response->validationError)){
return json(['code' => 502, 'msg' => 'Zlib登陆失败:'.$return->response->message]);
}
$url=parse_url($return->response->params)['query'];
$queryParts = explode('&', $url);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return json(['code'=>200,'msg'=>'登陆成功','userid'=>$params['remix_userid']])->cookie('id', $params['remix_userid'],43200,'/')->cookie('key', $params['remix_userkey'],43200,'/');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,93 @@
<?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;
class IndexController
{
public function index(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
$route=$request->get('route','/');
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url=getenv('ZlibraryLogin').'/rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
if(isset($return->response->validationError)){
return json(['code' => 502, 'msg' => 'Zlib登陆失败:'.$return->response->message]);
}
$url=parse_url($return->response->params)['query'];
$queryParts = explode('&', $url);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return json(['code'=>200,'msg'=>'登陆成功','userid'=>$params['remix_userid']])->cookie('id', $params['remix_userid'],43200,'/')->cookie('key', $params['remix_userkey'],43200,'/');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

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;
class IndexController
{
public function index(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
$route=$request->route;
$path=$route->getPath();
$url='http://'.getenv('ZlibraryLogin').$path;
$response = Http::withProxy('socks5h://'.getenv('proxy'))->get($url)
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url=getenv('ZlibraryLogin').'/rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
if(isset($return->response->validationError)){
return json(['code' => 502, 'msg' => 'Zlib登陆失败:'.$return->response->message]);
}
$url=parse_url($return->response->params)['query'];
$queryParts = explode('&', $url);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return json(['code'=>200,'msg'=>'登陆成功','userid'=>$params['remix_userid']])->cookie('id', $params['remix_userid'],43200,'/')->cookie('key', $params['remix_userkey'],43200,'/');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

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;
class IndexController
{
public function index(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
$route=$request->route;
$path=$route->getPath();
$url='http://'.getenv('ZlibraryLogin').$path;
$response = Http::withProxy('socks5h://'.getenv('proxy'))->get($url)
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url='http://'.getenv('ZlibraryLogin').'/rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
if(isset($return->response->validationError)){
return json(['code' => 502, 'msg' => 'Zlib登陆失败:'.$return->response->message]);
}
$url=parse_url($return->response->params)['query'];
$queryParts = explode('&', $url);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return json(['code'=>200,'msg'=>'登陆成功','userid'=>$params['remix_userid']])->cookie('id', $params['remix_userid'],43200,'/')->cookie('key', $params['remix_userkey'],43200,'/');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,98 @@
<?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;
class IndexController
{
public function index(Request $request)
{
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
$route=$request->route;
$path=$route->getPath();
$url='http://'.getenv('ZlibraryLogin').$path;
$auth=array('remix_userid'=>"$id",'remix_userkey'=>"$key",'siteLanguageV2'=>'zh');
$response = Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,'.'.getenv('ZlibraryLogin'))->get($url);
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url='http://'.getenv('ZlibraryLogin').'/rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
if(isset($return->response->validationError)){
return json(['code' => 502, 'msg' => 'Zlib登陆失败:'.$return->response->message]);
}
$url=parse_url($return->response->params)['query'];
$queryParts = explode('&', $url);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return json(['code'=>200,'msg'=>'登陆成功','userid'=>$params['remix_userid']])->cookie('id', $params['remix_userid'],43200,'/')->cookie('key', $params['remix_userkey'],43200,'/');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,107 @@
<?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;
class IndexController
{
public function index(Request $request)
{
$response = response();
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
$route=$request->route;
$path=$route->getPath();
$url='http://'.getenv('ZlibraryLogin').$path;
$auth=array('remix_userid'=>"$id",'remix_userkey'=>"$key",'siteLanguageV2'=>'zh');
$return = Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,'.'.getenv('ZlibraryLogin'))->get($url);
$response->withHeaders($return->headers());
/**
* if($return->header('Content-Type')[0]=='image/svg+xml'){
*}
*/
$response->withBody($return->body());
return $response;
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url='http://'.getenv('ZlibraryLogin').'/rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
if(isset($return->response->validationError)){
return json(['code' => 502, 'msg' => 'Zlib登陆失败:'.$return->response->message]);
}
$url=parse_url($return->response->params)['query'];
$queryParts = explode('&', $url);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return json(['code'=>200,'msg'=>'登陆成功','userid'=>$params['remix_userid']])->cookie('id', $params['remix_userid'],43200,'/')->cookie('key', $params['remix_userkey'],43200,'/');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,110 @@
<?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;
class IndexController
{
public function index(Request $request)
{
#$response = response();
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
$route=$request->route;
print_r($route);
return response('123');
$path=$route->getPath();
$url='http://'.getenv('ZlibraryLogin').$path;
$auth=array('remix_userid'=>"$id",'remix_userkey'=>"$key",'siteLanguageV2'=>'zh');
$return = Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,'.'.getenv('ZlibraryLogin'))->get($url);
$response->withHeaders($return->headers());
/**
* if($return->header('Content-Type')[0]=='image/svg+xml'){
*}
*/
$response->withBody($return->body());
return $response;
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url='http://'.getenv('ZlibraryLogin').'/rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
if(isset($return->response->validationError)){
return json(['code' => 502, 'msg' => 'Zlib登陆失败:'.$return->response->message]);
}
$url=parse_url($return->response->params)['query'];
$queryParts = explode('&', $url);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return json(['code'=>200,'msg'=>'登陆成功','userid'=>$params['remix_userid']])->cookie('id', $params['remix_userid'],43200,'/')->cookie('key', $params['remix_userkey'],43200,'/');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,110 @@
<?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;
class IndexController
{
public function index(Request $request)
{
#$response = response();
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
$route=$request->path();
print_r($route);
return response('123');
$path=$route->getPath();
$url='http://'.getenv('ZlibraryLogin').$path;
$auth=array('remix_userid'=>"$id",'remix_userkey'=>"$key",'siteLanguageV2'=>'zh');
$return = Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,'.'.getenv('ZlibraryLogin'))->get($url);
$response->withHeaders($return->headers());
/**
* if($return->header('Content-Type')[0]=='image/svg+xml'){
*}
*/
$response->withBody($return->body());
return $response;
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url='http://'.getenv('ZlibraryLogin').'/rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
if(isset($return->response->validationError)){
return json(['code' => 502, 'msg' => 'Zlib登陆失败:'.$return->response->message]);
}
$url=parse_url($return->response->params)['query'];
$queryParts = explode('&', $url);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return json(['code'=>200,'msg'=>'登陆成功','userid'=>$params['remix_userid']])->cookie('id', $params['remix_userid'],43200,'/')->cookie('key', $params['remix_userkey'],43200,'/');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,110 @@
<?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;
class IndexController
{
public function index(Request $request)
{
#$response = response();
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
$route=$request->uri();
print_r($route);
return response('123');
$path=$route->getPath();
$url='http://'.getenv('ZlibraryLogin').$path;
$auth=array('remix_userid'=>"$id",'remix_userkey'=>"$key",'siteLanguageV2'=>'zh');
$return = Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,'.'.getenv('ZlibraryLogin'))->get($url);
$response->withHeaders($return->headers());
/**
* if($return->header('Content-Type')[0]=='image/svg+xml'){
*}
*/
$response->withBody($return->body());
return $response;
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url='http://'.getenv('ZlibraryLogin').'/rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
if(isset($return->response->validationError)){
return json(['code' => 502, 'msg' => 'Zlib登陆失败:'.$return->response->message]);
}
$url=parse_url($return->response->params)['query'];
$queryParts = explode('&', $url);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return json(['code'=>200,'msg'=>'登陆成功','userid'=>$params['remix_userid']])->cookie('id', $params['remix_userid'],43200,'/')->cookie('key', $params['remix_userkey'],43200,'/');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,106 @@
<?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;
class IndexController
{
public function index(Request $request)
{
$response = response();
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
$path=$request->uri();
$url='http://'.getenv('ZlibraryLogin').$path;
$auth=array('remix_userid'=>"$id",'remix_userkey'=>"$key",'siteLanguageV2'=>'zh');
$return = Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,'.'.getenv('ZlibraryLogin'))->get($url);
$response->withHeaders($return->headers());
/**
* if($return->header('Content-Type')[0]=='image/svg+xml'){
*}
*/
$response->withBody($return->body());
return $response;
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url='http://'.getenv('ZlibraryLogin').'/rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
if(isset($return->response->validationError)){
return json(['code' => 502, 'msg' => 'Zlib登陆失败:'.$return->response->message]);
}
$url=parse_url($return->response->params)['query'];
$queryParts = explode('&', $url);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return json(['code'=>200,'msg'=>'登陆成功','userid'=>$params['remix_userid']])->cookie('id', $params['remix_userid'],43200,'/')->cookie('key', $params['remix_userkey'],43200,'/');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,106 @@
<?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;
class IndexController
{
public function index(Request $request)
{
$response = response();
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
$path=$request->uri();
$url='http://'.getenv('Zlibrary').$path;
$auth=array('remix_userid'=>"$id",'remix_userkey'=>"$key",'siteLanguageV2'=>'zh');
$return = Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,'.'.getenv('ZlibraryLogin'))->get($url);
$response->withHeaders($return->headers());
/**
* if($return->header('Content-Type')[0]=='image/svg+xml'){
*}
*/
$response->withBody($return->body());
return $response;
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url='http://'.getenv('ZlibraryLogin').'/rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
if(isset($return->response->validationError)){
return json(['code' => 502, 'msg' => 'Zlib登陆失败:'.$return->response->message]);
}
$url=parse_url($return->response->params)['query'];
$queryParts = explode('&', $url);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return json(['code'=>200,'msg'=>'登陆成功','userid'=>$params['remix_userid']])->cookie('id', $params['remix_userid'],43200,'/')->cookie('key', $params['remix_userkey'],43200,'/');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,109 @@
<?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;
class IndexController
{
public function index(Request $request)
{
$response = response();
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
$path=$request->uri();
if($path==''||$path=='/'){
$path='/?signAll=1&ts=1657';
}
$url='http://'.getenv('Zlibrary').$path;
$auth=array('remix_userid'=>"$id",'remix_userkey'=>"$key",'siteLanguageV2'=>'zh');
$return = Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,'.'.getenv('ZlibraryLogin'))->get($url);
$response->withHeaders($return->headers());
/**
* if($return->header('Content-Type')[0]=='image/svg+xml'){
*}
*/
$response->withBody($return->body());
return $response;
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url='http://'.getenv('ZlibraryLogin').'/rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
if(isset($return->response->validationError)){
return json(['code' => 502, 'msg' => 'Zlib登陆失败:'.$return->response->message]);
}
$url=parse_url($return->response->params)['query'];
$queryParts = explode('&', $url);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return json(['code'=>200,'msg'=>'登陆成功','userid'=>$params['remix_userid']])->cookie('id', $params['remix_userid'],43200,'/')->cookie('key', $params['remix_userkey'],43200,'/');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,109 @@
<?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;
class IndexController
{
public function index(Request $request)
{
$response = response();
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
$path=$request->uri();
if($path==''||$path=='/'){
$path='/?signAll=1&ts=1657';
}
$url='http://'.getenv('Zlibrary').$path;
$auth=array('remix_userid'=>"$id",'remix_userkey'=>"$key",'siteLanguageV2'=>'zh','selectedSiteMode'=>'books');
$return = Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,'.'.getenv('ZlibraryLogin'))->get($url);
$response->withHeaders($return->headers());
/**
* if($return->header('Content-Type')[0]=='image/svg+xml'){
*}
*/
$response->withBody($return->body());
return $response;
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url='http://'.getenv('ZlibraryLogin').'/rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
if(isset($return->response->validationError)){
return json(['code' => 502, 'msg' => 'Zlib登陆失败:'.$return->response->message]);
}
$url=parse_url($return->response->params)['query'];
$queryParts = explode('&', $url);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return json(['code'=>200,'msg'=>'登陆成功','userid'=>$params['remix_userid']])->cookie('id', $params['remix_userid'],43200,'/')->cookie('key', $params['remix_userkey'],43200,'/');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,109 @@
<?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;
class IndexController
{
public function index(Request $request)
{
$response = response();
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
$path=$request->uri();
if($path==''||$path=='/'){
$path='/?signAll=1&ts=1657';
}
$url='http://'.getenv('Zlibrary').$path;
$auth=array('remix_userid'=>"$id",'remix_userkey'=>"$key",'siteLanguageV2'=>'zh','selectedSiteMode'=>'books');
$return = Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,'.'.$request->host();)->get($url);
$response->withHeaders($return->headers());
/**
* if($return->header('Content-Type')[0]=='image/svg+xml'){
*}
*/
$response->withBody($return->body());
return $response;
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url='http://'.getenv('ZlibraryLogin').'/rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
if(isset($return->response->validationError)){
return json(['code' => 502, 'msg' => 'Zlib登陆失败:'.$return->response->message]);
}
$url=parse_url($return->response->params)['query'];
$queryParts = explode('&', $url);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return json(['code'=>200,'msg'=>'登陆成功','userid'=>$params['remix_userid']])->cookie('id', $params['remix_userid'],43200,'/')->cookie('key', $params['remix_userkey'],43200,'/');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,109 @@
<?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;
class IndexController
{
public function index(Request $request)
{
$response = response();
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
$path=$request->uri();
if($path==''||$path=='/'){
$path='/?signAll=1&ts=1657';
}
$url='http://'.getenv('Zlibrary').$path;
$auth=array('remix_userid'=>"$id",'remix_userkey'=>"$key",'siteLanguageV2'=>'zh','selectedSiteMode'=>'books');
$return = Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,'.'.$request->host())->get($url);
$response->withHeaders($return->headers());
/**
* if($return->header('Content-Type')[0]=='image/svg+xml'){
*}
*/
$response->withBody($return->body());
return $response;
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url='http://'.getenv('ZlibraryLogin').'/rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
if(isset($return->response->validationError)){
return json(['code' => 502, 'msg' => 'Zlib登陆失败:'.$return->response->message]);
}
$url=parse_url($return->response->params)['query'];
$queryParts = explode('&', $url);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return json(['code'=>200,'msg'=>'登陆成功','userid'=>$params['remix_userid']])->cookie('id', $params['remix_userid'],43200,'/')->cookie('key', $params['remix_userkey'],43200,'/');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,110 @@
<?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;
class IndexController
{
public function index(Request $request)
{
$response = response();
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
$path=$request->uri();
if($path==''||$path=='/'){
$path='/?signAll=1&ts=1657';
}
$url='http://'.getenv('Zlibrary').$path;
echo($url);
$auth=array('remix_userid'=>"$id",'remix_userkey'=>"$key",'siteLanguageV2'=>'zh','selectedSiteMode'=>'books');
$return = Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,'.'.$request->host())->get($url);
$response->withHeaders($return->headers());
/**
* if($return->header('Content-Type')[0]=='image/svg+xml'){
*}
*/
$response->withBody($return->body());
return $response;
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url='http://'.getenv('ZlibraryLogin').'/rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
if(isset($return->response->validationError)){
return json(['code' => 502, 'msg' => 'Zlib登陆失败:'.$return->response->message]);
}
$url=parse_url($return->response->params)['query'];
$queryParts = explode('&', $url);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return json(['code'=>200,'msg'=>'登陆成功','userid'=>$params['remix_userid']])->cookie('id', $params['remix_userid'],43200,'/')->cookie('key', $params['remix_userkey'],43200,'/');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,110 @@
<?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;
class IndexController
{
public function index(Request $request)
{
$response = response();
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
$path=$request->uri();
if($path==''||$path=='/'){
$path='/?signAll=1&ts=1657';
}
$url='http://'.getenv('Zlibrary').$path;
echo($url);
$auth=array('remix_userid'=>"$id",'remix_userkey'=>"$key",'siteLanguageV2'=>'zh','selectedSiteMode'=>'books');
$return = Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,'.'.getenv('Zlibrary'))->get($url);
$response->withHeaders($return->headers());
/**
* if($return->header('Content-Type')[0]=='image/svg+xml'){
*}
*/
$response->withBody($return->body());
return $response;
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url='http://'.getenv('ZlibraryLogin').'/rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
if(isset($return->response->validationError)){
return json(['code' => 502, 'msg' => 'Zlib登陆失败:'.$return->response->message]);
}
$url=parse_url($return->response->params)['query'];
$queryParts = explode('&', $url);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return json(['code'=>200,'msg'=>'登陆成功','userid'=>$params['remix_userid']])->cookie('id', $params['remix_userid'],43200,'/')->cookie('key', $params['remix_userkey'],43200,'/');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,109 @@
<?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;
class IndexController
{
public function index(Request $request)
{
$response = response();
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
$path=$request->uri();
if($path==''||$path=='/'){
$path='/?signAll=1&ts=1657';
}
$url='http://'.getenv('Zlibrary').$path;
$auth=array('remix_userid'=>"$id",'remix_userkey'=>"$key",'siteLanguageV2'=>'zh','selectedSiteMode'=>'books');
$return = Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,getenv('Zlibrary'))->withCookies($auth,getenv('ZlibraryLogin'))->get($url);
$response->withHeaders($return->headers());
/**
* if($return->header('Content-Type')[0]=='image/svg+xml'){
*}
*/
$response->withBody($return->body());
return $response;
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url='http://'.getenv('ZlibraryLogin').'/rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
if(isset($return->response->validationError)){
return json(['code' => 502, 'msg' => 'Zlib登陆失败:'.$return->response->message]);
}
$url=parse_url($return->response->params)['query'];
$queryParts = explode('&', $url);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return json(['code'=>200,'msg'=>'登陆成功','userid'=>$params['remix_userid']])->cookie('id', $params['remix_userid'],43200,'/')->cookie('key', $params['remix_userkey'],43200,'/');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,109 @@
<?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;
class IndexController
{
public function index(Request $request)
{
$response = response();
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
$path=$request->uri();
if($path==''||$path=='/'){
$path='/?signAll=1&ts=1657';
}
$url='http://'.getenv('Zlibrary').$path;
$auth=array('remix_userid'=>"$id",'remix_userkey'=>"$key",'siteLanguageV2'=>'zh','selectedSiteMode'=>'books');
$return = Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,getenv('Zlibrary'))->get($url);
$response->withHeaders($return->headers());
/**
* if($return->header('Content-Type')[0]=='image/svg+xml'){
*}
*/
$response->withBody($return->body());
return $response;
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url='http://'.getenv('ZlibraryLogin').'/rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
if(isset($return->response->validationError)){
return json(['code' => 502, 'msg' => 'Zlib登陆失败:'.$return->response->message]);
}
$url=parse_url($return->response->params)['query'];
$queryParts = explode('&', $url);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return json(['code'=>200,'msg'=>'登陆成功','userid'=>$params['remix_userid']])->cookie('id', $params['remix_userid'],43200,'/')->cookie('key', $params['remix_userkey'],43200,'/');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,112 @@
<?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;
class IndexController
{
public function index(Request $request)
{
$response = response();
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
$path=$request->uri();
if($path==''||$path=='/'){
$path='/?signAll=1&ts=1657';
}
$url='http://'.getenv('Zlibrary').$path;
$auth=array('remix_userid'=>"$id",'remix_userkey'=>"$key",'siteLanguageV2'=>'zh','selectedSiteMode'=>'books');
$return = Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,getenv('Zlibrary'))->get($url);
$response->withHeaders($return->headers());
$back=$return->body();
if($return->header('Content-Type')=='text/html; charset=utf-8'){
$back='<div><a href="/logout">退出</a></div>'.$back;
}
/**
* if($return->header('Content-Type')[0]=='image/svg+xml'){
*}
*/
$response->withBody($back);
return $response;
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url='http://'.getenv('ZlibraryLogin').'/rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
if(isset($return->response->validationError)){
return json(['code' => 502, 'msg' => 'Zlib登陆失败:'.$return->response->message]);
}
$url=parse_url($return->response->params)['query'];
$queryParts = explode('&', $url);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return json(['code'=>200,'msg'=>'登陆成功','userid'=>$params['remix_userid']])->cookie('id', $params['remix_userid'],43200,'/')->cookie('key', $params['remix_userkey'],43200,'/');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,112 @@
<?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;
class IndexController
{
public function index(Request $request)
{
$response = response();
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
$path=$request->uri();
if($path==''||$path=='/'){
$path='/?signAll=1&ts=1657';
}
$url='http://'.getenv('Zlibrary').$path;
$auth=array('remix_userid'=>"$id",'remix_userkey'=>"$key",'siteLanguageV2'=>'zh','selectedSiteMode'=>'books');
$return = Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,getenv('Zlibrary'))->get($url);
$response->withHeaders($return->headers());
$back=$return->body();
if($return->header('Content-Type')=='text/html; charset=utf-8'){
$back='<html><body><div><a href="/logout">退出</a></div></body></html>'.$back;
}
/**
* if($return->header('Content-Type')[0]=='image/svg+xml'){
*}
*/
$response->withBody($back);
return $response;
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url='http://'.getenv('ZlibraryLogin').'/rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
if(isset($return->response->validationError)){
return json(['code' => 502, 'msg' => 'Zlib登陆失败:'.$return->response->message]);
}
$url=parse_url($return->response->params)['query'];
$queryParts = explode('&', $url);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return json(['code'=>200,'msg'=>'登陆成功','userid'=>$params['remix_userid']])->cookie('id', $params['remix_userid'],43200,'/')->cookie('key', $params['remix_userkey'],43200,'/');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,113 @@
<?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;
class IndexController
{
public function index(Request $request)
{
$response = response();
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
$path=$request->uri();
if($path==''||$path=='/'){
$path='/?signAll=1&ts=1657';
}
$url='http://'.getenv('Zlibrary').$path;
$auth=array('remix_userid'=>"$id",'remix_userkey'=>"$key",'siteLanguageV2'=>'zh','selectedSiteMode'=>'books');
$return = Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,getenv('Zlibrary'))->get($url);
$response->withHeaders($return->headers());
$back=$return->body();
if($return->header('Content-Type')=='text/html; charset=utf-8'){
$back='<html><body><div><a href="/logout">退出</a></div></body></html>'.$back;
echo($back);
}
/**
* if($return->header('Content-Type')[0]=='image/svg+xml'){
*}
*/
$response->withBody($back);
return $response;
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url='http://'.getenv('ZlibraryLogin').'/rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
if(isset($return->response->validationError)){
return json(['code' => 502, 'msg' => 'Zlib登陆失败:'.$return->response->message]);
}
$url=parse_url($return->response->params)['query'];
$queryParts = explode('&', $url);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return json(['code'=>200,'msg'=>'登陆成功','userid'=>$params['remix_userid']])->cookie('id', $params['remix_userid'],43200,'/')->cookie('key', $params['remix_userkey'],43200,'/');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,114 @@
<?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;
class IndexController
{
public function index(Request $request)
{
$response = response();
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
$path=$request->uri();
if($path==''||$path=='/'){
$path='/?signAll=1&ts=1657';
}
$url='http://'.getenv('Zlibrary').$path;
$auth=array('remix_userid'=>"$id",'remix_userkey'=>"$key",'siteLanguageV2'=>'zh','selectedSiteMode'=>'books');
$return = Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,getenv('Zlibrary'))->get($url);
$response->withHeaders($return->headers());
$back=$return->body();
echo($return->header('Content-Type'));
if($return->header('Content-Type')=='text/html; charset=utf-8'){
$back='<html><body><div><a href="/logout">退出</a></div></body></html>'.$back;
echo($back);
}
/**
* if($return->header('Content-Type')[0]=='image/svg+xml'){
*}
*/
$response->withBody($back);
return $response;
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url='http://'.getenv('ZlibraryLogin').'/rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
if(isset($return->response->validationError)){
return json(['code' => 502, 'msg' => 'Zlib登陆失败:'.$return->response->message]);
}
$url=parse_url($return->response->params)['query'];
$queryParts = explode('&', $url);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return json(['code'=>200,'msg'=>'登陆成功','userid'=>$params['remix_userid']])->cookie('id', $params['remix_userid'],43200,'/')->cookie('key', $params['remix_userkey'],43200,'/');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,114 @@
<?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;
class IndexController
{
public function index(Request $request)
{
$response = response();
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
$path=$request->uri();
if($path==''||$path=='/'){
$path='/?signAll=1&ts=1657';
}
$url='http://'.getenv('Zlibrary').$path;
$auth=array('remix_userid'=>"$id",'remix_userkey'=>"$key",'siteLanguageV2'=>'zh','selectedSiteMode'=>'books');
$return = Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,getenv('Zlibrary'))->get($url);
$response->withHeaders($return->headers());
$back=$return->body();
echo($return->header('Content-Type'));
if($return->header('Content-Type')=='text/html; charset=UTF-8'){
$back='<html><body><div><a href="/logout">退出</a></div></body></html>'.$back;
echo($back);
}
/**
* if($return->header('Content-Type')[0]=='image/svg+xml'){
*}
*/
$response->withBody($back);
return $response;
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url='http://'.getenv('ZlibraryLogin').'/rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
if(isset($return->response->validationError)){
return json(['code' => 502, 'msg' => 'Zlib登陆失败:'.$return->response->message]);
}
$url=parse_url($return->response->params)['query'];
$queryParts = explode('&', $url);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return json(['code'=>200,'msg'=>'登陆成功','userid'=>$params['remix_userid']])->cookie('id', $params['remix_userid'],43200,'/')->cookie('key', $params['remix_userkey'],43200,'/');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,123 @@
<?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;
class IndexController
{
public function index(Request $request)
{
$response = response();
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
$path=$request->uri();
if($path==''||$path=='/'){
$path='/?signAll=1&ts=1657';
}
$url='http://'.getenv('Zlibrary').$path;
$auth=array('remix_userid'=>"$id",'remix_userkey'=>"$key",'siteLanguageV2'=>'zh','selectedSiteMode'=>'books');
$return = Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,getenv('Zlibrary'))->get($url);
$response->withHeaders($return->headers());
$back=$return->body();
echo($return->header('Content-Type'));
if($return->header('Content-Type')=='text/html; charset=UTF-8'){
$ver=getenv('version');
$front= <<<EOF
<html><body>
<center>
<div style="background-color: bisque;color: black;position:fixed!important;font-size:1.8rem;line-height:1.618;">
Zlibrary Proxy(v$ver) UserID:$id <a style="color: coral;" href="/login/logout">[退出账号]</a>
</div>
</center></body></html>
EOF;
$back=$front.$back;
echo($back);
}
/**
* if($return->header('Content-Type')[0]=='image/svg+xml'){
*}
*/
$response->withBody($back);
return $response;
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url='http://'.getenv('ZlibraryLogin').'/rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
if(isset($return->response->validationError)){
return json(['code' => 502, 'msg' => 'Zlib登陆失败:'.$return->response->message]);
}
$url=parse_url($return->response->params)['query'];
$queryParts = explode('&', $url);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return json(['code'=>200,'msg'=>'登陆成功','userid'=>$params['remix_userid']])->cookie('id', $params['remix_userid'],43200,'/')->cookie('key', $params['remix_userkey'],43200,'/');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,123 @@
<?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;
class IndexController
{
public function index(Request $request)
{
$response = response();
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
$path=$request->uri();
if($path==''||$path=='/'){
$path='/?signAll=1&ts=1657';
}
$url='http://'.getenv('Zlibrary').$path;
$auth=array('remix_userid'=>"$id",'remix_userkey'=>"$key",'siteLanguageV2'=>'zh','selectedSiteMode'=>'books');
$return = Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,getenv('Zlibrary'))->get($url);
$response->withHeaders($return->headers());
$back=$return->body();
echo($return->header('Content-Type'));
if($return->header('Content-Type')=='text/html; charset=UTF-8'){
$ver=getenv('version');
$front= <<<EOF
<html><body>
<center>
<div style="background-color: bisque;color: black;position:fixed!important;font-size:1.8rem;line-height:1.618;z-index:9999!important">
Zlibrary Proxy(v$ver) UserID:$id <a style="color: coral;" href="/login/logout">[退出账号]</a>
</div>
</center></body></html>
EOF;
$back=$front.$back;
echo($back);
}
/**
* if($return->header('Content-Type')[0]=='image/svg+xml'){
*}
*/
$response->withBody($back);
return $response;
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url='http://'.getenv('ZlibraryLogin').'/rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
if(isset($return->response->validationError)){
return json(['code' => 502, 'msg' => 'Zlib登陆失败:'.$return->response->message]);
}
$url=parse_url($return->response->params)['query'];
$queryParts = explode('&', $url);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return json(['code'=>200,'msg'=>'登陆成功','userid'=>$params['remix_userid']])->cookie('id', $params['remix_userid'],43200,'/')->cookie('key', $params['remix_userkey'],43200,'/');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,123 @@
<?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;
class IndexController
{
public function index(Request $request)
{
$response = response();
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
$path=$request->uri();
if($path==''||$path=='/'){
$path='/?signAll=1&ts=1657';
}
$url='http://'.getenv('Zlibrary').$path;
$auth=array('remix_userid'=>"$id",'remix_userkey'=>"$key",'siteLanguageV2'=>'zh','selectedSiteMode'=>'books');
$return = Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,getenv('Zlibrary'))->get($url);
$response->withHeaders($return->headers());
$back=$return->body();
echo($return->header('Content-Type'));
if($return->header('Content-Type')=='text/html; charset=UTF-8'){
$ver=getenv('version');
$front= <<<EOF
<html><body>
<center style="max-width:38em;padding:13px;">
<div style="background-color: bisque;color: black;position:fixed!important;font-size:1.8rem;line-height:1.618;z-index:9999!important;text-align:-webkit-center;">
Zlibrary Proxy(v$ver) UserID:$id <a style="color: coral;" href="/login/logout">[退出账号]</a>
</div>
</center></body></html>
EOF;
$back=$front.$back;
echo($back);
}
/**
* if($return->header('Content-Type')[0]=='image/svg+xml'){
*}
*/
$response->withBody($back);
return $response;
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url='http://'.getenv('ZlibraryLogin').'/rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
if(isset($return->response->validationError)){
return json(['code' => 502, 'msg' => 'Zlib登陆失败:'.$return->response->message]);
}
$url=parse_url($return->response->params)['query'];
$queryParts = explode('&', $url);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return json(['code'=>200,'msg'=>'登陆成功','userid'=>$params['remix_userid']])->cookie('id', $params['remix_userid'],43200,'/')->cookie('key', $params['remix_userkey'],43200,'/');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,123 @@
<?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;
class IndexController
{
public function index(Request $request)
{
$response = response();
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
$path=$request->uri();
if($path==''||$path=='/'){
$path='/?signAll=1&ts=1657';
}
$url='http://'.getenv('Zlibrary').$path;
$auth=array('remix_userid'=>"$id",'remix_userkey'=>"$key",'siteLanguageV2'=>'zh','selectedSiteMode'=>'books');
$return = Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,getenv('Zlibrary'))->get($url);
$response->withHeaders($return->headers());
$back=$return->body();
echo($return->header('Content-Type'));
if($return->header('Content-Type')=='text/html; charset=UTF-8'){
$ver=getenv('version');
$front= <<<EOF
<html><body>
<center>
<div style="background-color: bisque;color: black;position:fixed!important;font-size:1.8rem;line-height:1.618;z-index:9999!important;text-align:-webkit-center;">
Zlibrary Proxy(v$ver) UserID:$id <a style="color: coral;" href="/login/logout">[退出账号]</a>
</div>
</center></body></html>
EOF;
$back=$front.$back;
echo($back);
}
/**
* if($return->header('Content-Type')[0]=='image/svg+xml'){
*}
*/
$response->withBody($back);
return $response;
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url='http://'.getenv('ZlibraryLogin').'/rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
if(isset($return->response->validationError)){
return json(['code' => 502, 'msg' => 'Zlib登陆失败:'.$return->response->message]);
}
$url=parse_url($return->response->params)['query'];
$queryParts = explode('&', $url);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return json(['code'=>200,'msg'=>'登陆成功','userid'=>$params['remix_userid']])->cookie('id', $params['remix_userid'],43200,'/')->cookie('key', $params['remix_userkey'],43200,'/');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -0,0 +1,123 @@
<?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;
class IndexController
{
public function index(Request $request)
{
$response = response();
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
$path=$request->uri();
if($path==''||$path=='/'){
$path='/?signAll=1&ts=1657';
}
$url='http://'.getenv('Zlibrary').$path;
$auth=array('remix_userid'=>"$id",'remix_userkey'=>"$key",'siteLanguageV2'=>'zh','selectedSiteMode'=>'books');
$return = Http::withProxy('socks5h://'.getenv('proxy'))->withCookies($auth,getenv('Zlibrary'))->get($url);
$response->withHeaders($return->headers());
$back=$return->body();
echo($return->header('Content-Type'));
if($return->header('Content-Type')=='text/html; charset=UTF-8'){
$ver=getenv('version');
$front= <<<EOF
<html><body>
<center>
<div style="background-color: bisque;color: black;position:fixed!important;font-size:1.8rem;line-height:1.618;z-index:9999!important;text-align:-webkit-center;">
Zlibrary Proxy(v$ver) UserID:$id <a style="color: coral;" href="/login/logout">[退出账号]</a><a style="color: black;" href="//www.pmnet.gq" target="_blank_pmnet"> [PublicMirrorsNetwork]</a>
</div>
</center></body></html>
EOF;
$back=$front.$back;
echo($back);
}
/**
* if($return->header('Content-Type')[0]=='image/svg+xml'){
*}
*/
$response->withBody($back);
return $response;
}
public function login(Request $request)
{
return view('login');
}
public function check(Request $request)
{
$username=$request->post('name','blank');
$password=$request->post('password','blank');
$code=$request->post('code','blank');
if($username=='blank' || $password=='blank' || $code=='blank'){
return json(['code'=>500, 'msg'=>'缺少参数']);
}
try {
$V=v::Email()->setName('用户名')->check($username);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->setName('密码')->noWhitespace()->check($password);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
try {
$V=v::stringType()->length(5, 5)->setName('验证码')->noWhitespace()->check($code);
} catch (ValidationException $exception) {
return json(['code'=>500, 'msg'=>$exception->getMessage()]);
}
if (strtolower($code) !== $request->session()->get('captcha')) {
return json(['code' => 400, 'msg' => '输入的验证码不正确']);
}
$url='http://'.getenv('ZlibraryLogin').'/rpc.php';
$response = Http::withProxy('socks5h://'.getenv('proxy'))->post("$url", ['isModal' => true,'email'=>"$username",'password'=>"$password",'site_mode'=>'books','action'=>'login','redirectUrl'=>'','isSinglelogin'=>'1','isTorVersion'=>'1','gg_json_mode'=>'1']);
if(!$response->successful()){
return json(['code' => 501, 'msg' => '登陆失败,服务端错误']);
}
$return=$response->body();
$return=json_decode($return);
if(isset($return->response->validationError)){
return json(['code' => 502, 'msg' => 'Zlib登陆失败:'.$return->response->message]);
}
$url=parse_url($return->response->params)['query'];
$queryParts = explode('&', $url);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return json(['code'=>200,'msg'=>'登陆成功','userid'=>$params['remix_userid']])->cookie('id', $params['remix_userid'],43200,'/')->cookie('key', $params['remix_userkey'],43200,'/');
}
public function code(Request $request)
{
// 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

Some files were not shown because too many files have changed in this diff Show More