feature #8

Merged
XiaoLFeng merged 32 commits from feature into master 2023-06-29 13:25:35 +08:00
12 changed files with 603 additions and 35 deletions

View File

@ -0,0 +1,47 @@
name: Tests
on:
push:
branches:
- master
- '*.x'
pull_request:
schedule:
- cron: '0 0 * * *'
permissions:
contents: read
jobs:
tests:
runs-on: centos
strategy:
fail-fast: true
matrix:
php: [8.1, 8.2]
name: PHP
steps:
- name: 检查代码
uses: actions/checkout@v3
- name: 配置PHP
uses: XiaoLFeng/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite
coverage: none
- name: 安装PHP Composer依赖
run: composer install --prefer-dist --no-interaction --no-progress
- name: 复制配置文件
run: cp .env.example .env
- name: 生成应用程序密钥
run: php artisan key:generate
# - name: Execute tests
# run: /phpunit

View File

@ -13,16 +13,19 @@
use Illuminate\Contracts\View\Factory; use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View; use Illuminate\Contracts\View\View;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request; use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request as HttpRequest;
use Illuminate\Mail\Message; use Illuminate\Mail\Message;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Mail; use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Request;
use Illuminate\Support\Facades\Response; use Illuminate\Support\Facades\Response;
use Illuminate\Support\Facades\Validator; use Illuminate\Support\Facades\Validator;
class Link extends Controller class Link extends Controller
{ {
protected array $data; protected array $data;
private array $sendEmail;
public function __construct() public function __construct()
{ {
@ -30,7 +33,13 @@ public function __construct()
$this->data = $data->data; $this->data = $data->data;
} }
public function apiCustomAdd(Request $request): JsonResponse /**
* 添加友链API
*
* @param HttpRequest $request 获取HTTP中 Request 数据
* @return JsonResponse 返回JSON数据
*/
public function apiCustomAdd(HttpRequest $request): JsonResponse
{ {
/** @var array $returnData Json的 return 返回值 */ /** @var array $returnData Json的 return 返回值 */
/** @var Validator $dataCheck 数据判断 */ /** @var Validator $dataCheck 数据判断 */
@ -48,7 +57,7 @@ public function apiCustomAdd(Request $request): JsonResponse
'userRss' => 'string|regex:#[a-zA-z]+://[^\s]*#', 'userRss' => 'string|regex:#[a-zA-z]+://[^\s]*#',
'userLocation' => 'required|int', 'userLocation' => 'required|int',
'userSelColor' => 'required|int', 'userSelColor' => 'required|int',
'userRemark' => 'required|string', 'userRemark' => 'string',
]); ]);
// 检查发现错误 // 检查发现错误
@ -134,7 +143,13 @@ public function apiCustomAdd(Request $request): JsonResponse
return Response::json($returnData, $returnData['code']); return Response::json($returnData, $returnData['code']);
} }
public function apiCustomSearch(Request $request): JsonResponse /**
* 搜索友链数据
*
* @param HttpRequest $request 获取HTTP中 Request 数据
* @return JsonResponse 返回JSON数据
*/
public function apiCustomSearch(HttpRequest $request): JsonResponse
{ {
/** @var array $returnData Json的 return 返回值 */ /** @var array $returnData Json的 return 返回值 */
if (!empty($request->location_search)) { if (!empty($request->location_search)) {
@ -143,8 +158,8 @@ public function apiCustomSearch(Request $request): JsonResponse
->where([ ->where([
['blogName', 'LIKE', '%' . $request->location_search . '%', 'or'], ['blogName', 'LIKE', '%' . $request->location_search . '%', 'or'],
['blogUrl', 'LIKE', '%' . $request->location_search . '%', 'or'], ['blogUrl', 'LIKE', '%' . $request->location_search . '%', 'or'],
['blogOwnEmail', 'LIKE', '%' . $request->location_search . '%', 'or']]) ['blogOwnEmail', '=', $request->location_search, 'or']])
->select('blogName','blogUrl','blogDescription','blogIcon') ->select('id', 'blogName', 'blogUrl', 'blogDescription', 'blogIcon')
->orderBy('id') ->orderBy('id')
->get() ->get()
->toArray(); ->toArray();
@ -170,7 +185,7 @@ public function apiCustomSearch(Request $request): JsonResponse
if ($request->searchType == 'blogName') { if ($request->searchType == 'blogName') {
$resultData = DB::table('blog_link') $resultData = DB::table('blog_link')
->where([['blogName', 'LIKE', '%' . $request->location_search . '%']]) ->where([['blogName', 'LIKE', '%' . $request->location_search . '%']])
->select('blogName','blogUrl','blogDescription','blogIcon') ->select('id', 'blogName', 'blogUrl', 'blogDescription', 'blogIcon')
->orderBy('id') ->orderBy('id')
->get() ->get()
->toArray(); ->toArray();
@ -195,7 +210,7 @@ public function apiCustomSearch(Request $request): JsonResponse
} elseif ($request->searchType == 'blogUrl') { } elseif ($request->searchType == 'blogUrl') {
$resultData = DB::table('blog_link') $resultData = DB::table('blog_link')
->where([['blogUrl', 'LIKE', '%' . $request->location_search . '%']]) ->where([['blogUrl', 'LIKE', '%' . $request->location_search . '%']])
->select('blogName','blogUrl','blogDescription','blogIcon') ->select('id', 'blogName', 'blogUrl', 'blogDescription', 'blogIcon')
->orderBy('id') ->orderBy('id')
->get() ->get()
->toArray(); ->toArray();
@ -236,10 +251,190 @@ public function apiCustomSearch(Request $request): JsonResponse
], ],
]; ];
} }
return Response::json($returnData,$returnData['code']); return Response::json($returnData, $returnData['code']);
} }
protected function viewLink(Request $request): Factory|View|Application /**
* 检查数据验证是否正确
*
* @param HttpRequest $request 获取HTTP中 Request 数据
* @return JsonResponse 返回JSON数据
*/
public function apiCustomBlogCheck(HttpRequest $request): JsonResponse
{
/** @var array $returnData Json的 return 返回值 */
// 验证数据
$resultBlog = DB::table('blog_link')
->select('id', 'blogOwnEmail')
->find((int)$request->id);
if (!empty($resultBlog->id)) {
// 检查输入博客是否对应
if (!empty($resultBlog->blogOwnEmail)) {
if (strcmp($resultBlog->blogOwnEmail, $request->email) == 0) {
// 生成验证码(筛查内容)
$resultVerifyCode = DB::table('code')
->where([
['email', '=', $resultBlog->blogOwnEmail],
['type', '=', 'CODE-CUSTOM-CHECK'],
['time', '>', time()]])
->get()
->toArray();
// 不存在验证码,生成验证码并存入数据库中
if (empty($resultVerifyCode[0]->id)) {
// 生成6位数验证码
$verifyCode = null;
for ($i = 0; $i < 6; $i++)
$verifyCode .= rand(0, 9);
// 存入数据库
DB::table('code')
->insert([
'email' => $resultBlog->blogOwnEmail,
'code' => $verifyCode,
'type' => 'CODE-CUSTOM-CHECK',
'sendTime' => time(),
'time' => time()+900,
]);
// 数据整理
$this->sendEmail = [
'userEmail' => $resultBlog->blogOwnEmail,
'verifyCode' => $verifyCode,
'sendTime' => time(),
];
$this->apiCustomBlogCheckSendEmail();
$returnData = [
'output' => 'Success',
'code' => 200,
'data' => [
'message' => '发送成功',
],
];
} else {
// 存在验证码,检查验证码是否需要重新发送
$data = DB::table('code')
->where([
['email','=',$resultBlog->blogOwnEmail],
['type','=','CODE-CUSTOM-CHECK'],
['time','>',time()]])
->get()
->toArray();
$this->sendEmail = [
'userEmail' => $data[0]->email,
'verifyCode' => $data[0]->code,
'sendTime' => time(),
];
if ($resultVerifyCode[0]->sendTime < time()-60) {
// 发送验证码
DB::table('code')
->where([
['email','=',$resultBlog->blogOwnEmail],
['type','=','CODE-CUSTOM-CHECK'],
['time','>',time()]])
->update(['sendTime' => time()]);
$this->apiCustomBlogCheckSendEmail();
$returnData = [
'output' => 'Success',
'code' => 200,
'data' => [
'message' => '重新发送成功',
],
];
} else {
// 避免重复发送
$returnData = [
'output' => 'SendingTimeTooFast',
'code' => 403,
'data' => [
'message' => '邮件重新发送时间过快',
'data' => [
'time' => 60 - (time() - $resultVerifyCode[0]->sendTime),
],
],
];
}
}
} else {
$returnData = [
'output' => 'EmailMismatch',
'code' => 403,
'data' => [
'message' => '邮箱与对应ID不匹配',
],
];
}
} else {
$returnData = [
'output' => 'NoEmail',
'code' => 403,
'data' => [
'message' => '对应ID没有绑定邮箱请联系管理员',
],
];
}
} else {
$returnData = [
'output' => 'NoBlog',
'code' => 403,
'data' => [
'message' => '没有ID对应博客',
],
];
}
return Response::json($returnData, $returnData['code']);
}
/**
* 站长认证邮件发送模板
*
* @param array $data
* @return void
*/
private function apiCustomBlogCheckSendEmail(): void
{
// 验证通过发送邮件
Mail::send('mail.link-custom-check', $this->sendEmail, function (Message $mail) {
$mail->from(env('MAIL_USERNAME'), env('APP_NAME'));
$mail->to($this->sendEmail['userEmail']);
$mail->subject(env('APP_NAME') . '-验证码(友链自助修改)');
});
}
public function viewEditFriend($friendId): Application|Factory|View|RedirectResponse
{
// 检查内容是否为空
if (!empty($friendId)) {
$this->data['webSubTitle'] = '修改友链';
// 检查这个ID是否存在
$resultBlog = DB::table('blog_link')
->find($friendId);
if (!empty($resultBlog->id)) {
// 检查是否存在Cookie作为已验证
if (Request::hasCookie('friend_edit')) {
// 检查COOKIE与所验证ID是否匹配
if (password_verify($friendId, Request::cookie('friend_edit'))) {
return view('function.edit-friend', $this->data);
} else {
response()->withCookie(cookie('friend_edit', null, time() - 1));
return Response::redirectTo(route('function.edit-search'));
}
} else {
// 验证页面
// 加密用户邮箱
$this->data['blog'] = $resultBlog;
return view('function.edit-check', $this->data);
}
} else {
// 不存在这一个ID用户
return Response::redirectTo(route('function.edit-search'));
}
} else {
// ID为空的时候就返回数据
return Response::redirectTo(route('function.edit-search'));
}
}
protected function viewLink(HttpRequest $request): Factory|View|Application
{ {
$this->data['webSubTitle'] = '友链'; $this->data['webSubTitle'] = '友链';
$this->GetFriendsLink($this->data); $this->GetFriendsLink($this->data);
@ -266,16 +461,28 @@ protected function viewMakeFriend(): Factory|View|Application
return view('function.make-friend', $this->data); return view('function.make-friend', $this->data);
} }
protected function viewEditFriend(): Factory|View|Application
{
$this->data['webSubTitle'] = '修改友链';
return view('function.edit-friend', $this->data);
}
protected function viewSearchFriends(): Factory|View|Application protected function viewSearchFriends(): Factory|View|Application
{ {
$this->data['webSubTitle'] = '查询列表'; $this->data['webSubTitle'] = '查询列表';
return view('function.edit-search', $this->data); return view('function.edit-search', $this->data);
} }
protected function viewSearchFriend($friendId): Factory|View|Application|RedirectResponse
{
$this->data['webSubTitle'] = '查询列表';
if (!empty($friendId)) {
// 检查 friendId 是否存在
$resultBlog = DB::table('blog_link')
->select('id','blogOwnEmail')
->find($friendId);
if (!empty($resultBlog->id)) {
$this->data['blog'] = $resultBlog;
return view('function.edit-check', $this->data);
} else {
return Response::redirectTo(route('function.edit-search'));
}
} else {
return Response::redirectTo(route('function.edit-search'));
}
}
} }

