66 lines
3.2 KiB
PHP
66 lines
3.2 KiB
PHP
<?php
|
|
|
|
namespace App\Admin\Forms\Settings;
|
|
|
|
use App\Models\ArticleCategory;
|
|
use App\Models\Setting;
|
|
use App\Services\SettingService;
|
|
use Dcat\Admin\Widgets\Form;
|
|
|
|
class App extends Form
|
|
{
|
|
/**
|
|
* Handle the form request.
|
|
*
|
|
* @param array $input
|
|
*
|
|
* @return mixed
|
|
*/
|
|
public function handle(array $input)
|
|
{
|
|
Setting::where('key', 'app')->updateOrCreate([
|
|
'key' => 'app',
|
|
], ['value' => $input]);
|
|
|
|
//清配置缓存
|
|
app(SettingService::class)->cleanCache('app');
|
|
|
|
return $this
|
|
->response()
|
|
->success('配置更新成功!')
|
|
->refresh();
|
|
}
|
|
|
|
/**
|
|
* Build a form here.
|
|
*/
|
|
public function form()
|
|
{
|
|
$appSettings = (array) Setting::where('key', 'app')->value('value');
|
|
|
|
$this->text('app_name', 'APP名称')->value($appSettings['app_name'] ?? '');
|
|
$this->divider();
|
|
$this->text('search_hot_keys', '搜索热词(英文半角逗号隔开)')->value($appSettings['search_hot_keys'] ?? '');
|
|
$this->text('invite_uri', '分享邀请地址(链接)')->value($appSettings['invite_uri'] ?? '');
|
|
$this->divider();
|
|
$this->number('order_payment_expires_at', '订单支付过期时间(秒)')->value($appSettings['order_payment_expires_at'] ?? '');
|
|
$this->text('order_auto_complete_days', '订单自动完成时间(天)')->value($appSettings['order_auto_complete_days'] ?? '')->rules('required|numeric|min:0');
|
|
$this->text('sale_after_expire_days', '售后过期时间(天)')->value($appSettings['sale_after_expire_days'] ?? '')->rules('required|numeric|min:0');
|
|
$this->divider();
|
|
|
|
$this->number('sign_click_points', '签到送积分(分)')->value($appSettings['sign_click_points'] ?? '');
|
|
$this->number('sign_click_continue', '每连续签到额外奖励(天)')->value($appSettings['sign_click_continue'] ?? '');
|
|
$this->number('sign_click_continue_points', '每连续签到额外奖励(分)')->value($appSettings['sign_click_continue_points'] ?? '');
|
|
$this->divider();
|
|
|
|
$this->select('article_help', '帮助文章指定分类')->options(ArticleCategory::whereNull('parent_id')->pluck('name', 'id'))->value($appSettings['article_help'] ?? '');
|
|
$this->select('article_agreement', '协议文章指定分类')->options(ArticleCategory::whereNull('parent_id')->pluck('name', 'id'))->value($appSettings['article_agreement'] ?? '');
|
|
$this->select('article_health', '健康文章指定分类')->options(ArticleCategory::whereNull('parent_id')->pluck('name', 'id'))->value($appSettings['article_health'] ?? '');
|
|
|
|
$this->text('article_about_us', '关于我们文章指定(链接)')->value($appSettings['article_about_us'] ?? '');
|
|
$this->text('article_user_promotion_agreement', '服务协议文章指定(链接)')->value($appSettings['article_user_promotion_agreement'] ?? '');
|
|
$this->text('article_user_hide_agreement', '隐私协议文章指定(链接)')->value($appSettings['article_user_hide_agreement'] ?? '');
|
|
$this->text('article_user_agent_agreement', '升级规则文章指定(链接)')->value($appSettings['article_user_agent_agreement'] ?? '');
|
|
}
|
|
}
|