初始化仓库

This commit is contained in:
wangxiaowei
2025-04-22 14:09:52 +08:00
commit 8b100110bb
5155 changed files with 664201 additions and 0 deletions

View File

@ -0,0 +1,65 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
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);
}
}
}
}

View File

@ -0,0 +1,75 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\logic\setting;
use app\common\logic\BaseLogic;
use app\common\model\HotSearch;
use app\common\service\ConfigService;
use app\common\service\FileService;
/**
* 热门搜素逻辑
* Class HotSearchLogic
* @package app\adminapi\logic\setting
*/
class HotSearchLogic extends BaseLogic
{
/**
* @notes 获取配置
* @return array
* @author 段誉
* @date 2022/9/5 18:48
*/
public static function getConfig()
{
return [
// 功能状态 0-关闭 1-开启
'status' => ConfigService::get('hot_search', 'status', 0),
// 热门搜索数据
'data' => HotSearch::field(['name', 'sort'])->order(['sort' => 'desc', 'id' =>'desc'])->select()->toArray(),
];
}
/**
* @notes 设置热门搜搜
* @param $params
* @return bool
* @author 段誉
* @date 2022/9/5 18:58
*/
public static function setConfig($params)
{
try {
if (!empty($params['data'])) {
$model = (new HotSearch());
$model->where('id', '>', 0)->delete();
$model->saveAll($params['data']);
}
$status = empty($params['status']) ? 0 : $params['status'];
ConfigService::set('hot_search', 'status', $status);
return true;
} catch (\Exception $e) {
self::$error = $e->getMessage();
return false;
}
}
}

View File

@ -0,0 +1,203 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\logic\setting;
use app\common\logic\BaseLogic;
use app\common\service\ConfigService;
use think\facade\Cache;
/**
* 存储设置逻辑层
* Class ShopStorageLogic
* @package app\adminapi\logic\setting\
*/
class StorageLogic extends BaseLogic
{
/**
* @notes 存储引擎列表
* @return array[]
* @author 段誉
* @date 2022/4/20 16:14
*/
public static function lists()
{
$default = ConfigService::get('storage', 'default', 'local');
$data = [
[
'name' => '本地存储',
'path' => '存储在本地服务器',
'engine' => 'local',
'status' => $default == 'local' ? 1 : 0
],
[
'name' => '七牛云存储',
'path' => '存储在七牛云,请前往七牛云开通存储服务',
'engine' => 'qiniu',
'status' => $default == 'qiniu' ? 1 : 0
],
[
'name' => '阿里云OSS',
'path' => '存储在阿里云,请前往阿里云开通存储服务',
'engine' => 'aliyun',
'status' => $default == 'aliyun' ? 1 : 0
],
[
'name' => '腾讯云COS',
'path' => '存储在腾讯云,请前往腾讯云开通存储服务',
'engine' => 'qcloud',
'status' => $default == 'qcloud' ? 1 : 0
]
];
return $data;
}
/**
* @notes 存储设置详情
* @param $param
* @return mixed
* @author 段誉
* @date 2022/4/20 16:15
*/
public static function detail($param)
{
$default = ConfigService::get('storage', 'default', '');
// 本地存储
$local = ['status' => $default == 'local' ? 1 : 0];
// 七牛云存储
$qiniu = ConfigService::get('storage', 'qiniu', [
'bucket' => '',
'access_key' => '',
'secret_key' => '',
'domain' => '',
'status' => $default == 'qiniu' ? 1 : 0
]);
// 阿里云存储
$aliyun = ConfigService::get('storage', 'aliyun', [
'bucket' => '',
'access_key' => '',
'secret_key' => '',
'domain' => '',
'status' => $default == 'aliyun' ? 1 : 0
]);
// 腾讯云存储
$qcloud = ConfigService::get('storage', 'qcloud', [
'bucket' => '',
'region' => '',
'access_key' => '',
'secret_key' => '',
'domain' => '',
'status' => $default == 'qcloud' ? 1 : 0
]);
$data = [
'local' => $local,
'qiniu' => $qiniu,
'aliyun' => $aliyun,
'qcloud' => $qcloud
];
$result = $data[$param['engine']];
if ($param['engine'] == $default) {
$result['status'] = 1;
} else {
$result['status'] = 0;
}
return $result;
}
/**
* @notes 设置存储参数
* @param $params
* @return bool|string
* @author 段誉
* @date 2022/4/20 16:16
*/
public static function setup($params)
{
if ($params['status'] == 1) { //状态为开启
ConfigService::set('storage', 'default', $params['engine']);
} else {
ConfigService::set('storage', 'default', 'local');
}
switch ($params['engine']) {
case 'local':
ConfigService::set('storage', 'local', []);
break;
case 'qiniu':
ConfigService::set('storage', 'qiniu', [
'bucket' => $params['bucket'] ?? '',
'access_key' => $params['access_key'] ?? '',
'secret_key' => $params['secret_key'] ?? '',
'domain' => $params['domain'] ?? ''
]);
break;
case 'aliyun':
ConfigService::set('storage', 'aliyun', [
'bucket' => $params['bucket'] ?? '',
'access_key' => $params['access_key'] ?? '',
'secret_key' => $params['secret_key'] ?? '',
'domain' => $params['domain'] ?? ''
]);
break;
case 'qcloud':
ConfigService::set('storage', 'qcloud', [
'bucket' => $params['bucket'] ?? '',
'region' => $params['region'] ?? '',
'access_key' => $params['access_key'] ?? '',
'secret_key' => $params['secret_key'] ?? '',
'domain' => $params['domain'] ?? '',
]);
break;
}
Cache::delete('STORAGE_DEFAULT');
Cache::delete('STORAGE_ENGINE');
if ($params['engine'] == 'local' && $params['status'] == 0) {
return '默认开启本地存储';
} else {
return true;
}
}
/**
* @notes 切换状态
* @param $params
* @author 段誉
* @date 2022/4/20 16:17
*/
public static function change($params)
{
$default = ConfigService::get('storage', 'default', '');
if ($default == $params['engine']) {
ConfigService::set('storage', 'default', 'local');
} else {
ConfigService::set('storage', 'default', $params['engine']);
}
Cache::delete('STORAGE_DEFAULT');
Cache::delete('STORAGE_ENGINE');
}
}

