55 lines
1.5 KiB
PHP
55 lines
1.5 KiB
PHP
<?php
|
|
|
|
|
|
namespace app\adminapi\logic\setting;
|
|
|
|
use app\common\logic\BaseLogic;
|
|
use app\common\service\ConfigService;
|
|
use app\common\service\FileService;
|
|
|
|
/**
|
|
* 客服设置逻辑
|
|
* Class CustomerServiceLogic
|
|
* @package app\adminapi\logic\setting
|
|
*/
|
|
class CustomerServiceLogic extends BaseLogic
|
|
{
|
|
/**
|
|
* @notes 获取客服设置
|
|
* @return array
|
|
* @author ljj
|
|
* @date 2022/2/15 12:05 下午
|
|
*/
|
|
public static function getConfig()
|
|
{
|
|
$qrCode = ConfigService::get('customer_service', 'qr_code');
|
|
$qrCode = empty($qrCode) ? '' : FileService::getFileUrl($qrCode);
|
|
$config = [
|
|
'qr_code' => $qrCode,
|
|
'wechat' => ConfigService::get('customer_service', 'wechat', ''),
|
|
'phone' => ConfigService::get('customer_service', 'phone', ''),
|
|
'service_time' => ConfigService::get('customer_service', 'service_time', ''),
|
|
];
|
|
return $config;
|
|
}
|
|
|
|
/**
|
|
* @notes 设置客服设置
|
|
* @param $params
|
|
* @author ljj
|
|
* @date 2022/2/15 12:11 下午
|
|
*/
|
|
public static function setConfig($params)
|
|
{
|
|
$allowField = ['qr_code', 'wechat', 'phone', 'service_time'];
|
|
foreach ($params as $key => $value) {
|
|
if (in_array($key, $allowField)) {
|
|
if ($key == 'qr_code') {
|
|
$value = FileService::setFileUrl($value);
|
|
}
|
|
ConfigService::set('customer_service', $key, $value);
|
|
}
|
|
}
|
|
}
|
|
}
|