初始版本

This commit is contained in:
贾祥聪
2025-08-19 14:16:51 +08:00
commit f937a1f9b9
4373 changed files with 359728 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
<?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\channel;
use app\common\logic\BaseLogic;
use app\common\service\ConfigService;
/**
* App设置逻辑层
* Class AppSettingLogic
* @package app\adminapi\logic\settings\app
*/
class AppSettingLogic extends BaseLogic
{
/**
* @notes 获取App设置
* @return array
* @author 段誉
* @date 2022/3/29 10:25
*/
public static function getConfig()
{
$config = [
'ios_download_url' => ConfigService::get('app', 'ios_download_url', ''),
'android_download_url' => ConfigService::get('app', 'android_download_url', ''),
'download_title' => ConfigService::get('app', 'download_title', ''),
];
return $config;
}
/**
* @notes App设置
* @param $params
* @author 段誉
* @date 2022/3/29 10:26
*/
public static function setConfig($params)
{
ConfigService::set('app', 'ios_download_url', $params['ios_download_url'] ?? '');
ConfigService::set('app', 'android_download_url', $params['android_download_url'] ?? '');
ConfigService::set('app', 'download_title', $params['download_title'] ?? '');
}
}

View File

@@ -0,0 +1,88 @@
<?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\channel;
use app\common\logic\BaseLogic;
use app\common\service\ConfigService;
/**
* H5设置逻辑层
* Class HFiveSettingLogic
* @package app\adminapi\logic\settings\h5
*/
class H5SettingLogic extends BaseLogic
{
/**
* @notes 获取H5设置
* @return array
* @author ljj
* @date 2022/9/23 9:38 上午
*/
public static function getConfig()
{
$config = [
'status' => ConfigService::get('h5', 'status',1),
'page_status' => ConfigService::get('h5', 'page_status',1),
'page_url' => ConfigService::get('h5', 'page_url',''),
];
return $config;
}
/**
* @notes H5设置
* @param $params
* @author ljj
* @date 2022/9/23 10:02 上午
*/
public static function setConfig($params)
{
$params['close_url'] = $params['close_url'] ?? '';
ConfigService::set('h5', 'status', $params['status']);
ConfigService::set('h5', 'page_status', $params['page_status'] ?? 0);
ConfigService::set('h5', 'page_url', $params['page_url'] ?? '');
// 恢复原入口
if(file_exists('./mobile/index_lock.html')) {
// 存在则原商城入口被修改过,先清除修改后的入口
unlink('./mobile/index.html');
// 恢复原入口
rename('./mobile/index_lock.html', './mobile/index.html');
}
// H5商城关闭 且 显示空白页
if($params['status'] == 0 && $params['page_status'] == 1) {
// 变更文件名
rename('./mobile/index.html', './mobile/index_lock.html');
// 创建新空白文件
$newfile = fopen('./mobile/index.html', 'w');
fclose($newfile);
}
// H5商城关闭 且 跳转指定页
if($params['status'] == 0 && $params['page_status'] == 2 && !empty($params['close_url'])) {
// 变更文件名
rename('./mobile/index.html', './mobile/index_lock.html');
// 创建重定向文件
$newfile = fopen('./mobile/index.html', 'w');
$content = '<script>window.location.href = "' . $params['close_url'] . '";</script>';
fwrite($newfile, $content);
fclose($newfile);
}
}
}

View File

