Files
anmo/server/app/adminapi/logic/setting/user/UserLogic.php
2025-08-19 14:16:51 +08:00

153 lines
6.0 KiB
PHP
Executable File
Raw 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
// +----------------------------------------------------------------------
// | 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\user;
use app\common\{service\ConfigService, service\FileService};
/**
* 设置-用户设置逻辑层
* Class UserLogic
* @package app\adminapi\logic\config
*/
class UserLogic
{
/**
* @notes 获取用户设置
* @return array
* @author cjhao
* @date 2021/7/27 17:49
*/
public static function getConfig():array
{
$config = [
//默认头像
'default_avatar' => ConfigService::get('config', 'default_avatar', FileService::getFileUrl(config('project.default_image.default_avatar'))),
'default_coach_avatar' => ConfigService::get('config', 'default_coach_avatar', FileService::getFileUrl(config('project.default_image.default_coach_avatar'))),
'default_shop_avatar' => ConfigService::get('config', 'default_shop_avatar', FileService::getFileUrl(config('project.default_image.default_shop_avatar'))),
];
return $config;
}
/**
* @notes 设置用户设置
* @param array $postData
* @return bool
* @author cjhao
* @date 2021/7/27 17:58
*/
public function setConfig(array $params):bool
{
ConfigService::set('config', 'default_avatar', $params['default_avatar']);
ConfigService::set('config', 'default_coach_avatar', $params['default_coach_avatar']);
ConfigService::set('config', 'default_shop_avatar', $params['default_shop_avatar']);
return true;
}
/**
* @notes 获取注册配置
* @return array
* @author ljj
* @date 2022/2/17 3:32 下午
*/
public function getRegisterConfig():array
{
$config = [
// 'default_avatar' => ConfigService::get('login', 'default_avatar', FileService::getFileUrl(config('project.default_image.user_avatar'))),
// 登录方式
'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 cjhao
* @date 2021/9/14 17:20
*/
public static function setRegisterConfig(array $params):bool
{
// 登录方式1-账号密码登录2-手机短信验证码登录
// ConfigService::set('login', 'default_avatar', $params['default_avatar']);
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;
}
/**
* @notes 提现配置
* @return array
* @author cjhao
* @date 2024/8/27 17:54
*/
public function getWithdrawConfig()
{
$config = [
'way_list' => ConfigService::get('withdraw', 'way_list'),
'min_money' => ConfigService::get('withdraw', 'min_money'),
'max_money' => ConfigService::get('withdraw', 'max_money'),
'service_charge' => ConfigService::get('withdraw', 'service_charge'),
'withdraw_cycle_type' => ConfigService::get('withdraw', 'withdraw_cycle_type'),
'withdraw_cycle_date' => ConfigService::get('withdraw', 'withdraw_cycle_date'),
];
return $config;
}
/**
* @notes 设置提现配置
* @return void
* @author cjhao
* @date 2024/8/27 17:54
*/
public function setWithdrawConfig($params)
{
ConfigService::set('withdraw', 'way_list',$params['way_list']);
ConfigService::set('withdraw', 'min_money',$params['min_money']);
ConfigService::set('withdraw', 'max_money',$params['max_money']);
ConfigService::set('withdraw', 'service_charge',$params['service_charge']);
ConfigService::set('withdraw', 'withdraw_cycle_type',$params['withdraw_cycle_type']);
ConfigService::set('withdraw', 'withdraw_cycle_date',$params['withdraw_cycle_date']);
}
}