diff --git a/app/Admin/Controllers/AdController.php b/app/Admin/Controllers/AdController.php index 74287f3..f42f072 100644 --- a/app/Admin/Controllers/AdController.php +++ b/app/Admin/Controllers/AdController.php @@ -47,6 +47,7 @@ class AdController extends AdminController ])) ->columns([ amis()->TableColumn('id', __('admin.ads.id'))->width('50px')->sortable(), + amis()->TableColumn('title', __('admin.ads.title'))->width('300px'), amis()->TableColumn('address', __('admin.ads.address'))->type('mapping') ->map(Keyword::allChildrenOfKey('banner_address')->pluck('name', 'key')->toArray()) ->itemSchema(amis()->Tag()->label('${item}')->color(Admin::setting()->get('system_theme_setting')['theme_color'] ?? '#1677ff')), @@ -72,7 +73,9 @@ class AdController extends AdminController return $this->baseForm()->body([ Components::make()->parentControl(admin_url('api/keywords/tree-list?parent_name=banner_address&has_owner=0'), 'address', __('admin.ads.address'), 'name', 'key')->required(true), Components::make()->imageControl('resource', __('admin.ads.resource'))->required(true), - amis()->TextControl('remark', __('admin.ads.remark')), + amis()->TextControl('title', __('admin.ads.title')), + amis()->TextControl('sud_title', __('admin.ads.sud_title')), + // amis()->TextControl('remark', __('admin.ads.remark')), Components::make()->sortControl('sort', __('admin.ads.sort')), amis()->DateTimeControl('published_at', __('admin.ads.published_at'))->format('YYYY-MM-DD HH:mm:ss')->description(__('admin.ads.published_at_remark')), amis()->SwitchControl('is_enable', __('admin.ads.is_enable'))->value(false), diff --git a/app/Http/Resources/AdResource.php b/app/Http/Resources/AdResource.php index b684268..9fb543f 100644 --- a/app/Http/Resources/AdResource.php +++ b/app/Http/Resources/AdResource.php @@ -14,6 +14,8 @@ class AdResource extends JsonResource public function toArray($request) { return [ + 'title'=> $this->title, + 'sub_title'=> $this->sub_title, 'resource_url' => $this->resource_url, 'jump_type' => $this->jump_type, 'jump_config' => $this->jump_config, diff --git a/app/Models/Ad.php b/app/Models/Ad.php index f7031fb..9ff3314 100644 --- a/app/Models/Ad.php +++ b/app/Models/Ad.php @@ -35,6 +35,8 @@ class Ad extends Model ]; protected $fillable = [ + 'title', + 'sub_title', 'resource', 'address', 'remark', diff --git a/database/migrations/2026_02_25_222139_add_title_to_ads.php b/database/migrations/2026_02_25_222139_add_title_to_ads.php new file mode 100644 index 0000000..fb62f31 --- /dev/null +++ b/database/migrations/2026_02_25_222139_add_title_to_ads.php @@ -0,0 +1,31 @@ +text('title')->nullable()->comment('标题'); + $table->text('sub_title')->nullable()->comment('副标题'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('ads', function (Blueprint $table) { + // + $table->dropColumn(['title', 'sub_title']); + }); + } +}; diff --git a/lang/zh_CN/admin.php b/lang/zh_CN/admin.php index ecbd957..e4e2e49 100644 --- a/lang/zh_CN/admin.php +++ b/lang/zh_CN/admin.php @@ -304,6 +304,8 @@ return [ 'id' => 'ID', 'address' => '位置', 'resource' =>'内容', + 'title'=>'标题', + 'sub_title'=>'副标题', 'published_at' => '定时发布', 'published_at_g' => '发布时间', 'is_enable' => '显示',