AddFeature: 添加赞助内容

赞助初始化内容

新增:
- 2023_07_21_062701_create_sponsor_table.php
- 2023_07_21_063430_create_sponsor_type_table.php
- Sponsor.php
修改:
- DataBase.php
- sponsor.blade.php
- web.php

Signed-off-by: XiaoLFeng <gm@x-lf.cn>
This commit is contained in:
筱锋xiao_lfeng 2023-07-21 14:59:13 +08:00
parent d536233bc8
commit b289562ad6
6 changed files with 212 additions and 7 deletions

View File

@ -15,16 +15,20 @@ class DataBase extends Controller
public function __construct() public function __construct()
{ {
DB::statement("TRUNCATE TABLE `xf_index`.`blog_link`"); DB::statement("TRUNCATE TABLE `xf_index`.`blog_link`");
$result = DB::table('xf_blog_friends') $resultBlog = DB::table('xf_blog_friends')
->orderBy('id') ->orderBy('id')
->get() ->get()
->toArray(); ->toArray();
foreach ($result as $value) { foreach ($resultBlog as $value) {
$value->blog_rss_judge ? $value->blog_rss_judge = 1 : $value->blog_rss_judge = 0; $value->blog_rss_judge ? $value->blog_rss_judge = 1 : $value->blog_rss_judge = 0;
if ($value->blog_sel_color == 8) $value->blog_sel_color = 6; if ($value->blog_sel_color == 8) $value->blog_sel_color = 6;
if ($value->blog_sel_color == 2) $value->blog_sel_color = 8; if ($value->blog_sel_color == 2) $value->blog_sel_color = 8;
if ($value->blog_sel_color == 7) $value->blog_sel_color = 4; if ($value->blog_sel_color == 7) $value->blog_sel_color = 4;
if ($value->blog_sel_color == 5) $value->blog_sel_color = 3; if ($value->blog_sel_color == 5) $value->blog_sel_color = 3;
if (empty($value->blog_owner_email)) $value->blog_owner_email = null;
if (empty($value->blog_rss)) $value->blog_rss = null;
if (empty($value->blog_serverhost)) $value->blog_serverhost = null;
DB::table('blog_link') DB::table('blog_link')
->insert([ ->insert([
'blogName' => $value->blog_name, 'blogName' => $value->blog_name,
@ -40,5 +44,26 @@ public function __construct()
'created_at' => date('Y-m-d H:i:s'), 'created_at' => date('Y-m-d H:i:s'),
]); ]);
} }
DB::statement("TRUNCATE TABLE `xf_index`.`sponsor`");
$resultSponsor = DB::table('xf_sponsor')
->orderBy('id')
->get()
->toArray();
foreach ($resultSponsor as $value) {
if ($value->mode == 'AliPay') $value->mode = 1;
if ($value->mode == 'WeChat') $value->mode = 2;
if ($value->mode == 'QQ') $value->mode = 3;
if ($value->mode == 'PayPal') $value->mode = 4;
if (empty($value->url)) $value->url = null;
DB::table('sponsor')
->insert([
'name' => $value->name,
'url' => $value->url,
'type' => $value->mode,
'money' => $value->count,
'time' => $value->time,
]);
}
} }
} }

View File

@ -0,0 +1,30 @@
<?php
/*
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
* 开发开源遵循 MIT 许可,若需商用请联系开发者
* https://www.x-lf.com/
*/
namespace App\Http\Controllers\Function;
use App\Http\Controllers\Controller;
use App\Http\Controllers\Index;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
class Sponsor extends Controller
{
private array $data;
public function __construct()
{
$data = new Index();
$this->data = $data->data;
}
protected function viewSponsor(): Factory|View|Application
{
return view('function.sponsor', $this->data);
}
}

View File

@ -0,0 +1,40 @@
<?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 CreateSponsorTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('sponsor', function (Blueprint $table) {
$table->id();
$table->string('name')->comment('赞助者名称');
$table->string('url')->nullable()->comment('地址');
$table->integer('type')->comment('赞助方式');
$table->double('money')->comment('赞助金额');
$table->timestamp('time')->comment('时间戳');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('sponsor');
}
}

View File

@ -0,0 +1,38 @@
<?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 CreateSponsorTypeTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('sponsor_type', function (Blueprint $table) {
$table->id();
$table->string('name')->comment('赞助类型名称');
$table->boolean('include')->default(true)->comment('是否计入总数');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('sponsor_type');
}
}

View File

