24 lines
969 B
PHP
24 lines
969 B
PHP
<?php
|
|
namespace App\Services\CustomerService;
|
|
|
|
class Settings
|
|
{
|
|
public const DEFAULTS = [
|
|
'enabled' => false, 'base_url' => '', 'website_token' => '',
|
|
'working_hours' => '工作日早9点至晚5点',
|
|
'offline_title' => '当前没有在线客服',
|
|
'offline_message' => '您可以在这里留言,客服上线后会尽快回复。',
|
|
'ticket_url' => '/#/tickets', 'telegram_enabled' => false,
|
|
'telegram_bot_code' => 'base', 'telegram_target_code' => 'base',
|
|
];
|
|
public function all(): array
|
|
{
|
|
return array_replace(self::DEFAULTS, array_intersect_key((array) admin_setting('customer_service', []), self::DEFAULTS));
|
|
}
|
|
public function publicConfig(): array
|
|
{
|
|
return array_diff_key($this->all(), array_flip(['telegram_enabled','telegram_bot_code','telegram_target_code']))
|
|
+ ['online_count'=>max(0,min(3,(int)admin_setting('customer_service_display_count',1)))];
|
|
}
|
|
}
|