View File

@ -0,0 +1,64 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\logic\setting;
use app\common\logic\BaseLogic;
use app\common\service\ConfigService;
/**
* 交易设置逻辑
* Class TransactionSettingsLogic
* @package app\adminapi\logic\setting
*/
class TransactionSettingsLogic extends BaseLogic
{
/**
* @notes 获取交易设置
* @return array
* @author ljj
* @date 2022/2/15 11:40 上午
*/
public static function getConfig()
{
$config = [
'cancel_unpaid_orders' => ConfigService::get('transaction', 'cancel_unpaid_orders', 1),
'cancel_unpaid_orders_times' => ConfigService::get('transaction', 'cancel_unpaid_orders_times', 30),
'verification_orders' => ConfigService::get('transaction', 'verification_orders', 1),
'verification_orders_times' => ConfigService::get('transaction', 'verification_orders_times', 24),
];
return $config;
}
/**
* @notes 设置交易设置
* @param $params
* @author ljj
* @date 2022/2/15 11:49 上午
*/
public static function setConfig($params)
{
ConfigService::set('transaction', 'cancel_unpaid_orders', $params['cancel_unpaid_orders']);
ConfigService::set('transaction', 'verification_orders', $params['verification_orders']);
if (isset($params['cancel_unpaid_orders_times'])) {
ConfigService::set('transaction', 'cancel_unpaid_orders_times', $params['cancel_unpaid_orders_times']);
}
if (isset($params['verification_orders_times'])) {
ConfigService::set('transaction', 'verification_orders_times', $params['verification_orders_times']);
}
}
}

View File

