reset
This commit is contained in:
parent
e0f5d143d5
commit
0430851120
|
@ -1 +0,0 @@
|
|||
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 = "7263"
UNIQUE_IDENTIFICATION = likeadmin
# 演示环境
DEMO_ENV = false
|
|
@ -1,9 +1,2 @@
|
|||
/.idea
|
||||
/.vscode
|
||||
*.log
|
||||
/.env
|
||||
/public/uploads/*
|
||||
/public/nginx.htaccess
|
||||
!/public/uploads/index.html
|
||||
/runtime/*
|
||||
!/runtime/index.html
|
||||
/.vscode
|
42
.travis.yml
42
.travis.yml
|
@ -1,42 +0,0 @@
|
|||
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
32
LICENSE.txt
|
@ -1,32 +0,0 @@
|
|||
|
||||
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
56
README.md
|
@ -1,56 +0,0 @@
|
|||
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 +0,0 @@
|
|||
deny from all
|
|
@ -1,22 +0,0 @@
|
|||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app;
|
||||
|
||||
use think\Service;
|
||||
|
||||
/**
|
||||
* 应用服务类
|
||||
*/
|
||||
class AppService extends Service
|
||||
{
|
||||
public function register()
|
||||
{
|
||||
// 服务注册
|
||||
}
|
||||
|
||||
public function boot()
|
||||
{
|
||||
// 服务启动
|
||||
}
|
||||
}
|
|
@ -1,95 +0,0 @@
|
|||
<?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);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
<?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);
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
<?php
|
||||
namespace app;
|
||||
|
||||
// 应用请求对象类
|
||||
class Request extends \think\Request
|
||||
{
|
||||
// 全局过滤规则
|
||||
protected $filter = ['trim'];
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
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,
|
||||
],
|
||||
];
|
|
@ -1,40 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
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'];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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']);
|
||||
}
|
||||
}
|
|
@ -1,137 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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);
|
||||
}
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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();
|
||||
}
|
||||
}
|
|
@ -1,144 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace app\adminapi\controller;
|
||||
|
||||
use think\facade\Db;
|
||||
use think\facade\Filesystem;
|
||||
use think\response\Json;
|
||||
|
||||
class SuYuanController extends BaseAdminController
|
||||
{
|
||||
public array $notNeedLogin = ['areaLists','areaDetail','monitorDetail','imageUpload','monitorList'];
|
||||
|
||||
//添加种植基地
|
||||
public function addArea(): Json
|
||||
{
|
||||
if(!$this->request->isPost()) {
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params = $this->request->post(['name','pic','area','crop','growth_cycle','cultivation_method','content','crop_info']);
|
||||
if(!isset($params['name']) || $params['name'] == ''){
|
||||
return $this->fail('请填写名称');
|
||||
}
|
||||
$result = Db::name('production_base')->insert($params);
|
||||
if($result){
|
||||
return $this->success('添加成功');
|
||||
}else{
|
||||
return $this->fail('添加失败');
|
||||
}
|
||||
}
|
||||
|
||||
//修改种植基地
|
||||
public function ediArea(): Json
|
||||
{
|
||||
if(!$this->request->isPost()) {
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params = $this->request->post(['id','name','pic','area','crop','growth_cycle','cultivation_method','content','crop_info']);
|
||||
if(!isset($params['id']) || $params['id'] == '' || !isset($params['name']) || $params['name'] == ''){
|
||||
return $this->fail('请填写名称');
|
||||
}
|
||||
$result = Db::name('production_base')->update($params);
|
||||
if($result){
|
||||
return $this->success('修改成功');
|
||||
}else{
|
||||
return $this->fail('修改失败');
|
||||
}
|
||||
}
|
||||
|
||||
//种植基地详情
|
||||
public function areaDetail(): Json
|
||||
{
|
||||
if(!$this->request->isPost()) {
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params = $this->request->post(['id']);
|
||||
if(!isset($params['id']) || $params['id'] == ''){
|
||||
return $this->fail('请填写名称');
|
||||
}
|
||||
$data = Db::name('production_base')->field('id,name,pic,area,crop,growth_cycle,cultivation_method,content,crop_info')->where('id',$params['id'])->findOrEmpty();
|
||||
return $this->success('请求成功',$data);
|
||||
}
|
||||
|
||||
//种植基地列表
|
||||
public function areaLists(): Json
|
||||
{
|
||||
$data = Db::name('production_base')->field('id,name,pic,area,crop,growth_cycle,cultivation_method,content,crop_info')->select();
|
||||
return $this->success('请求成功',$data->toArray());
|
||||
}
|
||||
|
||||
//添加环境监测数据
|
||||
public function addMonitor(): Json
|
||||
{
|
||||
if(!$this->request->isPost()) {
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params = $this->request->post(['production_base_id','soil_temperature','soil_moisture','room_temperature','air_humidity','air_quality_index','pond_temperature','pond_ph_value','wind_direction','wind_speed','illumination','rainfall','carbon_dioxide_content','nitrogen_content','methane_content','ammonia_nitrogen_content','nitrite_content','dissolved_oxygen','temperature_threshold','humidity_threshold','flag']);
|
||||
if(!isset($params['production_base_id']) || $params['production_base_id'] == ''){
|
||||
return $this->fail('请选择区域');
|
||||
}
|
||||
$result = Db::name('environmental_data')->insert($params);
|
||||
if($result){
|
||||
return $this->success('添加成功');
|
||||
}else{
|
||||
return $this->fail('添加失败');
|
||||
}
|
||||
}
|
||||
|
||||
//修改环境检查数据
|
||||
public function ediMonitor(): Json
|
||||
{
|
||||
if(!$this->request->isPost()) {
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params = $this->request->post(['id','production_base_id','soil_temperature','soil_moisture','room_temperature','air_humidity','air_quality_index','pond_temperature','pond_ph_value','wind_direction','wind_speed','illumination','rainfall','carbon_dioxide_content','nitrogen_content','methane_content','ammonia_nitrogen_content','nitrite_content','dissolved_oxygen','temperature_threshold','humidity_threshold']);
|
||||
if(!isset($params['id']) || $params['id'] == '' || !isset($params['production_base_id']) || $params['production_base_id'] == ''){
|
||||
return $this->fail('请选择区域');
|
||||
}
|
||||
$result = Db::name('environmental_data')->update($params);
|
||||
if($result){
|
||||
return $this->success('修改成功');
|
||||
}else{
|
||||
return $this->fail('修改失败');
|
||||
}
|
||||
}
|
||||
|
||||
//环境检查数据详情
|
||||
public function monitorDetail(): Json
|
||||
{
|
||||
if(!$this->request->isPost()) {
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params = $this->request->post(['id','flag']);
|
||||
if(empty($params['id']) || empty($params['flag'])){
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
$data = Db::name('environmental_data')->where('production_base_id',$params['id'])->where('flag',$params['flag'])->order('id desc')->findOrEmpty();
|
||||
return $this->success('请求成功',$data);
|
||||
}
|
||||
|
||||
public function monitorList(): Json
|
||||
{
|
||||
$params = $this->request->get(['id','flag']);
|
||||
if(empty($params['id']) || empty($params['flag'])){
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
$data = Db::name('environmental_data')->where('production_base_id',$params['id'])->where('flag',$params['flag'])->limit(6)->select();
|
||||
$content = Db::name('production_base')->where('id',$params['id'])->field('content')->findOrEmpty();
|
||||
return $this->success('请求成功',['data'=>$data,'content'=>$content['content']]);
|
||||
}
|
||||
|
||||
//上传图片
|
||||
public function imageUpload(): Json
|
||||
{
|
||||
if(!$this->request->isPost()) {
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$file = request()->file('file');
|
||||
if(empty($file)){
|
||||
return $this->fail('上传文件不存在');
|
||||
}
|
||||
$save_name = Filesystem::disk('public')->putFile( '', $file);
|
||||
return $this->success('上传成功',['image'=>$this->request->domain().$save_name]);
|
||||
}
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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);
|
||||
}
|
||||
}
|
|
@ -1,114 +0,0 @@
|
|||
<?php
|
||||
namespace app\adminapi\controller\action;
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use think\facade\Db;
|
||||
use think\response\Json;
|
||||
|
||||
class ActionController extends BaseAdminController
|
||||
{
|
||||
private string $actionTableName = 'farmer_action';
|
||||
private string $actionDetailTableName = 'farmer_action_detail';
|
||||
|
||||
//添加用戶操作
|
||||
public function add(): Json
|
||||
{
|
||||
//获取參數
|
||||
$params = $this->request->post(['type_id','farmer_type','name','detail']);
|
||||
//验证基本参数
|
||||
if(empty($params['type_id']) || empty($params['farmer_type']) || !in_array($params['farmer_type'],[1,2,3,4]) || empty($params['name'])){
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
//验证json数据
|
||||
$detail = json_decode($params['detail'],true);
|
||||
if(empty($detail)){
|
||||
return $this->fail('相关信息数据错误');
|
||||
}
|
||||
//验证数据是否存在
|
||||
$hasRes = Db::name($this->actionTableName)->where('type_id',$params['type_id'])->where('farmer_type',$params['farmer_type'])->where('name',$params['name'])->findOrEmpty();
|
||||
if(!empty($hasRes)){
|
||||
return $this->fail('数据已存在');
|
||||
}
|
||||
//写入数据
|
||||
Db::transaction(function () use($params,$detail) {
|
||||
$actionId = Db::name($this->actionTableName)->insertGetId([
|
||||
'type_id' => $params['type_id'],
|
||||
'farmer_type' => $params['farmer_type'],
|
||||
'name' => $params['name']
|
||||
]);
|
||||
foreach($detail as $k => $v){
|
||||
$detail[$k]['action_id'] = $actionId;
|
||||
}
|
||||
Db::name($this->actionDetailTableName)->insertAll($detail);
|
||||
});
|
||||
return $this->success('添加成功',[],1,1);
|
||||
}
|
||||
|
||||
//删除用户操作
|
||||
public function delete(): Json
|
||||
{
|
||||
//获取参数
|
||||
$params = $this->request->post(['action_id']);
|
||||
if(empty($params['action_id'])){
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
//删除数据
|
||||
Db::transaction(function () use($params) {
|
||||
//先删除相关信息
|
||||
Db::name($this->actionDetailTableName)->where('action_id','in',$params['action_id'])->delete();
|
||||
//在删除操作信息
|
||||
Db::name($this->actionTableName)->where('id',$params['action_id'])->delete();
|
||||
});
|
||||
return $this->success('删除成功',[],1,1);
|
||||
}
|
||||
|
||||
//删除相关信息
|
||||
public function deleteDetail(): Json
|
||||
{
|
||||
//获取参数
|
||||
$params = $this->request->post(['action_detail_id']);
|
||||
if(empty($params['action_detail_id'])){
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
//删除数据
|
||||
$delRes = Db::name($this->actionDetailTableName)->where('id',$params['action_detail_id'])->delete();
|
||||
//返回数据
|
||||
return $delRes ? $this->success('删除成功',[],1,1) : $this->fail('删除失败',[],1,1);
|
||||
}
|
||||
|
||||
//操作列表
|
||||
public function list(): Json
|
||||
{
|
||||
//获取参数
|
||||
$params = $this->request->get(['type_id','farmer_type','name','page_no','page_size']);
|
||||
//设置搜索条件
|
||||
$where = [];
|
||||
if(!empty($params['type_id'])){
|
||||
$where[] = ['type_id','=',$params['type_id']];
|
||||
}
|
||||
if(!empty($params['farmer_type'])){
|
||||
$where[] = ['farmer_type','=',$params['farmer_type']];
|
||||
}
|
||||
if(!empty($params['name'])){
|
||||
$where[] = ['name','like','%'.$params['name'].'%'];
|
||||
}
|
||||
//设置分页属性
|
||||
$pageNo = empty($params['page_no']) || $params['page_no'] < 0 ? 1 : $params['page_no'];
|
||||
$pageSize = empty($params['page_size']) || $params['page_size'] < 0 ? 15 : $params['page_size'];
|
||||
//查询数据
|
||||
$data = Db::name($this->actionTableName)->where($where)->page($pageNo,$pageSize)->order('id desc')->select()->each(function($item){
|
||||
$item['type_name'] = Db::name('farmer_action_type')->where('id',$item['type_id'])->column('name')[0];
|
||||
$item['detail'] = Db::name($this->actionDetailTableName)->where('action_id','in',$item['id'])->select();
|
||||
return $item;
|
||||
})->toArray();
|
||||
$count = Db::name($this->actionTableName)->where($where)->count();
|
||||
$result = [
|
||||
'count' => $count,
|
||||
'page_no' => $pageNo,
|
||||
'page_size'=>$pageSize,
|
||||
'lists' => $data
|
||||
];
|
||||
//返回数据
|
||||
return $this->success('请求成功',$result);
|
||||
}
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
<?php
|
||||
namespace app\adminapi\controller\action;
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use think\facade\Db;
|
||||
use think\response\Json;
|
||||
|
||||
class ActionTypeController extends BaseAdminController
|
||||
{
|
||||
private string $actionTypeTableName = 'farmer_action_type';
|
||||
//添加操作类型
|
||||
public function add(): Json
|
||||
{
|
||||
//获取参数
|
||||
$params = $this->request->post(['name']);
|
||||
//验证参数
|
||||
if(empty($params['name'])){
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
//判断操作类型是否存在
|
||||
$hasRes = Db::name($this->actionTypeTableName)->field('id')->where('name',$params['name'])->findOrEmpty();
|
||||
if(!empty($hasRes)){
|
||||
return $this->fail('数据已存在');
|
||||
}
|
||||
//添加数据
|
||||
$addRes = Db::name($this->actionTypeTableName)->insert(['name'=>$params['name']]);
|
||||
//返回数据
|
||||
return $addRes ? $this->success('添加成功',[],1,1) : $this->fail('添加失败',[],1,1);
|
||||
}
|
||||
|
||||
//修改操作类型
|
||||
public function edit(): Json
|
||||
{
|
||||
//获取参数
|
||||
$params = $this->request->post(['id','name']);
|
||||
//验证参数
|
||||
if(empty($params['id']) || empty($params['name'])){
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
//判断操作类型是否存在
|
||||
$hasRes = Db::name($this->actionTypeTableName)->where('id','<>',$params['id'])->where('name',$params['name'])->field('id')->findOrEmpty();
|
||||
if(!empty($hasRes)){
|
||||
return $this->fail('数据已存在');
|
||||
}
|
||||
//更新数据
|
||||
$ediRes = Db::name($this->actionTypeTableName)->where('id',$params['id'])->update(['name'=>$params['name']]);
|
||||
//返回数据
|
||||
return $ediRes ? $this->success('修改成功',[],1,1) : $this->fail('修改失败',[],1,1);
|
||||
}
|
||||
|
||||
//操作记录列表
|
||||
public function list(): Json
|
||||
{
|
||||
//获取参数
|
||||
$params = $this->request->get(['name']);
|
||||
$where = empty($params['name']) ? [] : [['name','like','%'.$params['name'].'%']];
|
||||
//获取数据
|
||||
$data = Db::name($this->actionTypeTableName)->where($where)->order('id desc')->select();
|
||||
//返回数据
|
||||
return $this->success('请求成功',$data->toArray());
|
||||
}
|
||||
}
|
|
@ -1,134 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,114 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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());
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,134 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,142 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,124 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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);
|
||||
}
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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);
|
||||
}
|
||||
}
|
|
@ -1,74 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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);
|
||||
}
|
||||
}
|
|
@ -1,148 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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'
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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);
|
||||
}
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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);
|
||||
}
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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);
|
||||
}
|
||||
}
|
|
@ -1,308 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace app\adminapi\controller\code;
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use think\facade\Db;
|
||||
use think\response\Json;
|
||||
|
||||
class CodeController extends BaseAdminController
|
||||
{
|
||||
public function lists(): Json
|
||||
{
|
||||
//type=>1-种植户 2-家禽养殖户 3-家畜养殖户 4-水产养殖户
|
||||
$params = $this->request->get(['type','page_no','page_size']);
|
||||
if(empty($params['type']) || !in_array($params['type'],[1,2,3,4])){
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
//设置分页条件
|
||||
$pageNo = empty($params['page_no']) || $params['page_no'] < 0 ? 1 : $params['page_no'];
|
||||
$pageSize = empty($params['page_size']) || $params['page_size'] < 0 ? 10 : $params['page_size'];
|
||||
switch ($params['type']) {
|
||||
case 1:
|
||||
$data = Db::name('farmer_land_crop')->field('id,user_id,source_code as code,crop_variety as kind,crop_brand as breed,ripe_time,seed_time as create_time')
|
||||
->where('flag',1)->page($pageNo,$pageSize)->order('seed_time desc')->select()->each(function($item){
|
||||
if(!empty($item['ripe_time'])){
|
||||
$item['status'] = '已成熟';
|
||||
}else{
|
||||
$item['status'] = '生长中';
|
||||
}
|
||||
$item['create_time'] = date('Y-m-d H:i:s',$item['create_time']);
|
||||
unset($item['ripe_time']);
|
||||
return $item;
|
||||
})->toArray();
|
||||
$count = Db::name('farmer_land_crop')->field('id,')->where('flag',1)->count();
|
||||
break;
|
||||
case 2:
|
||||
$data = Db::name('farmer_poultry_breed')->field('id,user_id,code,kind,breed,status,create_time')
|
||||
->page($pageNo,$pageSize)->order('create_time desc')->select()->each(function($item){
|
||||
//状态 1-健康 2-产蛋期 3-生病隔离 4-可出栏 5-已出栏
|
||||
switch ($item['status']) {
|
||||
case 1:
|
||||
$item['status'] = '健康';
|
||||
break;
|
||||
case 2:
|
||||
$item['status'] = '产蛋期';
|
||||
break;
|
||||
case 3:
|
||||
$item['status'] = '生病隔离';
|
||||
break;
|
||||
case 4:
|
||||
$item['status'] = '可出栏';
|
||||
break;
|
||||
case 5:
|
||||
$item['status'] = '已出栏';
|
||||
break;
|
||||
}
|
||||
$item['create_time'] = date('Y-m-d H:i:s',$item['create_time']);
|
||||
return $item;
|
||||
})->toArray();
|
||||
$count = Db::name('farmer_poultry_breed')->field('id,')->count();
|
||||
break;
|
||||
case 3:
|
||||
$data = Db::name('farmer_animal_breed')->field('id,user_id,animal_code as code,animal_kind as kind,animal_breed as breed,animal_status as status,create_time')
|
||||
->page($pageNo,$pageSize)->order('create_time desc')->select()->each(function($item){
|
||||
//养殖动物状态 1-健康 2-怀孕中 3-生病隔离中 4-可出栏 5-已出栏
|
||||
switch ($item['status']) {
|
||||
case 1:
|
||||
$item['status'] = '健康';
|
||||
break;
|
||||
case 2:
|
||||
$item['status'] = '怀孕中';
|
||||
break;
|
||||
case 3:
|
||||
$item['status'] = '生病隔离';
|
||||
break;
|
||||
case 4:
|
||||
$item['status'] = '可出栏';
|
||||
break;
|
||||
case 5:
|
||||
$item['status'] = '已出栏';
|
||||
break;
|
||||
}
|
||||
$item['create_time'] = date('Y-m-d H:i:s',$item['create_time']);
|
||||
return $item;
|
||||
})->toArray();
|
||||
$count = Db::name('farmer_animal_breed')->field('id,')->count();
|
||||
break;
|
||||
case 4:
|
||||
$data = Db::name('farmer_pond_breed')->field('id,user_id,source_code as code,kind,breed,create_time')
|
||||
->page($pageNo,$pageSize)->order('create_time desc')->select()->each(function($item){
|
||||
$item['status'] = '生长中';
|
||||
$item['create_time'] = date('Y-m-d H:i:s',$item['create_time']);
|
||||
return $item;
|
||||
})->toArray();
|
||||
$count = Db::name('farmer_pond_breed')->field('id,')->count();
|
||||
break;
|
||||
default:
|
||||
$data = [];
|
||||
$count = 0;
|
||||
}
|
||||
$url = env('project.worker_domain').'/api/information/farmerInfo';
|
||||
foreach($data as $k=>$v) {
|
||||
$farmer = curl_post($url,[],['user_id'=>$v['user_id']]);
|
||||
if(!empty($farmer) && $farmer['code'] == 1){
|
||||
$data[$k]['address'] = $farmer['data']['area_name'].$farmer['data']['street_name'].$farmer['data']['village_name'].$farmer['data']['brigade_name'].$farmer['data']['address'];
|
||||
$data[$k]['captain_name'] = $farmer['data']['captain_name'];
|
||||
$data[$k]['group_name'] = $farmer['data']['group_name'];
|
||||
$data[$k]['farmer_name'] = $farmer['data']['name'];
|
||||
}
|
||||
$data[$k]['type'] = $params['type'];
|
||||
}
|
||||
$result = [
|
||||
'count'=>$count,
|
||||
'page_no' => $pageNo,
|
||||
'page_size' => $pageSize,
|
||||
'lists' => $data
|
||||
];
|
||||
return $this->success('请求成功',$result);
|
||||
}
|
||||
|
||||
public function detail(): Json
|
||||
{
|
||||
//type=>1-种植户 2-家禽养殖户 3-家畜养殖户 4-水产养殖户
|
||||
$params = $this->request->get(['id','type']);
|
||||
if(empty($params['id']) || empty($params['type']) || !in_array($params['type'],[1,2,3,4])){
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
//获取数据
|
||||
switch ($params['type']) {
|
||||
case 1:
|
||||
$data = Db::name('farmer_land_crop')->field('id,user_id,land_id,source_code as code,crop_variety as kind,crop_brand as breed,ripe_time,seed_time as create_time')->where('id',$params['id'])->findOrEmpty();
|
||||
if(!empty($data)){
|
||||
$data['status'] = !empty($data['ripe_time']) ? '已成熟' : '生长中';
|
||||
$data['create_time'] = date('Y-m-d H:i:s',$data['create_time']);
|
||||
unset($data['ripe_time']);
|
||||
//获取生长记录
|
||||
$data['action_lists'] = Db::name('farmer_land_crop_record')->field('action_id,action_content,create_time')
|
||||
->where('crop_id',$data['id'])->order('create_time desc')->limit(10)->select()->each(function($item){
|
||||
$action = Db::name('farmer_action')->where('id',$item['action_id'])->findOrEmpty();
|
||||
if(!empty($action)){
|
||||
$item['action_name'] = $action['name'];
|
||||
}
|
||||
$item['create_time'] = date('Y-m-d H:i:s',$item['create_time']);
|
||||
return $item;
|
||||
})->toArray();
|
||||
//获取监管记录
|
||||
$data['check_list'] = Db::name('farmer_land_check')->field('check_status,pic,create_time')
|
||||
->where('land_id',$data['land_id'])->order('create_time desc')->limit(10)->select()->each(function($item){
|
||||
//1-正常 2-未及时更新生产状况 3-生产状况与实际不符
|
||||
$item['status'] = $item['check_status'] == 1 ? '正常' : ($item['check_status'] == 2 ? '未及时更新生产状况' : '生产状况与实际不符');
|
||||
$item['create_time'] = date('Y-m-d H:i:s',$item['create_time']);
|
||||
unset($item['check_status']);
|
||||
return $item;
|
||||
})->toArray();
|
||||
unset($data['land_id']);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
$data = Db::name('farmer_poultry_breed')->field('id,user_id,code,kind,breed,status,create_time')->where('id',$params['id'])->findOrEmpty();
|
||||
if(!empty($data)){
|
||||
switch ($data['status']) {
|
||||
case 1:
|
||||
$data['status'] = '健康';
|
||||
break;
|
||||
case 2:
|
||||
$data['status'] = '产蛋期';
|
||||
break;
|
||||
case 3:
|
||||
$data['status'] = '生病隔离';
|
||||
break;
|
||||
case 4:
|
||||
$data['status'] = '可出栏';
|
||||
break;
|
||||
case 5:
|
||||
$data['status'] = '已出栏';
|
||||
break;
|
||||
}
|
||||
$data['create_time'] = date('Y-m-d H:i:s',$data['create_time']);
|
||||
//获取生长记录
|
||||
$data['action_lists'] = Db::name('farmer_poultry_record')->field('action_id,action_content,create_time')
|
||||
->where('user_id',$data['user_id'])->order('create_time desc')->limit(10)->select()->each(function($item){
|
||||
$action = Db::name('farmer_action')->where('id',$item['action_id'])->findOrEmpty();
|
||||
if(!empty($action)){
|
||||
$item['action_name'] = $action['name'];
|
||||
}
|
||||
$item['create_time'] = date('Y-m-d H:i:s',$item['create_time']);
|
||||
return $item;
|
||||
})->toArray();
|
||||
//获取监管记录
|
||||
$data['check_list'] = Db::name('farmer_poultry_check')->field('check_status,pic,create_time')
|
||||
->where('user_id',$data['user_id'])->order('create_time desc')->limit(10)->select()->each(function($item){
|
||||
//1-正常 2-未及时更新生产状况 3-生产状况与实际不符
|
||||
$item['status'] = $item['check_status'] == 1 ? '正常' : ($item['check_status'] == 2 ? '未及时更新生产状况' : '生产状况与实际不符');
|
||||
$item['create_time'] = date('Y-m-d H:i:s',$item['create_time']);
|
||||
unset($item['check_status']);
|
||||
return $item;
|
||||
})->toArray();
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
$data = Db::name('farmer_animal_breed')->field('id,user_id,animal_code as code,animal_kind as kind,animal_breed as breed,animal_status as status,create_time')->where('id',$params['id'])->findOrEmpty();
|
||||
if(!empty($data)){
|
||||
switch ($data['status']) {
|
||||
case 1:
|
||||
$data['status'] = '健康';
|
||||
break;
|
||||
case 2:
|
||||
$data['status'] = '怀孕中';
|
||||
break;
|
||||
case 3:
|
||||
$data['status'] = '生病隔离';
|
||||
break;
|
||||
case 4:
|
||||
$data['status'] = '可出栏';
|
||||
break;
|
||||
case 5:
|
||||
$data['status'] = '已出栏';
|
||||
break;
|
||||
}
|
||||
$data['create_time'] = date('Y-m-d H:i:s',$data['create_time']);
|
||||
//获取生长记录
|
||||
$data['action_lists'] = Db::name('farmer_animal_record')->field('action_id,action_content,create_time')
|
||||
->where('user_id',$data['user_id'])->order('create_time desc')->limit(10)->select()->each(function($item){
|
||||
$action = Db::name('farmer_action')->where('id',$item['action_id'])->findOrEmpty();
|
||||
if(!empty($action)){
|
||||
$item['action_name'] = $action['name'];
|
||||
}
|
||||
$item['create_time'] = date('Y-m-d H:i:s',$item['create_time']);
|
||||
return $item;
|
||||
})->toArray();
|
||||
//获取监管记录
|
||||
$data['check_list'] = Db::name('farmer_animal_check')->field('check_status,pic,create_time')
|
||||
->where('user_id',$data['user_id'])->order('create_time desc')->limit(10)->select()->each(function($item){
|
||||
//1-正常 2-未及时更新生产状况 3-生产状况与实际不符
|
||||
$item['status'] = $item['check_status'] == 1 ? '正常' : ($item['check_status'] == 2 ? '未及时更新生产状况' : '生产状况与实际不符');
|
||||
$item['create_time'] = date('Y-m-d H:i:s',$item['create_time']);
|
||||
unset($item['check_status']);
|
||||
return $item;
|
||||
})->toArray();
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
$data = Db::name('farmer_pond_breed')->field('id,user_id,pond_id,source_code as code,kind,breed,create_time')->where('id',$params['id'])->findOrEmpty();
|
||||
if(!empty($data)){
|
||||
$data['status'] = '生长中';
|
||||
$data['create_time'] = date('Y-m-d H:i:s',$data['create_time']);
|
||||
//获取生长记录
|
||||
$data['action_lists'] = Db::name('farmer_pond_record')->field('action_id,action_content,create_time')
|
||||
->where('pond_id',$data['pond_id'])->order('create_time desc')->limit(10)->select()->each(function($item){
|
||||
$action = Db::name('farmer_action')->where('id',$item['action_id'])->findOrEmpty();
|
||||
if(!empty($action)){
|
||||
$item['action_name'] = $action['name'];
|
||||
}
|
||||
$item['create_time'] = date('Y-m-d H:i:s',$item['create_time']);
|
||||
return $item;
|
||||
})->toArray();
|
||||
//获取监管记录
|
||||
$data['check_list'] = Db::name('farmer_pond_check')->field('check_status,pic,create_time')
|
||||
->where('pond_id',$data['pond_id'])->order('create_time desc')->limit(10)->select()->each(function($item){
|
||||
//1-正常 2-未及时更新生产状况 3-生产状况与实际不符
|
||||
$item['status'] = $item['check_status'] == 1 ? '正常' : ($item['check_status'] == 2 ? '未及时更新生产状况' : '生产状况与实际不符');
|
||||
$item['create_time'] = date('Y-m-d H:i:s',$item['create_time']);
|
||||
unset($item['check_status']);
|
||||
return $item;
|
||||
})->toArray();
|
||||
unset($data['pond_id']);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$data = [];
|
||||
}
|
||||
if(!empty($data)){
|
||||
$url = env('project.worker_domain').'/api/information/farmerInfo';
|
||||
$farmer = curl_post($url,[],['user_id'=>$data['user_id']]);
|
||||
if(!empty($farmer) && $farmer['code'] == 1){
|
||||
$data['address'] = $farmer['data']['area_name'].$farmer['data']['street_name'].$farmer['data']['village_name'].$farmer['data']['brigade_name'].$farmer['data']['address'];
|
||||
$data['captain_name'] = $farmer['data']['captain_name'];
|
||||
$data['group_name'] = $farmer['data']['group_name'];
|
||||
$data['farmer_name'] = $farmer['data']['name'];
|
||||
}
|
||||
}
|
||||
return $this->success('请求成功',$data);
|
||||
}
|
||||
|
||||
public function landEnv(): Json
|
||||
{
|
||||
$params = $this->request->get(['user_id','start_time','end_time']);
|
||||
if(empty($params['user_id']) || empty($params['start_time']) || empty($params['end_time'])){
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
//获取数据
|
||||
$data = Db::name('farmer_land_env_data')->where('user_id',$params['user_id'])->whereBetweenTime('create_time', $params['start_time'], $params['end_time'])->order('id asc')->select()->each(function($item){
|
||||
$item['create_time'] = date('m-d',$item['create_time']);
|
||||
return $item;
|
||||
})->toArray();
|
||||
if(empty($data)){
|
||||
return $this->fail('暂无数据');
|
||||
}
|
||||
$result = [
|
||||
['title' => '土地温度','categories' => array_column($data,'create_time'),'series'=>[['name'=>'土地温度','data'=>array_column($data,'soil_temp')]],'max'=>max(array_column($data,'soil_temp'))],
|
||||
['title' => '土地湿度','categories' => array_column($data,'create_time'),'series'=>[['name'=>'土地湿度','data'=>array_column($data,'soil_mois')]],'max'=>max(array_column($data,'soil_mois'))],
|
||||
['title' => '土壤磷含量','categories' => array_column($data,'create_time'),'series'=>[['name'=>'土壤磷含量','data'=>array_column($data,'p_content')]],'max'=>max(array_column($data,'p_content'))],
|
||||
['title' => '土壤氮含量','categories' => array_column($data,'create_time'),'series'=>[['name'=>'土壤氮含量','data'=>array_column($data,'n_content')]],'max'=>max(array_column($data,'n_content'))],
|
||||
['title' => '土壤钾含量','categories' => array_column($data,'create_time'),'series'=>[['name'=>'土壤钾含量','data'=>array_column($data,'k_content')]],'max'=>max(array_column($data,'k_content'))],
|
||||
];
|
||||
return $this->success('请求成功',$result);
|
||||
}
|
||||
}
|
|
@ -1,135 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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);
|
||||
}
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\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);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\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);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,134 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,118 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,148 +0,0 @@
|
|||
<?php
|
||||
namespace app\adminapi\controller\device;
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use think\facade\Db;
|
||||
use think\response\Json;
|
||||
|
||||
class DeviceController extends BaseAdminController
|
||||
{
|
||||
public function add(): Json
|
||||
{
|
||||
//设备类型 1-土地监测 2-环境监测 3-水质监测
|
||||
$params = $this->request->post(['device_no','device_type','farmer_phone']);
|
||||
if(empty($params['device_no']) || empty($params['device_type']) || !in_array($params['device_type'],[1,2,3]) || empty($params['farmer_phone'])){
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
//获取农户信息
|
||||
$url = env('project.worker_domain').'/api/information/farmerInfoByPhone';
|
||||
$farmer = curl_post($url,[],['phone'=>$params['farmer_phone']]);
|
||||
if(empty($farmer) || $farmer['code'] == 0){
|
||||
return $this->fail('未找到农户');
|
||||
}
|
||||
$result = Db::name('farmer_device')->insert([
|
||||
'user_id' => $farmer['data']['id'],
|
||||
'user_name' => $farmer['data']['name'],
|
||||
'user_phone' => $farmer['data']['phone'],
|
||||
'user_address' => $farmer['data']['area_name'].$farmer['data']['street_name'].$farmer['data']['village_name'].$farmer['data']['brigade_name'].$farmer['data']['address'],
|
||||
'code' => $params['device_no'],
|
||||
'type' => $params['device_type'],
|
||||
'status' => 1,
|
||||
'create_time' => time()
|
||||
]);
|
||||
return $result ? $this->success('添加成功',[],1,1) : $this->fail('添加失败',[],1,1);
|
||||
}
|
||||
|
||||
public function lists(): Json
|
||||
{
|
||||
$params = $this->request->get(['device_no','farmer_name','farmer_phone','page_no','page_size']);
|
||||
//设置分页条件
|
||||
$pageNo = empty($params['page_no']) || $params['page_no'] < 0 ? 1 : $params['page_no'];
|
||||
$pageSize = empty($params['page_size']) || $params['page_size'] < 0 ? 10 : $params['page_size'];
|
||||
//设置搜索条件
|
||||
$search = [];
|
||||
if(!empty($params['device_no'])){
|
||||
$search[] = ['code','like','%'.$params['device_no'].'%'];
|
||||
}
|
||||
if(!empty($params['farmer_name'])){
|
||||
$search[] = ['user_name','like','%'.$params['farmer_name'].'%'];
|
||||
}
|
||||
if(!empty($params['farmer_phone'])){
|
||||
$search[] = ['user_phone','like','%'.$params['farmer_phone'].'%'];
|
||||
}
|
||||
$data = Db::name('farmer_device')->where($search)->page($pageNo,$pageSize)->order('create_time desc')->select()->each(function($item){
|
||||
$item['create_time'] = date('Y-m-d H:i:s',$item['create_time']);
|
||||
return $item;
|
||||
})->toArray();
|
||||
$count = Db::name('farmer_device')->where($search)->count();
|
||||
$result = [
|
||||
'count' => $count,
|
||||
'page_no' => $pageNo,
|
||||
'page_size' => $pageSize,
|
||||
'lists' => $data
|
||||
];
|
||||
return $this->success('请求成功',$result);
|
||||
}
|
||||
|
||||
public function detail(): Json
|
||||
{
|
||||
$params = $this->request->get(['id']);
|
||||
if(empty($params['id'])){
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
$data = Db::name('farmer_device')->where('id',$params['id'])->findOrEmpty();
|
||||
if(!empty($data)){
|
||||
$data['create_time'] = date('Y-m-d H:i:s',$data['create_time']);
|
||||
}
|
||||
return $this->success('请求成功',$data);
|
||||
}
|
||||
|
||||
public function deviceEnvData(): Json
|
||||
{
|
||||
$params = $this->request->get(['id','start_time','end_time']);
|
||||
if(empty($params['id']) || empty($params['start_time']) || empty($params['end_time'])){
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
$device = $data = Db::name('farmer_device')->where('id',$params['id'])->findOrEmpty();
|
||||
if(empty($device)){
|
||||
return $this->fail('未找到相关设备');
|
||||
}
|
||||
switch ($device['type']) {
|
||||
case 1:
|
||||
//获取数据
|
||||
$data = Db::name('farmer_land_env_data')->where('user_id',$device['user_id'])->whereBetweenTime('create_time', $params['start_time'], $params['end_time'])->order('id asc')->select()->each(function($item){
|
||||
$item['create_time'] = date('m-d',$item['create_time']);
|
||||
return $item;
|
||||
})->toArray();
|
||||
if(empty($data)){
|
||||
return $this->fail('暂无数据');
|
||||
}
|
||||
$result = [
|
||||
['title' => '土地温度','categories' => array_column($data,'create_time'),'series'=>[['name'=>'土地温度','data'=>array_column($data,'soil_temp')]],'max'=>max(array_column($data,'soil_temp'))],
|
||||
['title' => '土地湿度','categories' => array_column($data,'create_time'),'series'=>[['name'=>'土地湿度','data'=>array_column($data,'soil_mois')]],'max'=>max(array_column($data,'soil_mois'))],
|
||||
['title' => '土壤磷含量','categories' => array_column($data,'create_time'),'series'=>[['name'=>'土壤磷含量','data'=>array_column($data,'p_content')]],'max'=>max(array_column($data,'p_content'))],
|
||||
['title' => '土壤氮含量','categories' => array_column($data,'create_time'),'series'=>[['name'=>'土壤氮含量','data'=>array_column($data,'n_content')]],'max'=>max(array_column($data,'n_content'))],
|
||||
['title' => '土壤钾含量','categories' => array_column($data,'create_time'),'series'=>[['name'=>'土壤钾含量','data'=>array_column($data,'k_content')]],'max'=>max(array_column($data,'k_content'))],
|
||||
];
|
||||
break;
|
||||
case 2:
|
||||
//获取数据
|
||||
$data = Db::name('farmer_animal_env_data')->where('user_id',$device['user_id'])->whereBetweenTime('create_time', $params['start_time'], $params['end_time'])->order('id asc')->select()->each(function($item){
|
||||
$item['create_time'] = date('m-d',$item['create_time']);
|
||||
return $item;
|
||||
})->toArray();
|
||||
if(empty($data)){
|
||||
return $this->fail('暂无数据');
|
||||
}
|
||||
$result = [
|
||||
['title' => '环境温度','categories' => array_column($data,'create_time'),'series'=>[['name'=>'环境温度','data'=>array_column($data,'hj_temp')]],'max'=>max(array_column($data,'hj_temp'))],
|
||||
['title' => '环境湿度','categories' => array_column($data,'create_time'),'series'=>[['name'=>'环境湿度','data'=>array_column($data,'hj_humi')]],'max'=>max(array_column($data,'hj_humi'))],
|
||||
['title' => '氧气浓度','categories' => array_column($data,'create_time'),'series'=>[['name'=>'氧气浓度','data'=>array_column($data,'o_content')]],'max'=>max(array_column($data,'o_content'))],
|
||||
['title' => '二氧化碳浓度','categories' => array_column($data,'create_time'),'series'=>[['name'=>'二氧化碳浓度','data'=>array_column($data,'c_content')]],'max'=>max(array_column($data,'c_content'))],
|
||||
['title' => '光照强调','categories' => array_column($data,'create_time'),'series'=>[['name'=>'光照强调','data'=>array_column($data,'light')]],'max'=>max(array_column($data,'light'))],
|
||||
['title' => '大气压强','categories' => array_column($data,'create_time'),'series'=>[['name'=>'大气压强','data'=>array_column($data,'dqy')]],'max'=>max(array_column($data,'dqy'))],
|
||||
];
|
||||
break;
|
||||
case 3:
|
||||
//获取数据
|
||||
$data = Db::name('farmer_pond_env_data')->where('user_id',$device['user_id'])->whereBetweenTime('create_time', $params['start_time'], $params['end_time'])->order('id asc')->select()->each(function($item){
|
||||
$item['create_time'] = date('m-d',$item['create_time']);
|
||||
return $item;
|
||||
})->toArray();
|
||||
if(empty($data)){
|
||||
return $this->fail('暂无数据');
|
||||
}
|
||||
$result = [
|
||||
['title' => '水温','categories' => array_column($data,'create_time'),'series'=>[['name'=>'水温','data'=>array_column($data,'water_temp')]],'max'=>max(array_column($data,'water_temp'))],
|
||||
['title' => '酸碱度','categories' => array_column($data,'create_time'),'series'=>[['name'=>'酸碱度','data'=>array_column($data,'ph_content')]],'max'=>max(array_column($data,'ph_content'))],
|
||||
['title' => '溶解氧','categories' => array_column($data,'create_time'),'series'=>[['name'=>'溶解氧','data'=>array_column($data,'dissolved_oxygen')]],'max'=>max(array_column($data,'dissolved_oxygen'))],
|
||||
['title' => '电导率','categories' => array_column($data,'create_time'),'series'=>[['name'=>'电导率','data'=>array_column($data,'electric_conductivity')]],'max'=>max(array_column($data,'electric_conductivity'))],
|
||||
['title' => 'TDS','categories' => array_column($data,'create_time'),'series'=>[['name'=>'TDS','data'=>array_column($data,'tds')]],'max'=>max(array_column($data,'tds'))],
|
||||
];
|
||||
break;
|
||||
default:
|
||||
$result = [];
|
||||
}
|
||||
return $this->success('请求成功',$result);
|
||||
}
|
||||
}
|
|
@ -1,158 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace app\adminapi\controller\farmer;
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use think\facade\Db;
|
||||
use think\response\Json;
|
||||
|
||||
class FarmerController extends BaseAdminController
|
||||
{
|
||||
//农户列表
|
||||
public function lists(): Json
|
||||
{
|
||||
$params = $this->request->get(['farmer_name','farmer_phone','group_name','captain_name','page_no','page_size']);
|
||||
//设置分页条件
|
||||
$params['page_no'] = empty($params['page_no']) || $params['page_no'] < 0 ? 1 : $params['page_no'];
|
||||
$params['page_size'] = empty($params['page_size']) || $params['page_size'] < 0 ? 10 : $params['page_size'];
|
||||
//获取数据
|
||||
$url = env('project.worker_domain').'/api/information/farmerList';
|
||||
$data = curl_post($url,[],$params);
|
||||
if(empty($data) || $data['code'] == 0){
|
||||
return $this->fail('请求失败');
|
||||
}
|
||||
return json($data);
|
||||
}
|
||||
|
||||
//农户详情
|
||||
public function detail(): Json
|
||||
{
|
||||
$params = $this->request->get(['id']);
|
||||
if(empty($params['id'])){
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
//获取数据
|
||||
$url = env('project.worker_domain').'/api/information/farmerInfo';
|
||||
$result = curl_post($url,[],['user_id'=>$params['id']]);
|
||||
if(empty($result) || $result['code'] == 0){
|
||||
return $this->fail('请求失败');
|
||||
}
|
||||
$data = $result['data'];
|
||||
if(empty($data)){
|
||||
return $this->fail('数据为空');
|
||||
}
|
||||
$data['address'] = $data['area_name'].$data['street_name'].$data['village_name'].$data['brigade_name'].$data['address'];
|
||||
$str = [];
|
||||
$area = [];
|
||||
$item['farmer_type'] = implode('/',$str);
|
||||
$item['farmer_area'] = implode('/',$area);
|
||||
//判断是否是种植农户
|
||||
if($data['is_zz_user']){
|
||||
$str[] = '种植户';
|
||||
$area[] = $data['total_land_area'];
|
||||
$lands = $data['land_detail'];
|
||||
foreach($lands as $k=>$v) {
|
||||
//查找种植信息
|
||||
$land_crop = Db::name('farmer_land_crop')->where([
|
||||
['user_id','=',$params['id']],
|
||||
['land_id','=',$v['land_id']],
|
||||
['flag','=',1]
|
||||
])->order('id desc')->findOrEmpty();
|
||||
if(!empty($land_crop)){
|
||||
$lands[$k]['is_cropped'] = true;
|
||||
$lands[$k]['source_code'] = $land_crop['source_code'];
|
||||
$lands[$k]['crop_name'] = $land_crop['crop_name'];
|
||||
$lands[$k]['crop_variety'] = $land_crop['crop_variety'];
|
||||
$lands[$k]['crop_brand'] = $land_crop['crop_brand'];
|
||||
$lands[$k]['crop_yield'] = $land_crop['crop_yield'];
|
||||
$lands[$k]['seed_time'] = date('Y-m-d H:i:s',$land_crop['seed_time']);
|
||||
$lands[$k]['ripe_time'] = !empty($land_crop['ripe_time']) && !empty($land_crop['crop_yield']) ? date('Y-m-d H:i:s',$land_crop['ripe_time']) : $land_crop['ripe_time'];
|
||||
}else{
|
||||
$lands[$k]['is_cropped'] = false;
|
||||
}
|
||||
}
|
||||
$data['land_detail'] = $lands;
|
||||
}
|
||||
//判断是否是水产养殖户
|
||||
if($data['is_sc_user']){
|
||||
$str[] = '水产养殖户';
|
||||
$area[] = $data['total_pond_area'];
|
||||
$ponds = $data['pond_detail'];
|
||||
foreach($ponds as $k=>$v) {
|
||||
//获取养殖信息
|
||||
$breedData = Db::name('farmer_pond_breed')->where('user_id',$params['id'])->where('pond_id',$v['pond_id'])->sum('number');
|
||||
//获取捕捞信息
|
||||
$catchData = Db::name('farmer_pond_catch')->where('user_id',$params['id'])->where('pond_id',$v['pond_id'])->sum('number');
|
||||
if($breedData - $catchData != 0){
|
||||
$ponds[$k]['is_culture'] = true;
|
||||
$ponds[$k]['total_num'] = $breedData - $catchData;
|
||||
//获取水产养殖种类
|
||||
$fishKind = Db::name('farmer_pond_breed')->distinct(true)->where('user_id',$params['id'])->where('pond_id',$v['pond_id'])->limit(4)->column('kind');
|
||||
//获取水产养殖具体品种
|
||||
$fiskBreed = Db::name('farmer_pond_breed')->distinct(true)->where('user_id',$params['id'])->where('pond_id',$v['pond_id'])->limit(4)->column('breed');
|
||||
$ponds[$k]['kind'] = $fishKind;
|
||||
$ponds[$k]['breed'] = $fiskBreed;
|
||||
//获取养殖时间
|
||||
$firstBreed = Db::name('farmer_pond_breed')->where('user_id',$params['id'])->where('pond_id',$v['pond_id'])->findOrEmpty();
|
||||
$ponds[$k]['source_code'] = $firstBreed['source_code'];
|
||||
$ponds[$k]['create_time'] = date('Y-m-d H:i:s',$firstBreed['create_time']);
|
||||
}else{
|
||||
$ponds[$k]['is_culture'] = false;
|
||||
}
|
||||
}
|
||||
$data['pond_detail'] = $ponds;
|
||||
}
|
||||
//判断是否是家畜养殖户
|
||||
if($data['is_dw_user']){
|
||||
$str[] = '家畜养殖户';
|
||||
$area[] = $data['total_pasture_area'];
|
||||
//获取家畜养殖数量
|
||||
$animalCount = Db::name('farmer_animal_breed')->where('user_id',$params['id'])->count();
|
||||
//获取家畜是公的数量
|
||||
$maleCount = Db::name('farmer_animal_breed')->where('user_id',$params['id'])->where('animal_gender',1)->count();
|
||||
//获取家畜是母的数量
|
||||
$maternalCount = Db::name('farmer_animal_breed')->where('user_id',$params['id'])->where('animal_gender',2)->count();
|
||||
//获取家畜养殖种类
|
||||
$animalKind = Db::name('farmer_animal_breed')->distinct(true)->where('user_id',$params['id'])->limit(4)->column('animal_kind');
|
||||
//获取家畜养殖具体品种
|
||||
$animalBreed = Db::name('farmer_animal_breed')->distinct(true)->where('user_id',$params['id'])->limit(4)->column('animal_breed');
|
||||
$animalLists = Db::name('farmer_animal_breed')->where('user_id',$params['id'])->select()->toArray();
|
||||
$data['animal_detail'] = [
|
||||
'total_count' => $animalCount,
|
||||
'male_count' => $maleCount,
|
||||
'maternal_count' => $maternalCount,
|
||||
'kind' => $animalKind,
|
||||
'breed' => $animalBreed,
|
||||
'lists' => $animalLists
|
||||
];
|
||||
}
|
||||
//判断是否是家禽养殖户
|
||||
if($data['is_jq_user']){
|
||||
$str[] = '家禽养殖户';
|
||||
$area[] = $data['total_henhouse_area'];
|
||||
//获取家畜养殖数量
|
||||
$poultryCount = Db::name('farmer_poultry_breed')->where('user_id',$params['id'])->count();
|
||||
//获取家畜是公的数量
|
||||
$maleCount = Db::name('farmer_poultry_breed')->where('user_id',$params['id'])->where('gender',1)->count();
|
||||
//获取家畜是母的数量
|
||||
$maternalCount = Db::name('farmer_poultry_breed')->where('user_id',$params['id'])->where('gender',2)->count();
|
||||
//获取家畜养殖种类
|
||||
$poultryKind = Db::name('farmer_poultry_breed')->distinct(true)->where('user_id',$params['id'])->limit(4)->column('kind');
|
||||
//获取家畜养殖具体品种
|
||||
$poultryBreed = Db::name('farmer_poultry_breed')->distinct(true)->where('user_id',$params['id'])->limit(4)->column('breed');
|
||||
$poultryList = Db::name('farmer_poultry_breed')->where('user_id',$params['id'])->select()->toArray();
|
||||
$data['poultry_detail'] = [
|
||||
'total_count' => $poultryCount,
|
||||
'male_count' => $maleCount,
|
||||
'maternal_count' => $maternalCount,
|
||||
'kind' => $poultryKind,
|
||||
'breed' => $poultryBreed,
|
||||
'lists' => $poultryList
|
||||
];
|
||||
}
|
||||
$data['farmer_type'] = implode('/',$str);
|
||||
$data['farmer_area'] = implode('/',$area);
|
||||
unset($data['area_name'],$data['street_name'],$data['village_name'],$data['brigade_name'],$data['is_zz_user'],$data['is_dw_user'],$data['is_jq_user'],$data['is_sc_user'],$data['total_land_area'],$data['total_pasture_area'],$data['total_henhouse_area'],$data['total_pond_area']);
|
||||
return $this->success('请求成功',$data);
|
||||
}
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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());
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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());
|
||||
}
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,107 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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);
|
||||
}
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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);
|
||||
}
|
||||
}
|
|
@ -1,86 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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);
|
||||
}
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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);
|
||||
}
|
||||
}
|
|
@ -1,99 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,116 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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());
|
||||
}
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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);
|
||||
}
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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);
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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());
|
||||
}
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,84 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\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);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,112 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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);
|
||||
}
|
||||
}
|
|
@ -1,206 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,86 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\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);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
return [
|
||||
'listen' => [
|
||||
'AppInit' => [],
|
||||
'HttpRun' => [],
|
||||
'HttpEnd' => ['app\adminapi\listener\OperationLog'],
|
||||
'LogLevel' => [],
|
||||
'LogWrite' => [],
|
||||
]
|
||||
];
|
|
@ -1,89 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,114 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
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);
|
||||
}
|
||||
}
|
|
@ -1,78 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
<?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();
|
||||
}
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\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;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,98 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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 [];
|
||||
}
|
||||
}
|
|
@ -1,99 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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 [];
|
||||
}
|
||||
}
|
|
@ -1,206 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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 [];
|
||||
}
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,93 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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();
|
||||
}
|
||||
}
|
|
@ -1,80 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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;
|
||||
}
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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();
|
||||
}
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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();
|
||||
}
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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();
|
||||
}
|
||||
}
|
|
@ -1,105 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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' => '添加时间',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
|
@ -1,73 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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();
|
||||
}
|
||||
}
|
|
@ -1,86 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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();
|
||||
}
|
||||
}
|
|
@ -1,119 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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();
|
||||
}
|
||||
}
|
|
@ -1,79 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,143 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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);
|
||||
}
|
||||
}
|
|
@ -1,71 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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();
|
||||
}
|
||||
}
|
|
@ -1,145 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,76 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,76 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,108 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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 '系统日志';
|
||||
}
|
||||
}
|
|
@ -1,74 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,111 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\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' => '注册时间',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
|
@ -1,104 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,119 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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']);
|
||||
}
|
||||
}
|
|
@ -1,84 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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']);
|
||||
}
|
||||
}
|
|
@ -1,208 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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' => '想了解更多请添加客服',
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
}
|
|
@ -1,127 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,121 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\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;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue