diff --git a/.gitignore b/.gitignore
index b3da0af..4c49bd7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1 @@
.env
-.history
\ No newline at end of file
diff --git a/.history/.env_20230101172316 b/.history/.env_20230101172316
deleted file mode 100644
index e69de29..0000000
diff --git a/.history/.env_20230101172348 b/.history/.env_20230101172348
deleted file mode 100644
index 9d49f06..0000000
--- a/.history/.env_20230101172348
+++ /dev/null
@@ -1 +0,0 @@
-proxy = 45.150.224.46:19100
\ No newline at end of file
diff --git a/.history/.env_20230101173049 b/.history/.env_20230101173049
deleted file mode 100644
index 95b8119..0000000
--- a/.history/.env_20230101173049
+++ /dev/null
@@ -1 +0,0 @@
-proxy = 10.1.5.2:19100
\ No newline at end of file
diff --git a/.history/.env_20230101181726 b/.history/.env_20230101181726
deleted file mode 100644
index 4d71776..0000000
--- a/.history/.env_20230101181726
+++ /dev/null
@@ -1,5 +0,0 @@
-proxy = 10.1.5.2:19100
-redis.host = 121.228.166.201
-redis.password = qi2005112
-redis.port = 16379
-redis.database = 17
\ No newline at end of file
diff --git a/.history/.env_20230101182453 b/.history/.env_20230101182453
deleted file mode 100644
index 6bb6837..0000000
--- a/.history/.env_20230101182453
+++ /dev/null
@@ -1,5 +0,0 @@
-proxy = 10.1.5.2:19100
-redis.host = 121.228.166.201
-redis.password = Qi2005112!
-redis.port = 16379
-redis.database = 17
\ No newline at end of file
diff --git a/.history/.env_20230101182642 b/.history/.env_20230101182642
deleted file mode 100644
index 4e27d42..0000000
--- a/.history/.env_20230101182642
+++ /dev/null
@@ -1,5 +0,0 @@
-proxy = 10.1.5.2:19100
-redis.host = 121.228.166.201
-redispassword = Qi2005112!
-redis.port = 16379
-redis.database = 17
\ No newline at end of file
diff --git a/.history/.env_20230101182748 b/.history/.env_20230101182748
deleted file mode 100644
index f417c89..0000000
--- a/.history/.env_20230101182748
+++ /dev/null
@@ -1,5 +0,0 @@
-proxy=10.1.5.2:19100
-RedisHost=121.228.166.201
-RedisPassword=Qi2005112!
-RedisPort=16379
-RedisDatabase=17
\ No newline at end of file
diff --git a/.history/.env_20230101191643 b/.history/.env_20230101191643
deleted file mode 100644
index 6eee5bd..0000000
--- a/.history/.env_20230101191643
+++ /dev/null
@@ -1,7 +0,0 @@
-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/
\ No newline at end of file
diff --git a/.history/.env_20230101203601 b/.history/.env_20230101203601
deleted file mode 100644
index d8ca361..0000000
--- a/.history/.env_20230101203601
+++ /dev/null
@@ -1,8 +0,0 @@
-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
\ No newline at end of file
diff --git a/.history/.env_20230101205534 b/.history/.env_20230101205534
deleted file mode 100644
index a430489..0000000
--- a/.history/.env_20230101205534
+++ /dev/null
@@ -1,8 +0,0 @@
-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
\ No newline at end of file
diff --git a/.history/.env_20230101210425 b/.history/.env_20230101210425
deleted file mode 100644
index 0294260..0000000
--- a/.history/.env_20230101210425
+++ /dev/null
@@ -1,8 +0,0 @@
-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
\ No newline at end of file
diff --git a/.history/.env_20230101220200 b/.history/.env_20230101220200
deleted file mode 100644
index 59bd9cd..0000000
--- a/.history/.env_20230101220200
+++ /dev/null
@@ -1,8 +0,0 @@
-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
\ No newline at end of file
diff --git a/.history/.env_20230101220201 b/.history/.env_20230101220201
deleted file mode 100644
index 0294260..0000000
--- a/.history/.env_20230101220201
+++ /dev/null
@@ -1,8 +0,0 @@
-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
\ No newline at end of file
diff --git a/.history/.env_20230101231839.example b/.history/.env_20230101231839.example
deleted file mode 100644
index e69de29..0000000
diff --git a/.history/.env_20230101231841.example b/.history/.env_20230101231841.example
deleted file mode 100644
index 593161e..0000000
--- a/.history/.env_20230101231841.example
+++ /dev/null
@@ -1,15 +0,0 @@
-// 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 .
-
diff --git a/.history/.env_20230101232035.example b/.history/.env_20230101232035.example
deleted file mode 100644
index 63cf76e..0000000
--- a/.history/.env_20230101232035.example
+++ /dev/null
@@ -1,23 +0,0 @@
-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
-#无需更改
\ No newline at end of file
diff --git a/.history/.gitignore_20230101172312 b/.history/.gitignore_20230101172312
deleted file mode 100644
index e69de29..0000000
diff --git a/.history/.gitignore_20230101172323 b/.history/.gitignore_20230101172323
deleted file mode 100644
index 2eea525..0000000
--- a/.history/.gitignore_20230101172323
+++ /dev/null
@@ -1 +0,0 @@
-.env
\ No newline at end of file
diff --git a/.history/app/controller/File_20230102143247.php b/.history/app/controller/File_20230102143247.php
deleted file mode 100644
index e69de29..0000000
diff --git a/.history/app/controller/File_20230102143249.php b/.history/app/controller/File_20230102143249.php
deleted file mode 100644
index 593161e..0000000
--- a/.history/app/controller/File_20230102143249.php
+++ /dev/null
@@ -1,15 +0,0 @@
-// 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 .
-
diff --git a/.history/app/controller/File_20230102143332.php b/.history/app/controller/File_20230102143332.php
deleted file mode 100644
index b1aa211..0000000
--- a/.history/app/controller/File_20230102143332.php
+++ /dev/null
@@ -1,17 +0,0 @@
-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'=>'未找到文件']);
- }
- }
-}
\ No newline at end of file
diff --git a/.history/app/controller/File_20230102154544.php b/.history/app/controller/File_20230102154544.php
deleted file mode 100644
index ff74311..0000000
--- a/.history/app/controller/File_20230102154544.php
+++ /dev/null
@@ -1,36 +0,0 @@
-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'=>'未找到文件']);
- }
- }
-}
\ No newline at end of file
diff --git a/.history/app/controller/File_20230102165530.php b/.history/app/controller/File_20230102165530.php
deleted file mode 100644
index 795aa82..0000000
--- a/.history/app/controller/File_20230102165530.php
+++ /dev/null
@@ -1,56 +0,0 @@
-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'=>'链接错误']);
- }
-
-
-}
\ No newline at end of file
diff --git a/.history/app/controller/File_20230102170445.php b/.history/app/controller/File_20230102170445.php
deleted file mode 100644
index 6819b74..0000000
--- a/.history/app/controller/File_20230102170445.php
+++ /dev/null
@@ -1,56 +0,0 @@
-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'=>'链接错误']);
- }
-
-
-}
\ No newline at end of file
diff --git a/.history/app/controller/File_20230102171742.php b/.history/app/controller/File_20230102171742.php
deleted file mode 100644
index 63c00ea..0000000
--- a/.history/app/controller/File_20230102171742.php
+++ /dev/null
@@ -1,64 +0,0 @@
-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");
-
-
-}
\ No newline at end of file
diff --git a/.history/app/controller/File_20230102171809.php b/.history/app/controller/File_20230102171809.php
deleted file mode 100644
index ec3874e..0000000
--- a/.history/app/controller/File_20230102171809.php
+++ /dev/null
@@ -1,64 +0,0 @@
-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");
-
-
-}
\ No newline at end of file
diff --git a/.history/app/controller/File_20230102171818.php b/.history/app/controller/File_20230102171818.php
deleted file mode 100644
index a2e608f..0000000
--- a/.history/app/controller/File_20230102171818.php
+++ /dev/null
@@ -1,65 +0,0 @@
-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");
- }
-
-
-}
\ No newline at end of file
diff --git a/.history/app/controller/File_20230102172707.php b/.history/app/controller/File_20230102172707.php
deleted file mode 100644
index 032cb04..0000000
--- a/.history/app/controller/File_20230102172707.php
+++ /dev/null
@@ -1,72 +0,0 @@
-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]);
- }
-
-
-}
\ No newline at end of file
diff --git a/.history/app/controller/File_20230102172825.php b/.history/app/controller/File_20230102172825.php
deleted file mode 100644
index 176c691..0000000
--- a/.history/app/controller/File_20230102172825.php
+++ /dev/null
@@ -1,74 +0,0 @@
-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]);
- }
-
-
-}
\ No newline at end of file
diff --git a/.history/app/controller/File_20230102172833.php b/.history/app/controller/File_20230102172833.php
deleted file mode 100644
index 04238bb..0000000
--- a/.history/app/controller/File_20230102172833.php
+++ /dev/null
@@ -1,75 +0,0 @@
-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]);
- }
-
-
-}
\ No newline at end of file
diff --git a/.history/app/controller/File_20230102173122.php b/.history/app/controller/File_20230102173122.php
deleted file mode 100644
index e180cb2..0000000
--- a/.history/app/controller/File_20230102173122.php
+++ /dev/null
@@ -1,79 +0,0 @@
-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]);
- }
-
-
-}
\ No newline at end of file
diff --git a/.history/app/controller/File_20230102173124.php b/.history/app/controller/File_20230102173124.php
deleted file mode 100644
index 3fd3a7d..0000000
--- a/.history/app/controller/File_20230102173124.php
+++ /dev/null
@@ -1,79 +0,0 @@
-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]);
- }
-
-
-}
\ No newline at end of file
diff --git a/.history/app/controller/File_20230102173125.php b/.history/app/controller/File_20230102173125.php
deleted file mode 100644
index be1fc42..0000000
--- a/.history/app/controller/File_20230102173125.php
+++ /dev/null
@@ -1,79 +0,0 @@
-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]);
- }
-
-
-}
\ No newline at end of file
diff --git a/.history/app/controller/File_20230102173220.php b/.history/app/controller/File_20230102173220.php
deleted file mode 100644
index f09898c..0000000
--- a/.history/app/controller/File_20230102173220.php
+++ /dev/null
@@ -1,82 +0,0 @@
-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)
- {
-
-
-
- }
-
-
-}
\ No newline at end of file
diff --git a/.history/app/controller/File_20230102173627.php b/.history/app/controller/File_20230102173627.php
deleted file mode 100644
index 42a2301..0000000
--- a/.history/app/controller/File_20230102173627.php
+++ /dev/null
@@ -1,97 +0,0 @@
-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'=>'未找到文件']);
- }
-
- }
-
-
-}
\ No newline at end of file
diff --git a/.history/app/controller/File_20230102174259.php b/.history/app/controller/File_20230102174259.php
deleted file mode 100644
index 5ae6157..0000000
--- a/.history/app/controller/File_20230102174259.php
+++ /dev/null
@@ -1,99 +0,0 @@
-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'=>'未找到文件']);
- }
-
- }
-
-
-}
\ No newline at end of file
diff --git a/.history/app/controller/File_20230102174312.php b/.history/app/controller/File_20230102174312.php
deleted file mode 100644
index 218c033..0000000
--- a/.history/app/controller/File_20230102174312.php
+++ /dev/null
@@ -1,99 +0,0 @@
-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'=>'未找到文件']);
- }
-
- }
-
-
-}
\ No newline at end of file
diff --git a/.history/app/controller/File_20230102182057.php b/.history/app/controller/File_20230102182057.php
deleted file mode 100644
index acca18c..0000000
--- a/.history/app/controller/File_20230102182057.php
+++ /dev/null
@@ -1,99 +0,0 @@
-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'=>'未找到文件']);
- }
-
- }
-
-
-}
\ No newline at end of file
diff --git a/.history/app/controller/File_20230102183433.php b/.history/app/controller/File_20230102183433.php
deleted file mode 100644
index a939255..0000000
--- a/.history/app/controller/File_20230102183433.php
+++ /dev/null
@@ -1,99 +0,0 @@
-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'=>'未找到文件']);
- }
-
- }
-
-
-}
\ No newline at end of file
diff --git a/.history/app/controller/File_20230102184127.php b/.history/app/controller/File_20230102184127.php
deleted file mode 100644
index 70017c1..0000000
--- a/.history/app/controller/File_20230102184127.php
+++ /dev/null
@@ -1,99 +0,0 @@
-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'=>'未找到文件']);
- }
-
- }
-
-
-}
\ No newline at end of file
diff --git a/.history/app/controller/File_20230102184835.php b/.history/app/controller/File_20230102184835.php
deleted file mode 100644
index e23761b..0000000
--- a/.history/app/controller/File_20230102184835.php
+++ /dev/null
@@ -1,100 +0,0 @@
-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'=>'未找到文件']);
- }
-
- }
-
-
-}
\ No newline at end of file
diff --git a/.history/app/controller/File_20230102185014.php b/.history/app/controller/File_20230102185014.php
deleted file mode 100644
index fb69aca..0000000
--- a/.history/app/controller/File_20230102185014.php
+++ /dev/null
@@ -1,100 +0,0 @@
-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'=>'未找到文件']);
- }
-
- }
-
-
-}
\ No newline at end of file
diff --git a/.history/app/controller/File_20230102185148.php b/.history/app/controller/File_20230102185148.php
deleted file mode 100644
index 29f58df..0000000
--- a/.history/app/controller/File_20230102185148.php
+++ /dev/null
@@ -1,101 +0,0 @@
-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'=>'未找到文件']);
- }
-
- }
-
-
-}
\ No newline at end of file
diff --git a/.history/app/controller/File_20230102185322.php b/.history/app/controller/File_20230102185322.php
deleted file mode 100644
index 4beb65a..0000000
--- a/.history/app/controller/File_20230102185322.php
+++ /dev/null
@@ -1,101 +0,0 @@
-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'=>'未找到文件']);
- }
-
- }
-
-
-}
\ No newline at end of file
diff --git a/.history/app/controller/File_20230102185353.php b/.history/app/controller/File_20230102185353.php
deleted file mode 100644
index 3b651b4..0000000
--- a/.history/app/controller/File_20230102185353.php
+++ /dev/null
@@ -1,101 +0,0 @@
-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'=>'未找到文件']);
- }
-
- }
-
-
-}
\ No newline at end of file
diff --git a/.history/app/controller/File_20230102185511.php b/.history/app/controller/File_20230102185511.php
deleted file mode 100644
index b80049f..0000000
--- a/.history/app/controller/File_20230102185511.php
+++ /dev/null
@@ -1,100 +0,0 @@
-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'=>'未找到文件']);
- }
-
- }
-
-
-}
\ No newline at end of file
diff --git a/.history/app/controller/File_20230102185714.php b/.history/app/controller/File_20230102185714.php
deleted file mode 100644
index a716058..0000000
--- a/.history/app/controller/File_20230102185714.php
+++ /dev/null
@@ -1,100 +0,0 @@
-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'=>'未找到文件']);
- }
-
- }
-
-
-}
\ No newline at end of file
diff --git a/.history/app/controller/File_20230102190051.php b/.history/app/controller/File_20230102190051.php
deleted file mode 100644
index 2f4777d..0000000
--- a/.history/app/controller/File_20230102190051.php
+++ /dev/null
@@ -1,101 +0,0 @@
-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'=>'未找到文件']);
- }
-
- }
-
-
-}
\ No newline at end of file
diff --git a/.history/app/controller/IndexController_20221212162407.php b/.history/app/controller/IndexController_20221212162407.php
deleted file mode 100644
index 31e1c43..0000000
--- a/.history/app/controller/IndexController_20221212162407.php
+++ /dev/null
@@ -1,24 +0,0 @@
- 'webman']);
- }
-
- public function json(Request $request)
- {
- return json(['code' => 0, 'msg' => 'ok']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101173342.php b/.history/app/controller/IndexController_20230101173342.php
deleted file mode 100644
index 24c3cb6..0000000
--- a/.history/app/controller/IndexController_20230101173342.php
+++ /dev/null
@@ -1,24 +0,0 @@
- 0, 'msg' => 'ok']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101182420.php b/.history/app/controller/IndexController_20230101182420.php
deleted file mode 100644
index e29adc8..0000000
--- a/.history/app/controller/IndexController_20230101182420.php
+++ /dev/null
@@ -1,28 +0,0 @@
- 0, 'msg' => 'ok']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101183521.php b/.history/app/controller/IndexController_20230101183521.php
deleted file mode 100644
index 9fdbe0b..0000000
--- a/.history/app/controller/IndexController_20230101183521.php
+++ /dev/null
@@ -1,40 +0,0 @@
-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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101183610.php b/.history/app/controller/IndexController_20230101183610.php
deleted file mode 100644
index 4053b29..0000000
--- a/.history/app/controller/IndexController_20230101183610.php
+++ /dev/null
@@ -1,41 +0,0 @@
-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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101184256.php b/.history/app/controller/IndexController_20230101184256.php
deleted file mode 100644
index da161cd..0000000
--- a/.history/app/controller/IndexController_20230101184256.php
+++ /dev/null
@@ -1,42 +0,0 @@
-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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101190155.php b/.history/app/controller/IndexController_20230101190155.php
deleted file mode 100644
index a1249be..0000000
--- a/.history/app/controller/IndexController_20230101190155.php
+++ /dev/null
@@ -1,73 +0,0 @@
-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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101192447.php b/.history/app/controller/IndexController_20230101192447.php
deleted file mode 100644
index 264683e..0000000
--- a/.history/app/controller/IndexController_20230101192447.php
+++ /dev/null
@@ -1,82 +0,0 @@
-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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101192731.php b/.history/app/controller/IndexController_20230101192731.php
deleted file mode 100644
index ac15164..0000000
--- a/.history/app/controller/IndexController_20230101192731.php
+++ /dev/null
@@ -1,82 +0,0 @@
-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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101192934.php b/.history/app/controller/IndexController_20230101192934.php
deleted file mode 100644
index b76a1ee..0000000
--- a/.history/app/controller/IndexController_20230101192934.php
+++ /dev/null
@@ -1,85 +0,0 @@
-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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101193243.php b/.history/app/controller/IndexController_20230101193243.php
deleted file mode 100644
index 791f593..0000000
--- a/.history/app/controller/IndexController_20230101193243.php
+++ /dev/null
@@ -1,85 +0,0 @@
-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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101194651.php b/.history/app/controller/IndexController_20230101194651.php
deleted file mode 100644
index 1dfc16c..0000000
--- a/.history/app/controller/IndexController_20230101194651.php
+++ /dev/null
@@ -1,94 +0,0 @@
-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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101194656.php b/.history/app/controller/IndexController_20230101194656.php
deleted file mode 100644
index 83842fb..0000000
--- a/.history/app/controller/IndexController_20230101194656.php
+++ /dev/null
@@ -1,92 +0,0 @@
-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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101194904.php b/.history/app/controller/IndexController_20230101194904.php
deleted file mode 100644
index d8febbf..0000000
--- a/.history/app/controller/IndexController_20230101194904.php
+++ /dev/null
@@ -1,92 +0,0 @@
-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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101202315.php b/.history/app/controller/IndexController_20230101202315.php
deleted file mode 100644
index 75c4d6c..0000000
--- a/.history/app/controller/IndexController_20230101202315.php
+++ /dev/null
@@ -1,96 +0,0 @@
-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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101203357.php b/.history/app/controller/IndexController_20230101203357.php
deleted file mode 100644
index 3b18c1b..0000000
--- a/.history/app/controller/IndexController_20230101203357.php
+++ /dev/null
@@ -1,95 +0,0 @@
-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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101205503.php b/.history/app/controller/IndexController_20230101205503.php
deleted file mode 100644
index 8c225b3..0000000
--- a/.history/app/controller/IndexController_20230101205503.php
+++ /dev/null
@@ -1,96 +0,0 @@
-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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101205507.php b/.history/app/controller/IndexController_20230101205507.php
deleted file mode 100644
index 958c68a..0000000
--- a/.history/app/controller/IndexController_20230101205507.php
+++ /dev/null
@@ -1,96 +0,0 @@
-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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101205513.php b/.history/app/controller/IndexController_20230101205513.php
deleted file mode 100644
index 3562201..0000000
--- a/.history/app/controller/IndexController_20230101205513.php
+++ /dev/null
@@ -1,93 +0,0 @@
-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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101205522.php b/.history/app/controller/IndexController_20230101205522.php
deleted file mode 100644
index 454ab0f..0000000
--- a/.history/app/controller/IndexController_20230101205522.php
+++ /dev/null
@@ -1,93 +0,0 @@
-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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101205548.php b/.history/app/controller/IndexController_20230101205548.php
deleted file mode 100644
index 94b53ff..0000000
--- a/.history/app/controller/IndexController_20230101205548.php
+++ /dev/null
@@ -1,93 +0,0 @@
-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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101210439.php b/.history/app/controller/IndexController_20230101210439.php
deleted file mode 100644
index 2835907..0000000
--- a/.history/app/controller/IndexController_20230101210439.php
+++ /dev/null
@@ -1,97 +0,0 @@
-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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101210449.php b/.history/app/controller/IndexController_20230101210449.php
deleted file mode 100644
index 2d6a0d0..0000000
--- a/.history/app/controller/IndexController_20230101210449.php
+++ /dev/null
@@ -1,97 +0,0 @@
-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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101210659.php b/.history/app/controller/IndexController_20230101210659.php
deleted file mode 100644
index 49218ca..0000000
--- a/.history/app/controller/IndexController_20230101210659.php
+++ /dev/null
@@ -1,98 +0,0 @@
-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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101215122.php b/.history/app/controller/IndexController_20230101215122.php
deleted file mode 100644
index 30091cc..0000000
--- a/.history/app/controller/IndexController_20230101215122.php
+++ /dev/null
@@ -1,107 +0,0 @@
-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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101215326.php b/.history/app/controller/IndexController_20230101215326.php
deleted file mode 100644
index 65a31ed..0000000
--- a/.history/app/controller/IndexController_20230101215326.php
+++ /dev/null
@@ -1,110 +0,0 @@
-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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101215401.php b/.history/app/controller/IndexController_20230101215401.php
deleted file mode 100644
index bfea132..0000000
--- a/.history/app/controller/IndexController_20230101215401.php
+++ /dev/null
@@ -1,110 +0,0 @@
-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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101215431.php b/.history/app/controller/IndexController_20230101215431.php
deleted file mode 100644
index 96203aa..0000000
--- a/.history/app/controller/IndexController_20230101215431.php
+++ /dev/null
@@ -1,110 +0,0 @@
-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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101215457.php b/.history/app/controller/IndexController_20230101215457.php
deleted file mode 100644
index 1386c93..0000000
--- a/.history/app/controller/IndexController_20230101215457.php
+++ /dev/null
@@ -1,106 +0,0 @@
-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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101215743.php b/.history/app/controller/IndexController_20230101215743.php
deleted file mode 100644
index 562a297..0000000
--- a/.history/app/controller/IndexController_20230101215743.php
+++ /dev/null
@@ -1,106 +0,0 @@
-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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101220103.php b/.history/app/controller/IndexController_20230101220103.php
deleted file mode 100644
index 22de6d3..0000000
--- a/.history/app/controller/IndexController_20230101220103.php
+++ /dev/null
@@ -1,109 +0,0 @@
-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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101220342.php b/.history/app/controller/IndexController_20230101220342.php
deleted file mode 100644
index 193cb6e..0000000
--- a/.history/app/controller/IndexController_20230101220342.php
+++ /dev/null
@@ -1,109 +0,0 @@
-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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101220540.php b/.history/app/controller/IndexController_20230101220540.php
deleted file mode 100644
index 32e94ca..0000000
--- a/.history/app/controller/IndexController_20230101220540.php
+++ /dev/null
@@ -1,109 +0,0 @@
-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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101220542.php b/.history/app/controller/IndexController_20230101220542.php
deleted file mode 100644
index 6cf499a..0000000
--- a/.history/app/controller/IndexController_20230101220542.php
+++ /dev/null
@@ -1,109 +0,0 @@
-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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101221211.php b/.history/app/controller/IndexController_20230101221211.php
deleted file mode 100644
index 8aa5ad5..0000000
--- a/.history/app/controller/IndexController_20230101221211.php
+++ /dev/null
@@ -1,110 +0,0 @@
-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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101221246.php b/.history/app/controller/IndexController_20230101221246.php
deleted file mode 100644
index 648c1d2..0000000
--- a/.history/app/controller/IndexController_20230101221246.php
+++ /dev/null
@@ -1,110 +0,0 @@
-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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101221441.php b/.history/app/controller/IndexController_20230101221441.php
deleted file mode 100644
index 3c3d7cf..0000000
--- a/.history/app/controller/IndexController_20230101221441.php
+++ /dev/null
@@ -1,109 +0,0 @@
-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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101221736.php b/.history/app/controller/IndexController_20230101221736.php
deleted file mode 100644
index c65e103..0000000
--- a/.history/app/controller/IndexController_20230101221736.php
+++ /dev/null
@@ -1,109 +0,0 @@
-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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101222759.php b/.history/app/controller/IndexController_20230101222759.php
deleted file mode 100644
index 8f515e5..0000000
--- a/.history/app/controller/IndexController_20230101222759.php
+++ /dev/null
@@ -1,112 +0,0 @@
-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='
'.$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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101222959.php b/.history/app/controller/IndexController_20230101222959.php
deleted file mode 100644
index 03c180d..0000000
--- a/.history/app/controller/IndexController_20230101222959.php
+++ /dev/null
@@ -1,112 +0,0 @@
-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=''.$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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101223138.php b/.history/app/controller/IndexController_20230101223138.php
deleted file mode 100644
index c7c860c..0000000
--- a/.history/app/controller/IndexController_20230101223138.php
+++ /dev/null
@@ -1,113 +0,0 @@
-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=''.$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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101223213.php b/.history/app/controller/IndexController_20230101223213.php
deleted file mode 100644
index 85486fa..0000000
--- a/.history/app/controller/IndexController_20230101223213.php
+++ /dev/null
@@ -1,114 +0,0 @@
-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=''.$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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101223238.php b/.history/app/controller/IndexController_20230101223238.php
deleted file mode 100644
index 8f47a22..0000000
--- a/.history/app/controller/IndexController_20230101223238.php
+++ /dev/null
@@ -1,114 +0,0 @@
-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=''.$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']);
- }
-
-}
diff --git a/.history/app/controller/IndexController_20230101224226.php b/.history/app/controller/IndexController_20230101224226.php
deleted file mode 100644
index 99d11a9..0000000
--- a/.history/app/controller/IndexController_20230101224226.php
+++ /dev/null
@@ -1,123 +0,0 @@
-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= <<
-
-
- Zlibrary Proxy(v$ver) UserID:$id
[退出账号]
-
-