This commit is contained in:
mkm 2024-01-19 23:37:35 +08:00
parent 4e2cb898e7
commit 9bd04ab275
40 changed files with 6 additions and 2511 deletions

View File

@ -6,7 +6,7 @@ namespace app\admin\controller;
use app\common\cache\ExportCache;
use app\common\service\JsonService;
use think\facade\Cache;
use support\Cache;
class DownloadController extends BaseAdminController
{

View File

@ -1,51 +0,0 @@
<?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\admin\controller\channel;
use app\admin\controller\BaseAdminController;
use app\admin\logic\channel\AppSettingLogic;
/**
* APP设置控制器
* Class AppSettingController
* @package app\admin\controller\settings\app
*/
class AppSettingController extends BaseAdminController
{
/**
* @notes 获取App设置
* @author 乔峰
* @date 2022/3/29 10:24
*/
public function getConfig()
{
$result = AppSettingLogic::getConfig();
return $this->data($result);
}
/**
* @notes App设置
* @author 乔峰
* @date 2022/3/29 10:25
*/
public function setConfig()
{
$params = $this->request->post();
AppSettingLogic::setConfig($params);
return $this->success('操作成功', [], 1, 1);
}
}

View File

@ -1,50 +0,0 @@
<?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\admin\controller\channel;
use app\admin\controller\BaseAdminController;
use app\admin\logic\channel\MnpSettingsLogic;
use app\admin\validate\channel\MnpSettingsValidate;
/**
* 小程序设置
* Class MnpSettingsController
* @package app\admin\controller\channel
*/
class MnpSettingsController extends BaseAdminController
{
/**
* @notes 获取小程序配置
* @author ljj
* @date 2022/2/16 9:38 上午
*/
public function getConfig()
{
$result = (new MnpSettingsLogic())->getConfig();
return $this->data($result);
}
/**
* @notes 设置小程序配置
* @author ljj
* @date 2022/2/16 9:51 上午
*/
public function setConfig()
{
$params = (new MnpSettingsValidate())->post()->goCheck();
(new MnpSettingsLogic())->setConfig($params);
return $this->success('操作成功', [], 1, 1);
}
}

View File

@ -1,71 +0,0 @@
<?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\admin\controller\channel;
use app\admin\controller\BaseAdminController;
use app\admin\logic\channel\OfficialAccountMenuLogic;
/**
* 微信公众号菜单控制器
* Class OfficialAccountMenuController
* @package app\admin\controller\channel
*/
class OfficialAccountMenuController extends BaseAdminController
{
/**
* @notes 保存菜单
* @author 乔峰
* @date 2022/3/29 10:41
*/
public function save()
{
$params = $this->request->post();
$result = OfficialAccountMenuLogic::save($params);
if(false === $result) {
return $this->fail(OfficialAccountMenuLogic::getError());
}
return $this->success('保存成功',[],1,1);
}
/**
* @notes 保存发布菜单
* @author 乔峰
* @date 2022/3/29 10:42
*/
public function saveAndPublish()
{
$params = $this->request->post();
$result = OfficialAccountMenuLogic::saveAndPublish($params);
if($result) {
return $this->success('保存并发布成功',[],1,1);
}
return $this->fail(OfficialAccountMenuLogic::getError());
}
/**
* @notes 查看菜单详情
* @author 乔峰
* @date 2022/3/29 10:42
*/
public function detail()
{
$result = OfficialAccountMenuLogic::detail();
return $this->data($result);
}
}

View File

@ -1,138 +0,0 @@
<?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\admin\controller\channel;
use app\admin\controller\BaseAdminController;
use app\admin\lists\channel\OfficialAccountReplyLists;
use app\admin\logic\channel\OfficialAccountReplyLogic;
use app\admin\validate\channel\OfficialAccountReplyValidate;
/**
* 微信公众号回复控制器
* Class OfficialAccountReplyController
* @package app\admin\controller\channel
*/
class OfficialAccountReplyController extends BaseAdminController
{
public $notNeedLogin = ['index'];
/**
* @notes 查看回复列表(关注/关键词/默认)
* @author 乔峰
* @date 2022/3/29 10:58
*/
public function lists()
{
return $this->dataLists(new OfficialAccountReplyLists());
}
/**
* @notes 添加回复(关注/关键词/默认)
* @author 乔峰
* @date 2022/3/29 10:58
*/
public function add()
{
$params = (new OfficialAccountReplyValidate())->post()->goCheck('add');
$result = OfficialAccountReplyLogic::add($params);
if ($result) {
return $this->success('操作成功', [], 1, 1);
}
return $this->fail(OfficialAccountReplyLogic::getError());
}
/**
* @notes 查看回复详情
* @author 乔峰
* @date 2022/3/29 10:58
*/
public function detail()
{
$params = (new OfficialAccountReplyValidate())->goCheck('detail');
$result = OfficialAccountReplyLogic::detail($params);
return $this->data($result);
}
/**
* @notes 编辑回复(关注/关键词/默认)
* @author 乔峰
* @date 2022/3/29 10:58
*/
public function edit()
{
$params = (new OfficialAccountReplyValidate())->post()->goCheck('edit');
$result = OfficialAccountReplyLogic::edit($params);
if ($result) {
return $this->success('操作成功', [], 1, 1);
}
return $this->fail(OfficialAccountReplyLogic::getError());
}
/**
* @notes 删除回复(关注/关键词/默认)
* @author 乔峰
* @date 2022/3/29 10:59
*/
public function delete()
{
$params = (new OfficialAccountReplyValidate())->post()->goCheck('delete');
OfficialAccountReplyLogic::delete($params);
return $this->success('操作成功', [], 1, 1);
}
/**
* @notes 更新排序
* @author 乔峰
* @date 2022/3/29 10:59
*/
public function sort()
{
$params = (new OfficialAccountReplyValidate())->post()->goCheck('sort');
OfficialAccountReplyLogic::sort($params);
return $this->success('操作成功', [], 1, 1);
}
/**
* @notes 更新状态
* @author 乔峰
* @date 2022/3/29 10:59
*/
public function status()
{
$params = (new OfficialAccountReplyValidate())->post()->goCheck('status');
OfficialAccountReplyLogic::status($params);
return $this->success('操作成功', [], 1, 1);
}
/**
* @notes 微信公众号回调
* @throws \ReflectionException
* @author 乔峰
* @date 2022/3/29 10:59
*/
public function index()
{
OfficialAccountReplyLogic::index();
}
}

View File

@ -1,50 +0,0 @@
<?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\admin\controller\channel;
use app\admin\controller\BaseAdminController;
use app\admin\logic\channel\OfficialAccountSettingLogic;
use app\admin\validate\channel\OfficialAccountSettingValidate;
/**
* 公众号设置
* Class OfficialAccountSettingController
* @package app\admin\controller\channel
*/
class OfficialAccountSettingController extends BaseAdminController
{
/**
* @notes 获取公众号配置
* @author ljj
* @date 2022/2/16 10:09 上午
*/
public function getConfig()
{
$result = (new OfficialAccountSettingLogic())->getConfig();
return $this->data($result);
}
/**
* @notes 设置公众号配置
* @author ljj
* @date 2022/2/16 10:09 上午
*/
public function setConfig()
{
$params = (new OfficialAccountSettingValidate())->post()->goCheck();
(new OfficialAccountSettingLogic())->setConfig($params);
return $this->success('操作成功',[],1,1);
}
}

View File

@ -1,52 +0,0 @@
<?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\admin\controller\channel;
use app\admin\controller\BaseAdminController;
use app\admin\logic\channel\OpenSettingLogic;
use app\admin\validate\channel\OpenSettingValidate;
/**
* 微信开放平台
* Class AppSettingController
* @package app\admin\controller\settings\app
*/
class OpenSettingController extends BaseAdminController
{
/**
* @notes 获取微信开放平台设置
* @author 乔峰
* @date 2022/3/29 11:03
*/
public function getConfig()
{
$result = OpenSettingLogic::getConfig();
return $this->data($result);
}
/**
* @notes 微信开放平台设置
* @author 乔峰
* @date 2022/3/29 11:03
*/
public function setConfig()
{
$params = (new OpenSettingValidate())->post()->goCheck();
OpenSettingLogic::setConfig($params);
return $this->success('操作成功', [], 1, 1);
}
}

View File

@ -1,52 +0,0 @@
<?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\admin\controller\channel;
use app\admin\controller\BaseAdminController;
use app\admin\logic\channel\WebPageSettingLogic;
use app\admin\validate\channel\WebPageSettingValidate;
/**
* H5设置控制器
* Class HFiveSettingController
* @package app\admin\controller\settings\h5
*/
class WebPageSettingController extends BaseAdminController
{
/**
* @notes 获取H5设置
* @author 乔峰
* @date 2022/3/29 10:36
*/
public function getConfig()
{
$result = WebPageSettingLogic::getConfig();
return $this->data($result);
}
/**
* @notes H5设置
* @author 乔峰
* @date 2022/3/29 10:36
*/
public function setConfig()
{
$params = (new WebPageSettingValidate())->post()->goCheck();
WebPageSettingLogic::setConfig($params);
return $this->success('操作成功', [], 1, 1);
}
}

View File

@ -1,49 +0,0 @@
<?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\admin\controller\setting;
use app\admin\controller\BaseAdminController;
use app\admin\logic\setting\CustomerServiceLogic;
/**
* 客服设置
* Class CustomerServiceController
* @package app\admin\controller\setting
*/
class CustomerServiceController extends BaseAdminController
{
/**
* @notes 获取客服设置
* @author ljj
* @date 2022/2/15 12:05 下午
*/
public function getConfig()
{
$result = CustomerServiceLogic::getConfig();
return $this->data($result);
}
/**
* @notes 设置客服设置
* @author ljj
* @date 2022/2/15 12:11 下午
*/
public function setConfig()
{
$params = $this->request->post();
CustomerServiceLogic::setConfig($params);
return $this->success('设置成功', [], 1, 1);
}
}

View File

@ -1,54 +0,0 @@
<?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\admin\controller\setting;
use app\admin\controller\BaseAdminController;
use app\admin\logic\setting\HotSearchLogic;
/**
* 热门搜索设置
* Class HotSearchController
* @package app\admin\controller\setting
*/
class HotSearchController extends BaseAdminController
{
/**
* @notes 获取热门搜索
* @author 乔峰
* @date 2022/9/5 19:00
*/
public function getConfig()
{
$result = HotSearchLogic::getConfig();
return $this->data($result);
}
/**
* @notes 设置热门搜索
* @author 乔峰
* @date 2022/9/5 19:00
*/
public function setConfig()
{
$params = $this->request->post();
$result = HotSearchLogic::setConfig($params);
if (false === $result) {
return $this->fail(HotSearchLogic::getError() ?: '系统错误');
}
return $this->success('设置成功', [], 1, 1);
}
}

View File

@ -1,51 +0,0 @@
<?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\admin\controller\setting;
use app\admin\controller\BaseAdminController;
use app\admin\logic\setting\TransactionSettingsLogic;
use app\admin\validate\setting\TransactionSettingsValidate;
/**
* 交易设置
* Class TransactionSettingsController
* @package app\admin\controller\setting
*/
class TransactionSettingsController extends BaseAdminController
{
/**
* @notes 获取交易设置
* @author ljj
* @date 2022/2/15 11:40 上午
*/
public function getConfig()
{
$result = TransactionSettingsLogic::getConfig();
return $this->data($result);
}
/**
* @notes 设置交易设置
* @author ljj
* @date 2022/2/15 11:50 上午
*/
public function setConfig()
{
$params = (new TransactionSettingsValidate())->post()->goCheck('setConfig');
TransactionSettingsLogic::setConfig($params);
return $this->success('操作成功',[],1,1);
}
}

View File

@ -1,83 +0,0 @@
<?php
namespace app\admin\lists\article;
use app\admin\lists\BaseAdminDataLists;
use app\common\lists\ListsSearchInterface;
use app\common\lists\ListsSortInterface;
use app\common\model\article\Article;
class ArticleLists extends BaseAdminDataLists implements ListsSearchInterface, ListsSortInterface
{
/**
* @notes 设置搜索条件
* @return array
* @author heshihu
* @date 2022/2/8 18:39
*/
public function setSearch(): array
{
return [
'%like%' => ['title'],
'=' => ['cid', 'is_show']
];
}
/**
* @notes 设置支持排序字段
* @return array
* @author heshihu
* @date 2022/2/9 15:11
*/
public function setSortFields(): array
{
return ['create_time' => 'create_time', 'id' => 'id'];
}
/**
* @notes 设置默认排序
* @return array
* @author heshihu
* @date 2022/2/9 15:08
*/
public function setDefaultOrder(): array
{
return ['sort' => 'desc', 'id' => 'desc'];
}
/**
* @notes 获取管理列表
* @return array
* @author heshihu
* @date 2022/2/21 17:11
*/
public function lists(): array
{
$ArticleLists = Article::where($this->searchWhere)
->append(['cate_name', 'click'])
->limit($this->limitOffset, $this->limitLength)
->order($this->sortOrder)
->select()
->toArray();
return $ArticleLists;
}
/**
* @notes 获取数量
* @return int
* @author heshihu
* @date 2022/2/9 15:12
*/
public function count(): int
{
return Article::where($this->searchWhere)->count();
}
public function extend()
{
return [];
}
}

View File

@ -1,80 +0,0 @@
<?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\admin\lists\channel;
use app\admin\lists\BaseAdminDataLists;
use app\common\lists\ListsSearchInterface;
use app\common\model\channel\OfficialAccountReply;
/**
* 微信公众号回复列表
* Class OfficialAccountLists
* @package app\admin\lists
*/
class OfficialAccountReplyLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索
* @return \string[][]
* @author 乔峰
* @date 2022/3/30 15:02
*/
public function setSearch(): array
{
return [
'=' => ['reply_type']
];
}
/**
* @notes 回复列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 乔峰
* @date 2022/3/30 15:02
*/
public function lists(): array
{
$field = 'id,name,keyword,matching_type,content,content_type,status,sort';
$field .= ',matching_type as matching_type_desc,content_type as content_type_desc,status as status_desc';
$lists = OfficialAccountReply::field($field)
->where($this->searchWhere)
->order(['sort' => 'desc', 'id' => 'desc'])
->limit($this->limitOffset, $this->limitLength)
->select()
->toArray();
return $lists;
}
/**
* @notes 回复记录数
* @return int
* @author 乔峰
* @date 2022/3/30 15:02
*/
public function count(): int
{
$count = OfficialAccountReply::where($this->searchWhere)->count();
return $count;
}
}

