diff --git a/app/Console/Commands/V2boardCache.php b/app/Console/Commands/V2boardCache.php index d296d701..7120ad10 100644 --- a/app/Console/Commands/V2boardCache.php +++ b/app/Console/Commands/V2boardCache.php @@ -8,7 +8,7 @@ use App\Models\Order; use App\Models\Server; use App\Models\ServerLog; use App\Utils\Helper; -use Illuminate\Support\Facades\Redis; +use Cache; class V2boardCache extends Command { @@ -48,7 +48,7 @@ class V2boardCache extends Command } private function setMonthIncome() { - Redis::set( + Cache::put( 'month_income', Order::where('created_at', '>=', strtotime(date('Y-m-1'))) ->where('created_at', '<', time()) @@ -58,7 +58,7 @@ class V2boardCache extends Command } private function setMonthRegisterTotal() { - Redis::set( + Cache::put( 'month_register_total', User::where('created_at', '>=', strtotime(date('Y-m-1'))) ->where('created_at', '<', time()) diff --git a/app/Http/Controllers/Admin/NoticeController.php b/app/Http/Controllers/Admin/NoticeController.php index 5162e109..4337ac31 100644 --- a/app/Http/Controllers/Admin/NoticeController.php +++ b/app/Http/Controllers/Admin/NoticeController.php @@ -6,7 +6,7 @@ use App\Http\Requests\Admin\NoticeSave; use Illuminate\Http\Request; use App\Http\Controllers\Controller; use App\Models\Notice; -use Illuminate\Support\Facades\Redis; +use Cache; class NoticeController extends Controller { diff --git a/app/Http/Controllers/Admin/ServerController.php b/app/Http/Controllers/Admin/ServerController.php index fc3f1ccc..d7c1bae0 100755 --- a/app/Http/Controllers/Admin/ServerController.php +++ b/app/Http/Controllers/Admin/ServerController.php @@ -10,7 +10,7 @@ use App\Models\ServerGroup; use App\Models\Server; use App\Models\Plan; use App\Models\User; -use Illuminate\Support\Facades\Redis; +use Cache; class ServerController extends Controller { @@ -22,9 +22,9 @@ class ServerController extends Controller } $server[$i]['group_id'] = json_decode($server[$i]['group_id']); if ($server[$i]['parent_id']) { - $server[$i]['last_check_at'] = Redis::get('server_last_check_at_' . $server[$i]['parent_id']); + $server[$i]['last_check_at'] = Cache::get('server_last_check_at_' . $server[$i]['parent_id']); } else { - $server[$i]['last_check_at'] = Redis::get('server_last_check_at_' . $server[$i]['id']); + $server[$i]['last_check_at'] = Cache::get('server_last_check_at_' . $server[$i]['id']); } } return response([ @@ -57,7 +57,7 @@ class ServerController extends Controller abort(500, '传输协议配置格式不正确'); } } - + if ($request->input('id')) { $server = Server::find($request->input('id')); if (!$server) { @@ -70,7 +70,7 @@ class ServerController extends Controller 'data' => true ]); } - + if (!Server::create($params)) { abort(500, '创建失败'); } @@ -79,7 +79,7 @@ class ServerController extends Controller 'data' => true ]); } - + public function groupFetch (Request $request) { if ($request->input('group_id')) { return response([ @@ -95,7 +95,7 @@ class ServerController extends Controller if (empty($request->input('name'))) { abort(500, '组名不能为空'); } - + if ($request->input('id')) { $serverGroup = ServerGroup::find($request->input('id')); } else { @@ -134,7 +134,7 @@ class ServerController extends Controller 'data' => $serverGroup->delete() ]); } - + public function drop (Request $request) { if ($request->input('id')) { $server = Server::find($request->input('id')); @@ -151,7 +151,7 @@ class ServerController extends Controller $params = $request->only([ 'show', ]); - + $server = Server::find($request->input('id')); if (!$server) { diff --git a/app/Http/Controllers/Admin/StatController.php b/app/Http/Controllers/Admin/StatController.php index 91b370eb..551bd5ee 100644 --- a/app/Http/Controllers/Admin/StatController.php +++ b/app/Http/Controllers/Admin/StatController.php @@ -10,22 +10,22 @@ use App\Models\Plan; use App\Models\User; use App\Models\Ticket; use App\Models\Order; -use Illuminate\Support\Facades\Redis; +use Cache; class StatController extends Controller { public function getOverride (Request $request) { return response([ 'data' => [ - 'month_income' => Redis::get('month_income'), - 'month_register_total' => Redis::get('month_register_total'), + 'month_income' => Cache::get('month_income'), + 'month_register_total' => Cache::get('month_register_total'), 'ticket_pendding_total' => Ticket::where('status', 0) ->count(), 'commission_pendding_total' => Order::where('commission_status', 0) ->where('invite_user_id', '!=', NULL) ->where('status', 3) ->count(), - + ] ]); } diff --git a/app/Http/Controllers/Guest/OrderController.php b/app/Http/Controllers/Guest/OrderController.php index 627c1899..588cdf27 100644 --- a/app/Http/Controllers/Guest/OrderController.php +++ b/app/Http/Controllers/Guest/OrderController.php @@ -7,7 +7,7 @@ use App\Http\Controllers\Controller; use App\Models\Order; use Omnipay\Omnipay; use Illuminate\Support\Facades\Log; -use Illuminate\Support\Facades\Redis; +use Cache; use Library\BitpayX; class OrderController extends Controller @@ -70,14 +70,14 @@ class OrderController extends Controller 'source' => $source['id'], ]); if ($charge['status'] == 'succeeded') { - $trade_no = Redis::get($source['id']); + $trade_no = Cache::get($source['id']); if (!$trade_no) { abort(500, 'redis is not found trade no by stripe source id'); } if (!$this->handle($trade_no, $source['id'])) { abort(500, 'fail'); } - Redis::del($source['id']); + Cache::forget($source['id']); die('success'); } break; diff --git a/app/Http/Controllers/OrderController.php b/app/Http/Controllers/OrderController.php index c6185e93..73187717 100755 --- a/app/Http/Controllers/OrderController.php +++ b/app/Http/Controllers/OrderController.php @@ -5,7 +5,7 @@ namespace App\Http\Controllers; use App\Http\Requests\OrderSave; use App\Http\Controllers\Controller; use Illuminate\Http\Request; -use Illuminate\Support\Facades\Redis; +use Cache; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\DB; use App\Models\Order; @@ -333,7 +333,7 @@ class OrderController extends Controller abort(500, '支付网关请求失败'); } - if (!Redis::set($source['id'], $order->trade_no)) { + if (!Cache::put($source['id'], $order->trade_no)) { abort(500, '订单创建失败'); } Redis::expire($source['id'], 3600); @@ -357,7 +357,7 @@ class OrderController extends Controller if (!$source['wechat']['qr_code_url']) { abort(500, '支付网关请求失败'); } - if (!Redis::set($source['id'], $order->trade_no)) { + if (!Cache::put($source['id'], $order->trade_no)) { abort(500, '订单创建失败'); } Redis::expire($source['id'], 3600); diff --git a/app/Http/Controllers/Passport/CommController.php b/app/Http/Controllers/Passport/CommController.php index 6ba09566..e50e0150 100644 --- a/app/Http/Controllers/Passport/CommController.php +++ b/app/Http/Controllers/Passport/CommController.php @@ -7,7 +7,7 @@ use Illuminate\Http\Request; use App\Http\Controllers\Controller; use Illuminate\Http\Exceptions\HttpResponseException; use Illuminate\Support\Facades\Mail; -use Illuminate\Support\Facades\Redis; +use Cache; class CommController extends Controller { @@ -29,7 +29,7 @@ class CommController extends Controller public function sendEmailVerify (CommSendEmailVerify $request) { $email = $request->input('email'); $redisKey = 'sendEmailVerify:' . $email; - if (Redis::get($redisKey)) { + if (Cache::get($redisKey)) { abort(500, '验证码已发送,请过一会在请求'); } $code = rand(100000, 999999); @@ -50,7 +50,7 @@ class CommController extends Controller abort(500, '发送失败'); } - Redis::set($redisKey, $code); + Cache::put($redisKey, $code); Redis::expire($redisKey, 600); return response([ 'data' => true diff --git a/app/Http/Controllers/Passport/ForgetController.php b/app/Http/Controllers/Passport/ForgetController.php index 6ea24c65..73ad06bb 100644 --- a/app/Http/Controllers/Passport/ForgetController.php +++ b/app/Http/Controllers/Passport/ForgetController.php @@ -7,13 +7,13 @@ use Illuminate\Http\Request; use App\Http\Controllers\Controller; use App\Models\User; use Illuminate\Support\Facades\Mail; -use Illuminate\Support\Facades\Redis; +use Cache; class ForgetController extends Controller { public function index (ForgetIndex $request) { $redisKey = 'sendEmailVerify:' . $request->input('email'); - if (Redis::get($redisKey) !== $request->input('email_code')) { + if (Cache::get($redisKey) !== $request->input('email_code')) { abort(500, '邮箱验证码有误'); } $user = User::where('email', $request->input('email'))->first(); @@ -21,7 +21,7 @@ class ForgetController extends Controller if (!$user->save()) { abort(500, '重置失败'); } - Redis::del($redisKey); + Cache::forget($redisKey); return response([ 'data' => true ]); diff --git a/app/Http/Controllers/Passport/LoginController.php b/app/Http/Controllers/Passport/LoginController.php index fb7bddf0..68695abe 100755 --- a/app/Http/Controllers/Passport/LoginController.php +++ b/app/Http/Controllers/Passport/LoginController.php @@ -6,7 +6,7 @@ use Illuminate\Http\Request; use App\Http\Requests\Passport\LoginIndex; use App\Http\Controllers\Controller; use App\Models\User; -use Illuminate\Support\Facades\Redis; +use Cache; use App\Utils\Helper; class LoginController extends Controller @@ -44,7 +44,7 @@ class LoginController extends Controller } $code = Helper::guid(); $key = 'token2Login_' . $code; - Redis::set($key, $user->id); + Cache::put($key, $user->id); Redis::expire($key, 600); $redirect = '/#/login?verify='. $code .'&redirect=' . ($request->input('redirect') ? $request->input('redirect') : 'dashboard'); if (config('v2board.app_url')) { @@ -57,7 +57,7 @@ class LoginController extends Controller if ($request->input('verify')) { $key = 'token2Login_' . $request->input('verify'); - $userId = Redis::get($key); + $userId = Cache::get($key); if (!$userId) { abort(500, '令牌有误'); } @@ -70,7 +70,7 @@ class LoginController extends Controller if ($user->is_admin) { $request->session()->put('is_admin', true); } - Redis::del($key); + Cache::forget($key); return response([ 'data' => true ]); diff --git a/app/Http/Controllers/Passport/RegisterController.php b/app/Http/Controllers/Passport/RegisterController.php index 551285d5..461ec64c 100755 --- a/app/Http/Controllers/Passport/RegisterController.php +++ b/app/Http/Controllers/Passport/RegisterController.php @@ -9,7 +9,7 @@ use App\Http\Controllers\Controller; use App\Models\User; use App\Models\Plan; use Illuminate\Http\Exceptions\HttpResponseException; -use Illuminate\Support\Facades\Redis; +use Cache; use App\Utils\Helper; use App\Models\InviteCode; @@ -33,7 +33,7 @@ class RegisterController extends Controller if (empty($request->input('email_code'))) { abort(500, '邮箱验证码不能为空'); } - if (Redis::get($redisKey) !== $request->input('email_code')) { + if (Cache::get($redisKey) !== $request->input('email_code')) { abort(500, '邮箱验证码有误'); } } @@ -80,7 +80,7 @@ class RegisterController extends Controller abort(500, '注册失败'); } if ((int)config('v2board.email_verify', 0)) { - Redis::del($redisKey); + Cache::forget($redisKey); } return response()->json([ 'data' => true diff --git a/app/Http/Controllers/Server/DeepbworkController.php b/app/Http/Controllers/Server/DeepbworkController.php index a26cef82..ea809817 100644 --- a/app/Http/Controllers/Server/DeepbworkController.php +++ b/app/Http/Controllers/Server/DeepbworkController.php @@ -9,7 +9,7 @@ use App\Models\Plan; use App\Models\Server; use App\Models\ServerLog; use Illuminate\Support\Facades\Log; -use Illuminate\Support\Facades\Redis; +use Cache; class DeepbworkController extends Controller { @@ -21,7 +21,7 @@ class DeepbworkController extends Controller if (!$server) { abort(500, 'fail'); } - Redis::set('server_last_check_at_' . $server->id, time()); + Cache::put('server_last_check_at_' . $server->id, time()); $users = User::whereIn('group_id', json_decode($server->group_id)) ->select([ 'id', diff --git a/app/Http/Controllers/ServerController.php b/app/Http/Controllers/ServerController.php index 14df02e4..37e9de99 100644 --- a/app/Http/Controllers/ServerController.php +++ b/app/Http/Controllers/ServerController.php @@ -3,7 +3,7 @@ namespace App\Http\Controllers; use Illuminate\Http\Request; -use Illuminate\Support\Facades\Redis; +use Cache; use App\Http\Controllers\Controller; use App\Models\Server; use App\Models\ServerLog; @@ -29,9 +29,9 @@ class ServerController extends Controller { for ($i = 0; $i < count($server); $i++) { $server[$i]['link'] = Helper::buildVmessLink($server[$i], $user); if ($server[$i]['parent_id']) { - $server[$i]['last_check_at'] = Redis::get('server_last_check_at_' . $server[$i]['parent_id']); + $server[$i]['last_check_at'] = Cache::get('server_last_check_at_' . $server[$i]['parent_id']); } else { - $server[$i]['last_check_at'] = Redis::get('server_last_check_at_' . $server[$i]['id']); + $server[$i]['last_check_at'] = Cache::get('server_last_check_at_' . $server[$i]['id']); } } return response([