first commit

This commit is contained in:
weiz 2023-11-21 11:51:27 +08:00
parent 0430851120
commit e500652c37
4606 changed files with 603055 additions and 1 deletions

1
.example.env Normal file
View File

@ -0,0 +1 @@
APP_DEBUG = true [APP] DEFAULT_TIMEZONE = Asia/Shanghai [DATABASE] TYPE = mysql HOSTNAME = 127.0.0.1 DATABASE = test USERNAME = username PASSWORD = password HOSTPORT = 3306 CHARSET = utf8 DEBUG = true PREFIX = la_ [LANG] default_lang = zh-cn [PROJECT] UNIQUE_IDENTIFICATION = likeadmin # 演示环境 DEMO_ENV = false

9
.gitignore vendored
View File

@ -1,2 +1,9 @@
/.idea /.idea
/.vscode /.vscode
*.log
/.env
/public/uploads/*
!/public/uploads/index.html
/runtime/*
!/runtime/index.html
/public/nginx.htaccess

42
.travis.yml Normal file
View File

@ -0,0 +1,42 @@
sudo: false
language: php
branches:
only:
- stable
cache:
directories:
- $HOME/.composer/cache
before_install:
- composer self-update
install:
- composer install --no-dev --no-interaction --ignore-platform-reqs
- zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Core.zip .
- composer require --update-no-dev --no-interaction "topthink/think-image:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-migration:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-captcha:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-mongo:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-worker:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-helper:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-queue:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-angular:^1.0"
- composer require --dev --update-no-dev --no-interaction "topthink/think-testing:^1.0"
- zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Full.zip .
script:
- php think unit
deploy:
provider: releases
api_key:
secure: TSF6bnl2JYN72UQOORAJYL+CqIryP2gHVKt6grfveQ7d9rleAEoxlq6PWxbvTI4jZ5nrPpUcBUpWIJHNgVcs+bzLFtyh5THaLqm39uCgBbrW7M8rI26L8sBh/6nsdtGgdeQrO/cLu31QoTzbwuz1WfAVoCdCkOSZeXyT/CclH99qV6RYyQYqaD2wpRjrhA5O4fSsEkiPVuk0GaOogFlrQHx+C+lHnf6pa1KxEoN1A0UxxVfGX6K4y5g4WQDO5zT4bLeubkWOXK0G51XSvACDOZVIyLdjApaOFTwamPcD3S1tfvuxRWWvsCD5ljFvb2kSmx5BIBNwN80MzuBmrGIC27XLGOxyMerwKxB6DskNUO9PflKHDPI61DRq0FTy1fv70SFMSiAtUv9aJRT41NQh9iJJ0vC8dl+xcxrWIjU1GG6+l/ZcRqVx9V1VuGQsLKndGhja7SQ+X1slHl76fRq223sMOql7MFCd0vvvxVQ2V39CcFKao/LB1aPH3VhODDEyxwx6aXoTznvC/QPepgWsHOWQzKj9ftsgDbsNiyFlXL4cu8DWUty6rQy8zT2b4O8b1xjcwSUCsy+auEjBamzQkMJFNlZAIUrukL/NbUhQU37TAbwsFyz7X0E/u/VMle/nBCNAzgkMwAUjiHM6FqrKKBRWFbPrSIixjfjkCnrMEPw=
file:
- ThinkPHP_Core.zip
- ThinkPHP_Full.zip
skip_cleanup: true
on:
tags: true

32
LICENSE.txt Normal file
View File

@ -0,0 +1,32 @@
ThinkPHP遵循Apache2开源协议发布并提供免费使用。
版权所有Copyright © 2006-2016 by ThinkPHP (http://thinkphp.cn)
All rights reserved。
ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。
Apache Licence是著名的非盈利开源组织Apache采用的协议。
该协议和BSD类似鼓励代码共享和尊重原作者的著作权
允许代码修改,再作为开源或商业软件发布。需要满足
的条件:
1 需要给代码的用户一份Apache Licence
2 如果你修改了代码,需要在被修改的文件中说明;
3 在延伸的代码中(修改和有源代码衍生的代码中)需要
带有原来代码中的协议,商标,专利声明和其他原来作者规
定需要包含的说明;
4 如果再发布的产品中包含一个Notice文件则在Notice文
件中需要带有本协议内容。你可以在Notice中增加自己的
许可但不可以表现为对Apache Licence构成更改。
具体的协议参考http://www.apache.org/licenses/LICENSE-2.0
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

56
README.md Normal file
View File

@ -0,0 +1,56 @@
ThinkPHP 6.0
===============
> 运行环境要求PHP7.1+兼容PHP8.0。
[官方应用服务市场](https://market.topthink.com) | [`ThinkAPI`——官方统一API服务](https://docs.topthink.com/think-api)
ThinkPHPV6.0版本由[亿速云](https://www.yisu.com/)独家赞助发布。
## 主要新特性
* 采用`PHP7`强类型(严格模式)
* 支持更多的`PSR`规范
* 原生多应用支持
* 更强大和易用的查询
* 全新的事件系统
* 模型事件和数据库事件统一纳入事件系统
* 模板引擎分离出核心
* 内部功能中间件化
* SESSION/Cookie机制改进
* 对Swoole以及协程支持改进
* 对IDE更加友好
* 统一和精简大量用法
## 安装
~~~
composer create-project topthink/think tp 6.0.*
~~~
如果需要更新框架使用
~~~
composer update topthink/framework
~~~
## 文档
[完全开发手册](https://www.kancloud.cn/manual/thinkphp6_0/content)
## 参与开发
请参阅 [ThinkPHP 核心框架包](https://github.com/top-think/framework)。
## 版权信息
ThinkPHP遵循Apache2开源协议发布并提供免费使用。
本项目包含的第三方源码和二进制文件之版权信息另行标注。
版权所有Copyright © 2006-2020 by ThinkPHP (http://thinkphp.cn)
All rights reserved。
ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。
更多细节参阅 [LICENSE.txt](LICENSE.txt)

1
app/.htaccess Normal file
View File

@ -0,0 +1 @@
deny from all

22
app/AppService.php Normal file
View File

@ -0,0 +1,22 @@
<?php
declare (strict_types = 1);
namespace app;
use think\Service;
/**
* 应用服务类
*/
class AppService extends Service
{
public function register()
{
// 服务注册
}
public function boot()
{
// 服务启动
}
}

95
app/BaseController.php Normal file
View File

@ -0,0 +1,95 @@
<?php
declare (strict_types = 1);
namespace app;
use think\App;
use think\exception\ValidateException;
use think\Validate;
/**
* 控制器基础类
*/
abstract class BaseController
{
/**
* Request实例
* @var \think\Request
*/
protected $request;
/**
* 应用实例
* @var \think\App
*/
protected $app;
/**
* 是否批量验证
* @var bool
*/
protected $batchValidate = false;
/**
* 控制器中间件
* @var array
*/
protected $middleware = [];
/**
* 构造方法
* @access public
* @param App $app 应用对象
*/
public function __construct(App $app)
{
$this->app = $app;
$this->request = $this->app->request;
// 控制器初始化
$this->initialize();
}
// 初始化
protected function initialize()
{}
/**
* 验证数据
* @access protected
* @param array $data 数据
* @param string|array $validate 验证器名或者验证规则数组
* @param array $message 提示信息
* @param bool $batch 是否批量验证
* @return array|string|true
* @throws ValidateException
*/
protected function validate(array $data, $validate, array $message = [], bool $batch = false)
{
if (is_array($validate)) {
$v = new Validate();
$v->rule($validate);
} else {
if (strpos($validate, '.')) {
// 支持场景
[$validate, $scene] = explode('.', $validate);
}
$class = false !== strpos($validate, '\\') ? $validate : $this->app->parseClass('validate', $validate);
$v = new $class();
if (!empty($scene)) {
$v->scene($scene);
}
}
$v->message($message);
// 是否批量验证
if ($batch || $this->batchValidate) {
$v->batch(true);
}
return $v->failException(true)->check($data);
}
}

58
app/ExceptionHandle.php Normal file
View File

@ -0,0 +1,58 @@
<?php
namespace app;
use think\db\exception\DataNotFoundException;
use think\db\exception\ModelNotFoundException;
use think\exception\Handle;
use think\exception\HttpException;
use think\exception\HttpResponseException;
use think\exception\ValidateException;
use think\Response;
use Throwable;
/**
* 应用异常处理类
*/
class ExceptionHandle extends Handle
{
/**
* 不需要记录信息(日志)的异常类列表
* @var array
*/
protected $ignoreReport = [
HttpException::class,
HttpResponseException::class,
ModelNotFoundException::class,
DataNotFoundException::class,
ValidateException::class,
];
/**
* 记录异常信息(包括日志或者其它方式记录)
*
* @access public
* @param Throwable $exception
* @return void
*/
public function report(Throwable $exception): void
{
// 使用内置的方式记录异常日志
parent::report($exception);
}
/**
* Render an exception into an HTTP response.
*
* @access public
* @param \think\Request $request
* @param Throwable $e
* @return Response
*/
public function render($request, Throwable $e): Response
{
// 添加自定义异常处理机制
// 其他错误交给系统处理
return parent::render($request, $e);
}
}

9
app/Request.php Normal file
View File

@ -0,0 +1,9 @@
<?php
namespace app;
// 应用请求对象类
class Request extends \think\Request
{
// 全局过滤规则
protected $filter = ['trim'];
}

View File

@ -0,0 +1,28 @@
<?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
// +----------------------------------------------------------------------
return [
'middleware' => [
// 初始化
app\adminapi\http\middleware\InitMiddleware::class,
// 登录验证
app\adminapi\http\middleware\LoginMiddleware::class,
// 权限认证
app\adminapi\http\middleware\AuthMiddleware::class,
// 演示模式 - 禁止提交数据
app\adminapi\http\middleware\CheckDemoMiddleware::class,
// 演示模式 - 不返回敏感数据
app\adminapi\http\middleware\EncryDemoDataMiddleware::class,
],
];

View File

@ -0,0 +1,40 @@
<?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
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\adminapi\controller;
use think\App;
use app\common\controller\BaseLikeAdminController;
/**
* 管理元控制器基类
* Class BaseAdminController
* @package app\adminapi\controller
*/
class BaseAdminController extends BaseLikeAdminController
{
protected int $adminId = 0;
protected array $adminInfo = [];
public function initialize()
{
if (isset($this->request->adminInfo) && $this->request->adminInfo) {
$this->adminInfo = $this->request->adminInfo;
$this->adminId = $this->request->adminInfo['admin_id'];
}
}
}

View File

@ -0,0 +1,61 @@
<?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\controller;
use app\adminapi\logic\auth\AuthLogic;
use app\adminapi\logic\ConfigLogic;
/**
* 配置控制器
* Class ConfigController
* @package app\adminapi\controller
*/
class ConfigController extends BaseAdminController
{
public array $notNeedLogin = ['getConfig', 'dict'];
/**
* @notes 基础配置
* @return \think\response\Json
* @author 段誉
* @date 2021/12/31 11:01
*/
public function getConfig()
{
$data = ConfigLogic::getConfig();
return $this->data($data);
}
/**
* @notes 根据类型获取字典数据
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2022/9/27 19:10
*/
public function dict()
{
$type = $this->request->get('type', '');
$data = ConfigLogic::getDictByType($type);
return $this->data($data);
}
}

View File

@ -0,0 +1,50 @@
<?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\controller;
use app\common\cache\ExportCache;
use app\common\service\JsonService;
class DownloadController extends BaseAdminController
{
public array $notNeedLogin = ['export'];
/**
* @notes 导出文件
* @return \think\response\File|\think\response\Json
* @author 段誉
* @date 2022/11/24 16:10
*/
public function export()
{
//获取文件缓存的key
$fileKey = request()->get('file');
//通过文件缓存的key获取文件储存的路径
$exportCache = new ExportCache();
$fileInfo = $exportCache->getFile($fileKey);
if (empty($fileInfo)) {
return JsonService::fail('下载文件不存在');
}
//下载前删除缓存
$exportCache->delete($fileKey);
return download($fileInfo['src'] . $fileInfo['name'], $fileInfo['name']);
}
}

View File

