You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
2.0 KiB
65 lines
2.0 KiB
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | Niucloud-admin 企业快速开发的多应用管理平台
|
|
// +----------------------------------------------------------------------
|
|
// | 官方网址:https://www.niucloud.com
|
|
// +----------------------------------------------------------------------
|
|
// | niucloud团队 版权所有 开源版本可自由商用
|
|
// +----------------------------------------------------------------------
|
|
// | Author: Niucloud Team
|
|
// +----------------------------------------------------------------------
|
|
|
|
namespace app\service\admin\wechat;
|
|
|
|
use app\dict\common\CommonDict;
|
|
use app\model\sys\SysConfig;
|
|
use app\service\core\wechat\CoreWechatConfigService;
|
|
use core\base\BaseAdminService;
|
|
use think\Model;
|
|
|
|
/**
|
|
* 微信配置模型
|
|
* Class WechatConfigService
|
|
* @package app\service\core\wechat
|
|
*/
|
|
class WechatConfigService extends BaseAdminService
|
|
{
|
|
/**
|
|
* 获取配置信息
|
|
* @return array|null
|
|
*/
|
|
public function getWechatConfig()
|
|
{
|
|
$config_info = (new CoreWechatConfigService())->getWechatConfig();
|
|
foreach ($config_info as $k => $v) {
|
|
if ($v !== '' && in_array($k, ['app_secret', 'encoding_aes_key'])) {
|
|
$config_info[$k] = CommonDict::ENCRYPT_STR;
|
|
}
|
|
}
|
|
return $config_info;
|
|
}
|
|
|
|
/**
|
|
* 设置配置
|
|
* @param array $data
|
|
* @return SysConfig|bool|Model
|
|
*/
|
|
public function setWechatConfig(array $data){
|
|
$config = (new CoreWechatConfigService())->getWechatConfig();
|
|
foreach ($data as $k => $v) {
|
|
if ($v == CommonDict::ENCRYPT_STR) {
|
|
$data[$k] = $config[$k];
|
|
}
|
|
}
|
|
return (new CoreWechatConfigService())->setWechatConfig($data);
|
|
}
|
|
|
|
/**
|
|
*查询微信需要的静态信息
|
|
* @return array
|
|
*/
|
|
public function getWechatStaticInfo(){
|
|
return (new CoreWechatConfigService())->getWechatStaticInfo();
|
|
}
|
|
|
|
}
|
|
|