@@ -0,0 +1,162 @@
<?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\channel;
use app\common\logic\BaseLogic;
use app\common\service\ConfigService;
use app\common\service\FileService;
/**
* 小程序设置逻辑
* Class MnpSettingsLogic
* @package app\adminapi\logic\channel
*/
class MnpSettingsLogic extends BaseLogic
{
/**
* @notes 获取小程序配置
* @return array
* @author ljj
* @date 2022/2/16 9:38 上午
*/
public function getConfig()
{
$domainName = $_SERVER['SERVER_NAME'];
$qrCode = ConfigService::get('mnp_setting', 'qr_code', '');
$qrCode = empty($qrCode) ? $qrCode : FileService::getFileUrl($qrCode);
$config = [
'name' => ConfigService::get('mnp_setting', 'name', ''),
'original_id' => ConfigService::get('mnp_setting', 'original_id', ''),
'qr_code' => $qrCode,
'app_id' => ConfigService::get('mnp_setting', 'app_id', ''),
'app_secret' => ConfigService::get('mnp_setting', 'app_secret', ''),
'request_domain' => 'https://'.$domainName,
'socket_domain' => 'wss://'.$domainName,
'upload_file_domain' => 'https://'.$domainName,
'download_file_domain' => 'https://'.$domainName,
'udp_domain' => 'udp://'.$domainName,
'business_domain' => $domainName,
];
return $config;
}
/**
* @notes 设置小程序配置
* @param $params
* @author ljj
* @date 2022/2/16 9:51 上午
*/
public function setConfig($params)
{
$qrCode = isset($params['qr_code']) ? FileService::setFileUrl($params['qr_code']) : '';
ConfigService::set('mnp_setting','name', $params['name'] ?? '');
ConfigService::set('mnp_setting','original_id',$params['original_id'] ?? '');
ConfigService::set('mnp_setting','qr_code',$qrCode);
ConfigService::set('mnp_setting','app_id',$params['app_id']);
ConfigService::set('mnp_setting','app_secret',$params['app_secret']);
}
/**
* @notes 获取小程序配置
* @return array
* @author ljj
* @date 2022/2/16 9:38 上午
*/
public function getCoachConfig()
{
$domainName = $_SERVER['SERVER_NAME'];
$qrCode = ConfigService::get('mnp_coach_setting', 'qr_code', '');
$qrCode = empty($qrCode) ? $qrCode : FileService::getFileUrl($qrCode);
$config = [
'name' => ConfigService::get('mnp_coach_setting', 'name', ''),
'original_id' => ConfigService::get('mnp_coach_setting', 'original_id', ''),
'qr_code' => $qrCode,
'app_id' => ConfigService::get('mnp_coach_setting', 'app_id', ''),
'app_secret' => ConfigService::get('mnp_coach_setting', 'app_secret', ''),
'request_domain' => 'https://'.$domainName,
'socket_domain' => 'wss://'.$domainName,
'upload_file_domain' => 'https://'.$domainName,
'download_file_domain' => 'https://'.$domainName,
'udp_domain' => 'udp://'.$domainName,
'business_domain' => $domainName,
];
return $config;
}
/**
* @notes 设置小程序配置
* @param $params
* @author ljj
* @date 2022/2/16 9:51 上午
*/
public function setCoachConfig($params)
{
$qrCode = isset($params['qr_code']) ? FileService::setFileUrl($params['qr_code']) : '';
ConfigService::set('mnp_coach_setting','name', $params['name'] ?? '');
ConfigService::set('mnp_coach_setting','original_id',$params['original_id'] ?? '');
ConfigService::set('mnp_coach_setting','qr_code',$qrCode);
ConfigService::set('mnp_coach_setting','app_id',$params['app_id']);
ConfigService::set('mnp_coach_setting','app_secret',$params['app_secret']);
}
/**
* @notes 获取小程序配置
* @return array
* @author ljj
* @date 2022/2/16 9:38 上午
*/
public function getShopConfig()
{
$domainName = $_SERVER['SERVER_NAME'];
$qrCode = ConfigService::get('mnp_shop_setting', 'qr_code', '');
$qrCode = empty($qrCode) ? $qrCode : FileService::getFileUrl($qrCode);
$config = [
'name' => ConfigService::get('mnp_shop_setting', 'name', ''),
'original_id' => ConfigService::get('mnp_shop_setting', 'original_id', ''),
'qr_code' => $qrCode,
'app_id' => ConfigService::get('mnp_shop_setting', 'app_id', ''),
'app_secret' => ConfigService::get('mnp_shop_setting', 'app_secret', ''),
'request_domain' => 'https://'.$domainName,
'socket_domain' => 'wss://'.$domainName,
'upload_file_domain' => 'https://'.$domainName,
'download_file_domain' => 'https://'.$domainName,
'udp_domain' => 'udp://'.$domainName,
'business_domain' => $domainName,
];
return $config;
}
/**
* @notes 设置小程序配置
* @param $params
* @author ljj
* @date 2022/2/16 9:51 上午
*/
public function setShopConfig($params)
{
$qrCode = isset($params['qr_code']) ? FileService::setFileUrl($params['qr_code']) : '';
ConfigService::set('mnp_shop_setting','name', $params['name'] ?? '');
ConfigService::set('mnp_shop_setting','original_id',$params['original_id'] ?? '');
ConfigService::set('mnp_shop_setting','qr_code',$qrCode);
ConfigService::set('mnp_shop_setting','app_id',$params['app_id']);
ConfigService::set('mnp_shop_setting','app_secret',$params['app_secret']);
}
}