@ -0,0 +1,84 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\logic\setting\dict;
use app\common\logic\BaseLogic;
use app\common\model\dict\DictData;
use app\common\model\dict\DictType;
/**
* 字典数据逻辑
* Class DictDataLogic
* @package app\adminapi\logic\DictData
*/
class DictDataLogic extends BaseLogic
{
/**
* @notes 添加编辑
* @param array $params
* @return DictData|\think\Model
* @author 段誉
* @date 2022/6/20 17:13
*/
public static function save(array $params)
{
$data = [
'name' => $params['name'],
'value' => $params['value'],
'sort' => $params['sort'] ?? 0,
'status' => $params['status'],
'remark' => $params['remark'] ?? '',
];
if (!empty($params['id'])) {
return DictData::where(['id' => $params['id']])->update($data);
} else {
$dictType = DictType::findOrEmpty($params['type_id']);
$data['type_id'] = $params['type_id'];
$data['type_value'] = $dictType['type'];
return DictData::create($data);
}
}
/**
* @notes 删除字典数据
* @param array $params
* @return bool
* @author 段誉
* @date 2022/6/20 17:01
*/
public static function delete(array $params)
{
return DictData::destroy($params['id']);
}
/**
* @notes 获取字典数据详情
* @param $params
* @return array
* @author 段誉
* @date 2022/6/20 17:01
*/
public static function detail($params): array
{
return DictData::findOrEmpty($params['id'])->toArray();
}
}

View File

@ -0,0 +1,111 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\logic\setting\dict;
use app\common\enum\YesNoEnum;
use app\common\logic\BaseLogic;
use app\common\model\dict\DictData;
use app\common\model\dict\DictType;
/**
* 字典类型逻辑
* Class DictTypeLogic
* @package app\adminapi\logic\dict
*/
class DictTypeLogic extends BaseLogic
{
/**
* @notes 添加字典类型
* @param array $params
* @return DictType|\think\Model
* @author 段誉
* @date 2022/6/20 16:08
*/
public static function add(array $params)
{
return DictType::create([
'name' => $params['name'],
'type' => $params['type'],
'status' => $params['status'],
'remark' => $params['remark'] ?? '',
]);
}
/**
* @notes 编辑字典类型
* @param array $params
* @author 段誉
* @date 2022/6/20 16:10
*/
public static function edit(array $params)
{
DictType::update([
'id' => $params['id'],
'name' => $params['name'],
'type' => $params['type'],
'status' => $params['status'],
'remark' => $params['remark'] ?? '',
]);
DictData::where(['type_id' => $params['id']])
->update(['type_value' => $params['type']]);
}
/**
* @notes 删除字典类型
* @param array $params
* @author 段誉
* @date 2022/6/20 16:23
*/
public static function delete(array $params)
{
DictType::destroy($params['id']);
}
/**
* @notes 获取字典详情
* @param $params
* @return array
* @author 段誉
* @date 2022/6/20 16:23
*/
public static function detail($params): array
{
return DictType::findOrEmpty($params['id'])->toArray();
}
/**
* @notes 角色数据
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2022/10/13 10:44
*/
public static function getAllData()
{
return DictType::where(['status' => YesNoEnum::YES])
->order(['id' => 'desc'])
->select()
->toArray();
}
}

View File

@ -0,0 +1,96 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\logic\setting\pay;
use app\common\enum\PayEnum;
use app\common\logic\BaseLogic;
use app\common\model\pay\PayConfig;
use app\common\service\FileService;
/**
* 支付配置
* Class PayConfigLogic
* @package app\adminapi\logic\setting\pay
*/
class PayConfigLogic extends BaseLogic
{
/**
* @notes 设置配置
* @param $params
* @return bool
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2023/2/23 16:16
*/
public static function setConfig($params)
{
$payConfig = PayConfig::find($params['id']);
$config = '';
if ($payConfig['pay_way'] == PayEnum::WECHAT_PAY) {
$config = [
'interface_version' => $params['config']['interface_version'],
'merchant_type' => $params['config']['merchant_type'],
'mch_id' => $params['config']['mch_id'],
'pay_sign_key' => $params['config']['pay_sign_key'],
'apiclient_cert' => $params['config']['apiclient_cert'],
'apiclient_key' => $params['config']['apiclient_key'],
];
}
if ($payConfig['pay_way'] == PayEnum::ALI_PAY) {
$config = [
'mode' => $params['config']['mode'],
'merchant_type' => $params['config']['merchant_type'],
'app_id' => $params['config']['app_id'],
'private_key' => $params['config']['private_key'],
'ali_public_key' => $params['config']['mode'] == 'normal_mode' ? $params['config']['ali_public_key'] : '',
'public_cert' => $params['config']['mode'] == 'certificate' ? $params['config']['public_cert'] : '',
'ali_public_cert' => $params['config']['mode'] == 'certificate' ? $params['config']['ali_public_cert'] : '',
'ali_root_cert' => $params['config']['mode'] == 'certificate' ? $params['config']['ali_root_cert'] : '',
];
}
$payConfig->name = $params['name'];
$payConfig->icon = FileService::setFileUrl($params['icon']);
$payConfig->sort = $params['sort'];
$payConfig->config = $config;
$payConfig->remark = $params['remark'] ?? '';
return $payConfig->save();
}
/**
* @notes 获取配置
* @param $params
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2023/2/23 16:16
*/
public static function getConfig($params)
{
$payConfig = PayConfig::find($params['id'])->toArray();
$payConfig['icon'] = FileService::getFileUrl($payConfig['icon']);
$payConfig['domain'] = request()->domain();
return $payConfig;
}
}