View File

@ -0,0 +1,46 @@
<?php
/*
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
* 开发开源遵循 MIT 许可,若需商用请联系开发者
* https://www.x-lf.com/
*/
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCodeTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('code', function (Blueprint $table) {
$table->id()
->comment('自动ID');
$table->string('email',100)
->comment('邮箱');
$table->string('code',64)
->comment('验证码内容');
$table->string('type',40)
->comment('类型例如CODE-CUSTOM-CHECK');
$table->integer('sendTime')
->comment('发送时间');
$table->integer('time')
->comment('存储结束时间戳');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('code');
}
}

View File

@ -24,14 +24,14 @@
</include> </include>
</coverage> </coverage>
<php> <php>
<server name="APP_ENV" valueLink="testing"/> <env name="APP_ENV" value="testing"/>
<server name="BCRYPT_ROUNDS" valueLink="4"/> <env name="BCRYPT_ROUNDS" value="4"/>
<server name="CACHE_DRIVER" valueLink="array"/> <env name="CACHE_DRIVER" value="array"/>
<!-- <server name="DB_CONNECTION" valueLink="sqlite"/> --> <env name="DB_CONNECTION" value="sqlite"/>
<!-- <server name="DB_DATABASE" valueLink=":memory:"/> --> <env name="DB_DATABASE" value=":memory:"/>
<server name="MAIL_MAILER" valueLink="array"/> <env name="MAIL_MAILER" value="array"/>
<server name="QUEUE_CONNECTION" valueLink="sync"/> <env name="QUEUE_CONNECTION" value="sync"/>
<server name="SESSION_DRIVER" valueLink="array"/> <env name="SESSION_DRIVER" value="array"/>
<server name="TELESCOPE_ENABLED" valueLink="false"/> <env name="TELESCOPE_ENABLED" value="false"/>
</php> </php>
</phpunit> </phpunit>