View File

@@ -0,0 +1,228 @@
<?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\channel;
use app\common\enum\OfficialAccountEnum;
use app\common\logic\BaseLogic;
use app\common\service\ConfigService;
use EasyWeChat\Factory;
/**
* 微信公众号菜单逻辑层
* Class OfficialAccountMenuLogic
* @package app\adminapi\logic\wechat
*/
class OfficialAccountMenuLogic extends BaseLogic
{
/**
* @notes 保存
* @param $params
* @return bool
* @author 段誉
* @date 2022/3/29 10:43
*/
public static function save($params)
{
try {
self::checkMenu($params);
ConfigService::set('oa_setting', 'menu', $params);
return true;
} catch (\Exception $e) {
OfficialAccountMenuLogic::setError($e->getMessage());
return false;
}
}
/**
* @notes 一级菜单校验
* @param $menu
* @throws \Exception
* @author 段誉
* @date 2022/3/29 10:55
*/
public static function checkMenu($menu)
{
if (empty($menu) || !is_array($menu)) {
throw new \Exception('请设置正确格式菜单');
}
if (count($menu) > 3) {
throw new \Exception('一级菜单超出限制(最多3个)');
}
foreach ($menu as $item) {
if (!is_array($item)) {
throw new \Exception('一级菜单项须为数组格式');
}
if (empty($item['name'])) {
throw new \Exception('请输入一级菜单名称');
}
if (false == $item['has_menu']) {
if (empty($item['type'])) {
throw new \Exception('一级菜单未选择菜单类型');
}
if (!in_array($item['type'], OfficialAccountEnum::MENU_TYPE)) {
throw new \Exception('一级菜单类型错误');
}
self::checkType($item);
}
if (true == $item['has_menu'] && empty($item['sub_button'])) {
throw new \Exception('请配置子菜单');
}
self::checkType($item);
if (!empty($item['sub_button'])) {
self::checkSubButton($item['sub_button']);
}
}
}
/**
* @notes 二级菜单校验
* @param $subButtion
* @throws \Exception
* @author 段誉
* @date 2022/3/29 10:55
*/
public static function checkSubButton($subButtion)
{
if (!is_array($subButtion)) {
throw new \Exception('二级菜单须为数组格式');
}
if (count($subButtion) > 5) {
throw new \Exception('二级菜单超出限制(最多5个)');
}
foreach ($subButtion as $subItem) {
if (!is_array($subItem)) {
throw new \Exception('二级菜单项须为数组');
}
if (empty($subItem['name'])) {
throw new \Exception('请输入二级菜单名称');
}
if (empty($subItem['type']) || !in_array($subItem['type'], OfficialAccountEnum::MENU_TYPE)) {
throw new \Exception('二级未选择菜单类型或菜单类型错误');
}
self::checkType($subItem);
}
}
/**
* @notes 菜单类型校验
* @param $item
* @throws \Exception
* @author 段誉
* @date 2022/3/29 10:55
*/
public static function checkType($item)
{
switch ($item['type']) {
// 关键字
case 'click':
if (empty($item['key'])) {
throw new \Exception('请输入关键字');
}
break;
// 跳转网页链接
case 'view':
if (empty($item['url'])) {
throw new \Exception('请输入网页链接');
}
break;
// 小程序
case 'miniprogram':
if (empty($item['url'])) {
throw new \Exception('请输入网页链接');
}
if (empty($item['appid'])) {
throw new \Exception('请输入appid');
}
if (empty($item['pagepath'])) {
throw new \Exception('请输入小程序路径');
}
break;
}
}
/**
* @notes 保存发布菜单
* @param $params
* @return bool
* @throws \GuzzleHttp\Exception\GuzzleException
* @author 段誉
* @date 2022/3/29 10:55
*/
public static function saveAndPublish($params)
{
try {
self::checkMenu($params);
$officialAccountSetting = (new OfficialAccountSettingLogic())->getConfig();
if (empty($officialAccountSetting['app_id']) || empty($officialAccountSetting['app_secret'])) {
throw new \Exception('请先配置好微信公众号');
}
$app = Factory::officialAccount([
'app_id' => $officialAccountSetting['app_id'],
'secret' => $officialAccountSetting['app_secret'],
'response_type' => 'array',
]);
$result = $app->menu->create($params);
if ($result['errcode'] == 0) {
ConfigService::set('oa_setting', 'menu', $params);
return true;
}
self::setError('保存发布菜单失败' . json_encode($result));
return false;
} catch (\Exception $e) {
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 查看菜单详情
* @return array|int|mixed|string|null
* @author 段誉
* @date 2022/3/29 10:56
*/
public static function detail()
{
$data = ConfigService::get('oa_setting', 'menu', []);
if (!empty($data)) {
foreach ($data as &$item) {
$item['has_menu'] = !empty($item['has_menu']);
}
}
return $data;
}
}

View File

@@ -0,0 +1,217 @@
<?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\channel;
use app\common\enum\OfficialAccountEnum;
use app\common\enum\YesNoEnum;
use app\common\logic\BaseLogic;
use app\common\model\channel\OfficialAccountReply;
use EasyWeChat\Factory;
use EasyWeChat\Kernel\Messages\Text;
/**
* 微信公众号回复逻辑层
* Class OfficialAccountReplyLogic
* @package app\adminapi\logic\channel
*/
class OfficialAccountReplyLogic extends BaseLogic
{
/**
* @notes 添加回复(关注/关键词/默认)
* @param $params
* @return bool
* @author 段誉
* @date 2022/3/29 10:57
*/
public static function add($params)
{
try {
// 关键字回复排序值须大于0
if ($params['reply_type'] == OfficialAccountEnum::REPLY_TYPE_KEYWORD && $params['sort'] <= 0) {
throw new \Exception('排序值须大于0');
}
if ($params['reply_type'] != OfficialAccountEnum::REPLY_TYPE_KEYWORD && $params['status']) {
// 非关键词回复只能有一条记录处于启用状态,所以将该回复类型下的已有记录置为禁用状态
OfficialAccountReply::where(['reply_type' => $params['reply_type']])->update(['status' => YesNoEnum::NO]);
}
OfficialAccountReply::create($params);
return true;
} catch (\Exception $e) {
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 查看回复详情
* @param $params
* @return array
* @author 段誉
* @date 2022/3/29 11:00
*/
public static function detail($params)
{
$field = 'id,name,keyword,reply_type,matching_type,content_type,content,status,sort';
$field .= ',reply_type as reply_type_desc, matching_type as matching_type_desc, content_type as content_type_desc, status as status_desc';
return OfficialAccountReply::field($field)->findOrEmpty($params['id'])->toArray();
}
/**
* @notes 编辑回复(关注/关键词/默认)
* @param $params
* @return bool
* @author 段誉
* @date 2022/3/29 11:01
*/
public static function edit($params)
{
try {
// 关键字回复排序值须大于0
if ($params['reply_type'] == OfficialAccountEnum::REPLY_TYPE_KEYWORD && $params['sort'] <= 0) {
throw new \Exception('排序值须大于0');
}
if ($params['reply_type'] != OfficialAccountEnum::REPLY_TYPE_KEYWORD && $params['status']) {
// 非关键词回复只能有一条记录处于启用状态,所以将该回复类型下的已有记录置为禁用状态
OfficialAccountReply::where(['reply_type' => $params['reply_type']])->update(['status' => YesNoEnum::NO]);
}
OfficialAccountReply::update($params);
return true;
} catch (\Exception $e) {
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除回复(关注/关键词/默认)
* @param $params
* @author 段誉
* @date 2022/3/29 11:01
*/
public static function delete($params)
{
OfficialAccountReply::destroy($params['id']);
}
/**
* @notes 更新排序
* @param $params
* @author 段誉
* @date 2022/3/29 11:01
*/
public static function sort($params)
{
$params['sort'] = $params['new_sort'];
OfficialAccountReply::update($params);
}
/**
* @notes 更新状态
* @param $params
* @author 段誉
* @date 2022/3/29 11:01
*/
public static function status($params)
{
$reply = OfficialAccountReply::findOrEmpty($params['id']);
$reply->status = !$reply->status;
$reply->save();
}
/**
* @notes 微信公众号回调
* @throws \EasyWeChat\Kernel\Exceptions\BadRequestException
* @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
* @throws \ReflectionException
* @author 段誉
* @date 2022/3/29 11:01
*/
public static function index()
{
// 确认此次GET请求来自微信服务器原样返回echostr参数内容接入生效成为开发者成功
if (isset($_GET['echostr'])) {
echo $_GET['echostr'];
exit;
}
$officialAccountSetting = (new OfficialAccountSettingLogic())->getConfig();
$config = [
'app_id' => $officialAccountSetting['app_id'],
'secret' => $officialAccountSetting['app_secret'],
'response_type' => 'array',
];
$app = Factory::officialAccount($config);
$app->server->push(function ($message) {
switch ($message['MsgType']) { // 消息类型
case OfficialAccountEnum::MSG_TYPE_EVENT: // 事件
switch ($message['Event']) {
case OfficialAccountEnum::EVENT_SUBSCRIBE: // 关注事件
$reply_content = OfficialAccountReply::where(['reply_type' => OfficialAccountEnum::REPLY_TYPE_FOLLOW, 'status' => YesNoEnum::YES])
->value('content');
if (empty($reply_content)) {
// 未启用关注回复 或 关注回复内容为空
$reply_content = OfficialAccountReply::where(['reply_type' => OfficialAccountEnum::REPLY_TYPE_DEFAULT, 'status' => YesNoEnum::YES])
->value('content');
}
if ($reply_content) {
$text = new Text($reply_content);
return $text;
}
break;
}
break;
case OfficialAccountEnum::MSG_TYPE_TEXT: // 文本
$reply_list = OfficialAccountReply::where(['reply_type' => OfficialAccountEnum::REPLY_TYPE_KEYWORD, 'status' => YesNoEnum::YES])
->order('sort asc')
->select();
$reply_content = '';
foreach ($reply_list as $reply) {
switch ($reply['matching_type']) {
case OfficialAccountEnum::MATCHING_TYPE_FULL:
$reply['keyword'] === $message['Content'] && $reply_content = $reply['content'];
break;
case OfficialAccountEnum::MATCHING_TYPE_FUZZY:
stripos($message['Content'], $reply['keyword']) !== false && $reply_content = $reply['content'];
break;
}
if ($reply_content) {
break; // 得到回复文本,中止循环
}
}
//消息回复为空的话,找默认回复
if (empty($reply_content)) {
$reply_content = OfficialAccountReply::where(['reply_type' => OfficialAccountEnum::REPLY_TYPE_DEFAULT, 'status' => YesNoEnum::YES])
->value('content');
}
if ($reply_content) {
$text = new Text($reply_content);
return $text;
}
break;
}
});
$response = $app->server->serve();
$response->send();
}
}

View File

@@ -0,0 +1,76 @@
<?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\channel;
use app\common\logic\BaseLogic;
use app\common\service\ConfigService;
use app\common\service\FileService;
/**
* 公众号设置逻辑
* Class OfficialAccountSettingLogic
* @package app\adminapi\logic\channel
*/
class OfficialAccountSettingLogic extends BaseLogic
{
/**
* @notes 获取公众号配置
* @return array
* @author ljj
* @date 2022/2/16 10:08 上午
*/
public function getConfig()
{
$domainName = $_SERVER['SERVER_NAME'];
$qrCode = ConfigService::get('oa_setting', 'qr_code', '');
$qrCode = empty($qrCode) ? $qrCode : FileService::getFileUrl($qrCode);
$config = [
'name' => ConfigService::get('oa_setting', 'name', ''),
'original_id' => ConfigService::get('oa_setting', 'original_id', ''),
'qr_code' => $qrCode,
'app_id' => ConfigService::get('oa_setting', 'app_id', ''),
'app_secret' => ConfigService::get('oa_setting', 'app_secret', ''),
// url()方法返回Url实例通过与空字符串连接触发该实例的__toString()方法以得到路由地址
'url' => url('adminapi/channel.official_account_reply/index', [],'',true).'',
'token' => ConfigService::get('oa_setting', 'token'),
'encoding_aes_key' => ConfigService::get('oa_setting', 'encoding_aes_key', ''),
'encryption_type' => ConfigService::get('oa_setting', 'encryption_type'),
'business_domain' => $domainName,
'js_secure_domain' => $domainName,
'web_auth_domain' => $domainName,
];
return $config;
}
/**
* @notes 设置公众号配置
* @param $params
* @author ljj
* @date 2022/2/16 10:08 上午
*/
public function setConfig($params)
{
$qrCode = isset($params['qr_code']) ? FileService::setFileUrl($params['qr_code']) : '';
ConfigService::set('oa_setting','name', $params['name'] ?? '');
ConfigService::set('oa_setting','original_id', $params['original_id'] ?? '');
ConfigService::set('oa_setting','qr_code', $qrCode);
ConfigService::set('oa_setting','app_id',$params['app_id']);
ConfigService::set('oa_setting','app_secret',$params['app_secret']);
ConfigService::set('oa_setting','token',$params['token'] ?? '');
ConfigService::set('oa_setting','encoding_aes_key',$params['encoding_aes_key'] ?? '');
ConfigService::set('oa_setting','encryption_type',$params['encryption_type']);
}
}

View File

@@ -0,0 +1,55 @@
<?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\channel;
use app\common\logic\BaseLogic;
use app\common\service\ConfigService;
/**
* 微信开放平台
* Class AppSettingLogic
* @package app\adminapi\logic\settings\app
*/
class OpenSettingLogic extends BaseLogic
{
/**
* @notes 获取微信开放平台设置
* @return array
* @author 段誉
* @date 2022/3/29 11:03
*/
public static function getConfig()
{
$config = [
'app_id' => ConfigService::get('open_platform', 'app_id', ''),
'app_secret' => ConfigService::get('open_platform', 'app_secret', ''),
];
return $config;
}
/**
* @notes 微信开放平台设置
* @param $params
* @author 段誉
* @date 2022/3/29 11:03
*/
public static function setConfig($params)
{
ConfigService::set('open_platform', 'app_id', $params['app_id'] ?? '');
ConfigService::set('open_platform', 'app_secret', $params['app_secret'] ?? '');
}
}

View File

@@ -0,0 +1,59 @@
<?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\channel;
use app\common\logic\BaseLogic;
use app\common\service\ConfigService;
/**
* H5设置逻辑层
* Class HFiveSettingLogic
* @package app\adminapi\logic\settings\h5
*/
class WebPageSettingLogic extends BaseLogic
{
/**
* @notes 获取H5设置
* @return array
* @author 段誉
* @date 2022/3/29 10:34
*/
public static function getConfig()
{
$config = [
// 渠道状态 0-关闭 1-开启
'status' => ConfigService::get('web_page', 'status', 1),
// 关闭后渠道后访问页面 0-空页面 1-自定义链接
'page_status' => ConfigService::get('web_page', 'page_status', 0),
// 自定义链接
'page_url' => ConfigService::get('web_page', 'page_url', ''),
'url' => request()->domain() . '/mobile'
];
return $config;
}
/**
* @notes H5设置
* @param $params
* @author 段誉
* @date 2022/3/29 10:34
*/
public static function setConfig($params)
{
ConfigService::set('web_page', 'status', $params['status']);
ConfigService::set('web_page', 'page_status', $params['page_status']);
ConfigService::set('web_page', 'page_url', $params['page_url']);
}
}