first commit

This commit is contained in:
2026-01-18 09:52:48 +08:00
commit 836bdc9409
584 changed files with 40891 additions and 0 deletions

View File

View File

View File

@@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration{
/**
* Run the migrations.
*/
public function up(): void {
Schema::create('ads', function (Blueprint $table) {
$table->id()->uniqid()->comment('主键id');
$table->unsignedBigInteger('client_id')->default(0)->comment('站点ID');
$table->string('title')->comment('广告标题');
$table->string('name')->nullable()->comment('广告标识');
$table->string('group')->nullable()->comment('广告所属板块标识');
$table->string('description')->nullable()->comment('广告描述');
$table->string('cover')->nullable()->comment('广告封面');
$table->string('link')->nullable()->comment('广告链接');
$table->string('sort')->default(0)->comment('排序');
$table->tinyInteger('status')->default(1)->comment('状态 1正常 2禁用');
$table->timestamp('created_at')->nullable()->comment('创建时间');
$table->timestamp('updated_at')->nullable()->comment('更新时间');
$table->engine = 'InnoDB';
$table->charset = 'utf8mb4';
$table->collation = 'utf8mb4_unicode_ci';
$table->comment('广告表');
});
}
/**
* Reverse the migrations.
*/
public function down(): void {
Schema::dropIfExists('ads');
}
};

View File

View File

@@ -0,0 +1,42 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2024 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace Modules\Ads\Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use App\Services\Auth\MenuService;
class AdsDatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$this->initMenu();
}
public function initMenu(){
$menuService = app(MenuService::class);
$operate = DB::table('auth_permissions')->where('name', 'operate')->first();
if (!$operate) {
$menu = [
['title' => '营销', 'name' => 'operate', 'path' => '/operate', 'component' => '', 'type' => 'menu', 'sort' => 5, 'children' => [
['title' => '广告管理', 'name' => 'operate.ads', 'path' => '/operate/ads', 'component' => 'operate/ads', 'type' => 'menu']
]]
];
$menuService->importMenu($menu, 0);
}else{
$menuService->importMenu([
['title' => '广告管理', 'name' => 'operate.ads', 'path' => '/operate/ads', 'component' => 'operate/ads', 'type' => 'menu']
], $operate->id);
}
}
}