diff --git a/app/Http/Controllers/DataBase.php b/app/Http/Controllers/DataBase.php index bfce5eb..c7983f7 100644 --- a/app/Http/Controllers/DataBase.php +++ b/app/Http/Controllers/DataBase.php @@ -15,16 +15,20 @@ class DataBase extends Controller public function __construct() { DB::statement("TRUNCATE TABLE `xf_index`.`blog_link`"); - $result = DB::table('xf_blog_friends') + $resultBlog = DB::table('xf_blog_friends') ->orderBy('id') ->get() ->toArray(); - foreach ($result as $value) { + foreach ($resultBlog as $value) { $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 == 2) $value->blog_sel_color = 8; if ($value->blog_sel_color == 7) $value->blog_sel_color = 4; 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') ->insert([ 'blogName' => $value->blog_name, @@ -40,5 +44,26 @@ public function __construct() '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, + ]); + } } } diff --git a/app/Http/Controllers/Function/Sponsor.php b/app/Http/Controllers/Function/Sponsor.php new file mode 100644 index 0000000..2ec641f --- /dev/null +++ b/app/Http/Controllers/Function/Sponsor.php @@ -0,0 +1,30 @@ +data = $data->data; + } + + protected function viewSponsor(): Factory|View|Application + { + return view('function.sponsor', $this->data); + } +} diff --git a/database/migrations/2023_07_21_062701_create_sponsor_table.php b/database/migrations/2023_07_21_062701_create_sponsor_table.php new file mode 100644 index 0000000..901a3be --- /dev/null +++ b/database/migrations/2023_07_21_062701_create_sponsor_table.php @@ -0,0 +1,40 @@ +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'); + } +} diff --git a/database/migrations/2023_07_21_063430_create_sponsor_type_table.php b/database/migrations/2023_07_21_063430_create_sponsor_type_table.php new file mode 100644 index 0000000..edcaccb --- /dev/null +++ b/database/migrations/2023_07_21_063430_create_sponsor_type_table.php @@ -0,0 +1,38 @@ +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'); + } +} diff --git a/resources/views/function/sponsor.blade.php b/resources/views/function/sponsor.blade.php index b3d9bbc..f25a853 100644 --- a/resources/views/function/sponsor.blade.php +++ b/resources/views/function/sponsor.blade.php @@ -1 +1,73 @@ - + + + + + + + + @include('modules.head') + {!! $webHeader !!} + + +
+ @include('modules.navbar') +
+ +
+
+ qwe +
+
+ qwe +
+
+ +
+
+ + + + +{!! $webFooter !!} + diff --git a/routes/web.php b/routes/web.php index b7a34ac..ea7895e 100644 --- a/routes/web.php +++ b/routes/web.php @@ -7,7 +7,9 @@ use App\Http\Controllers\Console\Dashboard; 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\Sponsor; use App\Http\Controllers\Index; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Response; @@ -28,7 +30,7 @@ Route::get('about', [Index::class, 'ViewAboutMe'])->name('about'); Route::get('404', [Index::class, 'viewPageNotFounded'])->name('404'); 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::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/{friendId}', [UserLink::class, 'viewSearchFriend'])->name('function.edit-searchOnly'); Route::get('edit-friend/{friendId}', [UserLink::class, 'viewEditFriend'])->name('function.edit-friend'); - Route::get('sponsor', function () { - return view('function.sponsor'); - })->name('function.sponsor'); + Route::get('sponsor', [Sponsor::class, 'viewSponsor'])->name('function.sponsor'); Route::get('music', function () { return view('function.music'); })->name('function.music');