Files
anmo/server/app/coachapi/logic/ConfigLogic.php
2025-08-19 14:16:51 +08:00

138 lines
6.0 KiB
PHP
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\coachapi\logic;
use app\common\logic\BaseLogic;
use app\common\model\TextList;
use app\common\service\ConfigService;
use app\common\service\FileService;
class ConfigLogic extends BaseLogic
{
/**
* @notes 基础配置信息
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author ljj
* @date 2022/2/23 10:30 上午
*/
public function config()
{
$config = [
// 登录方式
'login_way' => ConfigService::get('login', 'login_way', config('project.login.login_way')),
// 注册强制绑定手机
'coerce_mobile' => ConfigService::get('login', 'coerce_mobile', config('project.login.coerce_mobile')),
// 政策协议
'login_agreement' => ConfigService::get('login', 'login_agreement', config('project.login.login_agreement')),
// 第三方登录 开关
'third_auth' => ConfigService::get('login', 'third_auth', config('project.login.third_auth')),
// 微信授权登录
'wechat_auth' => ConfigService::get('login', 'wechat_auth', config('project.login.wechat_auth')),
// qq授权登录
// 'qq_auth' => ConfigService::get('login', 'qq_auth', config('project.login.qq_auth')),
//版权信息
'info' => ConfigService::get('copyright', 'info'),
//ICP备案号
'icp_number' => ConfigService::get('copyright', 'icp_number'),
//ICP备案链接
'icp_link' => ConfigService::get('copyright', 'icp_link'),
//名称
'name' => ConfigService::get('coach', 'name',''),
//logo
'logo' => FileService::getFileUrl(ConfigService::get('coach', 'logo','')),
//地图key
'tencent_map_key' => ConfigService::get('map','tencent_map_key',''),
//版本号
'version' => request()->header('version'),
//默认头像
'default_avatar' => ConfigService::get('config', 'default_coach_avatar', FileService::getFileUrl(config('project.default_image.user_avatar'))),
//文件域名
'domain' => request()->domain().'/',
//联系客服
'service_mobile' => ConfigService::get('platform', 'service_mobile',''),
//网站名称
'web_name' => ConfigService::get('platform_logo', 'platform_name',''),
//网站logo
'web_logo' => FileService::getFileUrl(ConfigService::get('platform_logo', 'platform_logo')),
//商城名称
'shop_name' => ConfigService::get('coach', 'coach_name',''),
//商城logo
'shop_logo' => FileService::getFileUrl(ConfigService::get('coach', 'coach_logo','')),
];
return $config;
}
/**
* @notes 政策协议
* @return array
* @author ljj
* @date 2022/2/23 11:42 上午
*/
public function agreement()
{
$service = TextList::where(['id'=>3])->field('title,content')->findOrEmpty();
$privacy = TextList::where(['id'=>4])->field('title,content')->findOrEmpty();
$config = [
//隐私协议
'service_title' => $service['title'],
'service_agreement' => $service['content'],
//服务协议
'privacy_title' => $privacy['title'],
'privacy_agreement' => $privacy['content'],
];
return $config;
}
/**
* @notes 获取客服配置
* @return array
* @author ljj
* @date 2024/8/28 下午4:06
*/
public function getKefuConfig()
{
$defaultData = [
'way' => 1,
'name' => '',
'remarks' => '',
'phone' => '',
'business_time' => '',
'qr_code' => '',
'enterprise_id' => '',
'kefu_link' => ''
];
$config = [
'mnp' => ConfigService::get('kefu_config', 'mnp', $defaultData),
'oa' => ConfigService::get('kefu_config', 'oa', $defaultData),
'h5' => ConfigService::get('kefu_config', 'h5', $defaultData),
];
if (!empty($config['mnp']['qr_code'])) $config['mnp']['qr_code'] = FileService::getFileUrl($config['mnp']['qr_code']);
if (!empty($config['oa']['qr_code'])) $config['oa']['qr_code'] = FileService::getFileUrl($config['oa']['qr_code']);
if (!empty($config['h5']['qr_code'])) $config['h5']['qr_code'] = FileService::getFileUrl($config['h5']['qr_code']);
return $config;
}
}