@ -0,0 +1,137 @@
<?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\controller;
use app\adminapi\lists\file\FileCateLists;
use app\adminapi\lists\file\FileLists;
use app\adminapi\logic\FileLogic;
use app\adminapi\validate\FileValidate;
use think\response\Json;
/**文件管理
* Class FileController
* @package app\adminapi\controller
*/
class FileController extends BaseAdminController
{
/**
* @notes 文件列表
* @return Json
* @author 段誉
* @date 2021/12/29 14:30
*/
public function lists()
{
return $this->dataLists(new FileLists());
}
/**
* @notes 文件移动成功
* @return Json
* @author 段誉
* @date 2021/12/29 14:30
*/
public function move()
{
$params = (new FileValidate())->post()->goCheck('move');
FileLogic::move($params);
return $this->success('移动成功', [], 1, 1);
}
/**
* @notes 重命名文件
* @return Json
* @author 段誉
* @date 2021/12/29 14:31
*/
public function rename()
{
$params = (new FileValidate())->post()->goCheck('rename');
FileLogic::rename($params);
return $this->success('重命名成功', [], 1, 1);
}
/**
* @notes 删除文件
* @return Json
* @author 段誉
* @date 2021/12/29 14:31
*/
public function delete()
{
$params = (new FileValidate())->post()->goCheck('delete');
FileLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 分类列表
* @return Json
* @author 段誉
* @date 2021/12/29 14:31
*/
public function listCate()
{
return $this->dataLists(new FileCateLists());
}
/**
* @notes 添加文件分类
* @return Json
* @author 段誉
* @date 2021/12/29 14:31
*/
public function addCate()
{
$params = (new FileValidate())->post()->goCheck('addCate');
FileLogic::addCate($params);
return $this->success('添加成功', [], 1, 1);
}
/**
* @notes 编辑文件分类
* @return Json
* @author 段誉
* @date 2021/12/29 14:31
*/
public function editCate()
{
$params = (new FileValidate())->post()->goCheck('editCate');
FileLogic::editCate($params);
return $this->success('编辑成功', [], 1, 1);
}
/**
* @notes 删除文件分类
* @return Json
* @author 段誉
* @date 2021/12/29 14:32
*/
public function delCate()
{
$params = (new FileValidate())->post()->goCheck('id');
FileLogic::delCate($params);
return $this->success('删除成功', [], 1, 1);
}
}

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\controller;
use app\adminapi\logic\LoginLogic;
use app\adminapi\validate\LoginValidate;
/**
* 管理员登录控制器
* Class LoginController
* @package app\adminapi\controller
*/
class LoginController extends BaseAdminController
{
public array $notNeedLogin = ['account'];
/**
* @notes 账号登录
* @date 2021/6/30 17:01
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 令狐冲
*/
public function account()
{
$params = (new LoginValidate())->post()->goCheck();
return $this->data((new LoginLogic())->login($params));
}
/**
* @notes 退出登录
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 令狐冲
* @date 2021/7/8 00:36
*/
public function logout()
{
//退出登录情况特殊只有成功的情况也不需要token验证
(new LoginLogic())->logout($this->adminInfo);
return $this->success();
}
}

View File

@ -0,0 +1,63 @@
<?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\controller;
use app\common\service\UploadService;
use Exception;
use think\response\Json;
/**
* 上传文件
* Class UploadController
* @package app\adminapi\controller
*/
class UploadController extends BaseAdminController
{
/**
* @notes 上传图片
* @return Json
* @author 段誉
* @date 2021/12/29 16:27
*/
public function image()
{
try {
$cid = $this->request->post('cid', 0);
$result = UploadService::image($cid);
return $this->success('上传成功', $result);
} catch (Exception $e) {
return $this->fail($e->getMessage());
}
}
/**
* @notes 上传视频
* @return Json
* @author 段誉
* @date 2021/12/29 16:27
*/
public function video()
{
try {
$cid = $this->request->post('cid', 0);
$result = UploadService::video($cid);
return $this->success('上传成功', $result);
} catch (Exception $e) {
return $this->fail($e->getMessage());
}
}
}

View File

@ -0,0 +1,38 @@
<?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\controller;
use app\adminapi\logic\WorkbenchLogic;
/**
* 工作台
* Class WorkbenchCotroller
* @package app\adminapi\controller
*/
class WorkbenchController extends BaseAdminController
{
/**
* @notes 工作台
* @return \think\response\Json
* @author 段誉
* @date 2021/12/29 17:01
*/
public function index()
{
$result = WorkbenchLogic::index();
return $this->data($result);
}
}

View File

@ -0,0 +1,134 @@
<?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\controller\article;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\article\ArticleCateLists;
use app\adminapi\logic\article\ArticleCateLogic;
use app\adminapi\validate\article\ArticleCateValidate;
/**
* 资讯分类管理控制器
* Class ArticleCateController
* @package app\adminapi\controller\article
*/
class ArticleCateController extends BaseAdminController
{
/**
* @notes 查看资讯分类列表
* @return \think\response\Json
* @author heshihu
* @date 2022/2/21 17:11
*/
public function lists()
{
return $this->dataLists(new ArticleCateLists());
}
/**
* @notes 添加资讯分类
* @return \think\response\Json
* @author heshihu
* @date 2022/2/21 17:31
*/
public function add()
{
$params = (new ArticleCateValidate())->post()->goCheck('add');
ArticleCateLogic::add($params);
return $this->success('添加成功', [], 1, 1);
}
/**
* @notes 编辑资讯分类
* @return \think\response\Json
* @author heshihu
* @date 2022/2/21 17:49
*/
public function edit()
{
$params = (new ArticleCateValidate())->post()->goCheck('edit');
$result = ArticleCateLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(ArticleCateLogic::getError());
}
/**
* @notes 删除资讯分类
* @return \think\response\Json
* @author heshihu
* @date 2022/2/21 17:52
*/
public function delete()
{
$params = (new ArticleCateValidate())->post()->goCheck('delete');
ArticleCateLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 资讯分类详情
* @return \think\response\Json
* @author heshihu
* @date 2022/2/21 17:54
*/
public function detail()
{
$params = (new ArticleCateValidate())->goCheck('detail');
$result = ArticleCateLogic::detail($params);
return $this->data($result);
}
/**
* @notes 更改资讯分类状态
* @return \think\response\Json
* @author heshihu
* @date 2022/2/21 10:15
*/
public function updateStatus()
{
$params = (new ArticleCateValidate())->post()->goCheck('status');
$result = ArticleCateLogic::updateStatus($params);
if (true === $result) {
return $this->success('修改成功', [], 1, 1);
}
return $this->fail(ArticleCateLogic::getError());
}
/**
* @notes 获取文章分类
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2022/10/13 10:54
*/
public function all()
{
$result = ArticleCateLogic::getAllData();
return $this->data($result);
}
}

View File

@ -0,0 +1,114 @@
<?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\controller\article;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\article\ArticleLists;
use app\adminapi\logic\article\ArticleLogic;
use app\adminapi\validate\article\ArticleValidate;
/**
* 资讯管理控制器
* Class ArticleController
* @package app\adminapi\controller\article
*/
class ArticleController extends BaseAdminController
{
/**
* @notes 查看资讯列表
* @return \think\response\Json
* @author heshihu
* @date 2022/2/22 9:47
*/
public function lists()
{
return $this->dataLists(new ArticleLists());
}
/**
* @notes 添加资讯
* @return \think\response\Json
* @author heshihu
* @date 2022/2/22 9:57
*/
public function add()
{
$params = (new ArticleValidate())->post()->goCheck('add');
ArticleLogic::add($params);
return $this->success('添加成功', [], 1, 1);
}
/**
* @notes 编辑资讯
* @return \think\response\Json
* @author heshihu
* @date 2022/2/22 10:12
*/
public function edit()
{
$params = (new ArticleValidate())->post()->goCheck('edit');
$result = ArticleLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(ArticleLogic::getError());
}
/**
* @notes 删除资讯
* @return \think\response\Json
* @author heshihu
* @date 2022/2/22 10:17
*/
public function delete()
{
$params = (new ArticleValidate())->post()->goCheck('delete');
ArticleLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 资讯详情
* @return \think\response\Json
* @author heshihu
* @date 2022/2/22 10:15
*/
public function detail()
{
$params = (new ArticleValidate())->goCheck('detail');
$result = ArticleLogic::detail($params);
return $this->data($result);
}
/**
* @notes 更改资讯状态
* @return \think\response\Json
* @author heshihu
* @date 2022/2/22 10:18
*/
public function updateStatus()
{
$params = (new ArticleValidate())->post()->goCheck('status');
$result = ArticleLogic::updateStatus($params);
if (true === $result) {
return $this->success('修改成功', [], 1, 1);
}
return $this->fail(ArticleLogic::getError());
}
}

View File

@ -0,0 +1,134 @@
<?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\controller\auth;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\auth\AdminLists;
use app\adminapi\validate\auth\AdminValidate;
use app\adminapi\logic\auth\AdminLogic;
use app\adminapi\validate\auth\editSelfValidate;
/**
* 管理员控制器
* Class AdminController
* @package app\adminapi\controller\auth
*/
class AdminController extends BaseAdminController
{
/**
* @notes 查看管理员列表
* @return \think\response\Json
* @author 段誉
* @date 2021/12/29 9:55
*/
public function lists()
{
return $this->dataLists(new AdminLists());
}
/**
* @notes 添加管理员
* @return \think\response\Json
* @author 段誉
* @date 2021/12/29 10:21
*/
public function add()
{
$params = (new AdminValidate())->post()->goCheck('add');
$result = AdminLogic::add($params);
if (true === $result) {
return $this->success('操作成功', [], 1, 1);
}
return $this->fail(AdminLogic::getError());
}
/**
* @notes 编辑管理员
* @return \think\response\Json
* @author 段誉
* @date 2021/12/29 11:03
*/
public function edit()
{
$params = (new AdminValidate())->post()->goCheck('edit');
$result = AdminLogic::edit($params);
if (true === $result) {
return $this->success('操作成功', [], 1, 1);
}
return $this->fail(AdminLogic::getError());
}
/**
* @notes 删除管理员
* @return \think\response\Json
* @author 段誉
* @date 2021/12/29 11:03
*/
public function delete()
{
$params = (new AdminValidate())->post()->goCheck('delete');
$result = AdminLogic::delete($params);
if (true === $result) {
return $this->success('操作成功', [], 1, 1);
}
return $this->fail(AdminLogic::getError());
}
/**
* @notes 查看管理员详情
* @return \think\response\Json
* @author 段誉
* @date 2021/12/29 11:07
*/
public function detail()
{
$params = (new AdminValidate())->goCheck('detail');
$result = AdminLogic::detail($params);
return $this->data($result);
}
/**
* @notes 获取当前管理员信息
* @return \think\response\Json
* @author 段誉
* @date 2021/12/31 10:53
*/
public function mySelf()
{
$result = AdminLogic::detail(['id' => $this->adminId], 'auth');
return $this->data($result);
}
/**
* @notes 编辑超级管理员信息
* @return \think\response\Json
* @author 段誉
* @date 2022/4/8 17:54
*/
public function editSelf()
{
$params = (new editSelfValidate())->post()->goCheck('', ['admin_id' => $this->adminId]);
$result = AdminLogic::editSelf($params);
return $this->success('操作成功', [], 1, 1);
}
}

View File

@ -0,0 +1,142 @@
<?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\controller\auth;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\auth\MenuLists;
use app\adminapi\logic\auth\MenuLogic;
use app\adminapi\validate\auth\MenuValidate;
/**
* 系统菜单权限
* Class MenuController
* @package app\adminapi\controller\setting\system
*/
class MenuController extends BaseAdminController
{
/**
* @notes 获取菜单路由
* @return \think\response\Json
* @author 段誉
* @date 2022/6/29 17:41
*/
public function route()
{
$result = MenuLogic::getMenuByAdminId($this->adminId);
return $this->data($result);
}
/**
* @notes 获取菜单列表
* @return \think\response\Json
* @author 段誉
* @date 2022/6/29 17:23
*/
public function lists()
{
return $this->dataLists(new MenuLists());
}
/**
* @notes 菜单详情
* @return \think\response\Json
* @author 段誉
* @date 2022/6/30 10:07
*/
public function detail()
{
$params = (new MenuValidate())->goCheck('detail');
return $this->data(MenuLogic::detail($params));
}
/**
* @notes 添加菜单
* @return \think\response\Json
* @author 段誉
* @date 2022/6/30 10:07
*/
public function add()
{
$params = (new MenuValidate())->post()->goCheck('add');
MenuLogic::add($params);
return $this->success('操作成功', [], 1, 1);
}
/**
* @notes 编辑菜单
* @return \think\response\Json
* @author 段誉
* @date 2022/6/30 10:07
*/
public function edit()
{
$params = (new MenuValidate())->post()->goCheck('edit');
MenuLogic::edit($params);
return $this->success('操作成功', [], 1, 1);
}
/**
* @notes 删除菜单
* @return \think\response\Json
* @author 段誉
* @date 2022/6/30 10:07
*/
public function delete()
{
$params = (new MenuValidate())->post()->goCheck('delete');
MenuLogic::delete($params);
return $this->success('操作成功', [], 1, 1);
}
/**
* @notes 更新状态
* @return \think\response\Json
* @author 段誉
* @date 2022/7/6 17:04
*/
public function updateStatus()
{
$params = (new MenuValidate())->post()->goCheck('status');
MenuLogic::updateStatus($params);
return $this->success('操作成功', [], 1, 1);
}
/**
* @notes 获取菜单数据
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2022/10/13 11:03
*/
public function all()
{
$result = MenuLogic::getAllData();
return $this->data($result);
}
}

View File

@ -0,0 +1,124 @@
<?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\controller\auth;
use app\adminapi\{
logic\auth\RoleLogic,
lists\auth\RoleLists,
validate\auth\RoleValidate,
controller\BaseAdminController
};
/**
* 角色控制器
* Class RoleController
* @package app\adminapi\controller\auth
*/
class RoleController extends BaseAdminController
{
/**
* @notes 查看角色列表
* @return \think\response\Json
* @author 段誉
* @date 2021/12/29 11:49
*/
public function lists()
{
return $this->dataLists(new RoleLists());
}
/**
* @notes 添加权限
* @return \think\response\Json
* @author 段誉
* @date 2021/12/29 11:49
*/
public function add()
{
$params = (new RoleValidate())->post()->goCheck('add');
$res = RoleLogic::add($params);
if (true === $res) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(RoleLogic::getError());
}
/**
* @notes 编辑角色
* @return \think\response\Json
* @author 段誉
* @date 2021/12/29 14:18
*/
public function edit()
{
$params = (new RoleValidate())->post()->goCheck('edit');
$res = RoleLogic::edit($params);
if (true === $res) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(RoleLogic::getError());
}
/**
* @notes 删除角色
* @return \think\response\Json
* @author 段誉
* @date 2021/12/29 14:18
*/
public function delete()
{
$params = (new RoleValidate())->post()->goCheck('del');
RoleLogic::delete($params['id']);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 查看角色详情
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2021/12/29 14:18
*/
public function detail()
{
$params = (new RoleValidate())->goCheck('detail');
$detail = RoleLogic::detail($params['id']);
return $this->data($detail);
}
/**
* @notes 获取角色数据
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2022/10/13 10:39
*/
public function all()
{
$result = RoleLogic::getAllData();
return $this->data($result);
}
}

View File

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

View File

@ -0,0 +1,52 @@
<?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\controller\channel;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\logic\channel\MnpSettingsLogic;
use app\adminapi\validate\channel\MnpSettingsValidate;
/**
* 小程序设置
* Class MnpSettingsController
* @package app\adminapi\controller\channel
*/
class MnpSettingsController extends BaseAdminController
{
/**
* @notes 获取小程序配置
* @return \think\response\Json
* @author ljj
* @date 2022/2/16 9:38 上午
*/
public function getConfig()
{
$result = (new MnpSettingsLogic())->getConfig();
return $this->data($result);
}
/**
* @notes 设置小程序配置
* @return \think\response\Json
* @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

@ -0,0 +1,74 @@
<?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\controller\channel;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\logic\channel\OfficialAccountMenuLogic;
/**
* 微信公众号菜单控制器
* Class OfficialAccountMenuController
* @package app\adminapi\controller\channel
*/
class OfficialAccountMenuController extends BaseAdminController
{
/**
* @notes 保存菜单
* @return \think\response\Json
* @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 保存发布菜单
* @return \think\response\Json
* @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 查看菜单详情
* @return \think\response\Json
* @author 段誉
* @date 2022/3/29 10:42
*/
public function detail()
{
$result = OfficialAccountMenuLogic::detail();
return $this->data($result);
}
}

View File

@ -0,0 +1,148 @@
<?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\controller\channel;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\channel\OfficialAccountReplyLists;
use app\adminapi\logic\channel\OfficialAccountReplyLogic;
use app\adminapi\validate\channel\OfficialAccountReplyValidate;
/**
* 微信公众号回复控制器
* Class OfficialAccountReplyController
* @package app\adminapi\controller\channel
*/
class OfficialAccountReplyController extends BaseAdminController
{
public array $notNeedLogin = ['index'];
/**
* @notes 查看回复列表(关注/关键词/默认)
* @return \think\response\Json
* @author 段誉
* @date 2022/3/29 10:58
*/
public function lists()
{
return $this->dataLists(new OfficialAccountReplyLists());
}
/**
* @notes 添加回复(关注/关键词/默认)
* @return \think\response\Json
* @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 查看回复详情
* @return \think\response\Json
* @author 段誉
* @date 2022/3/29 10:58
*/
public function detail()
{
$params = (new OfficialAccountReplyValidate())->goCheck('detail');
$result = OfficialAccountReplyLogic::detail($params);
return $this->data($result);
}
/**
* @notes 编辑回复(关注/关键词/默认)
* @return \think\response\Json
* @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 删除回复(关注/关键词/默认)
* @return \think\response\Json
* @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 更新排序
* @return \think\response\Json
* @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 更新状态
* @return \think\response\Json
* @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()
{
$result = OfficialAccountReplyLogic::index();
return response($result->getBody())->header([
'Content-Type' => 'text/plain;charset=utf-8'
]);
}
}

View File

@ -0,0 +1,52 @@
<?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\controller\channel;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\logic\channel\OfficialAccountSettingLogic;
use app\adminapi\validate\channel\OfficialAccountSettingValidate;
/**
* 公众号设置
* Class OfficialAccountSettingController
* @package app\adminapi\controller\channel
*/
class OfficialAccountSettingController extends BaseAdminController
{
/**
* @notes 获取公众号配置
* @return \think\response\Json
* @author ljj
* @date 2022/2/16 10:09 上午
*/
public function getConfig()
{
$result = (new OfficialAccountSettingLogic())->getConfig();
return $this->data($result);
}
/**
* @notes 设置公众号配置
* @return \think\response\Json
* @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

@ -0,0 +1,54 @@
<?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\controller\channel;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\logic\channel\OpenSettingLogic;
use app\adminapi\validate\channel\OpenSettingValidate;
/**
* 微信开放平台
* Class AppSettingController
* @package app\adminapi\controller\setting\app
*/
class OpenSettingController extends BaseAdminController
{
/**
* @notes 获取微信开放平台设置
* @return \think\response\Json
* @author 段誉
* @date 2022/3/29 11:03
*/
public function getConfig()
{
$result = OpenSettingLogic::getConfig();
return $this->data($result);
}
/**
* @notes 微信开放平台设置
* @return \think\response\Json
* @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

@ -0,0 +1,54 @@
<?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\controller\channel;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\logic\channel\WebPageSettingLogic;
use app\adminapi\validate\channel\WebPageSettingValidate;
/**
* H5设置控制器
* Class HFiveSettingController
* @package app\adminapi\controller\setting\h5
*/
class WebPageSettingController extends BaseAdminController
{
/**
* @notes 获取H5设置
* @return \think\response\Json
* @author 段誉
* @date 2022/3/29 10:36
*/
public function getConfig()
{
$result = WebPageSettingLogic::getConfig();
return $this->data($result);
}
/**
* @notes H5设置
* @return \think\response\Json
* @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

@ -0,0 +1,135 @@
<?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\controller\crontab;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\crontab\CrontabLists;
use app\adminapi\logic\crontab\CrontabLogic;
use app\adminapi\validate\crontab\CrontabValidate;
/**
* 定时任务控制器
* Class CrontabController
* @package app\adminapi\controller\crontab
*/
class CrontabController extends BaseAdminController
{
/**
* @notes 定时任务列表
* @return \think\response\Json
* @author 段誉
* @date 2022/3/29 14:27
*/
public function lists()
{
return $this->dataLists(new CrontabLists());
}
/**
* @notes 添加定时任务
* @return \think\response\Json
* @author 段誉
* @date 2022/3/29 14:27
*/
public function add()
{
$params = (new CrontabValidate())->post()->goCheck('add');
$result = CrontabLogic::add($params);
if($result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(CrontabLogic::getError());
}
/**
* @notes 查看定时任务详情
* @return \think\response\Json
* @author 段誉
* @date 2022/3/29 14:27
*/
public function detail()
{
$params = (new CrontabValidate())->goCheck('detail');
$result = CrontabLogic::detail($params);
return $this->data($result);
}
/**
* @notes 编辑定时任务
* @return \think\response\Json
* @author 段誉
* @date 2022/3/29 14:27
*/
public function edit()
{
$params = (new CrontabValidate())->post()->goCheck('edit');
$result = CrontabLogic::edit($params);
if($result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(CrontabLogic::getError());
}
/**
* @notes 删除定时任务
* @return \think\response\Json
* @author 段誉
* @date 2022/3/29 14:27
*/
public function delete()
{
$params = (new CrontabValidate())->post()->goCheck('delete');
$result = CrontabLogic::delete($params);
if($result) {
return $this->success('删除成功', [], 1, 1);
}
return $this->fail('删除失败');
}
/**
* @notes 操作定时任务
* @return \think\response\Json
* @author 段誉
* @date 2022/3/29 14:28
*/
public function operate()
{
$params = (new CrontabValidate())->post()->goCheck('operate');
$result = CrontabLogic::operate($params);
if($result) {
return $this->success('操作成功', [], 1, 1);
}
return $this->fail(CrontabLogic::getError());
}
/**
* @notes 获取规则执行时间
* @return \think\response\Json
* @author 段誉
* @date 2022/3/29 14:28
*/
public function expression()
{
$params = (new CrontabValidate())->goCheck('expression');
$result = CrontabLogic::expression($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,47 @@
<?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\controller\decorate;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\logic\decorate\DecorateDataLogic;
/**
* 装修-数据
* Class DataController
* @package app\adminapi\controller\decorate
*/
class DataController extends BaseAdminController
{
/**
* @notes 文章列表
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2022/9/22 16:50
*/
public function article()
{
$limit = $this->request->get('limit/d', 10);
$result = DecorateDataLogic::getArticleLists($limit);
return $this->success('获取成功', $result);
}
}

View File

@ -0,0 +1,61 @@
<?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\controller\decorate;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\logic\decorate\DecoratePageLogic;
use app\adminapi\validate\decorate\DecoratePageValidate;
/**
* 装修页面
* Class DecoratePageController
* @package app\adminapi\controller\decorate
*/
class PageController extends BaseAdminController
{
/**
* @notes 获取装修修页面详情
* @return \think\response\Json
* @author 段誉
* @date 2022/9/14 18:43
*/
public function detail()
{
$id = $this->request->get('id/d');
$result = DecoratePageLogic::getDetail($id);
return $this->success('获取成功', $result);
}
/**
* @notes 保存装修配置
* @return \think\response\Json
* @author 段誉
* @date 2022/9/15 9:57
*/
public function save()
{
$params = (new DecoratePageValidate())->post()->goCheck();
$result = DecoratePageLogic::save($params);
if (false === $result) {
return $this->fail(DecoratePageLogic::getError());
}
return $this->success('操作成功', [], 1, 1);
}
}

View File

@ -0,0 +1,58 @@
<?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\controller\decorate;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\logic\decorate\DecorateTabbarLogic;
/**
* 装修-底部导航
* Class DecorateTabbarController
* @package app\adminapi\controller\decorate
*/
class TabbarController extends BaseAdminController
{
/**
* @notes 底部导航详情
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2022/9/7 16:39
*/
public function detail()
{
$data = DecorateTabbarLogic::detail();
return $this->success('', $data);
}
/**
* @notes 底部导航保存
* @return \think\response\Json
* @author 段誉
* @date 2022/9/6 9:58
*/
public function save()
{
$params = $this->request->post();
DecorateTabbarLogic::save($params);
return $this->success('操作成功', [], 1, 1);
}
}

View File

@ -0,0 +1,134 @@
<?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\controller\dept;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\logic\dept\DeptLogic;
use app\adminapi\validate\dept\DeptValidate;
/**
* 部门管理控制器
* Class DeptController
* @package app\adminapi\controller\dept
*/
class DeptController extends BaseAdminController
{
/**
* @notes 部门列表
* @return \think\response\Json
* @author 段誉
* @date 2022/5/25 18:07
*/
public function lists()
{
$params = $this->request->get();
$result = DeptLogic::lists($params);
return $this->success('',$result);
}
/**
* @notes 上级部门
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2022/5/26 18:36
*/
public function leaderDept()
{
$result = DeptLogic::leaderDept();
return $this->success('',$result);
}
/**
* @notes 添加部门
* @return \think\response\Json
* @author 段誉
* @date 2022/5/25 18:40
*/
public function add()
{
$params = (new DeptValidate())->post()->goCheck('add');
DeptLogic::add($params);
return $this->success('添加成功', [], 1, 1);
}
/**
* @notes 编辑部门
* @return \think\response\Json
* @author 段誉
* @date 2022/5/25 18:41
*/
public function edit()
{
$params = (new DeptValidate())->post()->goCheck('edit');
$result = DeptLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(DeptLogic::getError());
}
/**
* @notes 删除部门
* @return \think\response\Json
* @author 段誉
* @date 2022/5/25 18:41
*/
public function delete()
{
$params = (new DeptValidate())->post()->goCheck('delete');
DeptLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取部门详情
* @return \think\response\Json
* @author 段誉
* @date 2022/5/25 18:41
*/
public function detail()
{
$params = (new DeptValidate())->goCheck('detail');
$result = DeptLogic::detail($params);
return $this->data($result);
}
/**
* @notes 获取部门数据
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2022/10/13 10:28
*/
public function all()
{
$result = DeptLogic::getAllData();
return $this->data($result);
}
}

View File

@ -0,0 +1,118 @@
<?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\controller\dept;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\dept\JobsLists;
use app\adminapi\logic\dept\JobsLogic;
use app\adminapi\validate\dept\JobsValidate;
/**
* 岗位管理控制器
* Class JobsController
* @package app\adminapi\controller\dept
*/
class JobsController extends BaseAdminController
{
/**
* @notes 岗位列表
* @return \think\response\Json
* @author 段誉
* @date 2022/5/26 10:00
*/
public function lists()
{
return $this->dataLists(new JobsLists());
}
/**
* @notes 添加岗位
* @return \think\response\Json
* @author 段誉
* @date 2022/5/25 18:40
*/
public function add()
{
$params = (new JobsValidate())->post()->goCheck('add');
JobsLogic::add($params);
return $this->success('添加成功', [], 1, 1);
}
/**
* @notes 编辑岗位
* @return \think\response\Json
* @author 段誉
* @date 2022/5/25 18:41
*/
public function edit()
{
$params = (new JobsValidate())->post()->goCheck('edit');
$result = JobsLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(JobsLogic::getError());
}
/**
* @notes 删除岗位
* @return \think\response\Json
* @author 段誉
* @date 2022/5/25 18:41
*/
public function delete()
{
$params = (new JobsValidate())->post()->goCheck('delete');
JobsLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取岗位详情
* @return \think\response\Json
* @author 段誉
* @date 2022/5/25 18:41
*/
public function detail()
{
$params = (new JobsValidate())->goCheck('detail');
$result = JobsLogic::detail($params);
return $this->data($result);
}
/**
* @notes 获取岗位数据
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2022/10/13 10:31
*/
public function all()
{
$result = JobsLogic::getAllData();
return $this->data($result);
}
}

View File

@ -0,0 +1,54 @@
<?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\controller\finance;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\finance\AccountLogLists;
use app\common\enum\user\AccountLogEnum;
/***
* 账户流水控制器
* Class AccountLogController
* @package app\adminapi\controller
*/
class AccountLogController extends BaseAdminController
{
/**
* @notes 账户流水明细
* @return \think\response\Json
* @author 段誉
* @date 2023/2/24 15:25
*/
public function lists()
{
return $this->dataLists(new AccountLogLists());
}
/**
* @notes 用户余额变动类型
* @return \think\response\Json
* @author 段誉
* @date 2023/2/24 15:25
*/
public function getUmChangeType()
{
return $this->data(AccountLogEnum::getUserMoneyChangeTypeDesc());
}
}

View File

@ -0,0 +1,72 @@
<?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\controller\finance;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\finance\RefundLogLists;
use app\adminapi\lists\finance\RefundRecordLists;
use app\adminapi\logic\finance\RefundLogic;
/**
* 退款控制器
* Class RefundController
* @package app\adminapi\controller\finance
*/
class RefundController extends BaseAdminController
{
/**
* @notes 退还统计
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2023/3/3 12:10
*/
public function stat()
{
$result = RefundLogic::stat();
return $this->success('', $result);
}
/**
* @notes 退款记录
* @return \think\response\Json
* @author 段誉
* @date 2023/3/1 9:47
*/
public function record()
{
return $this->dataLists(new RefundRecordLists());
}
/**
* @notes 退款日志
* @return \think\response\Json
* @author 段誉
* @date 2023/3/1 9:47
*/
public function log()
{
$recordId = $this->request->get('record_id', 0);
$result = RefundLogic::refundLog($recordId);
return $this->success('', $result);
}
}

View File

@ -0,0 +1,70 @@
<?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\controller\notice;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\notice\NoticeSettingLists;
use app\adminapi\logic\notice\NoticeLogic;
use app\adminapi\validate\notice\NoticeValidate;
/**
* 通知控制器
* Class NoticeController
* @package app\adminapi\controller\notice
*/
class NoticeController extends BaseAdminController
{
/**
* @notes 查看通知设置列表
* @return \think\response\Json
* @author 段誉
* @date 2022/3/29 11:18
*/
public function settingLists()
{
return $this->dataLists(new NoticeSettingLists());
}
/**
* @notes 查看通知设置详情
* @return \think\response\Json
* @author 段誉
* @date 2022/3/29 11:18
*/
public function detail()
{
$params = (new NoticeValidate())->goCheck('detail');
$result = NoticeLogic::detail($params);
return $this->data($result);
}
/**
* @notes 通知设置
* @return \think\response\Json
* @author 段誉
* @date 2022/3/29 11:18
*/
public function set()
{
$params = $this->request->post();
$result = NoticeLogic::set($params);
if ($result) {
return $this->success('设置成功');
}
return $this->fail(NoticeLogic::getError());
}
}

View File

@ -0,0 +1,69 @@
<?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\controller\notice;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\logic\notice\SmsConfigLogic;
use app\adminapi\validate\notice\SmsConfigValidate;
/**
* 短信配置控制器
* Class SmsConfigController
* @package app\adminapi\controller\notice
*/
class SmsConfigController extends BaseAdminController
{
/**
* @notes 获取短信配置
* @return \think\response\Json
* @author 段誉
* @date 2022/3/29 11:36
*/
public function getConfig()
{
$result = SmsConfigLogic::getConfig();
return $this->data($result);
}
/**
* @notes 短信配置
* @return \think\response\Json
* @author 段誉
* @date 2022/3/29 11:36
*/
public function setConfig()
{
$params = (new SmsConfigValidate())->post()->goCheck('setConfig');
SmsConfigLogic::setConfig($params);
return $this->success('操作成功',[],1,1);
}
/**
* @notes 查看短信配置详情
* @return \think\response\Json
* @author 段誉
* @date 2022/3/29 11:36
*/
public function detail()
{
$params = (new SmsConfigValidate())->goCheck('detail');
$result = SmsConfigLogic::detail($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,107 @@
<?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\controller\recharge;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\recharge\RechargeLists;
use app\adminapi\logic\recharge\RechargeLogic;
use app\adminapi\validate\recharge\RechargeRefundValidate;
/**
* 充值控制器
* Class RechargeController
* @package app\adminapi\controller\recharge
*/
class RechargeController extends BaseAdminController
{
/**
* @notes 获取充值设置
* @return \think\response\Json
* @author 段誉
* @date 2023/2/22 16:48
*/
public function getConfig()
{
$result = RechargeLogic::getConfig();
return $this->data($result);
}
/**
* @notes 充值设置
* @return \think\response\Json
* @author 段誉
* @date 2023/2/22 16:48
*/
public function setConfig()
{
$params = $this->request->post();
$result = RechargeLogic::setConfig($params);
if($result) {
return $this->success('操作成功', [], 1, 1);
}
return $this->fail(RechargeLogic::getError());
}
/**
* @notes 充值记录
* @return \think\response\Json
* @author 段誉
* @date 2023/2/24 16:01
*/
public function lists()
{
return $this->dataLists(new RechargeLists());
}
/**
* @notes 退款
* @return \think\response\Json
* @author 段誉
* @date 2023/2/28 17:29
*/
public function refund()
{
$params = (new RechargeRefundValidate())->post()->goCheck('refund');
$result = RechargeLogic::refund($params, $this->adminId);
list($flag, $msg) = $result;
if(false === $flag) {
return $this->fail($msg);
}
return $this->success($msg, [], 1, 1);
}
/**
* @notes 重新退款
* @return \think\response\Json
* @author 段誉
* @date 2023/2/28 19:17
*/
public function refundAgain()
{
$params = (new RechargeRefundValidate())->post()->goCheck('again');
$result = RechargeLogic::refundAgain($params, $this->adminId);
list($flag, $msg) = $result;
if(false === $flag) {
return $this->fail($msg);
}
return $this->success($msg, [], 1, 1);
}
}

View File

@ -0,0 +1,51 @@
<?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\controller\setting;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\logic\setting\CustomerServiceLogic;
/**
* 客服设置
* Class CustomerServiceController
* @package app\adminapi\controller\setting
*/
class CustomerServiceController extends BaseAdminController
{
/**
* @notes 获取客服设置
* @return \think\response\Json
* @author ljj
* @date 2022/2/15 12:05 下午
*/
public function getConfig()
{
$result = CustomerServiceLogic::getConfig();
return $this->data($result);
}
/**
* @notes 设置客服设置
* @return \think\response\Json
* @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

@ -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\controller\setting;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\logic\setting\HotSearchLogic;
/**
* 热门搜索设置
* Class HotSearchController
* @package app\adminapi\controller\setting
*/
class HotSearchController extends BaseAdminController
{
/**
* @notes 获取热门搜索
* @return \think\response\Json
* @author 段誉
* @date 2022/9/5 19:00
*/
public function getConfig()
{
$result = HotSearchLogic::getConfig();
return $this->data($result);
}
/**
* @notes 设置热门搜索
* @return \think\response\Json
* @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

@ -0,0 +1,86 @@
<?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\controller\setting;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\logic\setting\StorageLogic;
use app\adminapi\validate\setting\StorageValidate;
use think\response\Json;
/**
* 存储设置控制器
* Class StorageController
* @package app\adminapi\controller\setting\shop
*/
class StorageController extends BaseAdminController
{
/**
* @notes 获取存储引擎列表
* @return Json
* @author 段誉
* @date 2022/4/20 16:13
*/
public function lists()
{
return $this->success('获取成功', StorageLogic::lists());
}
/**
* @notes 存储配置信息
* @return Json
* @author 段誉
* @date 2022/4/20 16:19
*/
public function detail()
{
$param = (new StorageValidate())->get()->goCheck('detail');
return $this->success('获取成功', StorageLogic::detail($param));
}
/**
* @notes 设置存储参数
* @return Json
* @author 段誉
* @date 2022/4/20 16:19
*/
public function setup()
{
$params = (new StorageValidate())->post()->goCheck('setup');
$result = StorageLogic::setup($params);
if (true === $result) {
return $this->success('配置成功', [], 1, 1);
}
return $this->success($result, [], 1, 1);
}
/**
* @notes 切换存储引擎
* @return Json
* @author 段誉
* @date 2022/4/20 16:19
*/
public function change()
{
$params = (new StorageValidate())->post()->goCheck('change');
StorageLogic::change($params);
return $this->success('切换成功', [], 1, 1);
}
}

View File

@ -0,0 +1,53 @@
<?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\controller\setting;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\logic\setting\TransactionSettingsLogic;
use app\adminapi\validate\setting\TransactionSettingsValidate;
/**
* 交易设置
* Class TransactionSettingsController
* @package app\adminapi\controller\setting
*/
class TransactionSettingsController extends BaseAdminController
{
/**
* @notes 获取交易设置
* @return \think\response\Json
* @author ljj
* @date 2022/2/15 11:40 上午
*/
public function getConfig()
{
$result = TransactionSettingsLogic::getConfig();
return $this->data($result);
}
/**
* @notes 设置交易设置
* @return \think\response\Json
* @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

@ -0,0 +1,99 @@
<?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\controller\setting\dict;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\setting\dict\DictDataLists;
use app\adminapi\logic\setting\dict\DictDataLogic;
use app\adminapi\validate\dict\DictDataValidate;
/**
* 字典数据
* Class DictDataController
* @package app\adminapi\controller\dictionary
*/
class DictDataController extends BaseAdminController
{
/**
* @notes 获取字典数据列表
* @return \think\response\Json
* @author 段誉
* @date 2022/6/20 16:35
*/
public function lists()
{
return $this->dataLists(new DictDataLists());
}
/**
* @notes 添加字典数据
* @return \think\response\Json
* @author 段誉
* @date 2022/6/20 17:13
*/
public function add()
{
$params = (new DictDataValidate())->post()->goCheck('add');
DictDataLogic::save($params);
return $this->success('添加成功', [], 1, 1);
}
/**
* @notes 编辑字典数据
* @return \think\response\Json
* @author 段誉
* @date 2022/6/20 17:13
*/
public function edit()
{
$params = (new DictDataValidate())->post()->goCheck('edit');
DictDataLogic::save($params);
return $this->success('编辑成功', [], 1, 1);
}
/**
* @notes 删除字典数据
* @return \think\response\Json
* @author 段誉
* @date 2022/6/20 17:13
*/
public function delete()
{
$params = (new DictDataValidate())->post()->goCheck('id');
DictDataLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取字典详情
* @return \think\response\Json
* @author 段誉
* @date 2022/6/20 17:14
*/
public function detail()
{
$params = (new DictDataValidate())->goCheck('id');
$result = DictDataLogic::detail($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,116 @@
<?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\controller\setting\dict;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\setting\dict\DictTypeLists;
use app\adminapi\logic\setting\dict\DictTypeLogic;
use app\adminapi\validate\dict\DictTypeValidate;
/**
* 字典类型
* Class DictTypeController
* @package app\adminapi\controller\dict
*/
class DictTypeController extends BaseAdminController
{
/**
* @notes 获取字典类型列表
* @return \think\response\Json
* @author 段誉
* @date 2022/6/20 15:50
*/
public function lists()
{
return $this->dataLists(new DictTypeLists());
}
/**
* @notes 添加字典类型
* @return \think\response\Json
* @author 段誉
* @date 2022/6/20 16:24
*/
public function add()
{
$params = (new DictTypeValidate())->post()->goCheck('add');
DictTypeLogic::add($params);
return $this->success('添加成功', [], 1, 1);
}
/**
* @notes 编辑字典类型
* @return \think\response\Json
* @author 段誉
* @date 2022/6/20 16:25
*/
public function edit()
{
$params = (new DictTypeValidate())->post()->goCheck('edit');
DictTypeLogic::edit($params);
return $this->success('编辑成功', [], 1, 1);
}
/**
* @notes 删除字典类型
* @return \think\response\Json
* @author 段誉
* @date 2022/6/20 16:25
*/
public function delete()
{
$params = (new DictTypeValidate())->post()->goCheck('delete');
DictTypeLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取字典详情
* @return \think\response\Json
* @author 段誉
* @date 2022/6/20 16:25
*/
public function detail()
{
$params = (new DictTypeValidate())->goCheck('detail');
$result = DictTypeLogic::detail($params);
return $this->data($result);
}
/**
* @notes 获取字典类型数据
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2022/10/13 10:46
*/
public function all()
{
$result = DictTypeLogic::getAllData();
return $this->data($result);
}
}

View File

@ -0,0 +1,70 @@
<?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\controller\setting\pay;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\setting\pay\PayConfigLists;
use app\adminapi\logic\setting\pay\PayConfigLogic;
use app\adminapi\validate\setting\PayConfigValidate;
/**
* 支付配置
* Class PayConfigController
* @package app\adminapi\controller\setting\pay
*/
class PayConfigController extends BaseAdminController
{
/**
* @notes 设置支付配置
* @return \think\response\Json
* @author 段誉
* @date 2023/2/23 16:14
*/
public function setConfig()
{
$params = (new PayConfigValidate())->post()->goCheck();
PayConfigLogic::setConfig($params);
return $this->success('设置成功', [], 1, 1);
}
/**
* @notes 获取支付配置
* @return \think\response\Json
* @author 段誉
* @date 2023/2/23 16:14
*/
public function getConfig()
{
$id = (new PayConfigValidate())->goCheck('get');
$result = PayConfigLogic::getConfig($id);
return $this->success('获取成功', $result);
}
/**
* @notes
* @return \think\response\Json
* @author 段誉
* @date 2023/2/23 16:15
*/
public function lists()
{
return $this->dataLists(new PayConfigLists());
}
}

View File

@ -0,0 +1,61 @@
<?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\controller\setting\pay;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\logic\setting\pay\PayWayLogic;
/**
* 支付方式
* Class PayWayController
* @package app\adminapi\controller\setting\pay
*/
class PayWayController extends BaseAdminController
{
/**
* @notes 获取支付方式
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2023/2/23 16:27
*/
public function getPayWay()
{
$result = PayWayLogic::getPayWay();
return $this->success('获取成功',$result);
}
/**
* @notes 设置支付方式
* @return \think\response\Json
* @throws \Exception
* @author 段誉
* @date 2023/2/23 16:27
*/
public function setPayWay()
{
$params = $this->request->post();
$result = (new PayWayLogic())->setPayWay($params);
if (true !== $result) {
return $this->fail($result);
}
return $this->success('操作成功',[],1, 1);
}
}

View File

@ -0,0 +1,39 @@
<?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\controller\setting\system;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\logic\setting\system\CacheLogic;
/**
* 系统缓存
* Class CacheController
* @package app\adminapi\controller\setting\system
*/
class CacheController extends BaseAdminController
{
/**
* @notes 清除系统缓存
* @return \think\response\Json
* @author 段誉
* @date 2022/4/8 16:34
*/
public function clear()
{
CacheLogic::clear();
return $this->success('清除成功', [], 1, 1);
}
}

View File

@ -0,0 +1,38 @@
<?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\controller\setting\system;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\setting\system\LogLists;
/**
* 系统日志
* Class LogController
* @package app\adminapi\controller\setting\system
*/
class LogController extends BaseAdminController
{
/**
* @notes 查看系统日志列表
* @return \think\response\Json
* @author ljj
* @date 2021/8/3 4:25 下午
*/
public function lists()
{
return $this->dataLists(new LogLists());
}
}

View File

@ -0,0 +1,42 @@
<?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\controller\setting\system;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\logic\setting\system\SystemLogic;
/**
* 系统维护
* Class SystemController
* @package app\adminapi\controller\setting\system
*/
class SystemController extends BaseAdminController
{
/**
* @notes 获取系统环境信息
* @return \think\response\Json
* @author 段誉
* @date 2021/12/28 18:36
*/
public function info()
{
$result = SystemLogic::getInfo();
return $this->data($result);
}
}

View File

@ -0,0 +1,84 @@
<?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\controller\setting\user;
use app\adminapi\{
controller\BaseAdminController,
logic\setting\user\UserLogic,
validate\setting\UserConfigValidate
};
/**
* 设置-用户设置控制器
* Class UserController
* @package app\adminapi\controller\config
*/
class UserController extends BaseAdminController
{
/**
* @notes 获取用户设置
* @return \think\response\Json
* @author 段誉
* @date 2022/3/29 10:08
*/
public function getConfig()
{
$result = (new UserLogic())->getConfig();
return $this->data($result);
}
/**
* @notes 设置用户设置
* @return \think\response\Json
* @author 段誉
* @date 2022/3/29 10:08
*/
public function setConfig()
{
$params = (new UserConfigValidate())->post()->goCheck('user');
(new UserLogic())->setConfig($params);
return $this->success('操作成功', [], 1, 1);
}
/**
* @notes 获取注册配置
* @return \think\response\Json
* @author 段誉
* @date 2022/3/29 10:08
*/
public function getRegisterConfig()
{
$result = (new UserLogic())->getRegisterConfig();
return $this->data($result);
}
/**
* @notes 设置注册配置
* @return \think\response\Json
* @author 段誉
* @date 2022/3/29 10:08
*/
public function setRegisterConfig()
{
$params = (new UserConfigValidate())->post()->goCheck('register');
(new UserLogic())->setRegisterConfig($params);
return $this->success('操作成功', [], 1, 1);
}
}

View File

@ -0,0 +1,112 @@
<?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\controller\setting\web;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\logic\setting\web\WebSettingLogic;
use app\adminapi\validate\setting\WebSettingValidate;
/**
* 网站设置
* Class WebSettingController
* @package app\adminapi\controller\setting
*/
class WebSettingController extends BaseAdminController
{
/**
* @notes 获取网站信息
* @return \think\response\Json
* @author 段誉
* @date 2021/12/28 15:44
*/
public function getWebsite()
{
$result = WebSettingLogic::getWebsiteInfo();
return $this->data($result);
}
/**
* @notes 设置网站信息
* @return \think\response\Json
* @author 段誉
* @date 2021/12/28 15:45
*/
public function setWebsite()
{
$params = (new WebSettingValidate())->post()->goCheck('website');
WebSettingLogic::setWebsiteInfo($params);
return $this->success('设置成功', [], 1, 1);
}
/**
* @notes 获取备案信息
* @return \think\response\Json
* @author 段誉
* @date 2021/12/28 16:10
*/
public function getCopyright()
{
$result = WebSettingLogic::getCopyright();
return $this->data($result);
}
/**
* @notes 设置备案信息
* @return \think\response\Json
* @author 段誉
* @date 2021/12/28 16:10
*/
public function setCopyright()
{
$params = $this->request->post();
$result = WebSettingLogic::setCopyright($params);
if (false === $result) {
return $this->fail(WebSettingLogic::getError() ?: '操作失败');
}
return $this->success('设置成功', [], 1, 1);
}
/**
* @notes 设置政策协议
* @return \think\response\Json
* @author ljj
* @date 2022/2/15 11:00 上午
*/
public function setAgreement()
{
$params = $this->request->post();
WebSettingLogic::setAgreement($params);
return $this->success('设置成功', [], 1, 1);
}
/**
* @notes 获取政策协议
* @return \think\response\Json
* @author ljj
* @date 2022/2/15 11:16 上午
*/
public function getAgreement()
{
$result = WebSettingLogic::getAgreement();
return $this->data($result);
}
}

View File

@ -0,0 +1,206 @@
<?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\controller\tools;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\tools\DataTableLists;
use app\adminapi\lists\tools\GenerateTableLists;
use app\adminapi\logic\tools\GeneratorLogic;
use app\adminapi\validate\tools\EditTableValidate;
use app\adminapi\validate\tools\GenerateTableValidate;
/**
* 代码生成器控制器
* Class GeneratorController
* @package app\adminapi\controller\article
*/
class GeneratorController extends BaseAdminController
{
public array $notNeedLogin = ['download'];
/**
* @notes 获取数据库中所有数据表信息
* @return \think\response\Json
* @author 段誉
* @date 2022/6/14 10:57
*/
public function dataTable()
{
return $this->dataLists(new DataTableLists());
}
/**
* @notes 获取已选择的数据表
* @return \think\response\Json
* @author 段誉
* @date 2022/6/14 10:57
*/
public function generateTable()
{
return $this->dataLists(new GenerateTableLists());
}
/**
* @notes 选择数据表
* @return \think\response\Json
* @author 段誉
* @date 2022/6/15 10:09
*/
public function selectTable()
{
$params = (new GenerateTableValidate())->post()->goCheck('select');
$result = GeneratorLogic::selectTable($params, $this->adminId);
if (true === $result) {
return $this->success('操作成功', [], 1, 1);
}
return $this->fail(GeneratorLogic::getError());
}
/**
* @notes 生成代码
* @return \think\response\Json
* @author 段誉
* @date 2022/6/23 19:08
*/
public function generate()
{
$params = (new GenerateTableValidate())->post()->goCheck('id');
$result = GeneratorLogic::generate($params);
if (false === $result) {
return $this->fail(GeneratorLogic::getError());
}
return $this->success('操作成功', $result, 1, 1);
}
/**
* @notes 下载文件
* @return \think\response\File|\think\response\Json
* @author 段誉
* @date 2022/6/24 9:51
*/
public function download()
{
$params = (new GenerateTableValidate())->goCheck('download');
$result = GeneratorLogic::download($params['file']);
if (false === $result) {
return $this->fail(GeneratorLogic::getError() ?: '下载失败');
}
return download($result, 'likeadmin-curd.zip');
}
/**
* @notes 预览代码
* @return \think\response\Json
* @author 段誉
* @date 2022/6/23 19:07
*/
public function preview()
{
$params = (new GenerateTableValidate())->post()->goCheck('id');
$result = GeneratorLogic::preview($params);
if (false === $result) {
return $this->fail(GeneratorLogic::getError());
}
return $this->data($result);
}
/**
* @notes 同步字段
* @return \think\response\Json
* @author 段誉
* @date 2022/6/17 15:22
*/
public function syncColumn()
{
$params = (new GenerateTableValidate())->post()->goCheck('id');
$result = GeneratorLogic::syncColumn($params);
if (true === $result) {
return $this->success('操作成功', [], 1, 1);
}
return $this->fail(GeneratorLogic::getError());
}
/**
* @notes 编辑表信息
* @return \think\response\Json
* @author 段誉
* @date 2022/6/20 10:44
*/
public function edit()
{
$params = (new EditTableValidate())->post()->goCheck();
$result = GeneratorLogic::editTable($params);
if (true === $result) {
return $this->success('操作成功', [], 1, 1);
}
return $this->fail(GeneratorLogic::getError());
}
/**
* @notes 获取已选择的数据表详情
* @return \think\response\Json
* @author 段誉
* @date 2022/6/15 19:00
*/
public function detail()
{
$params = (new GenerateTableValidate())->goCheck('id');
$result = GeneratorLogic::getTableDetail($params);
return $this->success('', $result);
}
/**
* @notes 删除已选择的数据表信息
* @return \think\response\Json
* @author 段誉
* @date 2022/6/15 19:00
*/
public function delete()
{
$params = (new GenerateTableValidate())->post()->goCheck('id');
$result = GeneratorLogic::deleteTable($params);
if (true === $result) {
return $this->success('操作成功', [], 1, 1);
}
return $this->fail(GeneratorLogic::getError());
}
/**
* @notes 获取模型
* @return \think\response\Json
* @author 段誉
* @date 2022/12/14 11:07
*/
public function getModels()
{
$result = GeneratorLogic::getAllModels();
return $this->success('', $result, 1, 1);
}
}

View File

@ -0,0 +1,86 @@
<?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\controller\user;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\user\UserLists;
use app\adminapi\logic\user\UserLogic;
use app\adminapi\validate\user\AdjustUserMoney;
use app\adminapi\validate\user\UserValidate;
/**
* 用户控制器
* Class UserController
* @package app\adminapi\controller\user
*/
class UserController extends BaseAdminController
{
/**
* @notes 用户列表
* @return \think\response\Json
* @author 段誉
* @date 2022/9/22 16:16
*/
public function lists()
{
return $this->dataLists(new UserLists());
}
/**
* @notes 获取用户详情
* @return \think\response\Json
* @author 段誉
* @date 2022/9/22 16:34
*/
public function detail()
{
$params = (new UserValidate())->goCheck('detail');
$detail = UserLogic::detail($params['id']);
return $this->success('', $detail);
}
/**
* @notes 编辑用户信息
* @return \think\response\Json
* @author 段誉
* @date 2022/9/22 16:34
*/
public function edit()
{
$params = (new UserValidate())->post()->goCheck('setInfo');
UserLogic::setUserInfo($params);
return $this->success('操作成功', [], 1, 1);
}
/**
* @notes 调整用户余额
* @return \think\response\Json
* @author 段誉
* @date 2023/2/23 14:33
*/
public function adjustMoney()
{
$params = (new AdjustUserMoney())->post()->goCheck();
$res = UserLogic::adjustUserMoney($params);
if (true === $res) {
return $this->success('操作成功', [], 1, 1);
}
return $this->fail($res);
}
}

23
app/adminapi/event.php Normal file
View File

@ -0,0 +1,23 @@
<?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
// +----------------------------------------------------------------------
return [
'listen' => [
'AppInit' => [],
'HttpRun' => [],
'HttpEnd' => ['app\adminapi\listener\OperationLog'],
'LogLevel' => [],
'LogWrite' => [],
]
];

View File

@ -0,0 +1,89 @@
<?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
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\adminapi\http\middleware;
use app\common\{
cache\AdminAuthCache,
service\JsonService
};
use think\helper\Str;
/**
* 权限验证中间件
* Class AuthMiddleware
* @package app\adminapi\http\middleware
*/
class AuthMiddleware
{
/**
* @notes 权限验证
* @param $request
* @param \Closure $next
* @return mixed
* @author 令狐冲
* @date 2021/7/2 19:29
*/
public function handle($request, \Closure $next)
{
//不登录访问,无需权限验证
if ($request->controllerObject->isNotNeedLogin()) {
return $next($request);
}
//系统默认超级管理员,无需权限验证
if (1 === $request->adminInfo['root']) {
return $next($request);
}
$adminAuthCache = new AdminAuthCache($request->adminInfo['admin_id']);
// 当前访问路径
$accessUri = strtolower($request->controller() . '/' . $request->action());
// 全部路由
$allUri = $this->formatUrl($adminAuthCache->getAllUri());
// 判断该当前访问的uri是否存在不存在无需验证
if (!in_array($accessUri, $allUri)) {
return $next($request);
}
// 当前管理员拥有的路由权限
$AdminUris = $adminAuthCache->getAdminUri() ?? [];
$AdminUris = $this->formatUrl($AdminUris);
if (in_array($accessUri, $AdminUris)) {
return $next($request);
}
return JsonService::fail('权限不足,无法访问或操作');
}
/**
* @notes 格式化URL
* @param array $data
* @return array|string[]
* @author 段誉
* @date 2022/7/7 15:39
*/
public function formatUrl(array $data)
{
return array_map(function ($item) {
return strtolower(Str::camel($item));
}, $data);
}
}

View File

@ -0,0 +1,50 @@
<?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
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\adminapi\http\middleware;
use app\common\service\JsonService;
/**
* 校验演示环境
* Class CheckDemoMiddleware
* @package app\adminapi\http\middleware
*/
class CheckDemoMiddleware
{
// 允许post的接口
protected $ablePost = [
'login/account',
'login/logout',
];
public function handle($request, \Closure $next)
{
if ($request->method() != 'POST') {
return $next($request);
}
$accessUri = strtolower($request->controller() . '/' . $request->action());
if (!in_array($accessUri, $this->ablePost) && env('project.demo_env')) {
return JsonService::fail('演示环境不支持修改数据,请下载源码本地部署体验');
}
return $next($request);
}
}

View File

@ -0,0 +1,114 @@
<?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
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\adminapi\http\middleware;
/**
* 演示环境数据加密
* Class DemoDataMiddleware
* @package app\adminapi\http\middleware
*/
class EncryDemoDataMiddleware
{
// 需要过滤的接口
protected $needCheck = [
// 存储配置
'setting.storage/detail',
// 短信配置
'notice.smsConfig/detail',
// 公众号配置
'channel.official_account_setting/getConfig',
// 小程序配置
'channel.mnp_settings/getConfig',
// 开放平台配置
'channel.open_setting/getConfig',
// 支付配置
'setting.pay.pay_config/getConfig',
];
// 可以排除字段
protected $excludeParams = [
'name',
'icon',
'image',
'qr_code',
'interface_version',
'merchant_type',
];
public function handle($request, \Closure $next)
{
$response = $next($request);
// 非需校验的接口 或者 未开启演示模式
$accessUri = strtolower($request->controller() . '/' . $request->action());
if (!in_array($accessUri, lower_uri($this->needCheck)) || !env('project.demo_env')) {
return $response;
}
// 非json数据
if (!method_exists($response, 'header') || !in_array('application/json; charset=utf-8', $response->getHeader())) {
return $response;
}
$data = $response->getData();
if (!is_array($data) || empty($data)) {
return $response;
}
foreach ($data['data'] as $key => $item) {
// 字符串
if (is_string($item)) {
$data['data'][$key] = $this->getEncryData($key, $item);
continue;
}
// 数组
if (is_array($item)) {
foreach ($item as $itemKey => $itemValue) {
$data['data'][$key][$itemKey] = $this->getEncryData($itemKey, $itemValue);
}
}
}
return $response->data($data);
}
/**
* @notes 加密配置
* @param $key
* @param $value
* @return mixed|string
* @author 段誉
* @date 2023/3/6 11:49
*/
protected function getEncryData($key, $value)
{
// 非隐藏字段
if (in_array($key, $this->excludeParams)) {
return $value;
}
// 隐藏字段
if (is_string($value)) {
return '******';
}
return $value;
}
}

View File

@ -0,0 +1,57 @@
<?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
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\adminapi\http\middleware;
use app\adminapi\controller\BaseAdminController;
use app\common\exception\ControllerExtendException;
use think\exception\ClassNotFoundException;
use think\exception\HttpException;
/**
* 初始化验证中间件
* Class InitMiddleware
* @package app\adminapi\http\middleware
*/
class InitMiddleware
{
/**
* @notes 初始化
* @param $request
* @param \Closure $next
* @return mixed
* @author 令狐冲
* @date 2021/7/2 19:29
*/
public function handle($request, \Closure $next)
{
//获取控制器
try {
$controller = str_replace('.', '\\', $request->controller());
$controller = '\\app\\adminapi\\controller\\' . $controller . 'Controller';
$controllerClass = invoke($controller);
if (($controllerClass instanceof BaseAdminController) === false) {
throw new ControllerExtendException($controller, '404');
}
} catch (ClassNotFoundException $e) {
throw new HttpException(404, 'controller not exists:' . $e->getClass());
}
//创建控制器对象
$request->controllerObject = invoke($controller);
return $next($request);
}
}

View File

@ -0,0 +1,78 @@
<?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
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\adminapi\http\middleware;
use app\common\cache\AdminTokenCache;
use app\adminapi\service\AdminTokenService;
use app\common\service\JsonService;
use think\facade\Config;
/**
* 登录中间件
* Class LoginMiddleware
* @package app\adminapi\http\middleware
*/
class LoginMiddleware
{
/**
* @notes 登录验证
* @param $request
* @param \Closure $next
* @return mixed|\think\response\Json
* @author 令狐冲
* @date 2021/7/1 17:33
*/
public function handle($request, \Closure $next)
{
$token = $request->header('token');
//判断接口是否免登录
$isNotNeedLogin = $request->controllerObject->isNotNeedLogin();
//不直接判断$isNotNeedLogin结果使不需要登录的接口通过为了兼容某些接口可以登录或不登录访问
if (empty($token) && !$isNotNeedLogin) {
//没有token并且该地址需要登录才能访问
return JsonService::fail('请求参数缺token', [], 0, 0);
}
$adminInfo = (new AdminTokenCache())->getAdminInfo($token);
if (empty($adminInfo) && !$isNotNeedLogin) {
//token过期无效并且该地址需要登录才能访问
return JsonService::fail('登录超时,请重新登录', [], -1);
}
//token临近过期自动续期
if ($adminInfo) {
//获取临近过期自动续期时长
$beExpireDuration = Config::get('project.admin_token.be_expire_duration');
//token续期
if (time() > ($adminInfo['expire_time'] - $beExpireDuration)) {
$result = AdminTokenService::overtimeToken($token);
//续期失败(数据表被删除导致)
if (empty($result)) {
return JsonService::fail('登录过期', [], -1);
}
}
}
//给request赋值用于控制器
$request->adminInfo = $adminInfo;
$request->adminId = $adminInfo['admin_id'] ?? 0;
return $next($request);
}
}

View File

@ -0,0 +1,77 @@
<?php
namespace app\adminapi\listener;
use ReflectionClass;
use think\Exception;
class OperationLog
{
/**
* @notes 管理员操作日志
* @param $response
* @return bool|void
* @throws \ReflectionException
* @author 段誉
* @date 2022/4/8 17:09
*/
public function handle($response)
{
$request = request();
//需要登录的接口,无效访问时不记录
if (!$request->controllerObject->isNotNeedLogin() && empty($request->adminInfo)) {
return;
}
//不记录日志操作
if (strtolower(str_replace('.', '\\', $request->controller())) === 'setting\system\log') {
return;
}
//获取操作注解
$notes = '';
try {
$re = new ReflectionClass($request->controllerObject);
$doc = $re->getMethod($request->action())->getDocComment();
if (empty($doc)) {
throw new Exception('请给控制器方法注释');
}
preg_match('/\s(\w+)/u', $re->getMethod($request->action())->getDocComment(), $values);
$notes = $values[0];
} catch (Exception $e) {
$notes = $notes ?: '无法获取操作名称,请给控制器方法注释';
}
$params = $request->param();
//过滤密码参数
if (isset($params['password'])) {
$params['password'] = "******";
}
//过滤密钥参数
if(isset($params['app_secret'])){
$params['app_secret'] = "******";
}
//导出数据操作进行记录
if (isset($params['export']) && $params['export'] == 2) {
$notes .= '-数据导出';
}
//记录日志
$systemLog = new \app\common\model\OperationLog();
$systemLog->admin_id = $request->adminInfo['admin_id'] ?? 0;
$systemLog->admin_name = $request->adminInfo['name'] ?? '';
$systemLog->action = $notes;
$systemLog->account = $request->adminInfo['account'] ?? '';
$systemLog->url = $request->url(true);
$systemLog->type = $request->isGet() ? 'GET' : 'POST';
$systemLog->params = json_encode($params, true);
$systemLog->ip = $request->ip();
$systemLog->result = $response->getContent();
return $systemLog->save();
}
}

View File

@ -0,0 +1,39 @@
<?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\lists;
use app\common\lists\BaseDataLists;
/**
* 管理员模块数据列表基类
* Class BaseAdminDataLists
* @package app\adminapi\lists
*/
abstract class BaseAdminDataLists extends BaseDataLists
{
protected array $adminInfo;
protected int $adminId;
public function __construct()
{
parent::__construct();
$this->adminInfo = $this->request->adminInfo;
$this->adminId = $this->request->adminId;
}
}

View File

@ -0,0 +1,98 @@
<?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\lists\article;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\lists\ListsSearchInterface;
use app\common\lists\ListsSortInterface;
use app\common\model\article\ArticleCate;
/**
* 资讯分类列表
* Class ArticleCateLists
* @package app\adminapi\lists\article
*/
class ArticleCateLists extends BaseAdminDataLists implements ListsSearchInterface, ListsSortInterface
{
/**
* @notes 设置搜索条件
* @return array
* @author heshihu
* @date 2022/2/8 18:39
*/
public function setSearch(): array
{
return [];
}
/**
* @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
{
$ArticleCateLists = ArticleCate::where($this->searchWhere)
->append(['is_show_desc'])
->limit($this->limitOffset, $this->limitLength)
->order($this->sortOrder)
->append(['article_count'])
->select()
->toArray();
return $ArticleCateLists;
}
/**
* @notes 获取数量
* @return int
* @author heshihu
* @date 2022/2/9 15:12
*/
public function count(): int
{
return ArticleCate::where($this->searchWhere)->count();
}
public function extend()
{
return [];
}
}

View File

@ -0,0 +1,99 @@
<?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\lists\article;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\lists\ListsSearchInterface;
use app\common\lists\ListsSortInterface;
use app\common\model\article\Article;
/**
* 资讯列表
* Class ArticleLists
* @package app\adminapi\lists\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

@ -0,0 +1,206 @@
<?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\lists\auth;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\lists\ListsExcelInterface;
use app\common\lists\ListsExtendInterface;
use app\common\lists\ListsSearchInterface;
use app\common\lists\ListsSortInterface;
use app\common\model\auth\Admin;
use app\common\model\auth\AdminRole;
use app\common\model\auth\SystemRole;
use app\common\model\dept\Dept;
use app\common\model\dept\Jobs;
/**
* 管理员列表
* Class AdminLists
* @package app\adminapi\lists\auth
*/
class AdminLists extends BaseAdminDataLists implements ListsExtendInterface, ListsSearchInterface, ListsSortInterface,ListsExcelInterface
{
/**
* @notes 设置导出字段
* @return string[]
* @author 段誉
* @date 2021/12/29 10:08
*/
public function setExcelFields(): array
{
return [
'account' => '账号',
'name' => '名称',
'role_name' => '角色',
'dept_name' => '部门',
'create_time' => '创建时间',
'login_time' => '最近登录时间',
'login_ip' => '最近登录IP',
'disable_desc' => '状态',
];
}
/**
* @notes 设置导出文件名
* @return string
* @author 段誉
* @date 2021/12/29 10:08
*/
public function setFileName(): string
{
return '管理员列表';
}
/**
* @notes 设置搜索条件
* @return \string[][]
* @author 段誉
* @date 2021/12/29 10:07
*/
public function setSearch(): array
{
return [
'%like%' => ['name', 'account'],
];
}
/**
* @notes 设置支持排序字段
* @return string[]
* @author 段誉
* @date 2021/12/29 10:07
* @remark 格式: ['前端传过来的字段名' => '数据库中的字段名'];
*/
public function setSortFields(): array
{
return ['create_time' => 'create_time', 'id' => 'id'];
}
/**
* @notes 设置默认排序
* @return string[]
* @author 段誉
* @date 2021/12/29 10:06
*/
public function setDefaultOrder(): array
{
return ['id' => 'desc'];
}
/**
* @notes 查询条件
* @return array
* @author 段誉
* @date 2022/11/29 11:33
*/
public function queryWhere()
{
$where = [];
if (isset($this->params['role_id']) && $this->params['role_id'] != '') {
$adminIds = AdminRole::where('role_id', $this->params['role_id'])->column('admin_id');
if (!empty($adminIds)) {
$where[] = ['id', 'in', $adminIds];
}
}
return $where;
}
/**
* @notes 获取管理列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2021/12/29 10:05
*/
public function lists(): array
{
$field = [
'id', 'name', 'account', 'create_time', 'disable', 'root',
'login_time', 'login_ip', 'multipoint_login', 'avatar'
];
$adminLists = Admin::field($field)
->where($this->searchWhere)
->where($this->queryWhere())
->limit($this->limitOffset, $this->limitLength)
->order($this->sortOrder)
->append(['role_id', 'dept_id', 'jobs_id', 'disable_desc'])
->select()
->toArray();
// 角色数组('角色id'=>'角色名称')
$roleLists = SystemRole::column('name', 'id');
// 部门列表
$deptLists = Dept::column('name', 'id');
// 岗位列表
$jobsLists = Jobs::column('name', 'id');
//管理员列表增加角色名称
foreach ($adminLists as $k => $v) {
$roleName = '';
if ($v['root'] == 1) {
$roleName = '系统管理员';
} else {
foreach ($v['role_id'] as $roleId) {
$roleName .= $roleLists[$roleId] ?? '';
$roleName .= '/';
}
}
$deptName = '';
foreach ($v['dept_id'] as $deptId) {
$deptName .= $deptLists[$deptId] ?? '';
$deptName .= '/';
}
$jobsName = '';
foreach ($v['jobs_id'] as $jobsId) {
$jobsName .= $jobsLists[$jobsId] ?? '';
$jobsName .= '/';
}
$adminLists[$k]['role_name'] = trim($roleName, '/');
$adminLists[$k]['dept_name'] = trim($deptName, '/');
$adminLists[$k]['jobs_name'] = trim($jobsName, '/');
}
return $adminLists;
}
/**
* @notes 获取数量
* @return int
* @author 令狐冲
* @date 2021/7/13 00:52
*/
public function count(): int
{
return Admin::where($this->searchWhere)
->where($this->queryWhere())
->count();
}
public function extend()
{
return [];
}
}

View File

@ -0,0 +1,58 @@
<?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\lists\auth;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\auth\SystemMenu;
/**
* 菜单列表
* Class MenuLists
* @package app\adminapi\lists\auth
*/
class MenuLists extends BaseAdminDataLists
{
/**
* @notes 获取菜单列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2022/6/29 16:41
*/
public function lists(): array
{
$lists = SystemMenu::order(['sort' => 'desc', 'id' => 'asc'])
->select()
->toArray();
return linear_to_tree($lists, 'children');
}
/**
* @notes 获取菜单数量
* @return int
* @author 段誉
* @date 2022/6/29 16:41
*/
public function count(): int
{
return SystemMenu::count();
}
}

View File

@ -0,0 +1,93 @@
<?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\lists\auth;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\auth\AdminRole;
use app\common\model\auth\SystemRole;
/**
* 角色列表
* Class RoleLists
* @package app\adminapi\lists\auth
*/
class RoleLists extends BaseAdminDataLists
{
/**
* @notes 导出字段
* @return string[]
* @author Tab
* @date 2021/9/22 18:52
*/
public function setExcelFields(): array
{
return [
'name' => '角色名称',
'desc' => '备注',
'create_time' => '创建时间'
];
}
/**
* @notes 导出表名
* @return string
* @author Tab
* @date 2021/9/22 18:52
*/
public function setFileName(): string
{
return '角色表';
}
/**
* @notes 角色列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author cjhao
* @date 2021/8/25 18:00
*/
public function lists(): array
{
$lists = SystemRole::with(['role_menu_index'])
->field('id,name,desc,sort,create_time')
->limit($this->limitOffset, $this->limitLength)
->order(['sort' => 'desc', 'id' => 'desc'])
->select()
->toArray();
foreach ($lists as $key => $role) {
//使用角色的人数
$lists[$key]['num'] = AdminRole::where('role_id', $role['id'])->count();
$menuId = array_column($role['role_menu_index'], 'menu_id');
$lists[$key]['menu_id'] = $menuId;
unset($lists[$key]['role_menu_index']);
}
return $lists;
}
/**
* @notes 总记录数
* @return int
* @author Tab
* @date 2021/7/13 11:26
*/
public function count(): int
{
return SystemRole::count();
}
}

View File

@ -0,0 +1,80 @@
<?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\lists\channel;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\lists\ListsSearchInterface;
use app\common\model\channel\OfficialAccountReply;
/**
* 微信公众号回复列表
* Class OfficialAccountLists
* @package app\adminapi\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

@ -0,0 +1,61 @@
<?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\lists\crontab;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\Crontab;
/**
* 定时任务列表
* Class CrontabLists
* @package app\adminapi\lists\crontab
*/
class CrontabLists extends BaseAdminDataLists
{
/**
* @notes 定时任务列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2022/3/29 14:30
*/
public function lists(): array
{
$field = 'id,name,type,type as type_desc,command,params,expression,
status,status as status_desc,error,last_time,time,max_time';
$lists = Crontab::field($field)
->limit($this->limitOffset, $this->limitLength)
->order('id', 'desc')
->select()
->toArray();
return $lists;
}
/**
* @notes 定时任务数量
* @return int
* @author 段誉
* @date 2022/3/29 14:38
*/
public function count(): int
{
return Crontab::count();
}
}

View File

@ -0,0 +1,64 @@
<?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\lists\decorate;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\enum\MenuEnum;
use app\common\model\decorate\Menu;
/**
* 菜单列表
* Class MenuLists
* @package app\adminapi\lists\decorate
*/
class MenuLists extends BaseAdminDataLists
{
/**
* @notes 菜单列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author ljj
* @date 2022/2/14 11:29 上午
*/
public function lists(): array
{
$lists = (new Menu())->field('id,name,image,link_type,link_address,sort,status')
->order(['sort'=>'asc','id'=>'desc'])
->append(['link_address_desc','status_desc'])
->limit($this->limitOffset, $this->limitLength)
->select()
->toArray();
foreach ($lists as &$list) {
$list['link_address_desc'] = MenuEnum::getLinkDesc($list['link_type']).':'.$list['link_address_desc'];
}
return $lists;
}
/**
* @notes 菜单总数
* @return int
* @author ljj
* @date 2022/2/14 11:29 上午
*/
public function count(): int
{
return (new Menu())->count();
}
}

View File

@ -0,0 +1,52 @@
<?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\lists\decorate;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\decorate\Navigation;
/**
* 底部导航列表
* Class NavigationLists
* @package app\adminapi\lists\decorate
*/
class NavigationLists extends BaseAdminDataLists
{
/**
* @notes 底部导航列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author ljj
* @date 2022/2/14 10:12 上午
*/
public function lists(): array
{
return (new Navigation())->select()->toArray();
}
/**
* @notes 底部导航总数
* @return int
* @author ljj
* @date 2022/2/14 10:13 上午
*/
public function count(): int
{
return (new Navigation())->count();
}
}

View File

@ -0,0 +1,105 @@
<?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\lists\dept;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\lists\ListsExcelInterface;
use app\common\lists\ListsSearchInterface;
use app\common\model\dept\Jobs;
/**
* 岗位列表
* Class JobsLists
* @package app\adminapi\lists\dept
*/
class JobsLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author 段誉
* @date 2022/5/26 9:46
*/
public function setSearch(): array
{
return [
'%like%' => ['name'],
'=' => ['code', 'status']
];
}
/**
* @notes 获取管理列表
* @return array
* @author heshihu
* @date 2022/2/21 17:11
*/
public function lists(): array
{
$lists = Jobs::where($this->searchWhere)
->append(['status_desc'])
->limit($this->limitOffset, $this->limitLength)
->order(['sort' => 'desc', 'id' => 'desc'])
->select()
->toArray();
return $lists;
}
/**
* @notes 获取数量
* @return int
* @author 段誉
* @date 2022/5/26 9:48
*/
public function count(): int
{
return Jobs::where($this->searchWhere)->count();
}
/**
* @notes 导出文件名
* @return string
* @author 段誉
* @date 2022/11/24 16:17
*/
public function setFileName(): string
{
return '岗位列表';
}
/**
* @notes 导出字段
* @return string[]
* @author 段誉
* @date 2022/11/24 16:17
*/
public function setExcelFields(): array
{
return [
'code' => '岗位编码',
'name' => '岗位名称',
'remark' => '备注',
'status_desc' => '状态',
'create_time' => '添加时间',
];
}
}

View File

@ -0,0 +1,73 @@
<?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\lists\file;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\lists\ListsSearchInterface;
use app\common\model\file\FileCate;
/**
* 文件分类列表
* Class FileCateLists
* @package app\adminapi\lists\file
*/
class FileCateLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 文件分类搜素条件
* @return \string[][]
* @author 段誉
* @date 2021/12/29 14:24
*/
public function setSearch(): array
{
return [
'=' => ['type']
];
}
/**
* @notes 获取文件分类列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2021/12/29 14:24
*/
public function lists(): array
{
$lists = (new FileCate())->field(['id,pid,type,name'])
->where($this->searchWhere)
->select()->toArray();
return linear_to_tree($lists, 'children');
}
/**
* @notes 获取文件分类数量
* @return int
* @author 段誉
* @date 2021/12/29 14:24
*/
public function count(): int
{
return (new FileCate())->where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,86 @@
<?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\lists\file;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\enum\FileEnum;
use app\common\lists\ListsSearchInterface;
use app\common\model\file\File;
use app\common\service\FileService;
/**
* 文件列表
* Class FileLists
* @package app\adminapi\lists\file
*/
class FileLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 文件搜索条件
* @return \string[][]
* @author 段誉
* @date 2021/12/29 14:27
*/
public function setSearch(): array
{
return [
'=' => ['type', 'cid'],
'%like%' => ['name']
];
}
/**
* @notes 获取文件列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2021/12/29 14:27
*/
public function lists(): array
{
$lists = (new File())->field(['id,cid,type,name,uri,create_time'])
->order('id', 'desc')
->where($this->searchWhere)
->where('source', FileEnum::SOURCE_ADMIN)
->limit($this->limitOffset, $this->limitLength)
->select()
->toArray();
foreach ($lists as &$item) {
$item['url'] = $item['uri'];
$item['uri'] = FileService::getFileUrl($item['uri']);
}
return $lists;
}
/**
* @notes 获取文件数量
* @return int
* @author 段誉
* @date 2021/12/29 14:29
*/
public function count(): int
{
return (new File())->where($this->searchWhere)
->where('source', FileEnum::SOURCE_ADMIN)
->count();
}
}

View File

@ -0,0 +1,119 @@
<?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\lists\finance;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\enum\user\AccountLogEnum;
use app\common\lists\ListsSearchInterface;
use app\common\model\user\UserAccountLog;
use app\common\service\FileService;
/**
* 账记流水列表
* Class AccountLogLists
* @package app\adminapi\lists\finance
*/
class AccountLogLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 搜索条件
* @return array
* @author 段誉
* @date 2023/2/24 15:26
*/
public function setSearch(): array
{
return [
'=' => ['al.change_type'],
];
}
/**
* @notes 搜索条件
* @author 段誉
* @date 2023/2/24 15:26
*/
public function queryWhere()
{
$where = [];
// 用户余额
if (isset($this->params['type']) && $this->params['type'] == 'um') {
$where[] = ['change_type', 'in', AccountLogEnum::getUserMoneyChangeType()];
}
if (!empty($this->params['user_info'])) {
$where[] = ['u.sn|u.nickname|u.mobile', 'like', '%' . $this->params['user_info'] . '%'];
}
if (!empty($this->params['start_time'])) {
$where[] = ['al.create_time', '>=', strtotime($this->params['start_time'])];
}
if (!empty($this->params['end_time'])) {
$where[] = ['al.create_time', '<=', strtotime($this->params['end_time'])];
}
return $where;
}
/**
* @notes 获取列表
* @return array
* @author 段誉
* @date 2023/2/24 15:31
*/
public function lists(): array
{
$field = 'u.nickname,u.sn,u.avatar,u.mobile,al.action,al.change_amount,al.left_amount,al.change_type,al.source_sn,al.create_time';
$lists = UserAccountLog::alias('al')
->join('user u', 'u.id = al.user_id')
->field($field)
->where($this->searchWhere)
->where($this->queryWhere())
->order('al.id', 'desc')
->limit($this->limitOffset, $this->limitLength)
->select()
->toArray();
foreach ($lists as &$item) {
$item['avatar'] = FileService::getFileUrl($item['avatar']);
$item['change_type_desc'] = AccountLogEnum::getChangeTypeDesc($item['change_type']);
$symbol = $item['action'] == AccountLogEnum::INC ? '+' : '-';
$item['change_amount'] = $symbol . $item['change_amount'];
}
return $lists;
}
/**
* @notes 获取数量
* @return int
* @author 段誉
* @date 2023/2/24 15:36
*/
public function count(): int
{
return UserAccountLog::alias('al')
->join('user u', 'u.id = al.user_id')
->where($this->queryWhere())
->where($this->searchWhere)
->count();
}
}

View File

@ -0,0 +1,79 @@
<?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\lists\finance;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\refund\RefundLog;
/**
* 退款日志列表
* Class RefundLogLists
* @package app\adminapi\lists\product
*/
class RefundLogLists extends BaseAdminDataLists
{
/**
* @notes 查询条件
* @return array
* @author 段誉
* @date 2023/3/1 9:55
*/
public function queryWhere()
{
$where[] = ['record_id', '=', $this->params['record_id'] ?? 0];
return $where;
}
/**
* @notes 获取列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2023/3/1 9:56
*/
public function lists(): array
{
$lists = (new RefundLog())
->order(['id' => 'desc'])
->where($this->queryWhere())
->limit($this->limitOffset, $this->limitLength)
->hidden(['refund_msg'])
->append(['handler', 'refund_status_text'])
->select()
->toArray();
return $lists;
}
/**
* @notes 获取数量
* @return int
* @author 段誉
* @date 2023/3/1 9:56
*/
public function count(): int
{
return (new RefundLog())
->where($this->queryWhere())
->count();
}
}

View File

@ -0,0 +1,143 @@
<?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\lists\finance;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\enum\RefundEnum;
use app\common\lists\ListsExtendInterface;
use app\common\lists\ListsSearchInterface;
use app\common\model\refund\RefundRecord;
use app\common\service\FileService;
/**
* 退款记录列表
* Class RefundRecordLists
* @package app\adminapi\lists\product
*/
class RefundRecordLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExtendInterface
{
/**
* @notes 查询条件
* @return \string[][]
* @author 段誉
* @date 2023/3/1 9:51
*/
public function setSearch(): array
{
return [
'=' => ['r.sn', 'r.order_sn', 'r.refund_type'],
];
}
/**
* @notes 查询条件
* @param bool $flag
* @return array
* @author 段誉
* @date 2023/3/1 9:51
*/
public function queryWhere($flag = true)
{
$where = [];
if (!empty($this->params['user_info'])) {
$where[] = ['u.sn|u.nickname|u.mobile', 'like', '%' . $this->params['user_info'] . '%'];
}
if (!empty($this->params['start_time'])) {
$where[] = ['r.create_time', '>=', strtotime($this->params['start_time'])];
}
if (!empty($this->params['end_time'])) {
$where[] = ['r.create_time', '<=', strtotime($this->params['end_time'])];
}
if ($flag == true) {
if (isset($this->params['refund_status']) && $this->params['refund_status'] != '') {
$where[] = ['r.refund_status', '=', $this->params['refund_status']];
}
}
return $where;
}
/**
* @notes 获取列表
* @return array
* @author 段誉
* @date 2023/3/1 9:51
*/
public function lists(): array
{
$lists = (new RefundRecord())->alias('r')
->field('r.*,u.nickname,u.avatar')
->join('user u', 'u.id = r.user_id')
->order(['r.id' => 'desc'])
->where($this->searchWhere)
->where($this->queryWhere())
->limit($this->limitOffset, $this->limitLength)
->append(['refund_type_text', 'refund_status_text', 'refund_way_text'])
->select()
->toArray();
foreach ($lists as &$item) {
$item['avatar'] = FileService::getFileUrl($item['avatar']);
}
return $lists;
}
/**
* @notes 获取数量
* @return int
* @author 段誉
* @date 2023/3/1 9:51
*/
public function count(): int
{
return (new RefundRecord())->alias('r')
->join('user u', 'u.id = r.user_id')
->where($this->searchWhere)
->where($this->queryWhere())
->count();
}
/**
* @notes 额外参数
* @return mixed|null
* @author 段誉
* @date 2023/3/1 9:51
*/
public function extend()
{
$count = (new RefundRecord())->alias('r')
->join('user u', 'u.id = r.user_id')
->field([
'count(r.id) as total',
'count(if(r.refund_status='.RefundEnum::REFUND_ING.', true, null)) as ing',
'count(if(r.refund_status='.RefundEnum::REFUND_SUCCESS.', true, null)) as success',
'count(if(r.refund_status='.RefundEnum::REFUND_ERROR.', true, null)) as error',
])
->where($this->searchWhere)
->where($this->queryWhere(false))
->select()->toArray();
return array_shift($count);
}
}

View File

@ -0,0 +1,71 @@
<?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\lists\notice;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\lists\ListsSearchInterface;
use app\common\model\notice\NoticeSetting;
/**
* 通知设置
* Class NoticeSettingLists
* @package app\adminapi\lists\notice
*/
class NoticeSettingLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 搜索条件
* @return \string[][]
* @author ljj
* @date 2022/2/17 2:21 下午
*/
public function setSearch(): array
{
return [
'=' => ['recipient', 'type']
];
}
/**
* @notes 通知设置列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author ljj
* @date 2022/2/16 3:18 下午
*/
public function lists(): array
{
$lists = (new NoticeSetting())->field('id,scene_name,sms_notice,type')
->append(['sms_status_desc','type_desc'])
->where($this->searchWhere)
->select()
->toArray();
return $lists;
}
/**
* @notes 通知设置数量
* @return int
* @author ljj
* @date 2022/2/16 3:18 下午
*/
public function count(): int
{
return (new NoticeSetting())->where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,145 @@
<?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\lists\recharge;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\lists\ListsExcelInterface;
use app\common\lists\ListsSearchInterface;
use app\common\model\recharge\RechargeOrder;
use app\common\service\FileService;
/**
* 充值记录列表
* Class RecharLists
* @package app\adminapi\lists
*/
class RechargeLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
{
/**
* @notes 导出字段
* @return string[]
* @author 段誉
* @date 2023/2/24 16:07
*/
public function setExcelFields(): array
{
return [
'sn' => '充值单号',
'nickname' => '用户昵称',
'order_amount' => '充值金额',
'pay_way' => '支付方式',
'pay_status' => '支付状态',
'pay_time' => '支付时间',
'create_time' => '下单时间',
];
}
/**
* @notes 导出表名
* @return string
* @author 段誉
* @date 2023/2/24 16:07
*/
public function setFileName(): string
{
return '充值记录';
}
/**
* @notes 搜索条件
* @return \string[][]
* @author 段誉
* @date 2023/2/24 16:08
*/
public function setSearch(): array
{
return [
'=' => ['ro.sn', 'ro.pay_way', 'ro.pay_status'],
];
}
/**
* @notes 搜索条件
* @author 段誉
* @date 2023/2/24 16:08
*/
public function queryWhere()
{
$where = [];
// 用户编号
if (!empty($this->params['user_info'])) {
$where[] = ['u.sn|u.nickname|u.mobile', 'like', '%' . $this->params['user_info'] . '%'];
}
// 下单时间
if (!empty($this->params['start_time']) && !empty($this->params['end_time'])) {
$time = [strtotime($this->params['start_time']), strtotime($this->params['end_time'])];
$where[] = ['ro.create_time', 'between', $time];
}
return $where;
}
/**
* @notes 获取列表
* @return array
* @author 段誉
* @date 2023/2/24 16:13
*/
public function lists(): array
{
$field = 'ro.id,ro.sn,ro.order_amount,ro.pay_way,ro.pay_time,ro.pay_status,ro.create_time,ro.refund_status';
$field .= ',u.avatar,u.nickname';
$lists = RechargeOrder::alias('ro')
->join('user u', 'u.id = ro.user_id')
->field($field)
->where($this->queryWhere())
->where($this->searchWhere)
->order('ro.id', 'desc')
->limit($this->limitOffset, $this->limitLength)
->append(['pay_status_text', 'pay_way_text'])
->select()
->toArray();
foreach ($lists as &$item) {
$item['avatar'] = FileService::getFileUrl($item['avatar']);
$item['pay_time'] = empty($item['pay_time']) ? '' : date('Y-m-d H:i:s', $item['pay_time']);
}
return $lists;
}
/**
* @notes 获取数量
* @return int
* @author 段誉
* @date 2023/2/24 16:13
*/
public function count(): int
{
return RechargeOrder::alias('ro')
->join('user u', 'u.id = ro.user_id')
->where($this->queryWhere())
->where($this->searchWhere)
->count();
}
}

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\lists\setting\dict;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\lists\ListsSearchInterface;
use app\common\model\dict\DictData;
/**
* 字典数据列表
* Class DictDataLists
* @package app\adminapi\lists\dict
*/
class DictDataLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author 段誉
* @date 2022/6/20 16:29
*/
public function setSearch(): array
{
return [
'%like%' => ['name', 'type_value'],
'=' => ['status', 'type_id']
];
}
/**
* @notes 获取列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2022/6/20 16:35
*/
public function lists(): array
{
return DictData::where($this->searchWhere)
->append(['status_desc'])
->limit($this->limitOffset, $this->limitLength)
->order(['sort' => 'desc', 'id' => 'desc'])
->select()
->toArray();
}
/**
* @notes 获取数量
* @return int
* @author 段誉
* @date 2022/6/20 16:35
*/
public function count(): int
{
return DictData::where($this->searchWhere)->count();
}
}

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\lists\setting\dict;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\lists\ListsSearchInterface;
use app\common\model\dict\DictType;
/**
* 字典类型列表
* Class DictTypeLists
* @package app\adminapi\lists\dictionary
*/
class DictTypeLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author 段誉
* @date 2022/6/20 15:53
*/
public function setSearch(): array
{
return [
'%like%' => ['name', 'type'],
'=' => ['status']
];
}
/**
* @notes 获取列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2022/6/20 15:54
*/
public function lists(): array
{
return DictType::where($this->searchWhere)
->limit($this->limitOffset, $this->limitLength)
->append(['status_desc'])
->order(['id' => 'desc'])
->select()
->toArray();
}
/**
* @notes 获取数量
* @return int
* @author 段誉
* @date 2022/6/20 15:54
*/
public function count(): int
{
return DictType::where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,62 @@
<?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\lists\setting\pay;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\pay\PayConfig;
/**
* 支付配置列表
* Class PayConfigLists
* @package app\adminapi\lists\setting\pay
*/
class PayConfigLists extends BaseAdminDataLists
{
/**
* @notes 获取列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2023/2/23 16:15
*/
public function lists(): array
{
$lists = PayConfig::field('id,name,pay_way,icon,sort')
->append(['pay_way_name'])
->order('sort','asc')
->select()
->toArray();
return $lists;
}
/**
* @notes 获取数量
* @return int
* @author 段誉
* @date 2023/2/23 16:15
*/
public function count(): int
{
return PayConfig::count();
}
}

View File

@ -0,0 +1,108 @@
<?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\lists\setting\system;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\lists\ListsExcelInterface;
use app\common\lists\ListsSearchInterface;
use app\common\model\OperationLog;
/**
* 日志列表
* Class LogLists
* @package app\adminapi\lists\setting\system
*/
class LogLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author ljj
* @date 2021/8/3 4:21 下午
*/
public function setSearch(): array
{
return [
'%like%' => ['admin_name','url','ip','type'],
'between_time' => 'create_time',
];
}
/**
* @notes 查看系统日志列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author ljj
* @date 2021/8/3 4:21 下午
*/
public function lists(): array
{
$lists = OperationLog::field('id,action,admin_name,admin_id,url,type,params,ip,create_time')
->where($this->searchWhere)
->limit($this->limitOffset, $this->limitLength)
->order('id','desc')
->select()
->toArray();
return $lists;
}
/**
* @notes 查看系统日志总数
* @return int
* @author ljj
* @date 2021/8/3 4:23 下午
*/
public function count(): int
{
return OperationLog::where($this->searchWhere)->count();
}
/**
* @notes 设置导出字段
* @return string[]
* @author ljj
* @date 2021/8/3 4:48 下午
*/
public function setExcelFields(): array
{
return [
// '数据库字段名(支持别名) => 'Excel表字段名'
'id' => '记录ID',
'action' => '操作',
'admin_name' => '管理员',
'admin_id' => '管理员ID',
'url' => '访问链接',
'type' => '访问方式',
'params' => '访问参数',
'ip' => '来源IP',
'create_time' => '日志时间',
];
}
/**
* @notes 设置默认表名
* @return string
* @author ljj
* @date 2021/8/3 4:48 下午
*/
public function setFileName(): string
{
return '系统日志';
}
}

View File

@ -0,0 +1,74 @@
<?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\lists\tools;
use app\adminapi\lists\BaseAdminDataLists;
use think\facade\Db;
/**
* 数据表列表
* Class GeneratorLists
* @package app\adminapi\lists\tools
*/
class DataTableLists extends BaseAdminDataLists
{
/**
* @notes 查询结果
* @return mixed
* @author 段誉
* @date 2022/6/13 18:54
*/
public function queryResult()
{
$sql = 'SHOW TABLE STATUS WHERE 1=1 ';
if (!empty($this->params['name'])) {
$sql .= "AND name LIKE '%" . $this->params['name'] . "%'";
}
if (!empty($this->params['comment'])) {
$sql .= "AND comment LIKE '%" . $this->params['comment'] . "%'";
}
return Db::query($sql);
}
/**
* @notes 处理列表
* @return array
* @author 段誉
* @date 2022/6/13 18:54
*/
public function lists(): array
{
$lists = array_map("array_change_key_case", $this->queryResult());
$offset = max(0, ($this->pageNo - 1) * $this->pageSize);
$lists = array_slice($lists, $offset, $this->pageSize, true);
return array_values($lists);
}
/**
* @notes 获取数量
* @return int
* @author 段誉
* @date 2022/6/13 18:54
*/
public function count(): int
{
return count($this->queryResult());
}
}

View File

@ -0,0 +1,75 @@
<?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\lists\tools;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\lists\ListsSearchInterface;
use app\common\model\tools\GenerateTable;
/**
* 代码生成所选数据表列表
* Class GenerateTableLists
* @package app\adminapi\lists\tools
*/
class GenerateTableLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author 段誉
* @date 2022/6/14 10:55
*/
public function setSearch(): array
{
return [
'%like%' => ['table_name', 'table_comment']
];
}
/**
* @notes 查询列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2022/6/14 10:55
*/
public function lists(): array
{
return GenerateTable::where($this->searchWhere)
->order(['id' => 'desc'])
->append(['template_type_desc'])
->limit($this->limitOffset, $this->limitLength)
->select()
->toArray();
}
/**
* @notes 获取数量
* @return int
* @author 段誉
* @date 2022/6/14 10:55
*/
public function count(): int
{
return GenerateTable::count();
}
}

View File

@ -0,0 +1,111 @@
<?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\lists\user;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\enum\user\UserTerminalEnum;
use app\common\lists\ListsExcelInterface;
use app\common\model\user\User;
/**
* 用户列表
* Class UserLists
* @package app\adminapi\lists\user
*/
class UserLists extends BaseAdminDataLists implements ListsExcelInterface
{
/**
* @notes 搜索条件
* @return array
* @author 段誉
* @date 2022/9/22 15:50
*/
public function setSearch(): array
{
$allowSearch = ['keyword', 'channel', 'create_time_start', 'create_time_end'];
return array_intersect(array_keys($this->params), $allowSearch);
}
/**
* @notes 获取用户列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2022/9/22 15:50
*/
public function lists(): array
{
$field = "id,sn,nickname,sex,avatar,account,mobile,channel,create_time";
$lists = User::withSearch($this->setSearch(), $this->params)
->limit($this->limitOffset, $this->limitLength)
->field($field)
->order('id desc')
->select()->toArray();
foreach ($lists as &$item) {
$item['channel'] = UserTerminalEnum::getTermInalDesc($item['channel']);
}
return $lists;
}
/**
* @notes 获取数量
* @return int
* @author 段誉
* @date 2022/9/22 15:51
*/
public function count(): int
{
return User::withSearch($this->setSearch(), $this->params)->count();
}
/**
* @notes 导出文件名
* @return string
* @author 段誉
* @date 2022/11/24 16:17
*/
public function setFileName(): string
{
return '用户列表';
}
/**
* @notes 导出字段
* @return string[]
* @author 段誉
* @date 2022/11/24 16:17
*/
public function setExcelFields(): array
{
return [
'sn' => '用户编号',
'nickname' => '用户昵称',
'account' => '账号',
'mobile' => '手机号码',
'channel' => '注册来源',
'create_time' => '注册时间',
];
}
}

View File

@ -0,0 +1,104 @@
<?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;
use app\adminapi\logic\article\ArticleCateLogic;
use app\adminapi\logic\auth\MenuLogic;
use app\adminapi\logic\auth\RoleLogic;
use app\adminapi\logic\dept\DeptLogic;
use app\adminapi\logic\dept\JobsLogic;
use app\adminapi\logic\setting\dict\DictTypeLogic;
use app\common\enum\YesNoEnum;
use app\common\model\article\ArticleCate;
use app\common\model\auth\SystemMenu;
use app\common\model\auth\SystemRole;
use app\common\model\dept\Dept;
use app\common\model\dept\Jobs;
use app\common\model\dict\DictData;
use app\common\model\dict\DictType;
use app\common\service\{FileService, ConfigService};
/**
* 配置类逻辑层
* Class ConfigLogic
* @package app\adminapi\logic
*/
class ConfigLogic
{
/**
* @notes 获取配置
* @return array
* @author 段誉
* @date 2021/12/31 11:03
*/
public static function getConfig(): array
{
$config = [
// 文件域名
'oss_domain' => FileService::getFileUrl(),
// 网站名称
'web_name' => ConfigService::get('website', 'name'),
// 网站图标
'web_favicon' => FileService::getFileUrl(ConfigService::get('website', 'web_favicon')),
// 网站logo
'web_logo' => FileService::getFileUrl(ConfigService::get('website', 'web_logo')),
// 登录页
'login_image' => FileService::getFileUrl(ConfigService::get('website', 'login_image')),
// 版权信息
'copyright_config' => ConfigService::get('copyright', 'config', []),
];
return $config;
}
/**
* @notes 根据类型获取字典类型
* @param $type
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2022/9/27 19:09
*/
public static function getDictByType($type)
{
if (!is_string($type)) {
return [];
}
$type = explode(',', $type);
$lists = DictData::whereIn('type_value', $type)->select()->toArray();
if (empty($lists)) {
return [];
}
$result = [];
foreach ($type as $item) {
foreach ($lists as $dict) {
if ($dict['type_value'] == $item) {
$result[$item][] = $dict;
}
}
}
return $result;
}
}

View File

@ -0,0 +1,119 @@
<?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;
use app\common\logic\BaseLogic;
use app\common\model\file\File;
use app\common\model\file\FileCate;
use app\common\service\ConfigService;
use app\common\service\storage\Driver as StorageDriver;
/**
* 文件逻辑层
* Class FileLogic
* @package app\adminapi\logic
*/
class FileLogic extends BaseLogic
{
/**
* @notes 移动文件
* @param $params
* @author 张无忌
* @date 2021/7/28 15:29
*/
public static function move($params)
{
(new File())->whereIn('id', $params['ids'])
->update([
'cid' => $params['cid'],
'update_time' => time()
]);
}
/**
* @notes 重命名文件
* @param $params
* @author 张无忌
* @date 2021/7/29 17:16
*/
public static function rename($params)
{
(new File())->where('id', $params['id'])
->update([
'name' => $params['name'],
'update_time' => time()
]);
}
/**
* @notes 批量删除文件
* @param $params
* @author 张无忌
* @date 2021/7/28 15:41
*/
public static function delete($params)
{
$result = File::whereIn('id', $params['ids'])->select();
$StorageDriver = new StorageDriver([
'default' => ConfigService::get('storage', 'default', 'local'),
'engine' => ConfigService::get('storage') ?? ['local'=>[]],
]);
foreach ($result as $item) {
$StorageDriver->delete($item['uri']);
}
File::destroy($params['ids']);
}
/**
* @notes 添加文件分类
* @param $params
* @author 张无忌
* @date 2021/7/28 11:32
*/
public static function addCate($params)
{
FileCate::create([
'type' => $params['type'],
'pid' => $params['pid'],
'name' => $params['name']
]);
}
/**
* @notes 编辑文件分类
* @param $params
* @author 张无忌
* @date 2021/7/28 14:03
*/
public static function editCate($params)
{
FileCate::update([
'name' => $params['name'],
'update_time' => time()
], ['id' => $params['id']]);
}
/**
* @notes 删除文件分类
* @param $params
* @author 张无忌
* @date 2021/7/28 14:21
*/
public static function delCate($params)
{
FileCate::destroy($params['id']);
}
}

View File

@ -0,0 +1,84 @@
<?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;
use app\common\logic\BaseLogic;
use app\common\model\auth\Admin;
use app\adminapi\service\AdminTokenService;
use app\common\service\FileService;
use think\facade\Config;
/**
* 登录逻辑
* Class LoginLogic
* @package app\adminapi\logic
*/
class LoginLogic extends BaseLogic
{
/**
* @notes 管理员账号登录
* @param $params
* @return false|mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 令狐冲
* @date 2021/6/30 17:00
*/
public function login($params)
{
$time = time();
$admin = Admin::where('account', '=', $params['account'])->find();
//用户表登录信息更新
$admin->login_time = $time;
$admin->login_ip = request()->ip();
$admin->save();
//设置token
$adminInfo = AdminTokenService::setToken($admin->id, $params['terminal'], $admin->multipoint_login);
//返回登录信息
$avatar = $admin->avatar ? $admin->avatar : Config::get('project.default_image.admin_avatar');
$avatar = FileService::getFileUrl($avatar);
return [
'name' => $adminInfo['name'],
'avatar' => $avatar,
'role_name' => $adminInfo['role_name'],
'token' => $adminInfo['token'],
];
}
/**
* @notes 退出登录
* @param $adminInfo
* @return bool
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 令狐冲
* @date 2021/7/5 14:34
*/
public function logout($adminInfo)
{
//token不存在不注销
if (!isset($adminInfo['token'])) {
return false;
}
//设置token过期
return AdminTokenService::expireToken($adminInfo['token']);
}
}

View File

@ -0,0 +1,208 @@
<?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;
use app\common\logic\BaseLogic;
use app\common\service\ConfigService;
use app\common\service\FileService;
/**
* 工作台
* Class WorkbenchLogic
* @package app\adminapi\logic
*/
class WorkbenchLogic extends BaseLogic
{
/**
* @notes 工作套
* @param $adminInfo
* @return array
* @author 段誉
* @date 2021/12/29 15:58
*/
public static function index()
{
return [
// 版本信息
'version' => self::versionInfo(),
// 今日数据
'today' => self::today(),
// 常用功能
'menu' => self::menu(),
// 近15日访客数
'visitor' => self::visitor(),
// 服务支持
'support' => self::support()
];
}
/**
* @notes 常用功能
* @return array[]
* @author 段誉
* @date 2021/12/29 16:40
*/
public static function menu(): array
{
return [
[
'name' => '管理员',
'image' => FileService::getFileUrl(config('project.default_image.menu_admin')),
'url' => '/permission/admin'
],
[
'name' => '角色管理',
'image' => FileService::getFileUrl(config('project.default_image.menu_role')),
'url' => '/permission/role'
],
[
'name' => '部门管理',
'image' => FileService::getFileUrl(config('project.default_image.menu_dept')),
'url' => '/organization/department'
],
[
'name' => '字典管理',
'image' => FileService::getFileUrl(config('project.default_image.menu_dict')),
'url' => '/dev_tools/dict'
],
[
'name' => '代码生成器',
'image' => FileService::getFileUrl(config('project.default_image.menu_generator')),
'url' => '/dev_tools/code'
],
[
'name' => '素材中心',
'image' => FileService::getFileUrl(config('project.default_image.menu_file')),
'url' => '/material/index'
],
[
'name' => '菜单权限',
'image' => FileService::getFileUrl(config('project.default_image.menu_auth')),
'url' => '/permission/menu'
],
[
'name' => '网站信息',
'image' => FileService::getFileUrl(config('project.default_image.menu_web')),
'url' => '/setting/website/information'
],
];
}
/**
* @notes 版本信息
* @return array
* @author 段誉
* @date 2021/12/29 16:08
*/
public static function versionInfo(): array
{
return [
'version' => config('project.version'),
'website' => config('project.website.url'),
'name' => ConfigService::get('website', 'name'),
'based' => 'vue3.x、ElementUI、MySQL',
'channel' => [
'website' => 'https://www.likeadmin.cn',
'gitee' => 'https://gitee.com/likeadmin/likeadmin_php',
]
];
}
/**
* @notes 今日数据
* @return int[]
* @author 段誉
* @date 2021/12/29 16:15
*/
public static function today(): array
{
return [
'time' => date('Y-m-d H:i:s'),
// 今日销售额
'today_sales' => 100,
// 总销售额
'total_sales' => 1000,
// 今日访问量
'today_visitor' => 10,
// 总访问量
'total_visitor' => 100,
// 今日新增用户量
'today_new_user' => 30,
// 总用户量
'total_new_user' => 3000,
// 订单量 (笔)
'order_num' => 12,
// 总订单量
'order_sum' => 255
];
}
/**
* @notes 访问数
* @return array
* @author 段誉
* @date 2021/12/29 16:57
*/
public static function visitor(): array
{
$num = [];
$date = [];
for ($i = 0; $i < 15; $i++) {
$where_start = strtotime("- " . $i . "day");
$date[] = date('Y/m/d', $where_start);
$num[$i] = rand(0, 100);
}
return [
'date' => $date,
'list' => [
['name' => '访客数', 'data' => $num]
]
];
}
/**
* @notes 服务支持
* @return array[]
* @author 段誉
* @date 2022/7/18 11:18
*/
public static function support()
{
return [
[
'image' => FileService::getFileUrl(config('project.default_image.qq_group')),
'title' => '官方公众号',
'desc' => '关注官方公众号',
],
[
'image' => FileService::getFileUrl(config('project.default_image.customer_service')),
'title' => '添加企业客服微信',
'desc' => '想了解更多请添加客服',
]
];
}
}

View File

@ -0,0 +1,127 @@
<?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\article;
use app\common\enum\YesNoEnum;
use app\common\logic\BaseLogic;
use app\common\model\article\ArticleCate;
/**
* 资讯分类管理逻辑
* Class ArticleCateLogic
* @package app\adminapi\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

@ -0,0 +1,121 @@
<?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\article;
use app\common\logic\BaseLogic;
use app\common\model\article\Article;
use app\common\service\FileService;
/**
* 资讯管理逻辑
* Class ArticleLogic
* @package app\adminapi\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

@ -0,0 +1,337 @@
<?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\auth;
use app\common\cache\AdminAuthCache;
use app\common\enum\YesNoEnum;
use app\common\logic\BaseLogic;
use app\common\model\auth\Admin;
use app\common\model\auth\AdminDept;
use app\common\model\auth\AdminJobs;
use app\common\model\auth\AdminRole;
use app\common\model\auth\AdminSession;
use app\common\cache\AdminTokenCache;
use app\common\service\FileService;
use think\facade\Config;
use think\facade\Db;
/**
* 管理员逻辑
* Class AdminLogic
* @package app\adminapi\logic\auth
*/
class AdminLogic extends BaseLogic
{
/**
* @notes 添加管理员
* @param array $params
* @author 段誉
* @date 2021/12/29 10:23
*/
public static function add(array $params)
{
Db::startTrans();
try {
$passwordSalt = Config::get('project.unique_identification');
$password = create_password($params['password'], $passwordSalt);
$defaultAvatar = config('project.default_image.admin_avatar');
$avatar = !empty($params['avatar']) ? FileService::setFileUrl($params['avatar']) : $defaultAvatar;
$admin = Admin::create([
'name' => $params['name'],
'account' => $params['account'],
'avatar' => $avatar,
'password' => $password,
'create_time' => time(),
'disable' => $params['disable'],
'multipoint_login' => $params['multipoint_login'],
]);
// 角色
self::insertRole($admin['id'], $params['role_id'] ?? []);
// 部门
self::insertDept($admin['id'], $params['dept_id'] ?? []);
// 岗位
self::insertJobs($admin['id'], $params['jobs_id'] ?? []);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑管理员
* @param array $params
* @return bool
* @author 段誉
* @date 2021/12/29 10:43
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
// 基础信息
$data = [
'id' => $params['id'],
'name' => $params['name'],
'account' => $params['account'],
'disable' => $params['disable'],
'multipoint_login' => $params['multipoint_login']
];
// 头像
$data['avatar'] = !empty($params['avatar']) ? FileService::setFileUrl($params['avatar']) : '';
// 密码
if (!empty($params['password'])) {
$passwordSalt = Config::get('project.unique_identification');
$data['password'] = create_password($params['password'], $passwordSalt);
}
// 禁用或更换角色后.设置token过期
$roleId = AdminRole::where('admin_id', $params['id'])->column('role_id');
$editRole = false;
if (!empty(array_diff_assoc($roleId, $params['role_id']))) {
$editRole = true;
}
if ($params['disable'] == 1 || $editRole) {
$tokenArr = AdminSession::where('admin_id', $params['id'])->select()->toArray();
foreach ($tokenArr as $token) {
self::expireToken($token['token']);
}
}
Admin::update($data);
(new AdminAuthCache($params['id']))->clearAuthCache();
// 删除旧的关联信息
AdminRole::delByUserId($params['id']);
AdminDept::delByUserId($params['id']);
AdminJobs::delByUserId($params['id']);
// 角色
self::insertRole($params['id'], $params['role_id']);
// 部门
self::insertDept($params['id'], $params['dept_id'] ?? []);
// 岗位
self::insertJobs($params['id'], $params['jobs_id'] ?? []);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除管理员
* @param array $params
* @return bool
* @author 段誉
* @date 2021/12/29 10:45
*/
public static function delete(array $params): bool
{
Db::startTrans();
try {
$admin = Admin::findOrEmpty($params['id']);
if ($admin->root == YesNoEnum::YES) {
throw new \Exception("超级管理员不允许被删除");
}
Admin::destroy($params['id']);
//设置token过期
$tokenArr = AdminSession::where('admin_id', $params['id'])->select()->toArray();
foreach ($tokenArr as $token) {
self::expireToken($token['token']);
}
(new AdminAuthCache($params['id']))->clearAuthCache();
// 删除旧的关联信息
AdminRole::delByUserId($params['id']);
AdminDept::delByUserId($params['id']);
AdminJobs::delByUserId($params['id']);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 过期token
* @param $token
* @return bool
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2021/12/29 10:46
*/
public static function expireToken($token): bool
{
$adminSession = AdminSession::where('token', '=', $token)
->with('admin')
->find();
if (empty($adminSession)) {
return false;
}
$time = time();
$adminSession->expire_time = $time;
$adminSession->update_time = $time;
$adminSession->save();
return (new AdminTokenCache())->deleteAdminInfo($token);
}
/**
* @notes 查看管理员详情
* @param $params
* @return array
* @author 段誉
* @date 2021/12/29 11:07
*/
public static function detail($params, $action = 'detail'): array
{
$admin = Admin::field([
'id', 'account', 'name', 'disable', 'root',
'multipoint_login', 'avatar',
])->findOrEmpty($params['id'])->toArray();
if ($action == 'detail') {
return $admin;
}
$result['user'] = $admin;
// 当前管理员角色拥有的菜单
$result['menu'] = MenuLogic::getMenuByAdminId($params['id']);
// 当前管理员橘色拥有的按钮权限
$result['permissions'] = AuthLogic::getBtnAuthByRoleId($admin);
return $result;
}
/**
* @notes 编辑超级管理员
* @param $params
* @return Admin
* @author 段誉
* @date 2022/4/8 17:54
*/
public static function editSelf($params)
{
$data = [
'id' => $params['admin_id'],
'name' => $params['name'],
'avatar' => FileService::setFileUrl($params['avatar']),
];
if (!empty($params['password'])) {
$passwordSalt = Config::get('project.unique_identification');
$data['password'] = create_password($params['password'], $passwordSalt);
}
return Admin::update($data);
}
/**
* @notes 新增角色
* @param $adminId
* @param $roleIds
* @throws \Exception
* @author 段誉
* @date 2022/11/25 14:23
*/
public static function insertRole($adminId, $roleIds)
{
if (!empty($roleIds)) {
// 角色
$roleData = [];
foreach ($roleIds as $roleId) {
$roleData[] = [
'admin_id' => $adminId,
'role_id' => $roleId,
];
}
(new AdminRole())->saveAll($roleData);
}
}
/**
* @notes 新增部门
* @param $adminId
* @param $deptIds
* @throws \Exception
* @author 段誉
* @date 2022/11/25 14:22
*/
public static function insertDept($adminId, $deptIds)
{
// 部门
if (!empty($deptIds)) {
$deptData = [];
foreach ($deptIds as $deptId) {
$deptData[] = [
'admin_id' => $adminId,
'dept_id' => $deptId
];
}
(new AdminDept())->saveAll($deptData);
}
}
/**
* @notes 新增岗位
* @param $adminId
* @param $jobsIds
* @throws \Exception
* @author 段誉
* @date 2022/11/25 14:22
*/
public static function insertJobs($adminId, $jobsIds)
{
// 岗位
if (!empty($jobsIds)) {
$jobsData = [];
foreach ($jobsIds as $jobsId) {
$jobsData[] = [
'admin_id' => $adminId,
'jobs_id' => $jobsId
];
}
(new AdminJobs())->saveAll($jobsData);
}
}
}

View File

@ -0,0 +1,105 @@
<?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\auth;
use app\common\model\auth\Admin;
use app\common\model\auth\AdminRole;
use app\common\model\auth\SystemMenu;
use app\common\model\auth\SystemRoleMenu;
/**
* 权限功能类
* Class AuthLogic
* @package app\adminapi\logic\auth
*/
class AuthLogic
{
/**
* @notes 获取全部权限
* @return mixed
* @author 段誉
* @date 2022/7/1 11:55
*/
public static function getAllAuth()
{
return SystemMenu::distinct(true)
->where([
['is_disable', '=', 0],
['perms', '<>', '']
])
->column('perms');
}
/**
* @notes 获取当前管理员角色按钮权限
* @param $roleId
* @return mixed
* @author 段誉
* @date 2022/7/1 16:10
*/
public static function getBtnAuthByRoleId($admin)
{
if ($admin['root']) {
return ['*'];
}
$menuId = SystemRoleMenu::whereIn('role_id', $admin['role_id'])
->column('menu_id');
$where[] = ['is_disable', '=', 0];
$where[] = ['perms', '<>', ''];
$roleAuth = SystemMenu::distinct(true)
->where('id', 'in', $menuId)
->where($where)
->column('perms');
$allAuth = SystemMenu::distinct(true)
->where($where)
->column('perms');
$hasAllAuth = array_diff($allAuth, $roleAuth);
if (empty($hasAllAuth)) {
return ['*'];
}
return $roleAuth;
}
/**
* @notes 获取管理员角色关联的菜单id(菜单,权限)
* @param int $adminId
* @return array
* @author 段誉
* @date 2022/7/1 15:56
*/
public static function getAuthByAdminId(int $adminId): array
{
$roleIds = AdminRole::where('admin_id', $adminId)->column('role_id');
$menuId = SystemRoleMenu::whereIn('role_id', $roleIds)->column('menu_id');
return SystemMenu::distinct(true)
->where([
['is_disable', '=', 0],
['perms', '<>', ''],
['id', 'in', array_unique($menuId)],
])
->column('perms');
}
}

View File

@ -0,0 +1,184 @@
<?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\auth;
use app\common\enum\YesNoEnum;
use app\common\logic\BaseLogic;
use app\common\model\auth\Admin;
use app\common\model\auth\SystemMenu;
use app\common\model\auth\SystemRoleMenu;
/**
* 系统菜单
* Class MenuLogic
* @package app\adminapi\logic\auth
*/
class MenuLogic extends BaseLogic
{
/**
* @notes 获取管理员对应的角色菜单
* @param $adminId
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2022/7/1 10:50
*/
public static function getMenuByAdminId($adminId)
{
$admin = Admin::findOrEmpty($adminId);
$where = [];
$where[] = ['type', 'in', ['M', 'C']];
$where[] = ['is_disable', '=', 0];
if ($admin['root'] != 1) {
$roleMenu = SystemRoleMenu::whereIn('role_id', $admin['role_id'])->column('menu_id');
$where[] = ['id', 'in', $roleMenu];
}
$menu = SystemMenu::where($where)
->order(['sort' => 'desc', 'id' => 'asc'])
->select();
return linear_to_tree($menu, 'children');
}
/**
* @notes 添加菜单
* @param array $params
* @return SystemMenu|\think\Model
* @author 段誉
* @date 2022/6/30 10:06
*/
public static function add(array $params)
{
return SystemMenu::create([
'pid' => $params['pid'],
'type' => $params['type'],
'name' => $params['name'],
'icon' => $params['icon'] ?? '',
'sort' => $params['sort'],
'perms' => $params['perms'] ?? '',
'paths' => $params['paths'] ?? '',
'component' => $params['component'] ?? '',
'selected' => $params['selected'] ?? '',
'params' => $params['params'] ?? '',
'is_cache' => $params['is_cache'],
'is_show' => $params['is_show'],
'is_disable' => $params['is_disable'],
]);
}
/**
* @notes 编辑菜单
* @param array $params
* @return SystemMenu
* @author 段誉
* @date 2022/6/30 10:07
*/
public static function edit(array $params)
{
return SystemMenu::update([
'id' => $params['id'],
'pid' => $params['pid'],
'type' => $params['type'],
'name' => $params['name'],
'icon' => $params['icon'] ?? '',
'sort' => $params['sort'],
'perms' => $params['perms'] ?? '',
'paths' => $params['paths'] ?? '',
'component' => $params['component'] ?? '',
'selected' => $params['selected'] ?? '',
'params' => $params['params'] ?? '',
'is_cache' => $params['is_cache'],
'is_show' => $params['is_show'],
'is_disable' => $params['is_disable'],
]);
}
/**
* @notes 详情
* @param $params
* @return array
* @author 段誉
* @date 2022/6/30 9:54
*/
public static function detail($params)
{
return SystemMenu::findOrEmpty($params['id'])->toArray();
}
/**
* @notes 删除菜单
* @param $params
* @author 段誉
* @date 2022/6/30 9:47
*/
public static function delete($params)
{
// 删除菜单
SystemMenu::destroy($params['id']);
// 删除角色-菜单表中 与该菜单关联的记录
SystemRoleMenu::where(['menu_id' => $params['id']])->delete();
}
/**
* @notes 更新状态
* @param array $params
* @return SystemMenu
* @author 段誉
* @date 2022/7/6 17:02
*/
public static function updateStatus(array $params)
{
return SystemMenu::update([
'id' => $params['id'],
'is_disable' => $params['is_disable']
]);
}
/**
* @notes 全部数据
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2022/10/13 11:03
*/
public static function getAllData()
{
$data = SystemMenu::where(['is_disable' => YesNoEnum::NO])
->field('id,pid,name')
->order(['sort' => 'desc', 'id' => 'desc'])
->select()
->toArray();
return linear_to_tree($data, 'children');
}
}

View File

@ -0,0 +1,170 @@
<?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\auth;
use app\common\{
cache\AdminAuthCache,
model\auth\SystemRole,
logic\BaseLogic,
model\auth\SystemRoleMenu
};
use think\facade\Db;
/**
* 角色逻辑层
* Class RoleLogic
* @package app\adminapi\logic\auth
*/
class RoleLogic extends BaseLogic
{
/**
* @notes 添加角色
* @param array $params
* @return bool
* @author 段誉
* @date 2021/12/29 11:50
*/
public static function add(array $params): bool
{
Db::startTrans();
try {
$menuId = !empty($params['menu_id']) ? $params['menu_id'] : [];
$role = SystemRole::create([
'name' => $params['name'],
'desc' => $params['desc'] ?? '',
'sort' => $params['sort'] ?? 0,
]);
$data = [];
foreach ($menuId as $item) {
if (empty($item)) {
continue;
}
$data[] = [
'role_id' => $role['id'],
'menu_id' => $item,
];
}
(new SystemRoleMenu)->insertAll($data);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::$error = $e->getMessage();
return false;
}
}
/**
* @notes 编辑角色
* @param array $params
* @return bool
* @author 段誉
* @date 2021/12/29 14:16
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
$menuId = !empty($params['menu_id']) ? $params['menu_id'] : [];
SystemRole::update([
'id' => $params['id'],
'name' => $params['name'],
'desc' => $params['desc'] ?? '',
'sort' => $params['sort'] ?? 0,
]);
if (!empty($menuId)) {
SystemRoleMenu::where(['role_id' => $params['id']])->delete();
$data = [];
foreach ($menuId as $item) {
$data[] = [
'role_id' => $params['id'],
'menu_id' => $item,
];
}
(new SystemRoleMenu)->insertAll($data);
}
(new AdminAuthCache())->deleteTag();
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::$error = $e->getMessage();
return false;
}
}
/**
* @notes 删除角色
* @param int $id
* @return bool
* @author 段誉
* @date 2021/12/29 14:16
*/
public static function delete(int $id)
{
SystemRole::destroy(['id' => $id]);
(new AdminAuthCache())->deleteTag();
return true;
}
/**
* @notes 角色详情
* @param int $id
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2021/12/29 14:17
*/
public static function detail(int $id): array
{
$detail = SystemRole::field('id,name,desc,sort')->find($id);
$authList = $detail->roleMenuIndex()->select()->toArray();
$menuId = array_column($authList, 'menu_id');
$detail['menu_id'] = $menuId;
return $detail->toArray();
}
/**
* @notes 角色数据
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2022/10/13 10:39
*/
public static function getAllData()
{
return SystemRole::order(['sort' => 'desc', 'id' => 'desc'])
->select()
->toArray();
}
}

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\setting\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,72 @@
<?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']);
}
}

Some files were not shown because too many files have changed in this diff Show More