View File

@ -1,127 +0,0 @@
<?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\admin\logic\article;
use app\common\enum\YesNoEnum;
use app\common\logic\BaseLogic;
use app\common\model\article\ArticleCate;
/**
* 资讯分类管理逻辑
* Class ArticleCateLogic
* @package app\admin\logic\article
*/
class ArticleCateLogic extends BaseLogic
{
/**
* @notes 添加资讯分类
* @param array $params
* @author heshihu
* @date 2022/2/18 10:17
*/
public static function add(array $params)
{
ArticleCate::create([
'name' => $params['name'],
'is_show' => $params['is_show'],
'sort' => $params['sort'] ?? 0
]);
}
/**
* @notes 编辑资讯分类
* @param array $params
* @return bool
* @author heshihu
* @date 2022/2/21 17:50
*/
public static function edit(array $params) : bool
{
try {
ArticleCate::update([
'id' => $params['id'],
'name' => $params['name'],
'is_show' => $params['is_show'],
'sort' => $params['sort'] ?? 0
]);
return true;
} catch (\Exception $e) {
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除资讯分类
* @param array $params
* @author heshihu
* @date 2022/2/21 17:52
*/
public static function delete(array $params)
{
ArticleCate::destroy($params['id']);
}
/**
* @notes 查看资讯分类详情
* @param $params
* @return array
* @author heshihu
* @date 2022/2/21 17:54
*/
public static function detail($params) : array
{
return ArticleCate::findOrEmpty($params['id'])->toArray();
}
/**
* @notes 更改资讯分类状态
* @param array $params
* @return bool
* @author heshihu
* @date 2022/2/21 18:04
*/
public static function updateStatus(array $params)
{
ArticleCate::update([
'id' => $params['id'],
'is_show' => $params['is_show']
]);
return true;
}
/**
* @notes 文章分类数据
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 乔峰
* @date 2022/10/13 10:53
*/
public static function getAllData()
{
return ArticleCate::where(['is_show' => YesNoEnum::YES])
->order(['sort' => 'desc', 'id' => 'desc'])
->select()
->toArray();
}
}

View File

@ -1,121 +0,0 @@
<?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\admin\logic\article;
use app\common\logic\BaseLogic;
use app\common\model\article\Article;
use app\common\service\FileService;
/**
* 资讯管理逻辑
* Class ArticleLogic
* @package app\admin\logic\article
*/
class ArticleLogic extends BaseLogic
{
/**
* @notes 添加资讯
* @param array $params
* @author heshihu
* @date 2022/2/22 9:57
*/
public static function add(array $params)
{
Article::create([
'title' => $params['title'],
'desc' => $params['desc'] ?? '',
'author' => $params['author'] ?? '', //作者
'sort' => $params['sort'] ?? 0, // 排序
'abstract' => $params['abstract'], // 文章摘要
'click_virtual' => $params['click_virtual'] ?? 0,
'image' => $params['image'] ? FileService::setFileUrl($params['image']) : '',
'cid' => $params['cid'],
'is_show' => $params['is_show'],
'content' => $params['content'] ?? '',
]);
}
/**
* @notes 编辑资讯
* @param array $params
* @return bool
* @author heshihu
* @date 2022/2/22 10:12
*/
public static function edit(array $params) : bool
{
try {
Article::update([
'id' => $params['id'],
'title' => $params['title'],
'desc' => $params['desc'] ?? '', // 简介
'author' => $params['author'] ?? '', //作者
'sort' => $params['sort'] ?? 0, // 排序
'abstract' => $params['abstract'], // 文章摘要
'click_virtual' => $params['click_virtual'] ?? 0,
'image' => $params['image'] ? FileService::setFileUrl($params['image']) : '',
'cid' => $params['cid'],
'is_show' => $params['is_show'],
'content' => $params['content'] ?? '',
]);
return true;
} catch (\Exception $e) {
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除资讯
* @param array $params
* @author heshihu
* @date 2022/2/22 10:17
*/
public static function delete(array $params)
{
Article::destroy($params['id']);
}
/**
* @notes 查看资讯详情
* @param $params
* @return array
* @author heshihu
* @date 2022/2/22 10:15
*/
public static function detail($params) : array
{
return Article::findOrEmpty($params['id'])->toArray();
}
/**
* @notes 更改资讯状态
* @param array $params
* @return bool
* @author heshihu
* @date 2022/2/22 10:18
*/
public static function updateStatus(array $params)
{
Article::update([
'id' => $params['id'],
'is_show' => $params['is_show']
]);
return true;
}
}

View File

@ -1,56 +0,0 @@
<?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\admin\logic\channel;
use app\common\logic\BaseLogic;
use app\common\service\ConfigService;
/**
* App设置逻辑层
* Class AppSettingLogic
* @package app\admin\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

@ -1,72 +0,0 @@
<?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\admin\logic\channel;
use app\common\logic\BaseLogic;
use app\common\service\ConfigService;
use app\common\service\FileService;
/**
* 小程序设置逻辑
* Class MnpSettingsLogic
* @package app\admin\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']);
}
}

View File

@ -1,228 +0,0 @@
<?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\admin\logic\channel;
use app\common\enum\OfficialAccountEnum;
use app\common\logic\BaseLogic;
use app\common\service\ConfigService;
use EasyWeChat\Factory;
/**
* 微信公众号菜单逻辑层
* Class OfficialAccountMenuLogic
* @package app\admin\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

@ -1,217 +0,0 @@
<?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\admin\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\admin\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

@ -1,76 +0,0 @@
<?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\admin\logic\channel;
use app\common\logic\BaseLogic;
use app\common\service\ConfigService;
use app\common\service\FileService;
/**
* 公众号设置逻辑
* Class OfficialAccountSettingLogic
* @package app\admin\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('admin/wechat.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

@ -1,55 +0,0 @@
<?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\admin\logic\channel;
use app\common\logic\BaseLogic;
use app\common\service\ConfigService;
/**
* 微信开放平台
* Class AppSettingLogic
* @package app\admin\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

@ -1,59 +0,0 @@
<?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\admin\logic\channel;
use app\common\logic\BaseLogic;
use app\common\service\ConfigService;
/**
* H5设置逻辑层
* Class HFiveSettingLogic
* @package app\admin\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']);
}
}

View File

@ -1,56 +0,0 @@
<?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\admin\logic\decorate;
use app\common\logic\BaseLogic;
use app\common\model\article\Article;
/**
* 装修页-数据
* Class DecorateDataLogic
* @package app\admin\logic\decorate
*/
class DecorateDataLogic extends BaseLogic
{
/**
* @notes 获取文章列表
* @param $limit
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 乔峰
* @date 2022/9/22 16:49
*/
public static function getArticleLists($limit)
{
$field = 'id,title,desc,abstract,image,author,content,
click_virtual,click_actual,create_time';
return Article::where(['is_show' => 1])
->field($field)
->order(['id' => 'desc'])
->limit($limit)
->append(['click'])
->hidden(['click_virtual', 'click_actual'])
->select()->toArray();
}
}

View File

@ -1,67 +0,0 @@
<?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\admin\logic\decorate;
use app\common\logic\BaseLogic;
use app\common\model\decorate\DecoratePage;
/**
* 装修页面
* Class DecoratePageLogic
* @package app\admin\logic\theme
*/
class DecoratePageLogic extends BaseLogic
{
/**
* @notes 获取详情
* @param $id
* @return array
* @author 乔峰
* @date 2022/9/14 18:41
*/
public static function getDetail($id)
{
return DecoratePage::findOrEmpty($id)->toArray();
}
/**
* @notes 保存装修配置
* @param $params
* @return bool
* @author 乔峰
* @date 2022/9/15 9:37
*/
public static function save($params)
{
$pageData = DecoratePage::where(['id' => $params['id']])->findOrEmpty();
if ($pageData->isEmpty()) {
self::$error = '信息不存在';
return false;
}
DecoratePage::update([
'id' => $params['id'],
'type' => $params['type'],
'data' => $params['data'],
]);
return true;
}
}

View File

@ -1,80 +0,0 @@
<?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\admin\logic\decorate;
use app\common\logic\BaseLogic;
use app\common\model\decorate\DecorateTabbar;
use app\common\service\ConfigService;
use app\common\service\FileService;
/**
* 装修配置-底部导航
* Class DecorateTabbarLogic
* @package app\admin\logic\decorate
*/
class DecorateTabbarLogic extends BaseLogic
{
/**
* @notes 获取底部导航详情
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 乔峰
* @date 2022/9/7 16:58
*/
public static function detail(): array
{
$list = DecorateTabbar::getTabbarLists();
$style = ConfigService::get('tabbar', 'style', config('project.decorate.tabbar_style'));
return ['style' => $style, 'list' => $list];
}
/**
* @notes 底部导航保存
* @param $params
* @return bool
* @throws \Exception
* @author 乔峰
* @date 2022/9/7 17:19
*/
public static function save($params): bool
{
$model = new DecorateTabbar();
// 删除旧配置数据
$model->where('id', '>', 0)->delete();
// 保存数据
$tabbars = $params['list'] ?? [];
$data = [];
foreach ($tabbars as $item) {
$data[] = [
'name' => $item['name'],
'selected' => FileService::setFileUrl($item['selected']),
'unselected' => FileService::setFileUrl($item['unselected']),
'link' => $item['link'],
];
}
$model->saveAll($data);
if (!empty($params['style'])) {
ConfigService::set('tabbar', 'style', $params['style']);
}
return true;
}
}

View File

@ -1,65 +0,0 @@
<?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\admin\logic\setting;
use app\common\logic\BaseLogic;
use app\common\service\ConfigService;
use app\common\service\FileService;
/**
* 客服设置逻辑
* Class CustomerServiceLogic
* @package app\admin\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

@ -1,75 +0,0 @@
<?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\admin\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\admin\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

@ -17,8 +17,7 @@ namespace app\admin\logic\setting;
use app\common\logic\BaseLogic;
use app\common\service\ConfigService;
use think\facade\Cache;
use support\Cache;
/**
* 存储设置逻辑层

View File

@ -1,64 +0,0 @@
<?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\admin\logic\setting;
use app\common\logic\BaseLogic;
use app\common\service\ConfigService;
/**
* 交易设置逻辑
* Class TransactionSettingsLogic
* @package app\admin\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

@ -15,7 +15,7 @@
namespace app\admin\logic\setting\system;
use app\common\logic\BaseLogic;
use think\facade\Cache;
use support\Cache;
/**
* 系统缓存逻辑
@ -32,6 +32,6 @@ class CacheLogic extends BaseLogic
public static function clear()
{
Cache::clear();
del_target_dir(app()->getRootPath().'runtime/file',true);
del_target_dir(runtime_path() .'/file',true);
}
}

View File

@ -1,36 +0,0 @@
<?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\admin\validate\channel;
use app\common\validate\BaseValidate;
/**
* 小程序设置
* Class MnpSettingsValidate
* @package app\admin\validate\channel
*/
class MnpSettingsValidate extends BaseValidate
{
protected $rule = [
'app_id' => 'require',
'app_secret' => 'require',
];
protected $message = [
'app_id.require' => '请填写AppID',
'app_secret.require' => '请填写AppSecret',
];
}

View File

@ -1,72 +0,0 @@
<?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\admin\validate\channel;
use app\common\validate\BaseValidate;
/**
* 微信公众号回复验证器
* Class OfficialAccountReplyValidate
* @package app\admin\validate\channel
*/
class OfficialAccountReplyValidate extends BaseValidate
{
protected $rule = [
'id' => 'require|integer',
'reply_type' => 'require|in:1,2,3',
'name' => 'require',
'content_type' => 'require|in:1',
'content' => 'require',
'status' => 'require|in:0,1',
'keyword' => 'requireIf:reply_type,2',
'matching_type' => 'requireIf:reply_type,2|in:1,2',
'sort' => 'requireIf:reply_type,2',
'reply_num' => 'requireIf:reply_type,2|in:1',
'new_sort' => 'require|integer|egt:0',
];
protected $message = [
'reply_type.require' => '请输入回复类型',
'reply_type.in' => '回复类型状态值错误',
'name.require' => '请输入规则名称',
'content_type.require' => '请选择内容类型',
'content_type.in' => '内容类型状态值有误',
'content.require' => '请输入回复内容',
'status.require' => '请选择启用状态',
'status.in' => '启用状态值错误',
'keyword.requireIf' => '请输入关键词',
'matching_type.requireIf' => '请选择匹配类型',
'matching_type.in' => '匹配类型状态值错误',
'sort.requireIf' => '请输入排序值',
'sort.integer' => '排序值须为整型',
'sort.egt' => '排序值须大于或等于0',
'reply_num.requireIf' => '请选择回复数量',
'reply_num.in' => '回复数量状态值错误',
'id.require' => '参数缺失',
'id.integer' => '参数格式错误',
'new_sort.require' => '请输入新排序值',
'new_sort.integer' => '新排序值须为整型',
'new_sort.egt' => '新排序值须大于或等于0',
];
protected $scene = [
'add' => ['reply_type', 'name', 'content_type', 'content', 'status', 'keyword', 'matching_type', 'sort', 'reply_num'],
'detail' => ['id'],
'delete' => ['id'],
'sort' => ['id', 'new_sort'],
'status' => ['id'],
'edit' => ['id', 'reply_type', 'name', 'content_type', 'content', 'status','keyword', 'matching_type', 'sort', 'reply_num']
];
}

View File

@ -1,38 +0,0 @@
<?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\admin\validate\channel;
use app\common\validate\BaseValidate;
/**
* 公众号设置
* Class OfficialAccountSettingValidate
* @package app\admin\validate\channel
*/
class OfficialAccountSettingValidate extends BaseValidate
{
protected $rule = [
'app_id' => 'require',
'app_secret' => 'require',
'encryption_type' => 'require|in:1,2,3',
];
protected $message = [
'app_id.require' => '请填写AppID',
'app_secret.require' => '请填写AppSecret',
'encryption_type.require' => '请选择消息加密方式',
'encryption_type.in' => '消息加密方式状态值错误',
];
}

View File

@ -1,34 +0,0 @@
<?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\admin\validate\channel;
use app\common\validate\BaseValidate;
/**
* 开放平台验证
* Class OpenSettingValidate
* @package app\admin\validate\channel
*/
class OpenSettingValidate extends BaseValidate
{
protected $rule = [
'app_id' => 'require',
'app_secret' => 'require',
];
protected $message = [
'app_id.require' => '请输入appId',
'app_secret.require' => '请输入appSecret',
];
}

View File

@ -1,33 +0,0 @@
<?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\admin\validate\channel;
use app\common\validate\BaseValidate;
/**
* H5设置验证器
* Class HFiveSettingValidate
* @package app\admin\validate\settings\h5
*/
class WebPageSettingValidate extends BaseValidate
{
protected $rule = [
'status' => 'require|in:0,1'
];
protected $message = [
'status.require' => '请选择启用状态',
'status.in' => '启用状态值有误',
];
}

View File

@ -1,51 +0,0 @@
<?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\admin\validate\setting;
use app\common\validate\BaseValidate;
/**
* 交易设置验证
* Class TransactionSettingsValidate
* @package app\admin\validate\setting
*/
class TransactionSettingsValidate extends BaseValidate
{
protected $rule = [
'cancel_unpaid_orders' => 'require|in:0,1',
'cancel_unpaid_orders_times' => 'requireIf:cancel_unpaid_orders,1|integer|gt:0',
'verification_orders' => 'require|in:0,1',
'verification_orders_times' => 'requireIf:verification_orders,1|integer|gt:0',
];
protected $message = [
'cancel_unpaid_orders.require' => '请选择系统取消待付款订单方式',
'cancel_unpaid_orders.in' => '系统取消待付款订单状态值有误',
'cancel_unpaid_orders_times.requireIf' => '系统取消待付款订单时间未填写',
'cancel_unpaid_orders_times.integer' => '系统取消待付款订单时间须为整型',
'cancel_unpaid_orders_times.gt' => '系统取消待付款订单时间须大于0',
'verification_orders.require' => '请选择系统自动核销订单方式',
'verification_orders.in' => '系统自动核销订单状态值有误',
'verification_orders_times.requireIf' => '系统自动核销订单时间未填写',
'verification_orders_times.integer' => '系统自动核销订单时间须为整型',
'verification_orders_times.gt' => '系统自动核销订单时间须大于0',
];
public function sceneSetConfig()
{
return $this->only(['cancel_unpaid_orders','cancel_unpaid_orders_times','verification_orders','verification_orders_times']);
}
}

View File

@ -5,7 +5,7 @@ use WebSocket\Client;
class IndexController{
public function index(){
var_dump(runtime_path());
}

View File

@ -1,12 +0,0 @@
<?php
namespace app\common\model\article;
use app\common\model\BaseModel;
class Article extends BaseModel
{
}

View File

@ -1,28 +0,0 @@
<?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\common\model\channel;
use app\common\model\BaseModel;
/**
* 微信公众号回复
* Class OfficialAccountReply
* @package app\common\model\channel
*/
class OfficialAccountReply extends BaseModel
{
}

View File

@ -44,8 +44,7 @@
"doctrine/annotations": "^1.14",
"illuminate/redis": "^10.22",
"symfony/cache": "^5.4",
"max/var-dumper": "^0.1.1",
"textalk/websocket": "^1.5"
"max/var-dumper": "^0.1.1"
},
"suggest": {
"ext-event": "For better performance. "