From 05f01969fd7f158d65db055edb256062b5d51090 Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Mon, 27 Dec 2021 11:43:12 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=85=8D=E7=BD=AE=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Admin/Controllers/SettingController.php | 37 +++++ app/Admin/Forms/Settings/App.php | 61 ++++++++ app/Admin/Forms/Settings/Kuaidi100.php | 45 ++++++ app/Admin/Forms/Settings/Unipush.php | 50 ++++++ app/Admin/Services/OrderPackageService.php | 2 +- app/Console/Commands/PushMessageCommand.php | 4 +- .../Http/Controllers/ArticleController.php | 12 +- .../Api/Http/Controllers/ClickController.php | 6 +- .../Product/ProductSkuController.php | 2 +- .../Http/Controllers/ShareBgController.php | 2 +- .../Http/Controllers/ArticleController.php | 4 +- app/Models/Order.php | 4 +- app/Services/Kuaidi100Service.php | 10 +- app/Services/OrderPackageService.php | 2 +- app/Services/OrderService.php | 2 +- app/Services/Push/MallUnipushService.php | 8 +- app/Services/SettingService.php | 23 ++- database/seeders/AppSettingSeeder.php | 143 +++++------------- 18 files changed, 280 insertions(+), 137 deletions(-) create mode 100644 app/Admin/Forms/Settings/App.php create mode 100644 app/Admin/Forms/Settings/Kuaidi100.php create mode 100644 app/Admin/Forms/Settings/Unipush.php diff --git a/app/Admin/Controllers/SettingController.php b/app/Admin/Controllers/SettingController.php index 9e1fbca1..0a5f6434 100644 --- a/app/Admin/Controllers/SettingController.php +++ b/app/Admin/Controllers/SettingController.php @@ -2,13 +2,20 @@ namespace App\Admin\Controllers; +use App\Admin\Forms\Settings\App; +use App\Admin\Forms\Settings\Kuaidi100; +use App\Admin\Forms\Settings\Unipush; use App\Admin\Repositories\Setting; use Dcat\Admin\Admin; use Dcat\Admin\Form; use Dcat\Admin\Grid; use Dcat\Admin\Grid\Column; use Dcat\Admin\Http\Controllers\AdminController; +use Dcat\Admin\Layout\Content; +use Dcat\Admin\Layout\Row; use Dcat\Admin\Show; +use Dcat\Admin\Widgets\Tab; +use Illuminate\Support\Facades\Request; class SettingController extends AdminController { @@ -88,4 +95,34 @@ class SettingController extends AdminController $form->display('updated_at'); }); } + + public function index(Content $content): Content + { + return $content->header('配置管理') + ->description('配置管理') + ->body(function (Row $row) { + $type = Request::query('type', 'app'); + $tab = new Tab(); + switch ($type) { + case 'app': + $tab->add('系统配置', new App(), true); + $tab->addLink('快递100配置', admin_route('settings.index', ['type'=>'kuaidi100'])); + $tab->addLink('Uni-push配置', admin_route('settings.index', ['type'=>'unipush'])); + break; + case 'kuaidi100': + $tab->addLink('系统配置', admin_route('settings.index', ['type'=>'app'])); + $tab->add('快递100配置', new Kuaidi100(), true); + $tab->addLink('Uni-push配置', admin_route('settings.index', ['type'=>'unipush'])); + break; + case 'unipush': + $tab->addLink('系统配置', admin_route('settings.index', ['type'=>'app'])); + $tab->addLink('快递100配置', admin_route('settings.index', ['type'=>'kuaidi100'])); + $tab->add('Uni-push配置', new Unipush(), true); + break; + default: + break; + } + $row->column(12, $tab->withCard()); + }); + } } diff --git a/app/Admin/Forms/Settings/App.php b/app/Admin/Forms/Settings/App.php new file mode 100644 index 00000000..2719837b --- /dev/null +++ b/app/Admin/Forms/Settings/App.php @@ -0,0 +1,61 @@ +updateOrCreate([ + 'key' => 'app', + ], ['value' => $input]); + + return $this + ->response() + ->success('配置更新成功!') + ->refresh(); + } + + /** + * Build a form here. + */ + public function form() + { + $appSettings = Setting::where('key', 'app')->first(); + + $this->text('app_name', 'APP名称')->value($appSettings?->value['app_name']); + $this->divider(); + $this->text('search_hot_keys', '搜索热词(英文半角逗号隔开)')->value($appSettings?->value['search_hot_keys']); + $this->divider(); + $this->number('order_payment_expires_at', '订单支付过期时间(秒)')->value($appSettings?->value['order_payment_expires_at']); + $this->number('sale_after_expire_days', '售后过期时间(天)')->value($appSettings?->value['sale_after_expire_days']); + $this->divider(); + + $this->number('sign_click_points', '签到送积分(分)')->value($appSettings?->value['sign_click_points']); + $this->number('sign_click_continue', '每连续签到额外奖励(天)')->value($appSettings?->value['sign_click_continue']); + $this->number('sign_click_continue_points', '每连续签到额外奖励(分)')->value($appSettings?->value['sign_click_continue_points']); + $this->divider(); + + $this->select('article_help', '帮助文章指定分类')->options(ArticleCategory::whereNull('parent_id')->pluck('name', 'id'))->value($appSettings?->value['article_help']); + $this->select('article_agreement', '协议文章指定分类')->options(ArticleCategory::whereNull('parent_id')->pluck('name', 'id'))->value($appSettings?->value['article_agreement']); + $this->select('article_health', '健康文章指定分类')->options(ArticleCategory::whereNull('parent_id')->pluck('name', 'id'))->value($appSettings?->value['article_health']); + + $this->text('article_about_us', '关于我们文章指定(链接)')->value($appSettings?->value['article_about_us']); + $this->text('article_user_promotion_agreement', '服务协议文章指定(链接)')->value($appSettings?->value['article_user_promotion_agreement']); + $this->text('article_user_hide_agreement', '隐私协议文章指定(链接)')->value($appSettings?->value['article_user_hide_agreement']); + $this->divider(); + + $this->text('invite_uri', '分享邀请地址(链接)')->value($appSettings?->value['article_about_us']); + } +} diff --git a/app/Admin/Forms/Settings/Kuaidi100.php b/app/Admin/Forms/Settings/Kuaidi100.php new file mode 100644 index 00000000..56cac6c7 --- /dev/null +++ b/app/Admin/Forms/Settings/Kuaidi100.php @@ -0,0 +1,45 @@ +updateOrCreate([ + 'key' => 'kuaidi100', + ], ['value' => $input]); + + return $this + ->response() + ->success('配置更新成功!') + ->refresh(); + } + + /** + * Build a form here. + */ + public function form() + { + $appSettings = Setting::where('key', 'kuaidi100')->first(); + + $this->switch('is_use', '是否启用')->value(Arr::get($appSettings?->value, 'is_use', 0)); + $this->divider(); + $this->text('app_key', 'APP_KEY')->value(Arr::get($appSettings?->value, 'app_key', '')); + $this->text('customer', 'CUSTOMER')->value(Arr::get($appSettings?->value, 'customer', '')); + $this->text('secret', 'SECRET')->value(Arr::get($appSettings?->value, 'secret', '')); + $this->text('userid', 'USER_ID')->value(Arr::get($appSettings?->value, 'userid', '')); + $this->text('callback_uri', '回调地址(链接)')->value(Arr::get($appSettings?->value, 'callback_uri', '')); + } +} diff --git a/app/Admin/Forms/Settings/Unipush.php b/app/Admin/Forms/Settings/Unipush.php new file mode 100644 index 00000000..6f8ea0f8 --- /dev/null +++ b/app/Admin/Forms/Settings/Unipush.php @@ -0,0 +1,50 @@ +updateOrCreate([ + 'key' => 'unipush', + ], ['value' => $input]); + + return $this + ->response() + ->success('配置更新成功!') + ->refresh(); + } + + /** + * Build a form here. + */ + public function form() + { + $appSettings = Setting::where('key', 'unipush')->first(); + + $this->switch('is_use', '是否启用')->value(Arr::get($appSettings?->value, 'is_use', 0)); + $this->text('mall_app_id', '商城APP_ID')->value(Arr::get($appSettings?->value, 'mall_app_id', '')); + $this->text('mall_app_key', '商城APP_KEY')->value(Arr::get($appSettings?->value, 'mall_app_key', '')); + $this->text('mall_app_secret', '商城APP_SECRET')->value(Arr::get($appSettings?->value, 'mall_app_secret', '')); + $this->text('mall_master_secret', '商城APP_MASTER_SECRET')->value(Arr::get($appSettings?->value, 'mall_master_secret', '')); + + $this->divider(); + $this->switch('merchant_is_use', '是否启用')->value(Arr::get($appSettings?->value, 'merchant_is_use', 0)); + $this->text('merchant_app_id', '商户APP_ID')->value(Arr::get($appSettings?->value, 'merchant_app_id', '')); + $this->text('merchant_app_key', '商户APP_KEY')->value(Arr::get($appSettings?->value, 'merchant_app_key', '')); + $this->text('merchant_app_secret', '商户APP_SECRET')->value(Arr::get($appSettings?->value, 'merchant_app_secret', '')); + $this->text('merchant_master_secret', '商户APP_MASTER_SECRET')->value(Arr::get($appSettings?->value, 'merchant_master_secret', '')); + } +} diff --git a/app/Admin/Services/OrderPackageService.php b/app/Admin/Services/OrderPackageService.php index 3d97ceb9..25341540 100644 --- a/app/Admin/Services/OrderPackageService.php +++ b/app/Admin/Services/OrderPackageService.php @@ -74,7 +74,7 @@ class OrderPackageService 'updated_at' => $package->created_at, ]); }, $packageProducts)); - if (app_settings('kuaidi100_is_use')) { + if (app_settings('kuaidi100.is_use')) { $kuaidi100Service = new Kuaidi100Service(); $kuaidi100Service->poll($package->shipping_number, $package->shipping_code, $package->consignee_telephone); } diff --git a/app/Console/Commands/PushMessageCommand.php b/app/Console/Commands/PushMessageCommand.php index d396e2c4..e4d74157 100644 --- a/app/Console/Commands/PushMessageCommand.php +++ b/app/Console/Commands/PushMessageCommand.php @@ -40,7 +40,9 @@ class PushMessageCommand extends Command $status = 2; //默认失败 //如果是系统消息 if ($task->message instanceof Message) { - $status = $mallPushService->push($task->sn, $task->message) ? 1 : 2; + if ((bool) app_settings('nuipush.is_use')) {//如果开启了推送 + $status = $mallPushService->push($task->sn, $task->message) ? 1 : 2; + } } $task->update([ diff --git a/app/Endpoint/Api/Http/Controllers/ArticleController.php b/app/Endpoint/Api/Http/Controllers/ArticleController.php index 7edebc2e..6c1669b4 100644 --- a/app/Endpoint/Api/Http/Controllers/ArticleController.php +++ b/app/Endpoint/Api/Http/Controllers/ArticleController.php @@ -26,9 +26,9 @@ class ArticleController extends Controller public function config(Request $request) { return response()->json([ - 'about_us'=>app_settings('article_about_us', ''), - 'user_promotion_agreement'=> app_settings('article_user_promotion_agreement', ''), - 'user_hide_agreement' => app_settings('article_user_hide_agreement', ), + 'about_us'=>app_settings('app.article_about_us', ''), + 'user_promotion_agreement'=> app_settings('app.article_user_promotion_agreement', ''), + 'user_hide_agreement' => app_settings('app.article_user_hide_agreement', ), ]); } @@ -43,9 +43,9 @@ class ArticleController extends Controller $cate = (string) $request->query('cate'); $key = (string) $request->query('key'); $categoryId = Arr::get([ - 'help'=> app_settings('article_help'), - 'agreement'=> app_settings('article_agreement'), - 'health'=> app_settings('article_health'), + 'help'=> app_settings('app.article_help'), + 'agreement'=> app_settings('app.article_agreement'), + 'health'=> app_settings('app.article_health'), ], $cate); $query = Article::query()->with(['likesInfo'=>function ($q) use ($request) { $user_id = $request->user()?->id; diff --git a/app/Endpoint/Api/Http/Controllers/ClickController.php b/app/Endpoint/Api/Http/Controllers/ClickController.php index 76d7a114..afcd14d4 100644 --- a/app/Endpoint/Api/Http/Controllers/ClickController.php +++ b/app/Endpoint/Api/Http/Controllers/ClickController.php @@ -63,12 +63,12 @@ class ClickController extends Controller ]); //发放当天签到积分 - $points = app_settings('sign_click_points'); + $points = app_settings('app.sign_click_points'); $pointsService->sendPoints(1, $user, $points, '签到奖励'); //发放额外的奖励积分 - $continueClickDays = app_settings('sign_click_continue', 0); - $continueClickPoints = app_settings('sign_click_continue_points'); + $continueClickDays = app_settings('app.sign_click_continue', 0); + $continueClickPoints = app_settings('app.sign_click_continue_points'); if (($continueClickDays > 0 && $click->continue_click_times % $continueClickDays) == 0) { $pointsService->sendPoints(1, $user, $continueClickPoints, '连续签到奖励'); } diff --git a/app/Endpoint/Api/Http/Controllers/Product/ProductSkuController.php b/app/Endpoint/Api/Http/Controllers/Product/ProductSkuController.php index 790b0c1e..7255b4b0 100644 --- a/app/Endpoint/Api/Http/Controllers/Product/ProductSkuController.php +++ b/app/Endpoint/Api/Http/Controllers/Product/ProductSkuController.php @@ -45,7 +45,7 @@ class ProductSkuController extends Controller public function searchHotKeys(Request $request) { return response()->json([ - 'keys' => explode(',', app_settings('search_hot_keys')), + 'keys' => explode(',', app_settings('app.search_hot_keys')), ]); } diff --git a/app/Endpoint/Api/Http/Controllers/ShareBgController.php b/app/Endpoint/Api/Http/Controllers/ShareBgController.php index a5112ec7..291596de 100644 --- a/app/Endpoint/Api/Http/Controllers/ShareBgController.php +++ b/app/Endpoint/Api/Http/Controllers/ShareBgController.php @@ -22,7 +22,7 @@ class ShareBgController extends Controller public function userQrCode(Request $request) { - $inviteUri = app_settings('invite_uri').'/register?code='; + $inviteUri = app_settings('app.invite_uri').'/register?code='; return response()->json([ 'qr_code' => base64_encode(QrCode::format('png')->size(100)->margin(0)->generate($inviteUri.$request->user()->userInfo?->code)), ]); diff --git a/app/Endpoint/Wap/Http/Controllers/ArticleController.php b/app/Endpoint/Wap/Http/Controllers/ArticleController.php index 1af9b90e..d8ebb461 100644 --- a/app/Endpoint/Wap/Http/Controllers/ArticleController.php +++ b/app/Endpoint/Wap/Http/Controllers/ArticleController.php @@ -20,13 +20,13 @@ class ArticleController extends Controller $view = ''; //区分文章分类ID switch ($article->category_id) { - case app_settings('article_agreement'): //如果是协议分类 + case app_settings('app.article_agreement'): //如果是协议分类 $view = 'endpoint.article.agreement'; break; default: //区分文章的分类祖先ID switch ($article->category->ancestors->first()?->id) { - case app_settings('article_agreement'): //如果是协议 + case app_settings('app.article_agreement'): //如果是协议 $view = 'endpoint.article.agreement'; break; default: diff --git a/app/Models/Order.php b/app/Models/Order.php index 32d5a01e..7fd2b682 100644 --- a/app/Models/Order.php +++ b/app/Models/Order.php @@ -90,7 +90,7 @@ class Order extends Model public function scopeExpired() { return $this->where('status', static::STATUS_PENDING) - ->where('created_at', '<=', now()->subSeconds(app_settings('order_payment_expires_at'))); + ->where('created_at', '<=', now()->subSeconds(app_settings('app.order_payment_expires_at'))); } /** @@ -320,7 +320,7 @@ class Order extends Model } $seconds = now()->diffInSeconds( - $this->created_at->addSeconds(app_settings('order_payment_expires_at')), false + $this->created_at->addSeconds(app_settings('app.order_payment_expires_at')), false ); return $seconds > 0 ? $seconds : 0; diff --git a/app/Services/Kuaidi100Service.php b/app/Services/Kuaidi100Service.php index 9edb6cf3..18cc9b96 100644 --- a/app/Services/Kuaidi100Service.php +++ b/app/Services/Kuaidi100Service.php @@ -1328,12 +1328,12 @@ class Kuaidi100Service public function setAppKey($appKey = null) { - $this->appKey = $appKey ??app_settings('kuaidi100_app_key'); + $this->appKey = $appKey ??app_settings('kuaidi100.app_key'); } public function setCustomer($customer = null) { - $this->customer = $customer ??app_settings('kuaidi100_customer'); + $this->customer = $customer ??app_settings('kuaidi100.customer'); } /** @@ -1344,7 +1344,7 @@ class Kuaidi100Service public function poll(string $number, string $code, string $phone) { $uri = '/poll'; - $callbackUrl = app_settings('kuaidi100_callback'); + $callbackUrl = app_settings('kuaidi100.callback'); if (empty($callbackUrl)) { throw new BizException('未配置推送回调地址'); @@ -1357,7 +1357,7 @@ class Kuaidi100Service 'key' => $this->appKey, 'parameters'=> [ 'callbackurl'=> $callbackUrl, - 'salt' => app_settings('kuaidi100_secret'), + 'salt' => app_settings('kuaidi100.secret'), 'phone' => $phone, 'resultv2' => '1', 'autoCom' => empty($code) ? 1 : 0, @@ -1488,7 +1488,7 @@ class Kuaidi100Service */ public function unPollSign(string $sign, array $params) { - return $sign === strtoupper(md5(json_encode($params, JSON_UNESCAPED_UNICODE).app_settings('kuaidi100_secret'))); + return $sign === strtoupper(md5(json_encode($params, JSON_UNESCAPED_UNICODE).app_settings('kuaidi100.secret'))); } public function getStatusName($state = 0) diff --git a/app/Services/OrderPackageService.php b/app/Services/OrderPackageService.php index 57cd6b0e..a82a606d 100644 --- a/app/Services/OrderPackageService.php +++ b/app/Services/OrderPackageService.php @@ -65,7 +65,7 @@ class OrderPackageService // 更新商品的售后过期时间 $package->orderProducts()->update([ - 'after_expire_at'=> $package->checked_at->addDays(app_settings('sale_after_expire_days', 7)), + 'after_expire_at'=> $package->checked_at->addDays(app_settings('app.sale_after_expire_days', 7)), ]); } } diff --git a/app/Services/OrderService.php b/app/Services/OrderService.php index d858b8a2..773b9514 100644 --- a/app/Services/OrderService.php +++ b/app/Services/OrderService.php @@ -713,7 +713,7 @@ class OrderService 'attach' => json_encode([ 'pay_way' => $payWay, ]), - 'body' => app_settings('app_name').'-商城订单', + 'body' => app_settings('app.app_name').'-商城订单', 'out_trade_no' => $order->sn, 'total_fee' => $order->total_amount, 'notify_url' => url(route('wxpay.order_paid_notify', [], false), [], true), diff --git a/app/Services/Push/MallUnipushService.php b/app/Services/Push/MallUnipushService.php index 517ce12a..b6306c1b 100644 --- a/app/Services/Push/MallUnipushService.php +++ b/app/Services/Push/MallUnipushService.php @@ -16,10 +16,10 @@ class MallUnipushService extends UniPushService public function __construct() { - $this->appId = app_settings('mall_push_app_id', ''); - $this->appKey = app_settings('mall_push_app_key', ''); - $this->appSecret = app_settings('mall_push_app_secret', ''); - $this->masterSecret = app_settings('mall_push_master_secret', ''); + $this->appId = app_settings('unipush.mall_app_id', ''); + $this->appKey = app_settings('unipush.mall_app_key', ''); + $this->appSecret = app_settings('unipush.mall_app_secret', ''); + $this->masterSecret = app_settings('unipush.mall_master_secret', ''); parent::__construct($this->appId, $this->appKey, $this->appSecret, $this->masterSecret); } diff --git a/app/Services/SettingService.php b/app/Services/SettingService.php index 51c3874a..566af766 100644 --- a/app/Services/SettingService.php +++ b/app/Services/SettingService.php @@ -5,6 +5,8 @@ namespace App\Services; use App\Models\Setting; use Illuminate\Contracts\Cache\Repository as Cache; use Illuminate\Database\Eloquent\ModelNotFoundException; +use Illuminate\Support\Arr; +use Throwable; class SettingService { @@ -40,12 +42,15 @@ class SettingService if (! array_key_exists($key, $this->items)) { try { $this->items[$key] = $this->cache->remember($this->cacheKey($key), $this->ttl, function () use ($key) { - $settings = Setting::where('key', $key)->firstOrFail(); + $_key = $this->keyHandle($key); + $settings = Setting::where('key', $_key[0])->firstOrFail(); - return $settings->value; + return Arr::get($settings->value, $_key[1]); }); } catch (ModelNotFoundException $e) { return $default; + } catch (Throwable $th) { + return $default; } } @@ -81,11 +86,8 @@ class SettingService $keys = is_array($key) ? $key : [$key => $value]; foreach ($keys as $key => $value) { - Setting::updateOrCreate([ - 'key' => $key, - ], [ - 'value' => $value, - ]); + $_key = $this->keyHandle($key); + Setting::where('key', $_key[0])->update(['value->'.$_key[1] => $value]); $this->cleanCache($key); } @@ -95,7 +97,7 @@ class SettingService * @param string $key * @return void */ - protected function cleanCache(string $key): void + public function cleanCache(string $key): void { unset($this->items[$key]); @@ -110,4 +112,9 @@ class SettingService { return "settings.{$key}"; } + + protected function keyHandle(string $key) + { + return explode('.', $key); + } } diff --git a/database/seeders/AppSettingSeeder.php b/database/seeders/AppSettingSeeder.php index b3ae1bee..50941e02 100644 --- a/database/seeders/AppSettingSeeder.php +++ b/database/seeders/AppSettingSeeder.php @@ -15,110 +15,51 @@ class AppSettingSeeder extends Seeder public function run() { foreach ([ - 'app_name' => [ - 'value' => '子春生', - 'remarks'=>'应用名称', + 'app'=> [ + 'value'=> [ + 'app_name' => '子春生', + 'order_payment_expires_at' => 1800, + 'sale_after_expire_days' => 7, + 'sign_click_points' => 5, + 'sign_click_continue' => 7, + 'sign_click_continue_points' => 10, + 'article_help' => 1, + 'article_agreement' => 2, + 'article_health' => 3, + 'article_about_us' => env('APP_URL', '').'/h5/articles/1', + 'article_user_promotion_agreement' => env('APP_URL', '').'/h5/articles/2', + 'article_user_hide_agreement' => env('APP_URL', '').'/h5/articles/3', + 'invite_uri' => '', + 'search_hot_keys' => '搜索热词,分词1,分词2,分词3', + ], + 'remarks' => '系统配置', ], - 'order_payment_expires_at' => [ - 'value' => 1800, - 'remarks' => '订单支付过期时间(秒)', + 'kuaidi100' => [ + 'value' => [ + 'is_use' => true, + 'callback_uri' => env('APP_URL', '').'/callback/kuaidi100', + 'app_key' => 'BTvgbjti4727', + 'customer' => '064109188EC4D85DA655DFC342144C6A', + 'secret' => '1bd287d1981749f2a30ea74cac0ab99c', + 'userid' => 'ec0b6ec7729d4f22824cfd3c519dd45b', + ], + 'remarks' => '快递100配置', ], - 'sale_after_expire_days' => [ - 'value' => 7, - 'remarks' => '售后过期时间(天)', + 'unipush' => [ + 'value' =>[ + 'is_use' => true, + 'mall_app_id' => 'iikmCoESID8bC1LhOPG1r8', + 'mall_app_key' => 'JX33P0wP8bAQprI953hpN6', + 'mall_app_secret' => 'a3u3B6lXjq6fPTBlOGiOc9', + 'mall_master_secret' => 'MAxmqomwo597xJeDuMCvx1', + 'merchant_is_use' => false, + 'merchant_app_id' => '', + 'merchant_app_key' => '', + 'merchant_app_secret' => '', + 'merchant_master_secret' => '', + ], + 'remarks' => '个推配置', ], - - 'sign_click_points' => [ - 'value' => 5, - 'remarks' => '签到送积分(分)', - ], - 'sign_click_continue' => [ - 'value' => 7, - 'remarks' => '每连续N天签到额外奖励', - ], - 'sign_click_continue_points' => [ - 'value' => 10, - 'remarks' => '每连续签到额外奖励(分)', - ], - - 'article_help' => [ - 'value' => 1, - 'remarks' => '帮助文章指定分类(ID)', - ], - 'article_agreement' => [ - 'value' => 2, - 'remarks' => '协议文章指定分类(ID)', - ], - 'article_agreement' => [ - 'value' => 3, - 'remarks' => '健康文章指定分类(ID)', - ], - - 'article_about_us' => [ - 'value' => env('APP_URL', '').'/h5/articles/1', - 'remarks' => '关于我们文章指定(链接)', - ], - 'article_user_promotion_agreement' => [ - 'value' => env('APP_URL', '').'/h5/articles/2', - 'remarks' => '服务协议文章指定(链接)', - ], - 'article_user_hide_agreement' => [ - 'value' => env('APP_URL', '').'/h5/articles/3', - 'remarks' => '隐私协议文章指定(链接)', - ], - - 'kuaidi100_is_use' => [ - 'value' => true, - 'remarks' => '快递100:是否开启', - ], - 'kuaidi100_callback' => [ - 'value' => env('APP_URL', '').'/callback/kuaidi100', - 'remarks' => '快递100:回调地址(链接)', - ], - 'kuaidi100_app_key' => [ - 'value' => 'BTvgbjti4727', - 'remarks' => '快递100:APP_KEY', - ], - 'kuaidi100_customer' => [ - 'value' => '064109188EC4D85DA655DFC342144C6A', - 'remarks' => '快递100:CUSTOMER', - ], - 'kuaidi100_secret' => [ - 'value' => '1bd287d1981749f2a30ea74cac0ab99c', - 'remarks' => '快递100:SECRET', - ], - 'kuaidi100_userid' => [ - 'value' => 'ec0b6ec7729d4f22824cfd3c519dd45b', - 'remarks' => '快递100:USER_ID', - ], - - 'mall_push_app_id' => [ - 'value' => 'iikmCoESID8bC1LhOPG1r8', - 'remarks' => '个推:APP_ID', - ], - 'mall_push_app_key' => [ - 'value' => 'JX33P0wP8bAQprI953hpN6', - 'remarks' => '个推:APP_KEY', - ], - 'mall_push_app_secret' => [ - 'value' => 'a3u3B6lXjq6fPTBlOGiOc9', - 'remarks' => '个推:APP_SECRET', - ], - 'mall_push_master_secret' => [ - 'value' => 'MAxmqomwo597xJeDuMCvx1', - 'remarks' => '个推:APP_MASTER_SECRET', - ], - - 'invite_uri' => [ - 'value' => '', - 'remarks' => '分享邀请地址(链接)', - ], - - 'search_hot_keys' => [ - 'value' => '搜索热词,分词1,分词2,分词3', - 'remarks'=>'搜索热词(半角逗号,隔开)', - ], - ] as $key => $values) { Setting::firstOrCreate(['key' => $key], $values); }