View File

@ -172,7 +172,7 @@ class="w-16 h-16 p-1 rounded-full ring-2 ring-gray-300 dark:ring-gray-500 me-2 s
<select id="userSelColor" class="bg-gray-100 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"> <select id="userSelColor" class="bg-gray-100 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500">
<option>请选择一个颜色</option> <option>请选择一个颜色</option>
@if(empty($blogColor[0])) @if(empty($blogColor[0]))
<option><a href="{{ route('console.friends-link.color') }}">暂没有模块,点击添加模块</a></option> <option>暂没有模块,请去板块添加模块</option>
@else @else
@foreach($blogColor as $blogValue) @foreach($blogColor as $blogValue)
<option value="{{ $blogValue->id }}" @if($blog[0]->blogSetColor == $blogValue->id)selected @endif>{!! $blogValue->comment !!}</option> <option value="{{ $blogValue->id }}" @if($blog[0]->blogSetColor == $blogValue->id)selected @endif>{!! $blogValue->comment !!}</option>

View File

@ -0,0 +1,208 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="{{ asset('css/app.css') }}">
<link rel="stylesheet" href="{{ asset('css/flowbite.css') }}">
@include('modules.head')
{!! $webHeader !!}
</head>
<body>
<div class="bg-white">
@include('modules.navbar')
<div class="relative isolate px-6 lg:px-8">
<div class="absolute inset-x-0 -top-40 -z-10 transform-gpu overflow-hidden blur-3xl sm:-top-80"
aria-hidden="true">
<div
class="relative left-[calc(50%-11rem)] aspect-[1155/678] w-[36.125rem] -translate-x-1/2 rotate-[30deg] bg-gradient-to-tr from-[#ff80b5] to-[#9089fc] opacity-30 sm:left-[calc(50%-30rem)] sm:w-[72.1875rem]"
style="clip-path: polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)"></div>
</div>
<div class="mx-auto my-10 max-w-4xl py-8 sm:py-16 lg:py-16">
<form id="FormData" action="#" onsubmit="return false" method="POST">
<div class="flex">
<label for="location_search" class="mb-2 text-sm font-medium text-gray-900 sr-only dark:text-white">Your
Email</label>
<button id="dropdown-button-2" data-dropdown-toggle="dropdown-search-city"
class="flex-shrink-0 z-10 inline-flex items-center py-2.5 px-4 text-sm font-medium text-center text-gray-500 bg-gray-100 border border-gray-300 rounded-l-lg hover:bg-gray-200 focus:ring-4 focus:outline-none focus:ring-gray-100 dark:bg-gray-700 dark:hover:bg-gray-600 dark:focus:ring-gray-700 dark:text-white dark:border-gray-600"
type="button">
<span id="search-data">
<i class="bi bi-arrow-up-circle pe-1"></i>综合搜索
</span>
<svg aria-hidden="true" class="w-4 h-4 ml-1" fill="currentColor" viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd"
d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"
clip-rule="evenodd"></path>
</svg>
</button>
<div id="dropdown-search-city"
class="z-10 hidden bg-white divide-y divide-gray-100 rounded-lg shadow w-44 dark:bg-gray-700">
<ul class="py-2 text-sm text-gray-700 dark:text-gray-200" aria-labelledby="dropdown-button-2">
<li>
<button type="button" onclick="Search.Click(1)"
class="inline-flex w-full px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-600 dark:hover:text-white"
role="menuitem">
<div class="inline-flex items-center">
<i class="bi bi-1-circle pe-1"></i>博客名字
</div>
</button>
</li>
<li>
<button type="button" onclick="Search.Click(2)"
class="inline-flex w-full px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-600 dark:hover:text-white"
role="menuitem">
<div class="inline-flex items-center">
<i class="bi bi-2-circle pe-1"></i>博客地址
</div>
</button>
</li>
</ul>
</div>
<div class="relative w-full">
<input type="search" id="location_search" name="location_search"
class="block p-2.5 w-full z-20 text-sm text-gray-900 bg-gray-50 rounded-r-lg border-l-gray-50 border-l-2 border border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-l-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:border-blue-500"
placeholder="输入内容进行友链筛查" required>
<button onclick="Search.ajax()"
class="absolute top-0 right-0 p-2.5 text-sm font-medium text-white bg-blue-700 rounded-r-lg border border-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">
<i class="bi bi-search"></i>
<span class="sr-only">搜索</span>
</button>
</div>
</div>
<input id="searchType" type="number" class="hidden">
</form>
</div>
<div class="mx-auto my-10 max-w-4xl pb-8 sm:pb-16 lg:pb-16">
<div
class="col-span-10 lg:col-span-7 items-center justify-center rounded bg-gray-50 dark:bg-gray-800 shadow">
<div id="screen" class="px-10 py-5">
<h1 class="text-center mb-4 text-3xl font-extrabold leading-none tracking-tight text-gray-900 md:text-4xl lg:text-4xl dark:text-white mt-5">
在上方进行友链检索</h1>
<p class="mb-6 text-lg font-normal text-gray-500 lg:text-xl sm:px-16 xl:px-48 dark:text-gray-400 text-center">
选择内容输入博客名字、博客地址查询博客信息执行修改</p>
</div>
</div>
</div>
<div class="mb-20"></div>
<div
class="absolute inset-x-0 top-[calc(100%-13rem)] -z-10 transform-gpu overflow-hidden blur-3xl sm:top-[calc(100%-30rem)]"
aria-hidden="true">
<div
class="relative left-[calc(50%+3rem)] aspect-[1155/678] w-[36.125rem] -translate-x-1/2 bg-gradient-to-tr from-[#ff80b5] to-[#9089fc] opacity-30 sm:left-[calc(50%+36rem)] sm:w-[72.1875rem]"
style="clip-path: polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)"></div>
</div>
@include('modules.footer')
</div>
</div>
<!-- Toast -->
<div id="toast"
class="z-[9999] fixed top-5 left-5 hidden items-center w-full max-w-xs p-4 space-x-4 text-gray-500 bg-white divide-x divide-gray-200 rounded-lg shadow dark:text-gray-400 dark:divide-gray-700 space-x dark:bg-gray-800"
role="alert">
<div class="pl-4 text-sm font-normal">
<span id="toast-icon" class="pe-1"><i class="bi bi-info-circle text-blue-500"></i></span>
<span id="toast-info">Message sent successfully.</span>
</div>
</div>
</body>
<script src="{{ asset('js/app.js') }}"></script>
<script src="{{ asset('js/jquery.js') }}"></script>
<script type="text/javascript">
class Search {
static searchType = 'all';
static Click(type) {
if (type === 1) {
$('#search-data').html('<i class="bi bi-1-circle pe-1"></i>博客名字');
this.searchType = 'blogName';
} else if (type === 2) {
$('#search-data').html('<i class="bi bi-2-circle pe-1"></i>博客地址');
this.searchType = 'blogUrl';
}
}
static ajax() {
$.ajax({
async: true,
method: "GET",
data: $('#FormData').serialize(),
url: '{{ route('api.link.custom.search') }}?searchType=' + this.searchType,
dataType: "json",
beforeSend: function () {
$('#screen').html('<div class="text-center"><div role="status"><svg aria-hidden="true" class="inline w-8 h-8 mr-2 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="currentColor"/> <path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentFill"/></svg><span class="sr-only">Loading...</span></div></div>')
},
success: function (returnData) {
if (returnData.output === "Success") {
Toast.toggle('查找完毕', '<i class="bi bi-check-circle text-green-500"></i>');
let html;
html = '<ul class="divide-y divide-gray-200 dark:divide-gray-700">';
for (const value of returnData.data.data) {
html = html +
'<li class="py-3 sm:py-4">' +
'<div class="flex items-center space-x-4"> ' +
'<div class="flex-shrink-0"> ' +
'<img id="Lazy" class="w-10 h-10 rounded-full" src="' + value.blogIcon + '" data-src="' + value.blogIcon + '" alt="Neil image"> ' +
'</div> ' +
'<div class="flex-1 min-w-0"> ' +
'<p class="text-sm font-bold text-gray-900 truncate dark:text-white"> ' + value.blogName + ' </p>' +
'<p class="text-sm text-gray-400 truncate dark:text-gray-300">' +
'<a href="' + value.blogUrl + '" target="_blank"> ' + value.blogDescription + ' </a>' +
'</p>' +
'</div>' +
'<div onclick="Search.model(' + value.id + ')" type="button" class="inline-flex items-center text-base font-semibold text-gray-900 dark:text-white"> ' +
'<div type="button" class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm w-full sm:w-auto px-3 py-2 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">' +
'<i class="bi bi-pencil"></i>' +
'<span class="ps-1">编辑</span>' +
'</div>' +
'</a>' +
'</div>' +
'</li>'
}
html = html + '</ul>';
$('#screen').html(html);
const script = document.createElement('script');
script.type = 'text/javascript';
script.src = '{{ asset('js/jquery.js') }}';
// 添加<script>元素到页面中
document.head.appendChild(script);
} else if (returnData.output === "NoData") {
Toast.toggle('查找完毕', '<i class="bi bi-check-circle text-green-500"></i>');
$('#screen').html('<h1 class="text-center mb-4 text-3xl font-extrabold leading-none tracking-tight text-gray-900 md:text-4xl lg:text-4xl dark:text-white mt-5">没有数据</h1> <p class="mb-6 text-lg font-normal text-gray-500 lg:text-xl sm:px-16 xl:px-48 dark:text-gray-400 text-center">根据您筛查内容没有筛查到数据</p>');
} else {
Toast.toggle('未知错误', '<i class="bi bi-x-circle text-red-500"></i>');
}
},
error: function (returnData) {
if (returnData.responseJSON.output === "SearchEmpty") {
Toast.toggle('输入内容为空', '<i class="bi bi-x-circle text-red-500"></i>');
$('#screen').html('<h1 class="text-center mb-4 text-3xl font-extrabold leading-none tracking-tight text-gray-900 md:text-4xl lg:text-4xl dark:text-white mt-5">在上方进行友链检索</h1> <p class="mb-6 text-lg font-normal text-gray-500 lg:text-xl sm:px-16 xl:px-48 dark:text-gray-400 text-center">选择内容输入博客名字、博客地址查询博客信息执行修改</p>');
}
}
});
}
static model(friendId) {
location.href = '{{ route('function.edit-searchOnly','') }}/' + friendId;
}
}
class Toast {
static toggle(data, icon) {
this.set(data, icon);
$('#toast').fadeIn(300);
setTimeout(function () {
$('#toast').fadeOut(300);
}, 3000);
}
static set(data, icon) {
$('#toast-icon').html(icon);
$('#toast-info').text(data);
}
}
</script>
{!! $webFooter !!}
</html>

