128 lines
5.8 KiB
PHP
Executable File
128 lines
5.8 KiB
PHP
Executable File
<?php
|
||
// +----------------------------------------------------------------------
|
||
// | likeshop100%开源免费商用商城系统
|
||
// +----------------------------------------------------------------------
|
||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||
// | 开源版本可自由商用,可去除界面版权logo
|
||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||
// | 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团队 版权所有 拥有最终解释权
|
||
// +----------------------------------------------------------------------
|
||
// | author: likeshopTeam
|
||
// +----------------------------------------------------------------------
|
||
|
||
namespace app\adminapi\logic\setting\system;
|
||
|
||
|
||
use app\common\logic\BaseLogic;
|
||
use app\common\service\ConfigService;
|
||
|
||
/**
|
||
* 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)comparePHP('8.0.0'), 'remark' => '']
|
||
];
|
||
|
||
$auth = [
|
||
['dir' => '/runtime', 'require' => 'runtime目录可写', 'status' => (int)checkDirWrite('runtime'), 'remark' => ''],
|
||
];
|
||
|
||
return [
|
||
'server' => $server,
|
||
'env' => $env,
|
||
'auth' => $auth,
|
||
];
|
||
}
|
||
|
||
/**
|
||
* @notes 获取通用配置
|
||
* @return array[]
|
||
* @author cjhao
|
||
* @date 2024/8/27 17:21
|
||
*/
|
||
public static function getGeneralSetting()
|
||
{
|
||
$orderSetting = [
|
||
'order_cancel_order' => ConfigService::get('order_setting', 'order_cancel_order'),
|
||
'order_cancel_time' => ConfigService::get('order_setting', 'order_cancel_time'),
|
||
'over_time_comment' => ConfigService::get('order_setting', 'over_time_comment'),
|
||
'over_time_comment_content' => ConfigService::get('order_setting', 'over_time_comment_content')
|
||
];
|
||
$settleSetting = [
|
||
//结算方式
|
||
'commission_settle' => ConfigService::get('settle_setting', 'commission_settle'),
|
||
//结算周期:1-按状态;2-周期
|
||
'commission_settle_cycle' => ConfigService::get('settle_setting', 'commission_settle_cycle'),
|
||
//1-每周、2-每月
|
||
'commission_settle_cycle_type' => ConfigService::get('settle_setting', 'commission_settle_cycle_type'),
|
||
//订单结束X天后结算,每周X,每月X号
|
||
'commission_settle_cycle_day' => ConfigService::get('settle_setting', 'commission_settle_cycle_day'),
|
||
];
|
||
$serverSetting = [
|
||
'advance_appoint' => ConfigService::get('server_setting', 'advance_appoint'),
|
||
'coach_order_limit' => ConfigService::get('server_setting', 'coach_order_limit'),
|
||
'coach_server_scope' => ConfigService::get('server_setting', 'coach_server_scope'),
|
||
'shop_coach_limit' => ConfigService::get('server_setting', 'shop_coach_limit'),
|
||
'shop_order_limit' => ConfigService::get('server_setting', 'shop_order_limit'),
|
||
];
|
||
return [
|
||
'order_setting' => $orderSetting,
|
||
'settle_setting' => $settleSetting,
|
||
'server_setting' => $serverSetting,
|
||
];
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 设置通用设置
|
||
* @param array $params
|
||
* @return true
|
||
* @author cjhao
|
||
* @date 2024/8/27 17:11
|
||
*/
|
||
public static function setGeneralSetting(array $params)
|
||
{
|
||
ConfigService::set('order_setting', 'order_cancel_order',$params['order_setting']['order_cancel_order']);
|
||
ConfigService::set('order_setting', 'order_cancel_time',$params['order_setting']['order_cancel_time']);
|
||
ConfigService::set('order_setting', 'over_time_comment',$params['order_setting']['over_time_comment']);
|
||
ConfigService::set('order_setting', 'over_time_comment_content',$params['order_setting']['over_time_comment_content']);
|
||
|
||
ConfigService::set('settle_setting', 'commission_settle',$params['settle_setting']['commission_settle']);
|
||
ConfigService::set('settle_setting', 'commission_settle_cycle',$params['settle_setting']['commission_settle_cycle']);
|
||
ConfigService::set('settle_setting', 'commission_settle_cycle_type',$params['settle_setting']['commission_settle_cycle_type']);
|
||
ConfigService::set('settle_setting', 'commission_settle_cycle_day',$params['settle_setting']['commission_settle_cycle_day']);
|
||
|
||
ConfigService::set('server_setting', 'advance_appoint',$params['server_setting']['advance_appoint']);
|
||
ConfigService::set('server_setting', 'coach_order_limit',$params['server_setting']['coach_order_limit']);
|
||
ConfigService::set('server_setting', 'coach_server_scope',$params['server_setting']['coach_server_scope']);
|
||
ConfigService::set('server_setting', 'shop_coach_limit',$params['server_setting']['shop_coach_limit']);
|
||
ConfigService::set('server_setting', 'shop_order_limit',$params['server_setting']['shop_order_limit']);
|
||
return true;
|
||
}
|
||
|
||
} |