View File

@ -0,0 +1,111 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\logic\setting\pay;
use app\common\enum\PayEnum;
use app\common\enum\YesNoEnum;
use app\common\logic\BaseLogic;
use app\common\model\pay\PayConfig;
use app\common\model\pay\PayWay;
use app\common\service\FileService;
/**
* 支付方式
* Class PayWayLogic
* @package app\adminapi\logic\setting\pay
*/
class PayWayLogic extends BaseLogic
{
/**
* @notes 获取支付方式
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2023/2/23 16:25
*/
public static function getPayWay()
{
$payWay = PayWay::select()->append(['pay_way_name'])
->toArray();
if (empty($payWay)) {
return [];
}
$lists = [];
for ($i = 1; $i <= max(array_column($payWay, 'scene')); $i++) {
foreach ($payWay as $val) {
if ($val['scene'] == $i) {
$val['icon'] = FileService::getFileUrl(PayConfig::where('id', $val['pay_config_id'])->value('icon'));
$lists[$i][] = $val;
}
}
}
return $lists;
}
/**
* @notes 设置支付方式
* @param $params
* @return bool|string
* @throws \Exception
* @author 段誉
* @date 2023/2/23 16:26
*/
public static function setPayWay($params)
{
$payWay = new PayWay;
$data = [];
foreach ($params as $key => $value) {
$isDefault = array_column($value, 'is_default');
$isDefaultNum = array_count_values($isDefault);
$status = array_column($value, 'status');
$sceneName = PayEnum::getPaySceneDesc($key);
if (!in_array(YesNoEnum::YES, $isDefault)) {
return $sceneName . '支付场景缺少默认支付';
}
if ($isDefaultNum[YesNoEnum::YES] > 1) {
return $sceneName . '支付场景的默认值只能存在一个';
}
if (!in_array(YesNoEnum::YES, $status)) {
return $sceneName . '支付场景至少开启一个支付状态';
}
foreach ($value as $val) {
$result = PayWay::where('id', $val['id'])->findOrEmpty();
if ($result->isEmpty()) {
continue;
}
if ($val['is_default'] == YesNoEnum::YES && $val['status'] == YesNoEnum::NO) {
return $sceneName . '支付场景的默认支付未开启支付状态';
}
$data[] = [
'id' => $val['id'],
'is_default' => $val['is_default'],
'status' => $val['status'],
];
}
}
$payWay->saveAll($data);
return true;
}
}

View File

@ -0,0 +1,37 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\logic\setting\system;
use app\common\logic\BaseLogic;
use think\facade\Cache;
/**
* 系统缓存逻辑
* Class CacheLogic
* @package app\adminapi\logic\setting\system
*/
class CacheLogic extends BaseLogic
{
/**
* @notes 清楚系统缓存
* @author 段誉
* @date 2022/4/8 16:29
*/
public static function clear()
{
Cache::clear();
del_target_dir(app()->getRootPath().'runtime/file',true);
}
}

View File