View File

@ -296,8 +296,10 @@ function ajax() {
dataType: "json", dataType: "json",
success: function (returnData) { success: function (returnData) {
if (returnData.output === "Success") { if (returnData.output === "Success") {
Toast.toggle('友链申请成功','<i class="bi bi-check-circle text-green-500"></i>'); Toast.toggle('友链申请成功,即将跳转','<i class="bi bi-check-circle text-green-500"></i>');
location.href = '{{ route('home') }}' setTimeout(function () {
location.href = '{{ route('function.link') }}';
},3000);
} else { } else {
Toast('未知错误','<i class="bi bi-x-circle text-red-500"></i>'); Toast('未知错误','<i class="bi bi-x-circle text-red-500"></i>');
} }

View File

@ -7,7 +7,7 @@
</head> </head>
<table align="center" border="0" cellpadding="0" cellspacing="0" width="600" style="border-collapse: collapse;border: 1px solid #cccccc;box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175)"> <table align="center" border="0" cellpadding="0" cellspacing="0" width="600" style="border-collapse: collapse;border: 1px solid #cccccc;box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175)">
<tr> <tr>
<td align="center" bgcolor="#70bbd9" style="padding: 30px 0 30px 0; font-size: 30px;">$G_TitleName</td> <td align="center" bgcolor="#70bbd9" style="padding: 30px 0 30px 0; font-size: 30px;"><b>{{ env('APP_NAME') }}</b></td>
</tr> </tr>
<tr> <tr>
<td> <td>
@ -26,7 +26,8 @@
<td style="padding: 0px 5px 5px 0px;color: #000000; font-family: Arial, sans-serif; font-size: 16px;"> <td style="padding: 0px 5px 5px 0px;color: #000000; font-family: Arial, sans-serif; font-size: 16px;">
您好 <a style="text-decoration: none;color: #198754;" href="{{ $userUrl }}"><b>{{ $userBlog }}</b></a> 的站长:<b>{{ $userEmail }}</b><br/> 您好 <a style="text-decoration: none;color: #198754;" href="{{ $userUrl }}"><b>{{ $userBlog }}</b></a> 的站长:<b>{{ $userEmail }}</b><br/>
您在本博客(<a style="text-decoration: none;color: #198754;" href="{{ env('APP_BLOG') }}">{{ env('APP_NAME') }}</a>)申请了友链<br/> 您在本博客(<a style="text-decoration: none;color: #198754;" href="{{ env('APP_BLOG') }}">{{ env('APP_NAME') }}</a>)申请了友链<br/>
<hr style="padding: 0px 5px 5px 0px;"/> 邮件为通知您您已成功申请友链,需等待站长进行审核,我们将在审核完毕后再次发送邮件通知您
<hr/>
请在确认一次您的信息是否正确:<br/> 请在确认一次您的信息是否正确:<br/>
<ul> <ul>
<li>博主邮箱:{{ $userEmail }}</li> <li>博主邮箱:{{ $userEmail }}</li>
@ -34,8 +35,8 @@
<li>贵站地址:{{ $userUrl }}</li> <li>贵站地址:{{ $userUrl }}</li>
<li>图片地址:{{ $userIcon }}</li> <li>图片地址:{{ $userIcon }}</li>
<li>贵站介绍:{{ $userDescription }}</li> <li>贵站介绍:{{ $userDescription }}</li>
<li>备注内容:{{ $userRemark }}</li> @if(!empty($userRemark))<li>备注内容:{{ $userRemark }}</li> @endif
<li>RSS地址{{ $userRSS }}</li> @if(!empty($checkRssJudge))<li>RSS地址{{ $userRSS }}</li> @endif
</ul> </ul>
</td> </td>
</tr> </tr>

View File

@ -0,0 +1,54 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Mail</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>
<table align="center" border="0" cellpadding="0" cellspacing="0" width="600" style="border-collapse: collapse;border: 1px solid #cccccc;box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175)">
<tr>
<td align="center" bgcolor="#70bbd9" style="padding: 30px 0 30px 0; font-size: 30px;"><b>{{ env('APP_NAME') }}</b></td>
</tr>
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="padding: 30px 30px 30px 30px;">
<tr>
<td style="padding: 10px 0px 30px 0px;color: #08212b; font-family: Arial, sans-serif; font-size: 10px;">
时间: <b>{{ date('Y-m-d H:i',$sendTime) }}</b>
</td>
</tr>
<tr>
<td style="padding: 0px 0px 10px 0px;color: #000000; font-family: Arial, sans-serif; font-size: 24px;">
Dear. <a style="text-decoration: none;color: #198754;" href="mailto:{{ $userEmail }}">{{ $userEmail }}</a>
</td>
</tr>
<tr>
<td style="padding: 0px 5px 5px 0px;color: #000000; font-family: Arial, sans-serif; font-size: 16px;">
您在本博客(<a style="text-decoration: none;color: #198754;" href="{{ env('APP_BLOG') }}">{{ env('APP_NAME') }}</a>)正在进行 <b>友链自助修改</b> 操作。
<hr/>
您的验证码为:<span style="font-size: 20px;"><b>{{ $verifyCode }}</b></span> 验证码15分钟有效<br/>
<hr/>
若您未在本站进行对应操作,请勿外泄验证码,忽略本邮件即可!谢谢您对本站的支持<br/>
<span style="color: #595959;">验证UU码CODE-CUSTOM-CHECK</span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor="#f0f0f0" style="padding: 30px 20px 30px 20px;">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td style="font-family: Arial, sans-serif; font-size: 14px;">
<font style="color: grey;">&copy; 2022 - {{ date('Y') }}. {{ env('APP_NAME') }} All Rights Reserved.</font><br/>
<font style="color: grey;">本邮件为自动发出,请勿直接回复</font>
</td>
</tr>
</table>
</td>
</tr>
</table>
<tr>
<td style="padding: 30px 0 20px 0;"></td>
</tr>
</html>

View File

@ -80,7 +80,7 @@ class="fixed hidden inset-y-0 right-0 z-50 w-full overflow-y-auto bg-white px-6
<div class="flex items-center justify-between"> <div class="flex items-center justify-between">
<a href="#" class="-m-1.5 p-1.5"> <a href="#" class="-m-1.5 p-1.5">
<span class="sr-only">Your Company</span> <span class="sr-only">Your Company</span>
<img class="h-8 w-auto" src="https://tailwindui.com/img/logos/mark.svg?color=indigo&shade=600" <img class="h-8 w-auto" src="{{ asset('images/logo.jpg') }}"
alt=""> alt="">
</a> </a>
<button type="button" class="-m-2.5 rounded-md p-2.5 text-gray-700" onclick="openMenuOut()"> <button type="button" class="-m-2.5 rounded-md p-2.5 text-gray-700" onclick="openMenuOut()">

View File

@ -45,5 +45,7 @@
Route::prefix('custom')->group(function () { Route::prefix('custom')->group(function () {
Route::post('add',[Link::class,'apiCustomAdd'])->name('api.link.custom.add'); Route::post('add',[Link::class,'apiCustomAdd'])->name('api.link.custom.add');
Route::get('search',[Link::class, 'apiCustomSearch'])->name('api.link.custom.search'); Route::get('search',[Link::class, 'apiCustomSearch'])->name('api.link.custom.search');
Route::post('blogCheck',[Link::class,'apiCustomBlogCheck'])->name('api.link.custom.blogCheck');
Route::post('blogVerify',[Link::class,'apiCustomBlogVerify'])->name('api.link.custom.blogVerify');
}); });
}); });

View File

@ -32,7 +32,8 @@
Route::get('link',[UserLink::class, 'viewLink'])->name('function.link'); Route::get('link',[UserLink::class, 'viewLink'])->name('function.link');
Route::get('make-friend',[UserLink::class, 'viewMakeFriend'])->name('function.make-friend'); Route::get('make-friend',[UserLink::class, 'viewMakeFriend'])->name('function.make-friend');
Route::get('edit-search',[UserLink::class, 'viewSearchFriends'])->name('function.edit-search'); Route::get('edit-search',[UserLink::class, 'viewSearchFriends'])->name('function.edit-search');
Route::get('edit-friend',[UserLink::class, 'viewEditFriend'])->name('function.edit-friend'); Route::get('edit-search/{friendId}',[UserLink::class,'viewSearchFriend'])->name('function.edit-searchOnly');
Route::get('edit-friend/{friendId}',[UserLink::class,'viewEditFriend'])->name('function.edit-friend');
Route::get('sponsor',function () { Route::get('sponsor',function () {
return view('function.sponsor'); return view('function.sponsor');
})->name('function.sponsor'); })->name('function.sponsor');