title('搜索配置')->description('移动端') // ->body($this->buildPreviewButton()) // ->body($this->newline()) ->body( <<{$this->form_pagesearch()->render()} HTML ); } protected function form_pagesearch(){ $form = new Form(); $form->confirm('您确定要提交表单吗?', 'content'); $form->disableResetButton(); global $__MINI_GLOBAL_TENANT_ID__; if($__MINI_GLOBAL_TENANT_ID__ === 0){ $res1 = __system__paycode__tip__(1); Tooltip::make('.mini_global_admin_open_not_support_tip') ->bottom() ->title($res1['tip']); $form->color('app_search_highlight_color', '搜索高亮颜色')->help($res1['text'])->default(Settings::get('app_search_highlight_color', '#fc3a72')); } $form->multipleSelectTable('app_hot_search', '移动端热搜') ->title('搜索记录库') ->max(16) ->from(SearchRender::make()) ->model(WxSearch::class, 'id', 'search_content', 'selectTable:formMiniTrait:app_hot_search') ->help('搜索记录:如果为空,则选择标记为热门的搜索记录。(ps:如何控制顺序?) ') ->default(Settings::get('app_hot_search', '2054,2055,2056,2057,2058,2059,2060,2061,2062,2063,2064,2065,2066,2067,2068', true)); $form->divider(); $form->html(function () { return ''; }, ''); $form->html(function () { return '
解释:1、包含匹配是指 搜索关键词包含了触发词 2、一次只会触发一个
'; }, ''); $form->table('app_search_trigger_word','搜索触发词', function (NestedForm $table) { $table->text('text', '触发字')->required(); $table->select('match', '匹配关系')->options([1=>'绝对匹配', 2=>'包含匹配']); $table->image('img', '图片')->help('点击下载默认图')->uniqueName()->url('files/uploads')->autoUpload(); $table->text('title', '标题')->required(); $table->text('desc', '描述'); $table->radio('type', '类型')->options(FieldUtils::getUrlTypes())->default(0); $table->text('target', '跳转id')->help('怎么填请看路径大全'); // $table->sw })->default(Settings::get('app_search_trigger_word', '',true)); $form->action('settings/action/pagesearch'); return $form; } public function pagesearch(Request $request){ global $__MINI_GLOBAL_TENANT_ID__; SiteUtils::forget_config_data(); if($__MINI_GLOBAL_TENANT_ID__ === 0){ Settings::set('app_search_highlight_color', $request->input('app_search_highlight_color'), true, true); } Settings::set('app_hot_search', AdminUtils::_multipleSelectTable_order_process('selectTable:formMiniTrait:app_hot_search', $request->input('app_hot_search')) , true, true); Settings::set('app_search_trigger_word', AdminUtils::_table_data($request->input('app_search_trigger_word')), true, true); $__global_config_version__ = Settings::get('__global_config_version__', 1) + 1; Settings::set('__global_config_version__', $__global_config_version__); GatewayUtils::success('all', 13, [ 'version' => $__global_config_version__, 'file' => basename(__FILE__) ]); return $this->response()->success('成功!'); } }