@ -0,0 +1,65 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\logic\setting\system;
use app\common\logic\BaseLogic;
/**
* Class SystemLogic
* @package app\adminapi\logic\setting\system
*/
class SystemLogic extends BaseLogic
{
/**
* @notes 系统环境信息
* @return \array[][]
* @author 段誉
* @date 2021/12/28 18:35
*/
public static function getInfo() : array
{
$server = [
['param' => '服务器操作系统', 'value' => PHP_OS],
['param' => 'web服务器环境', 'value' => $_SERVER['SERVER_SOFTWARE']],
['param' => 'PHP版本', 'value' => PHP_VERSION],
];
$env = [
[ 'option' => 'PHP版本',
'require' => '8.0版本以上',
'status' => (int)compare_php('8.0.0'),
'remark' => ''
]
];
$auth = [
[
'dir' => '/runtime',
'require' => 'runtime目录可写',
'status' => (int)check_dir_write('runtime'),
'remark' => ''
],
];
return [
'server' => $server,
'env' => $env,
'auth' => $auth,
];
}
}

View File

@ -0,0 +1,108 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\logic\setting\user;
use app\common\service\{ConfigService, FileService};
/**
* 设置-用户设置逻辑层
* Class UserLogic
* @package app\adminapi\logic\config
*/
class UserLogic
{
/**
* @notes 获取用户设置
* @return array
* @author 段誉
* @date 2022/3/29 10:09
*/
public static function getConfig(): array
{
$defaultAvatar = config('project.default_image.user_avatar');
$config = [
//默认头像
'default_avatar' => FileService::getFileUrl(ConfigService::get('default_image', 'user_avatar', $defaultAvatar)),
];
return $config;
}
/**
* @notes 设置用户设置
* @param array $params
* @return bool
* @author 段誉
* @date 2022/3/29 10:09
*/
public function setConfig(array $params): bool
{
$avatar = FileService::setFileUrl($params['default_avatar']);
ConfigService::set('default_image', 'user_avatar', $avatar);
return true;
}
/**
* @notes 获取注册配置
* @return array
* @author 段誉
* @date 2022/3/29 10:10
*/
public function getRegisterConfig(): array
{
$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')),
];
return $config;
}
/**
* @notes 设置登录注册
* @param array $params
* @return bool
* @author 段誉
* @date 2022/3/29 10:10
*/
public static function setRegisterConfig(array $params): bool
{
// 登录方式1-账号密码登录2-手机短信验证码登录
ConfigService::set('login', 'login_way', $params['login_way']);
// 注册强制绑定手机
ConfigService::set('login', 'coerce_mobile', $params['coerce_mobile']);
// 政策协议
ConfigService::set('login', 'login_agreement', $params['login_agreement']);
// 第三方授权登录
ConfigService::set('login', 'third_auth', $params['third_auth']);
// 微信授权登录
ConfigService::set('login', 'wechat_auth', $params['wechat_auth']);
// qq登录
ConfigService::set('login', 'qq_auth', $params['qq_auth']);
return true;
}
}

View File