@ -1 +1,73 @@
<?php <!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 style="overflow: hidden;height: 100vh">
<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-6xl py-8 sm:py-16 lg:py-16 grid grid-cols-12 gap-4">
<div class="w-full p-4 bg-white border border-gray-200 rounded-lg shadow-lg sm:p-8 dark:bg-gray-800 dark:border-gray-700 col-span-12 lg:col-span-4">
qwe
</div>
<div class="w-full p-4 bg-white border border-gray-200 rounded-lg shadow-lg sm:p-8 dark:bg-gray-800 dark:border-gray-700 col-span-12 lg:col-span-8">
qwe
</div>
</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>
</div>
</div>
<footer class="fixed bottom-0 left-0 z-20 w-full p-4 md:flex md:items-end md:justify-between md:p-6">
@if(empty($sqlIcp) && empty($sqlGongan))
<div class="flex text-sm text-gray-500 dark:text-gray-400"></div>
<div class="flex text-sm text-gray-500 dark:text-gray-400">
<span class="flex justify-start"><i class="bi bi-c-circle"></i> @if(empty(!$sqlCopyRightYear))
{{ $sqlCopyRightYear }}-{{ date('Y') }}
@else
{{ date('Y') }}
@endif {{ $sqlAuthor }}. All Rights Reserved.</span>
</div>
@else
<div class="flex text-sm text-gray-500 dark:text-gray-400">
<span class="flex justify-start"><i class="bi bi-c-circle pe-2"></i> @if(empty(!$sqlCopyRightYear))
{{ $sqlCopyRightYear }}-{{ date('Y') }}
@else
{{ date('Y') }}
@endif {{ $sqlAuthor }}. All Rights Reserved.</span>
</div>
<div class="grid grid-cols-1 text-sm text-gray-500 dark:text-gray-400">
@if(!empty($sqlIcp))
<a href="https://beian.miit.gov.cn/"><span class="flex justify-end @if(!empty($sqlGongan))mb-1 @endif"><i class="bi bi-balloon pe-2"></i> {{ $sqlIcp }}</span></a>
@endif
@if(!empty($sqlGongan))
<a href="https://www.beian.gov.cn/portal/registerSystemInfo?recordcode={{ $GonganCode }}"><span
class="flex justify-end @if(!empty($sqlIcp))mt-1 @endif"><i class="bi bi-balloon-heart pe-2"></i> {{ $sqlGongan }}</span></a>
@endif
</div>
@endif
</footer>
</body>
<script src="{{ asset('js/app.js') }}"></script>
<script src="{{ asset('js/jquery.js') }}"></script>
{!! $webFooter !!}
</html>

View File

@ -7,7 +7,9 @@
use App\Http\Controllers\Console\Dashboard; use App\Http\Controllers\Console\Dashboard;
use App\Http\Controllers\Console\Link as ConsoleLink; use App\Http\Controllers\Console\Link as ConsoleLink;
use App\Http\Controllers\DataBase;
use App\Http\Controllers\Function\Link as UserLink; use App\Http\Controllers\Function\Link as UserLink;
use App\Http\Controllers\Function\Sponsor;
use App\Http\Controllers\Index; use App\Http\Controllers\Index;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Response; use Illuminate\Support\Facades\Response;
@ -28,7 +30,7 @@
Route::get('about', [Index::class, 'ViewAboutMe'])->name('about'); Route::get('about', [Index::class, 'ViewAboutMe'])->name('about');
Route::get('404', [Index::class, 'viewPageNotFounded'])->name('404'); Route::get('404', [Index::class, 'viewPageNotFounded'])->name('404');
Route::get('no-permission', [Index::class, 'viewNoPermission'])->name('no-permission'); Route::get('no-permission', [Index::class, 'viewNoPermission'])->name('no-permission');
Route::get('backup', [\App\Http\Controllers\DataBase::class, '__construct']); Route::get('backup', [DataBase::class, '__construct']);
Route::prefix('function')->group(function () { Route::prefix('function')->group(function () {
Route::get('link', [UserLink::class, 'viewLink'])->name('function.link'); Route::get('link', [UserLink::class, 'viewLink'])->name('function.link');
@ -36,9 +38,7 @@
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-search/{friendId}', [UserLink::class, 'viewSearchFriend'])->name('function.edit-searchOnly'); 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('edit-friend/{friendId}', [UserLink::class, 'viewEditFriend'])->name('function.edit-friend');
Route::get('sponsor', function () { Route::get('sponsor', [Sponsor::class, 'viewSponsor'])->name('function.sponsor');
return view('function.sponsor');
})->name('function.sponsor');
Route::get('music', function () { Route::get('music', function () {
return view('function.music'); return view('function.music');
})->name('function.music'); })->name('function.music');