@ -0,0 +1,187 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\logic\setting\web;
use app\common\logic\BaseLogic;
use app\common\service\ConfigService;
use app\common\service\FileService;
/**
* 网站设置
* Class WebSettingLogic
* @package app\adminapi\logic\setting
*/
class WebSettingLogic extends BaseLogic
{
/**
* @notes 获取网站信息
* @return array
* @author 段誉
* @date 2021/12/28 15:43
*/
public static function getWebsiteInfo(): array
{
return [
'name' => ConfigService::get('website', 'name'),
'web_favicon' => FileService::getFileUrl(ConfigService::get('website', 'web_favicon')),
'web_logo' => FileService::getFileUrl(ConfigService::get('website', 'web_logo')),
'login_image' => FileService::getFileUrl(ConfigService::get('website', 'login_image')),
'shop_name' => ConfigService::get('website', 'shop_name'),
'shop_logo' => FileService::getFileUrl(ConfigService::get('website', 'shop_logo')),
'pc_logo' => FileService::getFileUrl(ConfigService::get('website', 'pc_logo')),
'pc_title' => ConfigService::get('website', 'pc_title', ''),
'pc_ico' => FileService::getFileUrl(ConfigService::get('website', 'pc_ico')),
'pc_desc' => ConfigService::get('website', 'pc_desc', ''),
'pc_keywords' => ConfigService::get('website', 'pc_keywords', ''),
'h5_favicon' => FileService::getFileUrl(ConfigService::get('website', 'h5_favicon')),
];
}
/**
* @notes 设置网站信息
* @param array $params
* @author 段誉
* @date 2021/12/28 15:43
*/
public static function setWebsiteInfo(array $params)
{
$h5favicon = FileService::setFileUrl($params['h5_favicon']);
$favicon = FileService::setFileUrl($params['web_favicon']);
$logo = FileService::setFileUrl($params['web_logo']);
$login = FileService::setFileUrl($params['login_image']);
$shopLogo = FileService::setFileUrl($params['shop_logo']);
$pcLogo = FileService::setFileUrl($params['pc_logo']);
$pcIco = FileService::setFileUrl($params['pc_ico'] ?? '');
ConfigService::set('website', 'name', $params['name']);
ConfigService::set('website', 'web_favicon', $favicon);
ConfigService::set('website', 'web_logo', $logo);
ConfigService::set('website', 'login_image', $login);
ConfigService::set('website', 'shop_name', $params['shop_name']);
ConfigService::set('website', 'shop_logo', $shopLogo);
ConfigService::set('website', 'pc_logo', $pcLogo);
ConfigService::set('website', 'pc_title', $params['pc_title']);
ConfigService::set('website', 'pc_ico', $pcIco);
ConfigService::set('website', 'pc_desc', $params['pc_desc'] ?? '');
ConfigService::set('website', 'pc_keywords', $params['pc_keywords'] ?? '');
ConfigService::set('website', 'h5_favicon', $h5favicon);
}
/**
* @notes 获取版权备案
* @return array
* @author 段誉
* @date 2021/12/28 16:09
*/
public static function getCopyright() : array
{
return ConfigService::get('copyright', 'config', []);
}
/**
* @notes 设置版权备案
* @param array $params
* @return bool
* @author 段誉
* @date 2022/8/8 16:33
*/
public static function setCopyright(array $params)
{
try {
if (!is_array($params['config'])) {
throw new \Exception('参数异常');
}
ConfigService::set('copyright', 'config', $params['config'] ?? []);
return true;
} catch (\Exception $e) {
self::$error = $e->getMessage();
return false;
}
}
/**
* @notes 设置政策协议
* @param array $params
* @author ljj
* @date 2022/2/15 10:59 上午
*/
public static function setAgreement(array $params)
{
$serviceContent = clear_file_domain($params['service_content'] ?? '');
$privacyContent = clear_file_domain($params['privacy_content'] ?? '');
ConfigService::set('agreement', 'service_title', $params['service_title'] ?? '');
ConfigService::set('agreement', 'service_content', $serviceContent);
ConfigService::set('agreement', 'privacy_title', $params['privacy_title'] ?? '');
ConfigService::set('agreement', 'privacy_content', $privacyContent);
}
/**
* @notes 获取政策协议
* @return array
* @author ljj
* @date 2022/2/15 11:15 上午
*/
public static function getAgreement() : array
{
$config = [
'service_title' => ConfigService::get('agreement', 'service_title'),
'service_content' => ConfigService::get('agreement', 'service_content'),
'privacy_title' => ConfigService::get('agreement', 'privacy_title'),
'privacy_content' => ConfigService::get('agreement', 'privacy_content'),
];
$config['service_content'] = get_file_domain($config['service_content']);
$config['privacy_content'] = get_file_domain($config['privacy_content']);
return $config;
}
/**
* @notes 获取站点统计配置
* @return array
* @author yfdong
* @date 2024/09/20 22:25
*/
public static function getSiteStatistics()
{
return [
'clarity_code' => ConfigService::get('siteStatistics', 'clarity_code')
];
}
/**
* @notes 设置站点统计配置
* @param array $params
* @return void
* @author yfdong
* @date 2024/09/20 22:31
*/
public static function setSiteStatistics(array $params)
{
ConfigService::set('siteStatistics', 'clarity_code', $params['clarity_code']);
}
}