update niucloud

This commit is contained in:
全栈小学生 2023-08-12 16:03:34 +08:00
parent e827f909aa
commit 00f6383d37
506 changed files with 19562 additions and 4433 deletions

View File

@ -0,0 +1,21 @@
<template>
<el-container class="w-screen h-screen">
<el-header>
<layout-header />
</el-header>
<el-main>
<router-view></router-view>
</el-main>
<el-footer>
<div class="w-full h-full bg-[#f7f7f7] flex items-center justify-center">
Footer
</div>
</el-footer>
</el-container>
</template>
<script lang="ts" setup>
import layoutHeader from '@/layout/default/components/header/index.vue'
</script>
<style lang="scss" scoped></style>

View File

@ -9,6 +9,7 @@ return [
//应用管理
'AppManage' => ['addon\hello_world\app\listener\AppManageListener'],
'SiteLayout' => ['addon\hello_world\app\listener\SiteLayout']
],
'subscribe' => [

View File

@ -19,5 +19,8 @@ return [
'hello_world_link' => 'hello world链接',
'hello_world_index' => 'hello world index 插件',
'hello_world_info' => 'hello world info 插件'
],
'dict_site_layout' => [
'hellow_world' => '你好'
]
];

View File

@ -21,7 +21,7 @@ class AppManageListener
{
/**
* 应用管理
* @param $data
* @return array
*/
public function handle()
{

View File

@ -0,0 +1,29 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud-admin.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace addon\hello_world\app\listener;
/**
* 站点端布局
*/
class SiteLayout
{
public function handle()
{
return [
"name" => get_lang("dict_site_layout.hellow_world"),
"key" => "hellow",
"image" => "static/resource/images/system/layout-hellow.jpg",
"sort" => 1
];
}
}

View File

@ -4,7 +4,6 @@
"key": "hello_world",
"version": "1.0.1",
"author": "niucloud",
"url": "https://www.niucloud.com",
"type": "addon",
"support_app": "niucloud"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -99,13 +99,13 @@ class ExceptionHandle extends Handle
'previous' => $e->getPrevious(),
]);
} elseif ($e instanceof ValidateException) {
return fail($e->getMessage(), []);
return fail($e->getMessage());
} else if($e instanceof UnexpectedValueException){
return fail($e->getMessage(), [], 401);
}else if($e instanceof AuthException || $e instanceof AdminException){
return fail($e->getMessage(), [], $e->getCode() ?: 400);
}else if($e instanceof ServerException){
return fail($e->getMessage(), [], http_code:$e->getCode());
return fail($e->getMessage(), http_code:$e->getCode());
}else {
return fail($e->getMessage(), $massageData);
}

View File

@ -28,13 +28,19 @@ class Request extends \think\Request
$filter_rule = '';
foreach ($params as $param) {
$key = $param[0];
// 解析name
if (strpos($key, '/')) {
[$name, $type] = explode('/', $key);
}else{
$name = $key;
}
$default = $param[1];
$item_filter = $param[2] ?? $filter;
$input[$key] = $this->paramFilter($this->param($key, $default, $filter_rule ?? ''), $item_filter);
//过滤后产生空字符串,按照默认值
if($input[$key] === '')
if($input[$name] === '')
{
$input[$key] = $default;
$input[$name] = $default;
}
}
return $input;
@ -55,13 +61,13 @@ class Request extends \think\Request
"/(<[^>]*)on[a-zA-Z]+\s*=([^>]*>)/isU",
"/select|join|where|drop|like|modify|rename|insert|update|table|database|alter|truncate|\'|\/\*|\.\.\/|\.\/|union|into|load_file|outfile/is"
];
$param = preg_replace($filter_rule, '', $param);
return $param;
return preg_replace($filter_rule, '', $param);
}
/**
* 获取登录用户的uid
* @param $params
* @param int $uid
* @return int|mixed|void
*/
public function uid(int $uid = 0)
{
@ -87,7 +93,7 @@ class Request extends \think\Request
/**
* 站点id
* @param int $site_id
* @param int|string|null $site_id
* @return int
*/
public function siteId(int|string|null $site_id = 0)
@ -116,7 +122,7 @@ class Request extends \think\Request
/**
* 定义站点类型
* @param string $site_type
* @param string $app_type
* @return mixed|string
*/
public function appType(string $app_type = ''){
@ -129,7 +135,7 @@ class Request extends \think\Request
/**
* 获取管理端token
* @return void
* @return array|string|null
*/
public function adminToken(){
return $this->header(system_name('admin_token_name'));
@ -195,4 +201,18 @@ class Request extends \think\Request
$param = $this->header();
$this->withHeader(array_merge($param, $data));
}
/**
* 授权信息
* @param $key
* @param $value
* @return mixed|string|void
*/
public function auth($key, $value = ''){
if (!empty($value)) {
static::$auth_info[$key] = $value;
} else {
return static::$auth_info[$key] ?? '';
}
}
}

View File

@ -11,5 +11,5 @@
return [
// 默认输出类型
'default_return_type' => 'json',
'default_return_type' => 'json',
];

View File

@ -11,11 +11,11 @@
return [
// 是否强制使用路由
'url_route_must' => true,
'url_route_must' => true,
// 合并路由规则
'route_rule_merge' => true,
'route_rule_merge' => true,
// 路由是否完全匹配
'route_complete_match' => true,
'route_complete_match' => true,
// 是否自动转换URL中的控制器和操作名
'url_convert' => false,
'url_convert' => false,
];

View File

@ -24,7 +24,7 @@ class Addon extends BaseAdminController
*/
public function getLocalAddonList()
{
return success(( new CoreAddonService() )->getLocalAddonList());
return success((new CoreAddonService())->getLocalAddonList());
}
/**
@ -33,36 +33,38 @@ class Addon extends BaseAdminController
*/
public function install($addon)
{
return ( new AddonService() )->install($addon);
return (new AddonService())->install($addon);
}
/**
* 执行安装
* @param $addon
* @return void
* @return Response
*/
public function execute($addon)
{
return ( new AddonService() )->executeInstall($addon);
return (new AddonService())->executeInstall($addon);
}
/**
* 插件安装环境检测
* @param $addon
* @return mixed
* @return Response
*/
public function installCheck($addon)
{
return ( new AddonService() )->installCheck($addon);
return (new AddonService())->installCheck($addon);
}
/**
* 查询插件安装状态
* @param $addon
* @param $key
* @return Response
*/
public function getInstallState($addon, $key)
{
return success(( new AddonService() )->getInstallState($addon, $key));
return success((new AddonService())->getInstallState($addon, $key));
}
/**
@ -71,7 +73,7 @@ class Addon extends BaseAdminController
*/
public function uninstall($addon)
{
( new AddonService() )->uninstall($addon);
(new AddonService())->uninstall($addon);
return success('ADDON_UNINSTALL_SUCCESS');
}
@ -82,18 +84,19 @@ class Addon extends BaseAdminController
public function lists()
{
$data = $this->request->params([
[ 'title', '' ],
['title', ''],
]);
return success(( new AddonService() )->getPage($data));
return success((new AddonService())->getPage($data));
}
/**
* 插件详情
* @param int $id
* @return Response
*/
public function info(int $id)
{
return success(( new AddonService() )->getInfo($id));
return success((new AddonService())->getInfo($id));
}
/**
@ -104,9 +107,28 @@ class Addon extends BaseAdminController
*/
public function setStatus(int $id, int $status)
{
( new AddonService() )->setStatus($id, $status);
(new AddonService())->setStatus($id, $status);
return success('SET_SUCCESS');
}
/**
* 下载插件
* @param $app_key
* @return Response
*/
public function download($addon){
(new AddonService())->download($addon);
return success('DOWNLOAD_SUCCESS');
}
/**
* 更新插件
* @param $app_key
* @return Response
*/
public function update($addon){
(new AddonService())->update($addon);
return success('DOWNLOAD_SUCCESS');
}
}

View File

@ -22,7 +22,7 @@ class App extends BaseAdminController
*/
public function getAppList()
{
return success(( new CoreAddonService() )->getAppList());
return success((new CoreAddonService())->getAppList());
}
}

View File

@ -21,7 +21,8 @@ class Config extends BaseAdminController
* 获取支付宝配置信息
* @return Response
*/
public function get(){
public function get()
{
return success((new AliappConfigService())->getAliappConfig());
}
@ -29,7 +30,8 @@ class Config extends BaseAdminController
* 设置支付宝配置信息
* @return Response
*/
public function set(){
public function set()
{
$data = $this->request->params([
['name', ''],
['app_id', ''],
@ -49,7 +51,8 @@ class Config extends BaseAdminController
* 静态资源
* @return Response
*/
public function static(){
public function static()
{
return success((new AliappConfigService())->static());
}
}

View File

@ -11,8 +11,6 @@
namespace app\adminapi\controller\applet;
use app\model\applet\AppletSiteVersion;
use app\service\admin\applet\AppletVersionService;
use app\service\admin\applet\AppletVersionSiteService;
use core\base\BaseAdminController;
use think\Response;
@ -31,16 +29,17 @@ class SiteVersion extends BaseAdminController
$data = $this->request->params([
]);
return success(( new AppletVersionSiteService())->getPage($data));
return success((new AppletVersionSiteService())->getPage($data));
}
/**
* 详情
* @param int $id
* @return Response
*/
public function info(int $id)
{
return success(( new AppletVersionSiteService() )->getInfo($id));
return success((new AppletVersionSiteService())->getInfo($id));
}
/**
@ -48,9 +47,19 @@ class SiteVersion extends BaseAdminController
* @param string $type
* @return Response
*/
public function getLastVersion(string $type){
return success(( new AppletVersionSiteService() )->getLastVersion($type));
public function getLastVersion(string $type)
{
return success((new AppletVersionSiteService())->getLastVersion($type));
}
/**
* 查看可升级的最高版本
* @param string $type
* @return Response
*/
public function getUpgradeVersion(string $type)
{
return success((new AppletVersionSiteService())->getUpgradeVersion($type));
}
}

View File

@ -13,6 +13,7 @@ namespace app\adminapi\controller\applet;
use app\service\admin\applet\AppletVersionService;
use core\base\BaseAdminController;
use Exception;
use think\Response;
/**
@ -29,16 +30,17 @@ class Version extends BaseAdminController
$data = $this->request->params([
]);
return success(( new AppletVersionService() )->getPage($data));
return success((new AppletVersionService())->getPage($data));
}
/**
* 详情
* @param int $id
* @return Response
*/
public function info(int $id)
{
return success(( new AppletVersionService() )->getInfo($id));
return success((new AppletVersionService())->getInfo($id));
}
/**
@ -48,13 +50,13 @@ class Version extends BaseAdminController
public function add()
{
$data = $this->request->params([
[ 'type', '' ],
[ 'desc', '' ],
[ 'status', '' ],
[ 'path', '' ],
[ 'version', '' ],
['type', ''],
['desc', ''],
['status', ''],
['path', ''],
['version', ''],
]);
$id = ( new AppletVersionService() )->add($data);
$id = (new AppletVersionService())->add($data);
return success('ADD_SUCCESS');
}
@ -66,45 +68,49 @@ class Version extends BaseAdminController
public function edit(int $id)
{
$data = $this->request->params([
[ 'desc', '' ],
[ 'status', '' ],
[ 'path', '' ],
[ 'version', '' ],
['desc', ''],
['status', ''],
['path', ''],
['version', ''],
]);
( new AppletVersionService() )->edit($id, $data);
(new AppletVersionService())->edit($id, $data);
return success('EDIT_SUCCESS');
}
/**
* 删除
* @param int $id
* @return Response
*/
public function del(int $id)
{
( new AppletVersionService() )->del($id);
(new AppletVersionService())->del($id);
return success('DELETE_SUCCESS');
}
/**
* 设置状态
* @param int $id
* @param $type
* @param $status
* @return Response
*/
public function setStatus(int $id, $status){
( new AppletVersionService() )->setStatus($id, $status);
public function setStatus(int $id, $status)
{
(new AppletVersionService())->setStatus($id, $status);
return success('EDIT_SUCCESS');
}
/**
* 小程序包上传
* @return Response
* @throws \Exception
* @throws Exception
*/
public function upload(){
public function upload()
{
$data = $this->request->params([
['file', 'file'],
], true);
return success(data:( new AppletVersionService() )->upload($data['file']));
]);
return success(data: (new AppletVersionService())->upload($data['file']));
}
}

View File

@ -13,6 +13,7 @@ namespace app\adminapi\controller\applet;
use app\service\admin\applet\AppletDownloadService;
use core\base\BaseAdminController;
use think\response\File;
/**
* 小程序版本下载控制器
@ -23,9 +24,10 @@ class VersionDownload extends BaseAdminController
/**
* 下载
* @param $id
* @return mixed
* @return File
*/
public function download($id){
public function download($id)
{
return (new AppletDownloadService())->download($id);
}

View File

@ -29,21 +29,22 @@ class Article extends BaseAdminController
public function lists()
{
$data = $this->request->params([
[ 'title', '' ],
[ 'category_id', '' ],
[ 'sort', '' ],
[ 'is_show', '' ],
['title', ''],
['category_id', ''],
['sort', ''],
['is_show', ''],
]);
return success(( new ArticleService() )->getPage($data));
return success((new ArticleService())->getPage($data));
}
/**
* 文章详情
* @param int $id
* @return Response
*/
public function info(int $id)
{
return success(( new ArticleService() )->getInfo($id));
return success((new ArticleService())->getInfo($id));
}
/**
@ -53,20 +54,20 @@ class Article extends BaseAdminController
public function add()
{
$data = $this->request->params([
[ 'title', '' ],
[ 'category_id', '' ],
[ 'intro', '' ],
[ 'summary', '' ],
[ 'image', '' ],
[ 'author', '' ],
[ 'content', '' , false],
[ 'visit_virtual', 0 ],
[ 'is_show', 1 ],
[ 'sort', 0 ],
['title', ''],
['category_id', ''],
['intro', ''],
['summary', ''],
['image', ''],
['author', ''],
['content', '', false],
['visit_virtual', 0],
['is_show', 1],
['sort', 0],
]);
$this->validate($data, 'app\validate\article\Article.add');
$id = ( new ArticleService() )->add($data);
return success('ADD_SUCCESS', [ 'id' => $id ]);
$id = (new ArticleService())->add($data);
return success('ADD_SUCCESS', ['id' => $id]);
}
/**
@ -77,30 +78,31 @@ class Article extends BaseAdminController
public function edit(int $id)
{
$data = $this->request->params([
[ 'title', '' ],
[ 'category_id', '' ],
[ 'intro', '' ],
[ 'summary', '' ],
[ 'image', '' ],
[ 'author', '' ],
[ 'content', '' , false],
[ 'visit_virtual', 0 ],
[ 'is_show', 1 ],
[ 'sort', 0 ],
['title', ''],
['category_id', ''],
['intro', ''],
['summary', ''],
['image', ''],
['author', ''],
['content', '', false],
['visit_virtual', 0],
['is_show', 1],
['sort', 0],
]);
$this->validate($data, 'app\validate\article\Article.edit');
( new ArticleService() )->edit($id, $data);
(new ArticleService())->edit($id, $data);
return success('EDIT_SUCCESS');
}
/**
* 文章删除
* @param int $id
* @return Response
*/
public function del(int $id)
{
( new ArticleService() )->del($id);
(new ArticleService())->del($id);
return success('DELETE_SUCCESS');
}

View File

@ -21,7 +21,8 @@ class ArticleCategory extends BaseAdminController
* 文章分类列表
* @return Response
*/
public function lists(){
public function lists()
{
$data = $this->request->params([
['name', ''],
]);
@ -32,15 +33,18 @@ class ArticleCategory extends BaseAdminController
* 查询所有分类(文章添加,编辑,索引)
* @return Response
*/
public function all(){
public function all()
{
return success((new ArticleCategoryService())->getAll());
}
/**
* 文章分类详情
* @param int $id
* @return Response
*/
public function info(int $id){
public function info(int $id)
{
return success((new ArticleCategoryService())->getInfo($id));
}
@ -48,7 +52,8 @@ class ArticleCategory extends BaseAdminController
* 添加文章分类
* @return Response
*/
public function add(){
public function add()
{
$data = $this->request->params([
['name', ''],
['is_show', 1],
@ -61,10 +66,11 @@ class ArticleCategory extends BaseAdminController
/**
* 文章分类编辑
* @param int $category_id //分类id
* @param int $category_id //分类id
* @return Response
*/
public function edit(int $category_id){
public function edit(int $category_id)
{
$data = $this->request->params([
['name', ''],
['is_show', 1],
@ -78,8 +84,10 @@ class ArticleCategory extends BaseAdminController
/**
* 文章分类删除
* @param int $category_id
* @return Response
*/
public function del(int $category_id){
public function del(int $category_id)
{
(new ArticleCategoryService())->del($category_id);
return success('DELETE_SUCCESS');
}

View File

@ -14,6 +14,10 @@ namespace app\adminapi\controller\auth;
use app\service\admin\auth\AuthService;
use app\service\admin\auth\AuthSiteService;
use core\base\BaseAdminController;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\Response;
class Auth extends BaseAdminController
@ -22,15 +26,17 @@ class Auth extends BaseAdminController
/**
* 登录用户菜单列表的接口
*/
public function authMenuList(){
public function authMenuList()
{
return success((new AuthService())->getAuthMenuList(1));
}
/**
* 获取登录用户信息
* @return \think\Response
* @return Response
*/
public function get(){
public function get()
{
return success((new AuthService())->getAuthInfo());
}
@ -38,9 +44,10 @@ class Auth extends BaseAdminController
/**
* 修改登录用户信息
* @param $field
* @return \think\Response
* @return Response
*/
public function modify($field){
public function modify($field)
{
$data = $this->request->params([
['value', ''],
['field', $field]
@ -54,7 +61,8 @@ class Auth extends BaseAdminController
/**
* 更新用户
*/
public function edit(){
public function edit()
{
$data = $this->request->params([
['real_name', ''],
['head_img', ''],
@ -67,20 +75,22 @@ class Auth extends BaseAdminController
/**
* 获取当前登录站点信息
* @return \think\Response
* @return Response
*/
public function site(){
public function site()
{
return success((new AuthSiteService())->getSiteInfo());
}
/**
* 选择可以选择的页面
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @return Response
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function getShowMenuList(){
public function getShowMenuList()
{
return success((new AuthSiteService())->getShowMenuList());
}
}

View File

@ -21,7 +21,8 @@ class H5 extends BaseAdminController
* 获取H5配置信息
* @return Response
*/
public function get(){
public function get()
{
return success((new H5Service())->getH5());
}
@ -29,7 +30,8 @@ class H5 extends BaseAdminController
* 设置H5配置信息
* @return Response
*/
public function set(){
public function set()
{
$data = $this->request->params([
['is_open', 0],
]);

View File

@ -13,6 +13,7 @@ namespace app\adminapi\controller\diy;
use app\service\admin\diy\DiyConfigService;
use core\base\BaseAdminController;
use think\Response;
/**
@ -24,24 +25,24 @@ class Config extends BaseAdminController
{
/**
* 获取底部导航
* @return \think\Response
* @return Response
*/
public function getBottom()
{
return success(( new DiyConfigService() )->getBottomConfig());
return success((new DiyConfigService())->getBottomConfig());
}
/**
* 设置底部导航
* @return \think\Response
* @return Response
*/
public function setBottom()
{
$data = $this->request->params([
[ 'menu', [] ]
['menu', []]
]);
( new DiyConfigService() )->setBottomConfig($data[ 'menu' ]);
return success('SUCCESS');
(new DiyConfigService())->setBottomConfig($data['menu']);
return success();
}
}

View File

@ -13,6 +13,11 @@ namespace app\adminapi\controller\diy;
use app\service\admin\diy\DiyService;
use core\base\BaseAdminController;
use Exception;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\Response;
/**
@ -24,117 +29,120 @@ class Diy extends BaseAdminController
{
/**
* @notes 获取自定义页面分页列表
* @return \think\Response
* @return Response
*/
public function lists()
{
$data = $this->request->params([
[ "title", "" ],
[ "type", "" ],
[ 'mode', '' ]
["title", ""],
["type", ""],
['mode', '']
]);
return success(( new DiyService() )->getPage($data));
return success((new DiyService())->getPage($data));
}
/**
* @notes 获取自定义页面列表
* @return \think\Response
* @return Response
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function getList()
{
$data = $this->request->params([
[ "title", "" ],
[ "type", "" ],
[ 'mode', '' ]
["title", ""],
["type", ""],
['mode', '']
]);
return success(( new DiyService() )->getList($data));
return success((new DiyService())->getList($data));
}
/**
* 自定义页面详情
* @param int $id
* @return \think\Response
* @return Response
*/
public function info(int $id)
{
return success(( new DiyService() )->getInfo($id));
return success((new DiyService())->getInfo($id));
}
/**
* 添加自定义页面
* @return \think\Response
* @return Response
*/
public function add()
{
$data = $this->request->params([
[ "title", "" ],
[ "name", "" ],
[ "type", "" ],
[ 'template', '' ],
[ 'mode', 'diy' ], // 页面展示模式diy自定义fixed固定
[ "value", "" ],
[ 'is_default', 0 ],
[ 'is_change', '' ]
["title", ""],
["name", ""],
["type", ""],
['template', ''],
['mode', 'diy'], // 页面展示模式diy自定义fixed固定
["value", ""],
['is_default', 0],
['is_change', '']
]);
$this->validate($data, 'app\validate\diy\Diy.add');
$id = ( new DiyService() )->add($data);
return success('ADD_SUCCESS', [ 'id' => $id ]);
$id = (new DiyService())->add($data);
return success('ADD_SUCCESS', ['id' => $id]);
}
/**
* 自定义页面编辑
* @param $id
* @return \think\Response
* @return Response
*/
public function edit($id)
{
$data = $this->request->params([
[ "title", "" ],
[ "name", "" ],
[ "value", "" ],
[ 'is_change', '' ]
["title", ""],
["name", ""],
["value", ""],
['is_change', '']
]);
$this->validate($data, 'app\validate\diy\Diy.edit');
( new DiyService() )->edit($id, $data);
(new DiyService())->edit($id, $data);
return success('MODIFY_SUCCESS');
}
/**
* 自定义页面删除
* @param $id
* @return \think\Response
* @param int $id
* @return Response
*/
public function del(int $id)
{
( new DiyService() )->del($id);
(new DiyService())->del($id);
return success('DELETE_SUCCESS');
}
/**
* 设为使用
* @param $id
* @return \think\Response
* @throws \Exception
* @return Response
* @throws Exception
*/
public function setUse($id)
{
( new DiyService() )->setUse($id);
(new DiyService())->setUse($id);
return success('MODIFY_SUCCESS');
}
/**
* 获取页面初始化数据
* @return \think\Response
* @return Response
*/
public function getPageInit()
{
$params = $this->request->params([
[ 'id', "" ],
[ "name", "" ],
[ "type", "" ],
[ 'template', '' ],
[ "title", "" ],
['id', ""],
["name", ""],
["type", ""],
['template', ''],
["title", ""],
]);
$diy_service = new DiyService();
@ -152,14 +160,14 @@ class Diy extends BaseAdminController
/**
* 获取页面模板
* @return \think\Response
* @return Response
*/
public function getTemplate()
{
$params = $this->request->params([
[ 'type', "" ], // 页面类型模板
[ 'action', '' ], // 页面是否装修标识为空标识不装修decorate装修
[ 'mode', '' ] // 页面展示模式diy自定义fixed固定
['type', ""], // 页面类型模板
['action', ''], // 页面是否装修标识为空标识不装修decorate装修
['mode', ''] // 页面展示模式diy自定义fixed固定
]);
$diy_service = new DiyService();
return success($diy_service->getTemplate($params));
@ -168,13 +176,14 @@ class Diy extends BaseAdminController
/**
* 修改页面分享内容
* @param int $id
* @return Response
*/
public function modifyShare(int $id)
{
$data = $this->request->params([
[ "share", "" ],
["share", ""],
]);
( new DiyService() )->modifyShare($id, $data);
(new DiyService())->modifyShare($id, $data);
return success('MODIFY_SUCCESS');
}
@ -183,7 +192,7 @@ class Diy extends BaseAdminController
*/
public function getDecoratePage()
{
return success(( new DiyService() )->getDecoratePage());
return success((new DiyService())->getDecoratePage());
}
/**
@ -192,12 +201,12 @@ class Diy extends BaseAdminController
public function changeTemplate()
{
$data = $this->request->params([
[ "id", "" ],
[ 'type', '' ], // 页面类型
[ 'mode', '' ], // 页面展示模式diy自定义fixed固定
[ 'template', '' ] // 模板名称
["id", ""],
['type', ''], // 页面类型
['mode', ''], // 页面展示模式diy自定义fixed固定
['template', ''] // 模板名称
]);
return success(( new DiyService() )->changeTemplate($data));
return success((new DiyService())->changeTemplate($data));
}
/**
@ -206,10 +215,10 @@ class Diy extends BaseAdminController
public function getPreviewData()
{
$data = $this->request->params([
[ "id", "" ],
[ 'name', '' ]
["id", ""],
['name', '']
]);
$res = ( new DiyService() )->getPreviewData($data);
$res = (new DiyService())->getPreviewData($data);
return success($res);
}

View File

@ -13,6 +13,7 @@ namespace app\adminapi\controller\diy;
use app\service\admin\diy\DiyRouteService;
use core\base\BaseAdminController;
use think\Response;
/**
@ -24,80 +25,81 @@ class DiyRoute extends BaseAdminController
{
/**
* @notes 获取自定义路由表列表
* @return \think\Response
* @return Response
*/
public function lists()
{
$data = $this->request->params([
[ "title", "" ],
["title", ""],
]);
return success(( new DiyRouteService() )->getList($data));
return success((new DiyRouteService())->getList($data));
}
/**
* 自定义路由表详情
* @param int $id
* @return \think\Response
* @return Response
*/
public function info(int $id)
{
return success(( new DiyRouteService() )->getInfo($id));
return success((new DiyRouteService())->getInfo($id));
}
/**
* 自定义路由表详情
* @param string $name
* @return Response
*/
public function getInfoByName(string $name)
{
return success(( new DiyRouteService() )->getInfoByName($name));
return success((new DiyRouteService())->getInfoByName($name));
}
/**
* 添加自定义路由表
* @return \think\Response
* @return Response
*/
public function add()
{
$data = $this->request->params([
[ "title", "" ],
[ "name", "" ],
[ "page", "" ],
[ "share", "" ],
[ "is_share", "" ]
["title", ""],
["name", ""],
["page", ""],
["share", ""],
["is_share", ""]
]);
$this->validate($data, 'app\validate\diy\DiyRoute.add');
$id = ( new DiyRouteService() )->add($data);
return success('ADD_SUCCESS', [ 'id' => $id ]);
$id = (new DiyRouteService())->add($data);
return success('ADD_SUCCESS', ['id' => $id]);
}
/**
* 自定义路由表编辑
* @param $id
* @return \think\Response
* @return Response
*/
public function edit($id)
{
$data = $this->request->params([
[ "title", "" ],
[ "name", "" ],
[ "page", "" ],
[ "share", "" ],
[ "is_share", "" ]
["title", ""],
["name", ""],
["page", ""],
["share", ""],
["is_share", ""]
]);
$this->validate($data, 'app\validate\diy\DiyRoute.edit');
( new DiyRouteService() )->edit($id, $data);
(new DiyRouteService())->edit($id, $data);
return success('MODIFY_SUCCESS');
}
/**
* 自定义路由表删除
* @param $id
* @return \think\Response
* @param int $id
* @return Response
*/
public function del(int $id)
{
( new DiyRouteService() )->del($id);
(new DiyRouteService())->del($id);
return success('DELETE_SUCCESS');
}
@ -107,14 +109,14 @@ class DiyRoute extends BaseAdminController
public function modifyShare()
{
$data = $this->request->params([
[ 'share', '' ],
[ 'title', '' ],
[ 'name', '' ],
[ 'page', '' ],
[ 'is_share', 0 ],
[ 'sort', 0 ]
['share', ''],
['title', ''],
['name', ''],
['page', ''],
['is_share', 0],
['sort', 0]
]);
( new DiyRouteService() )->modifyShare($data);
(new DiyRouteService())->modifyShare($data);
return success('MODIFY_SUCCESS');
}

View File

@ -13,6 +13,10 @@ namespace app\adminapi\controller\generator;
use app\service\admin\generator\GenerateService;
use core\base\BaseController;
use Exception;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\Response;
/**
@ -30,34 +34,38 @@ class Generator extends BaseController
{
$data = $this->request->params([
[ 'table_name', '' ],
[ 'table_content', '' ],
['table_name', ''],
['table_content', ''],
]);
return success(( new GenerateService() )->getPage($data));
return success((new GenerateService())->getPage($data));
}
/**
* 代码生成详情
* @param int $id
* @return Response
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function info(int $id)
{
return success(( new GenerateService() )->getInfo($id));
return success((new GenerateService())->getInfo($id));
}
/**
* 添加代码生成
* @return Response
* @throws Exception
*/
public function add()
{
$data = $this->request->params([
[ "table_name", "" ],
["table_name", ""],
], false);
$this->validate($data, 'app\validate\generator\Generator.add');
$id = ( new GenerateService() )->add($data);
return success('ADD_SUCCESS', [ 'id' => $id ]);
$id = (new GenerateService())->add($data);
return success('ADD_SUCCESS', ['id' => $id]);
}
/**
@ -68,15 +76,15 @@ class Generator extends BaseController
public function edit($id)
{
$data = $this->request->params([
[ "table_name", "" ],
[ "table_content", "" ],
[ "class_name", "" ],
[ "module_name", "" ],
[ "edit_type", "1" ],
[ "table_column", "" ],
["table_name", ""],
["table_content", ""],
["class_name", ""],
["module_name", ""],
["edit_type", "1"],
["table_column", ""],
], false);
$this->validate($data, 'app\validate\generator\Generator.edit');
( new GenerateService() )->edit($id, $data);
(new GenerateService())->edit($id, $data);
return success('MODIFY_SUCCESS');
}
@ -87,7 +95,7 @@ class Generator extends BaseController
*/
public function del(int $id)
{
( new GenerateService() )->del($id);
(new GenerateService())->del($id);
return success('DELETE_SUCCESS');
}
@ -98,10 +106,10 @@ class Generator extends BaseController
public function create()
{
$data = $this->request->params([
[ 'id', '' ],
['id', ''],
]);
$data = ( new GenerateService() )->generate($data);
$data = (new GenerateService())->generate($data);
return success('ADD_SUCCESS', $data);
}
@ -112,10 +120,10 @@ class Generator extends BaseController
public function tableList()
{
$data = $this->request->params([
[ "name", "" ],
[ "comment", "" ],
["name", ""],
["comment", ""],
]);
$list = ( new GenerateService() )->tableList($data);
$list = (new GenerateService())->tableList($data);
return success('ADD_SUCCESS', $list);
}

View File

@ -23,7 +23,8 @@ class Captcha extends BaseAdminController
* 创建验证码
* @return Response
*/
public function create(){
public function create()
{
return success((new CaptchaService())->create());
}
@ -31,7 +32,8 @@ class Captcha extends BaseAdminController
* 一次校验验证码
* @return Response
*/
public function check(){
public function check()
{
return success((new CaptchaService())->check());
}
@ -39,7 +41,8 @@ class Captcha extends BaseAdminController
* 二次校验验证码
* @return Response
*/
public function verification(){
public function verification()
{
return success((new CaptchaService())->verification());
}

View File

@ -12,7 +12,6 @@
namespace app\adminapi\controller\login;
use app\service\admin\auth\ConfigService;
use app\service\core\upload\CoreImageService;
use core\base\BaseAdminController;
use think\Response;
@ -27,7 +26,7 @@ class Config extends BaseAdminController
*/
public function getConfig()
{
return success(( new ConfigService() )->getConfig());
return success((new ConfigService())->getConfig());
}
/**
@ -37,12 +36,12 @@ class Config extends BaseAdminController
public function setConfig()
{
$data = $this->request->params([
[ 'is_captcha', 0 ],
[ 'is_site_captcha', 0 ],
[ 'bg', '' ],
[ 'site_bg', '' ],
['is_captcha', 0],
['is_site_captcha', 0],
['bg', ''],
['site_bg', ''],
]);
( new ConfigService() )->setConfig($data);
(new ConfigService())->setConfig($data);
return success('MODIFY_SUCCESS');
}
}

View File

@ -26,12 +26,12 @@ class Login extends BaseAdminController
{
$data = $this->request->params([
[ 'username', '' ],
[ 'password', '' ],
['username', ''],
['password', ''],
]);
//参数验证
//验证码验证
$result = ( new LoginService() )->login($data[ 'username' ], $data[ 'password' ], $app_type);
$result = (new LoginService())->login($data['username'], $data['password'], $app_type);
if (!$result) {
//账号密码错误...., 重置验证码
return fail('USER_ERROR');
@ -46,18 +46,17 @@ class Login extends BaseAdminController
*/
public function logout()
{
( new LoginService )->logout();
(new LoginService)->logout();
return success('LOGOUT');
}
/**
* 获取登录设置
* @return Response
*/
public function getConfig()
{
return success(( new ConfigService() )->getConfig());
return success((new ConfigService())->getConfig());
}
}

View File

@ -26,13 +26,13 @@ class Account extends BaseAdminController
public function point()
{
$data = $this->request->params([
[ 'member_id', '' ],
[ 'from_type', '' ],
[ 'create_time', [] ],
[ 'keywords', '' ],
['member_id', ''],
['from_type', ''],
['create_time', []],
['keywords', ''],
]);
$data[ 'account_type' ] = 'point';
return success(( new MemberAccountService() )->getPage($data));
$data['account_type'] = 'point';
return success((new MemberAccountService())->getPage($data));
}
/**
@ -41,23 +41,22 @@ class Account extends BaseAdminController
public function sumPoint()
{
$data = $this->request->params([
[ 'member_id', '' ],
['member_id', ''],
]);
$member_account_service = new MemberAccountService();
$member_service = new MemberService();
if(empty($data['member_id']))
{
if (empty($data['member_id'])) {
$commission_data = [
'point_get' => $member_service->getSum('point_get'),//累计
'point_use' => abs($member_account_service->getExpensesSumAccount(MemberAccountTypeDict::POINT)),
];
return success($commission_data);
}else{
} else {
$info = $member_account_service->getMemberAccountInfo($data['member_id']);
$commission_data = [
'point_get' => $info['point_get'],
'point_use' => abs($member_account_service->getExpensesSumAccount(MemberAccountTypeDict::POINT,$data['member_id'])),
'point_use' => abs($member_account_service->getExpensesSumAccount(MemberAccountTypeDict::POINT, $data['member_id'])),
];
return success($commission_data);
}
@ -70,13 +69,13 @@ class Account extends BaseAdminController
public function balance()
{
$data = $this->request->params([
[ 'member_id', '' ],
[ 'from_type', '' ],
[ 'create_time', [] ],
[ 'keywords', '' ],
['member_id', ''],
['from_type', ''],
['create_time', []],
['keywords', ''],
]);
$data[ 'account_type' ] = 'balance';
return success(( new MemberAccountService() )->getPage($data));
$data['account_type'] = 'balance';
return success((new MemberAccountService())->getPage($data));
}
/**
@ -86,13 +85,13 @@ class Account extends BaseAdminController
public function money()
{
$data = $this->request->params([
[ 'member_id', '' ],
[ 'from_type', '' ],
[ 'create_time', [] ],
[ 'keywords', '' ],
['member_id', ''],
['from_type', ''],
['create_time', []],
['keywords', ''],
]);
$data[ 'account_type' ] = 'money';
return success(( new MemberAccountService() )->getPage($data));
$data['account_type'] = 'money';
return success((new MemberAccountService())->getPage($data));
}
/**
@ -101,12 +100,12 @@ class Account extends BaseAdminController
public function adjustPoint()
{
$data = $this->request->params([
[ 'member_id', '' ],
[ 'account_data', 0 ],
[ 'memo', '' ],
['member_id', ''],
['account_data', 0],
['memo', ''],
]);
$res = ( new MemberAccountService() )->adjustPoint($data);
return success('SUCCESS', [ 'id' => $res ]);
$res = (new MemberAccountService())->adjustPoint($data);
return success('SUCCESS', ['id' => $res]);
}
/**
@ -115,12 +114,12 @@ class Account extends BaseAdminController
public function adjustBalance()
{
$data = $this->request->params([
[ 'member_id', '' ],
[ 'account_data', 0 ],
[ 'memo', '' ],
['member_id', ''],
['account_data', 0],
['memo', ''],
]);
$res = ( new MemberAccountService() )->adjustBalance($data);
return success('SUCCESS', [ 'id' => $res ]);
$res = (new MemberAccountService())->adjustBalance($data);
return success('SUCCESS', ['id' => $res]);
}
/**
@ -130,12 +129,12 @@ class Account extends BaseAdminController
public function adjustMoney()
{
$data = $this->request->params([
[ 'member_id', '' ],
[ 'account_data', 0 ],
[ 'memo', '' ],
['member_id', ''],
['account_data', 0],
['memo', ''],
]);
$res = ( new MemberAccountService() )->adjustMoney($data);
return success('SUCCESS', [ 'id' => $res ]);
$res = (new MemberAccountService())->adjustMoney($data);
return success('SUCCESS', ['id' => $res]);
}
/**
@ -145,13 +144,13 @@ class Account extends BaseAdminController
public function commission()
{
$data = $this->request->params([
[ 'member_id', '' ],
[ 'from_type', '' ],
[ 'create_time', [] ],
[ 'keywords', '' ],
['member_id', ''],
['from_type', ''],
['create_time', []],
['keywords', ''],
]);
$data[ 'account_type' ] = 'commission';
return success(( new MemberAccountService() )->getPage($data));
$data['account_type'] = 'commission';
return success((new MemberAccountService())->getPage($data));
}
/**
@ -160,13 +159,12 @@ class Account extends BaseAdminController
public function sumCommission()
{
$data = $this->request->params([
[ 'member_id', '' ],
['member_id', ''],
]);
$member_account_service = new MemberAccountService();
$member_service = new MemberService();
if(empty($data['member_id']))
{
if (empty($data['member_id'])) {
$commission_data = [
'total_commission' => $member_service->getSum('commission_get'),//累计
'commission' => $member_service->getSum('commission'),//未提现
@ -174,7 +172,7 @@ class Account extends BaseAdminController
'commission_cash_outing' => $member_service->getSum('commission_cash_outing'),//提现中
];
return success($commission_data);
}else{
} else {
$info = $member_account_service->getMemberAccountInfo($data['member_id']);
$commission_data = [
'commission' => $info['commission'],
@ -192,29 +190,29 @@ class Account extends BaseAdminController
public function sumBalance()
{
$data = $this->request->params([
[ 'member_id', '' ],
['member_id', ''],
]);
$member_account_service = new MemberAccountService();
if(empty($data['member_id']))
{
if (empty($data['member_id'])) {
$balance_data = [
MemberAccountTypeDict::BALANCE => number_format($member_account_service->getSumAccount(MemberAccountTypeDict::BALANCE), 2),
MemberAccountTypeDict::MONEY => number_format($member_account_service->getSumAccount(MemberAccountTypeDict::MONEY), 2),
];
return success($balance_data);
}else{
} else {
return success($member_account_service->getMemberAccountInfo($data['member_id']));
}
}
/**
* 账户变化类型
* @param $account_type
* @param string $account_type
* @return Response
*/
public function changeType(string $account_type)
{
$res = ( new MemberAccountService() )->getFromType($account_type);
$res = (new MemberAccountService())->getFromType($account_type);
return success($res);
}

View File

@ -54,7 +54,7 @@ class CashOut extends BaseAdminController
['refuse_reason', ''],
]);
(new MemberCashOutService())->audit($id, $action, $data);
return success('SUCCESS');
return success();
}
/**
@ -79,14 +79,15 @@ class CashOut extends BaseAdminController
['transfer_type', '']
]);
(new MemberCashOutService())->transfer($id, $data);
return success('SUCCESS');
return success();
}
/**
* 状态
* @return Response
*/
public function getStatusList(){
public function getStatusList()
{
return success(MemberCashOutDict::getStatus());
}

View File

@ -23,7 +23,7 @@ class Config extends BaseAdminController
*/
public function getLoginConfig()
{
return success(( new MemberConfigService() )->getLoginConfig());
return success((new MemberConfigService())->getLoginConfig());
}
/**
@ -33,14 +33,14 @@ class Config extends BaseAdminController
public function setLoginConfig()
{
$data = $this->request->params([
[ 'is_username', 1 ],
[ 'is_mobile', 0 ],
[ 'is_auth_register', 1 ],
[ 'is_bind_mobile', 0 ],
[ 'agreement_show', 0 ]
['is_username', 1],
['is_mobile', 0],
['is_auth_register', 1],
['is_bind_mobile', 0],
['agreement_show', 0]
]);
$this->validate($data, 'app\validate\member\LoginConfig.set');
( new MemberConfigService() )->setLoginConfig($data);
(new MemberConfigService())->setLoginConfig($data);
return success('MODIFY_SUCCESS');
}
@ -50,7 +50,7 @@ class Config extends BaseAdminController
*/
public function getCashOutConfig()
{
return success(( new MemberConfigService() )->getCashOutConfig());
return success((new MemberConfigService())->getCashOutConfig());
}
/**
@ -60,15 +60,15 @@ class Config extends BaseAdminController
public function setCashOutConfig()
{
$data = $this->request->params([
[ 'is_open', 0 ], //是否开启
[ 'min', 0.01 ], //最低提现金额
[ 'rate', 0 ], //提现手续费比率
[ 'is_auto_verify', 0 ], //是否自动审核
[ 'is_auto_transfer', 0 ], //是否自动转账
[ 'transfer_type', [] ] //转账方式
['is_open', 0], //是否开启
['min', 0.01], //最低提现金额
['rate', 0], //提现手续费比率
['is_auto_verify', 0], //是否自动审核
['is_auto_transfer', 0], //是否自动转账
['transfer_type', []] //转账方式
]);
$this->validate($data, 'app\validate\member\CashOutConfig.set');
( new MemberConfigService() )->setCashOutConfig($data);
(new MemberConfigService())->setCashOutConfig($data);
return success('SET_SUCCESS');
}
@ -76,21 +76,23 @@ class Config extends BaseAdminController
* 获取会员配置
* @return Response
*/
public function getMemberConfig(){
return success(( new MemberConfigService() )->getMemberConfig());
public function getMemberConfig()
{
return success((new MemberConfigService())->getMemberConfig());
}
/**
* 设置会员配置
* @return Response
*/
public function setMemberConfig(){
public function setMemberConfig()
{
$data = $this->request->params([
[ 'prefix', '' ],
[ 'length', 10 ]
['prefix', ''],
['length', 10]
]);
$this->validate($data, 'app\validate\member\MemberConfig.set');
( new MemberConfigService() )->setMemberConfig($data);
(new MemberConfigService())->setMemberConfig($data);
return success('MODIFY_SUCCESS');
}
}

View File

@ -16,6 +16,9 @@ use app\dict\member\MemberRegisterChannelDict;
use app\dict\member\MemberRegisterTypeDict;
use app\service\admin\member\MemberService;
use core\base\BaseAdminController;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\Response;
class Member extends BaseAdminController
@ -38,7 +41,7 @@ class Member extends BaseAdminController
/**
* 会员详情
* @param int $member_id
* @param int $id
* @return Response
*/
public function info(int $id)
@ -113,7 +116,7 @@ class Member extends BaseAdminController
/**
* 会员使用场景
* @return array|mixed|string
* @return Response
*/
public function getMemberRegisterType()
{
@ -123,6 +126,9 @@ class Member extends BaseAdminController
/**
* 会员列表
* @return Response
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function getMemberList()
{
@ -144,9 +150,10 @@ class Member extends BaseAdminController
/**
* 设置会员的状态
* @param $status
* @return void
* @return Response
*/
public function setStatus($status){
public function setStatus($status)
{
$data = $this->request->params([
['member_ids', []],
@ -160,7 +167,8 @@ class Member extends BaseAdminController
* 获取状态枚举
* @return Response
*/
public function getStatusList(){
public function getStatusList()
{
return success(MemberDict::getStatus());
}
@ -168,7 +176,8 @@ class Member extends BaseAdminController
* 获取会员编码
* @return Response
*/
public function getMemberNo(){
public function getMemberNo()
{
$member_no = (new MemberService())->getMemberNo();
return success('SUCCESS', $member_no);
}

View File

@ -13,6 +13,9 @@ namespace app\adminapi\controller\member;
use app\service\admin\member\MemberLabelService;
use core\base\BaseAdminController;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\Response;
class MemberLabel extends BaseAdminController
@ -21,7 +24,8 @@ class MemberLabel extends BaseAdminController
* 会员标签列表
* @return Response
*/
public function lists(){
public function lists()
{
$data = $this->request->params([
['label_name', ''],
@ -32,8 +36,10 @@ class MemberLabel extends BaseAdminController
/**
* 会员标签详情
* @param int $id
* @return Response
*/
public function info(int $id){
public function info(int $id)
{
return success((new MemberLabelService())->getInfo($id));
}
@ -41,7 +47,8 @@ class MemberLabel extends BaseAdminController
* 添加会员标签
* @return Response
*/
public function add(){
public function add()
{
$data = $this->request->params([
['label_name', ''],
@ -56,7 +63,8 @@ class MemberLabel extends BaseAdminController
/**
* 菜单或接口更新
*/
public function edit($id){
public function edit($id)
{
$data = $this->request->params([
['label_name', ''],
['memo', ''],
@ -70,8 +78,10 @@ class MemberLabel extends BaseAdminController
/**
* 会员标签删除
* @param int $id
* @return Response
*/
public function del(int $id){
public function del(int $id)
{
(new MemberLabelService())->del($id);
return success('DELETE_SUCCESS');
@ -79,9 +89,13 @@ class MemberLabel extends BaseAdminController
/**
* 获取标签
* @return void
* @return Response
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function getAll(){
public function getAll()
{
return success((new MemberLabelService())->getAll());
}

View File

@ -0,0 +1,46 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud-admin.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\adminapi\controller\niucloud;
use app\service\admin\niucloud\NiucloudService;
use app\service\core\niucloud\CoreAuthService;
use core\base\BaseAdminController;
use think\Response;
class Module extends BaseAdminController
{
public function authorize()
{
return success((new CoreAuthService())->getAuthInfo());
}
/**
* 设置 授权信息
*/
public function setAuthorize()
{
$data = $this->request->params([
['auth_code', ''],
['auth_secret', '']
]);
return success("SUCCESS", (new NiucloudService())->setAuthorize($data));
}
/**
* 获取 授权信息
*/
public function getAuthorize()
{
return success((new NiucloudService())->getAuthorize());
}
}

View File

@ -36,6 +36,7 @@ class Notice extends BaseAdminController
$res = (new NoticeService())->getInfo($key);
return success($res);
}
/**
* 消息启动与关闭
* @return Response
@ -79,13 +80,12 @@ class Notice extends BaseAdminController
{
//参数获取
$sms_type_list = SmsDict::getType();
if(!array_key_exists($sms_type, $sms_type_list)) throw new AdminException('SMS_TYPE_NOT_EXIST');
if (!array_key_exists($sms_type, $sms_type_list)) throw new AdminException('SMS_TYPE_NOT_EXIST');
//数据验证
$data = [
['is_use', 0]
];
foreach ($sms_type_list[$sms_type]['params'] as $k_param => $v_param)
{
foreach ($sms_type_list[$sms_type]['params'] as $k_param => $v_param) {
$data[] = [$k_param, ''];
}

View File

@ -25,18 +25,18 @@ class NoticeLog extends BaseAdminController
public function lists()
{
$data = $this->request->params([
[ 'key', '' ],
[ 'receiver', '' ],
[ 'create_time', [] ]
['key', ''],
['receiver', ''],
['create_time', []]
]);
$res = ( new NoticeLogService() )->getPage($data);
$res = (new NoticeLogService())->getPage($data);
return success($res);
}
public function info($id)
{
$res = ( new NoticeLogService() )->getInfo($id);
$res = (new NoticeLogService())->getInfo($id);
return success($res);
}

View File

@ -11,7 +11,6 @@
namespace app\adminapi\controller\notice;
use app\service\admin\notice\NoticeLogService;
use app\service\admin\notice\NoticeSmsLogService;
use core\base\BaseAdminController;
use think\Response;
@ -26,18 +25,18 @@ class SmsLog extends BaseAdminController
public function lists()
{
$data = $this->request->params([
[ 'mobile', '' ],
[ 'sms_type', '' ],
[ 'key', '' ],
['mobile', ''],
['sms_type', ''],
['key', ''],
]);
$res = ( new NoticeSmsLogService() )->getPage($data);
$res = (new NoticeSmsLogService())->getPage($data);
return success($res);
}
public function info($id)
{
$res = ( new NoticeSmsLogService() )->getInfo($id);
$res = (new NoticeSmsLogService())->getInfo($id);
return success($res);
}

View File

@ -59,19 +59,6 @@ class Recharge extends BaseAdminController
return fail($res);
}
/**
* 充值统计
*/
public function stat()
{
$data = $this->request->params([
[ 'member_id', '' ],
]);
$res = (new RechargeOrderService())->stat($data);
return success($res);
}
/**
* 退款列表
* @return Response
@ -91,7 +78,7 @@ class Recharge extends BaseAdminController
/**
* 退款详情
* @param int $order_id
* @param int $refund_id
* @return Response
*/
public function refundDetail(int $refund_id)
@ -101,7 +88,6 @@ class Recharge extends BaseAdminController
/**
* 查询退款状态
* @param $type
* @return Response
*/
public function refundStatus()
@ -117,5 +103,17 @@ class Recharge extends BaseAdminController
return success((new RechargeOrderRefundService())->stat());
}
/**
* 充值统计
*/
public function stat()
{
$data = $this->request->params([
['member_id', ''],
]);
$res = (new RechargeOrderService())->stat($data);
return success($res);
}
}

View File

@ -0,0 +1,61 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud-admin.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\adminapi\controller\pay;
use app\dict\pay\PayDict;
use app\service\admin\pay\PayService;
use core\base\BaseAdminController;
class Pay extends BaseAdminController
{
/**
* 待审核支付记录
* @param array $where
* @return mixed
*/
public function audit(){
$data = $this->request->params([
['create_time', []],
['out_trade_no', ''],
['status', '']
]);
return success(data: (new PayService())->getAuditPage($data));
}
/**
* 查询详情
* @param string $out_trade_no
* @return \think\Response
*/
public function detail(int $id){
return success(data: (new PayService())->getDetail($id));
}
/**
* 支付审核通过
* @param string $out_trade_no
* @return \think\Response
*/
public function pass(string $out_trade_no){
return success(data: (new PayService())->pass($out_trade_no));
}
/**
* 审核拒绝
* @param string $out_trade_no
* @return void
*/
public function refuse(string $out_trade_no){
$reason = input('reason', '');
return success(data: (new PayService())->refuse($out_trade_no, $reason));
}
}

View File

@ -14,6 +14,9 @@ namespace app\adminapi\controller\pay;
use app\dict\pay\PayDict;
use app\service\admin\pay\PayChannelService;
use core\base\BaseAdminController;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\Response;
class PayChannel extends BaseAdminController
@ -23,7 +26,8 @@ class PayChannel extends BaseAdminController
* 支付渠道设置
* @return Response
*/
public function set($channel, $type){
public function set($channel, $type)
{
$data = $this->request->params([
['is_default', 0],
['config', []],
@ -40,19 +44,21 @@ class PayChannel extends BaseAdminController
* 支付渠道列表
* @return Response
*/
public function lists(){
return success((new PayChannelService())->getChannelList());
public function lists()
{
return success((new PayChannelService())->getChannelList());
}
/**
* 通过渠道获取支付配置
* @param $channel
* @return Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function getListByChannel($channel){
public function getListByChannel($channel)
{
return success((new PayChannelService())->getListByChannel($channel));
}
@ -61,7 +67,8 @@ class PayChannel extends BaseAdminController
* 支付设置
* @return Response
*/
public function setTransfer(){
public function setTransfer()
{
$data = $this->request->params([
['wechatpay_config', []],
['alipay_config', []],
@ -76,7 +83,8 @@ class PayChannel extends BaseAdminController
* 多渠道支付设置
* @return Response
*/
public function setAll(){
public function setAll()
{
$data = $this->request->params([
['config', []],
]);

View File

@ -38,6 +38,7 @@ class Site extends BaseAdminController
/**
* 站点详情
* @param int $id
* @return Response
*/
public function info(int $id)
{
@ -65,21 +66,6 @@ class Site extends BaseAdminController
return success('ADD_SUCCESS', ['site_id' => $site_id]);
}
/**
* 菜单或接口更新
*/
public function edit($id)
{
$data = $this->request->params([
['site_name', ''],
['group_id', 0],
['expire_time', 0]
]);
$this->validate($data, 'app\validate\site\Site.edit');
(new SiteService())->edit($id, $data);
return success('MODIFY_SUCCESS');
}
/**
* 站点状态
* @return Response
@ -93,7 +79,8 @@ class Site extends BaseAdminController
* 站点菜单
* @return Response
*/
public function menu(){
public function menu()
{
return success((new AuthSiteService())->getMenuList(1, 'all'));
}
@ -106,7 +93,22 @@ class Site extends BaseAdminController
['status', SiteDict::CLOSE],
]);
(new SiteService())->edit($id, $data);
return success('SUCCESS');
return success();
}
/**
* 菜单或接口更新
*/
public function edit($id)
{
$data = $this->request->params([
['site_name', ''],
['group_id', 0],
['expire_time', 0]
]);
$this->validate($data, 'app\validate\site\Site.edit');
(new SiteService())->edit($id, $data);
return success('MODIFY_SUCCESS');
}
/**
@ -118,8 +120,9 @@ class Site extends BaseAdminController
['status', SiteDict::ON],
]);
(new SiteService())->edit($id, $data);
return success('SUCCESS');
return success();
}
public function indexConfig()
{

View File

@ -12,10 +12,7 @@
namespace app\adminapi\controller\site;
use app\dict\site\SiteAccountLogDict;
use app\dict\site\SiteDict;
use app\service\admin\auth\AuthSiteService;
use app\service\admin\site\SiteAccountLogService;
use app\service\admin\site\SiteService;
use core\base\BaseAdminController;
use think\Response;
@ -37,11 +34,13 @@ class SiteAccount extends BaseAdminController
/**
* 账单详情
* @param int $id
* @return Response
*/
public function info(int $id)
{
return success((new SiteAccountLogService())->getInfo($id));
}
/**
* 累计账单
*/

View File

@ -13,6 +13,7 @@ namespace app\adminapi\controller\site;
use app\service\admin\site\SiteGroupService;
use core\base\BaseAdminController;
use Exception;
use think\Response;
/**
@ -26,7 +27,8 @@ class SiteGroup extends BaseAdminController
* 站点列表
* @return Response
*/
public function lists(){
public function lists()
{
$data = $this->request->params([
['keywords', ''],
]);
@ -38,16 +40,18 @@ class SiteGroup extends BaseAdminController
* @param int $group_id
* @return Response
*/
public function info(int $group_id){
public function info(int $group_id)
{
return success((new SiteGroupService())->getInfo($group_id));
}
/**
* 添加分组
* @return Response
* @throws \Exception
* @throws Exception
*/
public function add(){
public function add()
{
$data = $this->request->params([
['group_name', ''],
['group_desc', ''],
@ -63,7 +67,8 @@ class SiteGroup extends BaseAdminController
* @param $group_id
* @return Response
*/
public function edit($group_id){
public function edit($group_id)
{
$data = $this->request->params([
['group_name', ''],
['group_desc', ''],
@ -79,7 +84,8 @@ class SiteGroup extends BaseAdminController
* @param $group_id
* @return Response
*/
public function del($group_id){
public function del($group_id)
{
(new SiteGroupService())->del($group_id);
return success('DELETE_SUCCESS');
@ -89,8 +95,9 @@ class SiteGroup extends BaseAdminController
* 所有分组
* @return Response
*/
public function all(){
return success( (new SiteGroupService())->getAll());
public function all()
{
return success((new SiteGroupService())->getAll());
}
}

View File

@ -15,6 +15,7 @@ use app\dict\sys\UserDict;
use app\service\admin\site\SiteUserService;
use app\service\admin\user\UserService;
use core\base\BaseAdminController;
use Exception;
use think\Response;
/**
@ -24,7 +25,8 @@ use think\Response;
*/
class User extends BaseAdminController
{
public function lists(){
public function lists()
{
$data = $this->request->params([
['username', ''],
['realname', ''],
@ -41,15 +43,18 @@ class User extends BaseAdminController
* @param $uid
* @return Response
*/
public function info($uid){
public function info($uid)
{
return success((new SiteUserService())->getInfo($uid));
}
/**
* 新增用户
* @return Response
* @throws Exception
*/
public function add(){
public function add()
{
$data = $this->request->params([
['username', ''],
['password', ''],
@ -67,7 +72,8 @@ class User extends BaseAdminController
/**
* 更新用户
*/
public function edit($uid){
public function edit($uid)
{
$data = $this->request->params([
['real_name', ''],
['head_img', ''],
@ -85,7 +91,8 @@ class User extends BaseAdminController
* @param $field
* @return Response
*/
public function modify($uid, $field){
public function modify($uid, $field)
{
$data = $this->request->params([
['value', ''],
['field', $field]
@ -99,8 +106,10 @@ class User extends BaseAdminController
/**
* 删除单个用户
* @param $uid
* @return Response
*/
public function del($uid){
public function del($uid)
{
(new UserService())->del($uid);
return success('DELETE_SUCCESS');
}
@ -108,7 +117,8 @@ class User extends BaseAdminController
/**
* 锁定用户
*/
public function lock($uid){
public function lock($uid)
{
(new SiteUserService())->lock($uid);
return success('MODIFY_SUCCESS');
@ -117,7 +127,8 @@ class User extends BaseAdminController
/**
* 解锁用户
*/
public function unlock($uid){
public function unlock($uid)
{
(new SiteUserService())->unlock($uid);
return success('MODIFY_SUCCESS');

View File

@ -21,7 +21,8 @@ class UserLog extends BaseAdminController
* 操作日志列表
* @return Response
*/
public function lists(){
public function lists()
{
$data = $this->request->params([
['uid', 0],
['create_time', []],
@ -41,7 +42,8 @@ class UserLog extends BaseAdminController
* @param $id
* @return Response
*/
public function info($id){
public function info($id)
{
return success((new UserLogService())->getInfo($id));
}

View File

@ -13,6 +13,7 @@ namespace app\adminapi\controller\stat;
use app\service\admin\stat\SiteStatService;
use core\base\BaseAdminController;
use think\Response;
/**
* 统计数据
@ -23,7 +24,7 @@ class SiteStat extends BaseAdminController
{
/**
* 首页数据
* @return \think\Response
* @return Response
*/
public function index()
{

View File

@ -13,6 +13,7 @@ namespace app\adminapi\controller\stat;
use app\service\admin\stat\StatService;
use core\base\BaseAdminController;
use think\Response;
/**
* 统计数据
@ -23,7 +24,7 @@ class Stat extends BaseAdminController
{
/**
* 首页数据
* @return \think\Response
* @return Response
*/
public function index()
{

View File

@ -48,7 +48,8 @@ class Agreement extends BaseAdminController
* @param string $key
* @return Response
*/
public function edit(string $key){
public function edit(string $key)
{
$data = $this->request->params([
['title', ''],
['content', ''],

View File

@ -13,6 +13,7 @@ namespace app\adminapi\controller\sys;
use app\service\admin\sys\AppService;
use core\base\BaseAdminController;
use think\Response;
/**
* 应用管理
@ -21,9 +22,10 @@ class App extends BaseAdminController
{
/**
* 获取应用链接列表
* @return \think\Response
* @return Response
*/
public function getAppList(){
public function getAppList()
{
return success((new AppService())->getAppList());
}

View File

@ -13,22 +13,24 @@ namespace app\adminapi\controller\sys;
use app\service\admin\sys\AreaService;
use core\base\BaseAdminController;
use think\Response;
class Area extends BaseAdminController
{
/**
* 拖过pid获取子项列表
* @param int $pid
* @return mixed
* @return Response
*/
public function listByPid(int $pid){
public function listByPid(int $pid)
{
return success((new AreaService())->getListByPid($pid));
}
/**
* 获取层级列表
* @param int $level
* @return mixed
* @return Response
*/
public function tree(int $level)
{
@ -36,10 +38,10 @@ class Area extends BaseAdminController
}
/**
* @param string $address
* 地址解析
* @return Response
*/
public function addressInfo(){
public function addressInfo()
{
$data = $this->request->params([
['address', ''],
]);
@ -47,10 +49,10 @@ class Area extends BaseAdminController
}
/**
* @param string $location
* 逆地址解析
* @return Response
*/
public function contraryAddress(){
public function contraryAddress()
{
$data = $this->request->params([
['location', ''],
]);

View File

@ -25,13 +25,13 @@ class Attachment extends BaseAdminController
public function lists()
{
$data = $this->request->params([
[ 'att_type', '' ],
[ 'cate_id', 0 ],
[ 'real_name', '' ],
[ 'page', 0 ],
[ 'limit', 0 ],
['att_type', ''],
['cate_id', 0],
['real_name', ''],
['page', 0],
['limit', 0],
]);
return success(( new AttachmentService() )->getPage($data));
return success((new AttachmentService())->getPage($data));
}
/**
@ -51,9 +51,9 @@ class Attachment extends BaseAdminController
public function batchDel()
{
$data = $this->request->params([
[ 'att_ids', [] ],
['att_ids', []],
]);
( new AttachmentService() )->delAll($data[ 'att_ids' ]);
(new AttachmentService())->delAll($data['att_ids']);
return success('DELETE_SUCCESS');
}
@ -64,11 +64,11 @@ class Attachment extends BaseAdminController
public function addCategory()
{
$data = $this->request->params([
[ 'type', FileDict::IMAGE ],
[ 'name', '' ]
['type', FileDict::IMAGE],
['name', '']
]);
$this->validate($data, 'app\validate\sys\AttachmentCategory.add');
( new AttachmentService() )->addCategory($data);
(new AttachmentService())->addCategory($data);
return success('ADD_SUCCESS');
}
@ -78,10 +78,10 @@ class Attachment extends BaseAdminController
public function categoryLists()
{
$data = $this->request->params([
[ 'type', '' ],
[ 'name', '' ],
['type', ''],
['name', ''],
]);
return success(( new AttachmentService() )->getCategoryList($data));
return success((new AttachmentService())->getCategoryList($data));
}
/**
@ -91,10 +91,10 @@ class Attachment extends BaseAdminController
public function editCategory($id)
{
$data = $this->request->params([
[ 'name', '' ]
['name', '']
]);
$this->validate($data, 'app\validate\sys\AttachmentCategory.edit');
( new AttachmentService() )->editCategory($id, $data);
(new AttachmentService())->editCategory($id, $data);
return success('EDIT_SUCCESS');
}
@ -105,36 +105,35 @@ class Attachment extends BaseAdminController
*/
public function deleteCategory($id)
{
( new AttachmentService() )->delCategory($id);
(new AttachmentService())->delCategory($id);
return success('DELETE_SUCCESS');
}
/**
* 移动图片分组
* @return void
* @return Response
*/
public function moveCategory($att_id)
{
$data = $this->request->params([
[ 'cate_id', '' ]
['cate_id', '']
]);
( new AttachmentService() )->modifyCategory($att_id, $data[ 'cate_id' ]);
return success('SUCCESS');
(new AttachmentService())->modifyCategory($att_id, $data['cate_id']);
return success();
}
/**
* 批量移动图片分组
* @param $att_ids
* @return Response
*/
public function batchMoveCategory()
{
$data = $this->request->params([
[ 'cate_id', '' ],
[ 'att_ids', [] ]
['cate_id', ''],
['att_ids', []]
]);
( new AttachmentService() )->batchModifyCategory($data[ 'att_ids' ], $data[ 'cate_id' ]);
return success('SUCCESS');
(new AttachmentService())->batchModifyCategory($data['att_ids'], $data['cate_id']);
return success();
}
/**
@ -143,9 +142,9 @@ class Attachment extends BaseAdminController
public function getIconCategoryList()
{
$data = $this->request->params([
[ 'name', '' ],
['name', ''],
]);
return success(( new AttachmentService() )->getIconCategoryList($data));
return success((new AttachmentService())->getIconCategoryList($data));
}
/**
@ -154,12 +153,12 @@ class Attachment extends BaseAdminController
public function getIconList()
{
$data = $this->request->params([
[ 'page', 0 ],
[ 'limit', 0 ],
[ 'cate_id', 0 ],
[ 'real_name', '' ],
['page', 0],
['limit', 0],
['cate_id', 0],
['real_name', ''],
]);
return success(( new AttachmentService() )->getIconList($data));
return success((new AttachmentService())->getIconList($data));
}
}

View File

@ -13,14 +13,14 @@ namespace app\adminapi\controller\sys;
use app\dict\common\ChannelDict;
use core\base\BaseAdminController;
use think\Response;
class Channel extends BaseAdminController
{
/**
* 获取渠道列表
* @param int $level
* @return mixed
* @return Response
*/
public function getChannelType()
{

View File

@ -13,6 +13,7 @@ namespace app\adminapi\controller\sys;
use app\dict\sys\DateDict;
use core\base\BaseAdminController;
use think\Response;
/**
* 公共数据字典
@ -21,17 +22,19 @@ class Common extends BaseAdminController
{
/**
* 月份
* @return \think\Response
* @return Response
*/
public function getMonth(){
public function getMonth()
{
return success((new DateDict())->getMonth());
}
/**
* 星期
* @return \think\Response
* @return Response
*/
public function getWeek(){
public function getWeek()
{
return success((new DateDict())->getWeek());
}

View File

@ -21,7 +21,8 @@ class Config extends BaseAdminController
* 获取网站设置
* @return Response
*/
public function getWebsite(){
public function getWebsite()
{
return success((new ConfigService())->getWebSite());
}
@ -29,23 +30,24 @@ class Config extends BaseAdminController
* 网站设置
* @return Response
*/
public function setWebsite(){
public function setWebsite()
{
$data = $this->request->params([
["site_name",""],
["logo",""],
["keywords",""],
["desc",""],
["latitude",""],
["longitude",""],
["province_id",0],
["city_id",0],
["district_id",0],
["address",""],
["full_address",""],
["phone",""],
["business_hours",""],
["site_name",""],
["logo",""],
["site_name", ""],
["logo", ""],
["keywords", ""],
["desc", ""],
["latitude", ""],
["longitude", ""],
["province_id", 0],
["city_id", 0],
["district_id", 0],
["address", ""],
["full_address", ""],
["phone", ""],
["business_hours", ""],
["site_name", ""],
["logo", ""],
["front_end_name", ""],
["front_end_logo", ""],
["icon", ""]
@ -54,9 +56,9 @@ class Config extends BaseAdminController
(new ConfigService())->setWebSite($data);
$service_data = $this->request->params([
["wechat_code",""],
["enterprise_wechat",""],
["tel",""],
["wechat_code", ""],
["enterprise_wechat", ""],
["tel", ""],
]);
(new ConfigService())->setService($service_data);
@ -67,14 +69,16 @@ class Config extends BaseAdminController
* 获取版权信息
* @return Response
*/
public function getCopyright(){
public function getCopyright()
{
return success((new ConfigService())->getCopyright());
}
/**设置版权信息
* @return Response
*/
public function setCopyright(){
public function setCopyright()
{
$data = $this->request->params([
['icp', ''],
['gov_record', ''],
@ -93,7 +97,8 @@ class Config extends BaseAdminController
* 场景域名
* @return Response
*/
public function getSceneDomain(){
public function getSceneDomain()
{
return success((new ConfigService())->getSceneDomain());
}
@ -101,14 +106,16 @@ class Config extends BaseAdminController
* 获取服务信息
* @return Response
*/
public function getServiceInfo(){
public function getServiceInfo()
{
return success((new ConfigService())->getService());
}
/**设置版权信息
* @return Response
*/
public function setMap(){
public function setMap()
{
$data = $this->request->params([
['key', ''],
]);
@ -120,7 +127,8 @@ class Config extends BaseAdminController
* 获取地图设置
* @return Response
*/
public function getMap(){
public function getMap()
{
return success((new ConfigService())->getMap());
}
@ -144,6 +152,26 @@ class Config extends BaseAdminController
return success();
}
/**
* 获取站点首页列表如果正在使用is_use = 1
*/
public function getAdminIndexList()
{
return success((new ConfigService())->getAdminIndexList());
}
/**
* 首页配置
*/
public function setAdminIndex()
{
$data = $this->request->params([
['view_path', ''],
]);
(new ConfigService())->setAdminIndexConfig($data);
return success();
}
/**
* 设置快捷菜单
*/
@ -161,6 +189,6 @@ class Config extends BaseAdminController
*/
public function getShortcutMenu()
{
return success(data:(new ConfigService())->getShortcutMenu());
return success(data: (new ConfigService())->getShortcutMenu());
}
}

View File

@ -17,7 +17,6 @@ use app\dict\sys\MethodDict;
use app\service\admin\install\InstallSystemService;
use app\service\admin\sys\MenuService;
use core\base\BaseAdminController;
use think\Exception;
use think\Response;
class Menu extends BaseAdminController
@ -27,17 +26,19 @@ class Menu extends BaseAdminController
* 菜单列表(todo 限制只有平台端可以访问)
* @return Response
*/
public function lists($app_type){
public function lists($app_type)
{
return success((new MenuService())->getAllMenuList($app_type, 'all', 1));
}
/**
* 菜单信息
* @param $id
* @param $menu_key
* @return Response
*/
public function info($menu_key){
public function info($menu_key)
{
return success((new MenuService())->get($menu_key));
}
@ -45,7 +46,8 @@ class Menu extends BaseAdminController
* 新增菜单接口
* @return Response
*/
public function add(){
public function add()
{
$data = $this->request->params([
['menu_name', ''],
['menu_type', 0],
@ -71,7 +73,8 @@ class Menu extends BaseAdminController
/**
* 菜单或接口更新
*/
public function edit($menu_key){
public function edit($menu_key)
{
$data = $this->request->params([
['menu_name', ''],
['parent_key', ''],
@ -98,7 +101,8 @@ class Menu extends BaseAdminController
* 获取菜单类型静态资源
* @return Response
*/
public function getMenuType(){
public function getMenuType()
{
return success(MenuTypeDict::getMenuType());
}
@ -106,7 +110,8 @@ class Menu extends BaseAdminController
* 获取请求方式
* @return Response
*/
public function getMethodType(){
public function getMethodType()
{
return success(MethodDict::getMethodType());
}
@ -114,14 +119,15 @@ class Menu extends BaseAdminController
* 删除菜单
* @param $menu_key
* @return Response
* @throws Exception
*/
public function del($menu_key){
public function del($menu_key)
{
(new MenuService())->del($menu_key);
return success('DELETE_SUCCESS');
}
public function refreshMenu(){
public function refreshMenu()
{
(new InstallSystemService())->install();
return success('REFRESH_SUCCESS');
}

View File

@ -14,11 +14,13 @@ namespace app\adminapi\controller\sys;
use app\dict\sys\RoleStatusDict;
use app\service\admin\sys\RoleService;
use core\base\BaseAdminController;
use think\db\exception\DbException;
use think\Response;
class Role extends BaseAdminController
{
public function lists(){
public function lists()
{
$data = $this->request->params([
['role_name', ''],
]);
@ -29,10 +31,11 @@ class Role extends BaseAdminController
/**
* 用户组详情
* @param $uid
* @param $role_id
* @return Response
*/
public function info($role_id){
public function info($role_id)
{
return success((new RoleService())->getInfo($role_id));
}
@ -40,14 +43,17 @@ class Role extends BaseAdminController
* 获取全部权限
* @return Response
*/
public function all(){
public function all()
{
return success((new RoleService())->getAll());
}
/**
* 新增用户组
* @return Response
*/
public function add(){
public function add()
{
$data = $this->request->params([
['role_name', ''],
['rules', []],
@ -62,7 +68,8 @@ class Role extends BaseAdminController
/**
* 更新用户组
*/
public function edit($role_id){
public function edit($role_id)
{
$data = $this->request->params([
['role_name', ''],
['rules', []],
@ -76,9 +83,12 @@ class Role extends BaseAdminController
/**
* 删除单个用户组
* @param $uid
* @param $role_id
* @return Response
* @throws DbException
*/
public function del($role_id){
public function del($role_id)
{
(new RoleService())->del($role_id);
return success('DELETE_SUCCESS');
}

View File

@ -14,6 +14,7 @@ namespace app\adminapi\controller\sys;
use app\dict\schedule\ScheduleDict;
use app\service\admin\schedule\ScheduleService;
use core\base\BaseAdminController;
use think\Response;
/**
* 自动任务
@ -22,40 +23,44 @@ class Schedule extends BaseAdminController
{
/**
* 任务列表
* @return \think\Response
* @return Response
*/
public function lists(){
public function lists()
{
$data = $this->request->params([
['key', ''],
['status', ''],
]);
return success(data:(new ScheduleService())->getPage($data));
return success(data: (new ScheduleService())->getPage($data));
}
/**
* 计划任务模板
* @return \think\Response
* @return Response
*/
public function template(){
return success(data:(new ScheduleService())->getTemplateList());
public function template()
{
return success(data: (new ScheduleService())->getTemplateList());
}
/**
* 获取任务模式
* @return \think\Response
* @return Response
*/
public function getType(){
return success(data:ScheduleDict::getType());
public function getType()
{
return success(data: ScheduleDict::getType());
}
/**
* 详情
* @param int $id
* @return Response
*/
public function info(int $id)
{
return success(( new ScheduleService() )->getInfo($id));
return success((new ScheduleService())->getInfo($id));
}
/**
@ -65,12 +70,12 @@ class Schedule extends BaseAdminController
public function add()
{
$data = $this->request->params([
[ 'key', '' ],
[ 'time', [] ],
[ 'status', ScheduleDict::OFF ],
['key', ''],
['time', []],
['status', ScheduleDict::OFF],
]);
$this->validate($data, 'app\validate\sys\Schedule.add');
( new ScheduleService() )->add($data);
(new ScheduleService())->add($data);
return success('ADD_SUCCESS');
}
@ -83,40 +88,44 @@ class Schedule extends BaseAdminController
{
$data = $this->request->params([
// [ 'key', '' ],
[ 'time', [] ],
[ 'status', ScheduleDict::OFF ],
['time', []],
['status', ScheduleDict::OFF],
]);
( new ScheduleService() )->edit($id, $data);
(new ScheduleService())->edit($id, $data);
return success('EDIT_SUCCESS');
}
/**
* 启用或关闭
* @param int $id
* @return \think\Response
* @return Response
*/
public function modifyStatus(int $id){
public function modifyStatus(int $id)
{
$data = $this->request->params([
[ 'status', ScheduleDict::OFF ],
['status', ScheduleDict::OFF],
]);
( new ScheduleService() )->modifyStatus($id, $data['status']);
(new ScheduleService())->modifyStatus($id, $data['status']);
return success('EDIT_SUCCESS');
}
/**
* 删除
* @param int $id
* @return Response
*/
public function del(int $id)
{
( new ScheduleService() )->del($id);
(new ScheduleService())->del($id);
return success('DELETE_SUCCESS');
}
/**
* 时间间隔类型
* @return \think\Response
* @return Response
*/
public function getDateType(){
return success(data:ScheduleDict::getDateType());
public function getDateType()
{
return success(data: ScheduleDict::getDateType());
}
}

View File

@ -11,9 +11,9 @@
namespace app\adminapi\controller\sys;
use app\service\admin\schedule\ScheduleService;
use app\service\admin\sys\SystemService;
use core\base\BaseAdminController;
use think\Response;
/**
* 系统信息查询
@ -24,7 +24,7 @@ class System extends BaseAdminController
{
/**
* 获取当前系统信息
* @return array|mixed
* @return Response
*/
public function info()
{
@ -33,7 +33,7 @@ class System extends BaseAdminController
/**
* 获取当前url配置
* @return array|mixed
* @return Response
*/
public function url()
{
@ -42,35 +42,59 @@ class System extends BaseAdminController
/**
* 获取系统环境配置
* @return \think\Response
* @return Response
*/
public function getSystemInfo(){
public function getSystemInfo()
{
return success((new SystemService())->getSystemInfo());
}
/**
* 清理缓存,更新菜单
*/
public function schemaCache(){
public function schemaCache()
{
return success((new SystemService())->schemaCache());
}
/**
* 校验消息队列是否正常运行
* @return \think\Response
* @return Response
*/
public function checkJob(){
return success(data:(new SystemService())->checkJob());
public function checkJob()
{
return success(data: (new SystemService())->checkJob());
}
/**
* 校验计划任务是否正常运行
* @return \think\Response
* @return Response
*/
public function checkSchedule(){
return success(data:(new SystemService())->checkSchedule());
public function checkSchedule()
{
return success(data: (new SystemService())->checkSchedule());
}
/**
* 获取布局
* @return Response
*/
public function layout() {
$layouts = event('SiteLayout');
if (count($layouts) > 1) {
array_multisort(array_column($layouts, 'sort'), SORT_ASC, $layouts);
}
return success($layouts);
}
/**
*
* 设置布局
* @return Response
*/
public function setLayout(){
$key = input('key', '');
return success(data: (new SystemService())->setLayout($key));
}
}

View File

@ -27,10 +27,11 @@ class Upload extends BaseAdminController
$data = $this->request->params([
['file', 'file'],
['cate_id', '=', 0]
], true);
['cate_id', 0],
['is_attachment', 1]
]);
$upload_service = new UploadService();
return success($upload_service->image($data['file'], $data['cate_id']));
return success($upload_service->image($data['file'], $data['cate_id'], boolval($data['is_attachment'])));
}
/**
@ -41,8 +42,8 @@ class Upload extends BaseAdminController
{
$data = $this->request->params([
['file', 'file'],
['cate_id', '=', 0]
], true);
['cate_id', 0]
]);
$upload_service = new UploadService();
return success($upload_service->video($data['file'], $data['cate_id']));
}
@ -51,17 +52,18 @@ class Upload extends BaseAdminController
* 文件上传(默认不上云)
* @return Response
*/
public function document($type){
public function document($type)
{
$data = $this->request->params([
['file', 'file'],
], true);
]);
$upload_service = new UploadService();
return success($upload_service->document($data['file'], $type));
}
/**
* 上传配置
* @return void
* @return Response
*/
public function setUploadConfig()
{

View File

@ -17,7 +17,8 @@ use think\Response;
class User extends BaseAdminController
{
public function lists(){
public function lists()
{
$data = $this->request->params([
['username', ''],
['real_name', '']
@ -33,7 +34,8 @@ class User extends BaseAdminController
* @param $uid
* @return Response
*/
public function info($uid){
public function info($uid)
{
return success((new UserService())->getUserAdminInfo($uid));
}

View File

@ -21,7 +21,8 @@ class Config extends BaseAdminController
* 获取微信小程序配置信息
* @return Response
*/
public function get(){
public function get()
{
return success((new WeappConfigService())->getWeappConfig());
}
@ -29,7 +30,8 @@ class Config extends BaseAdminController
* 设置微信小程序配置信息
* @return Response
*/
public function set(){
public function set()
{
$data = $this->request->params([
['weapp_name', ''],
['weapp_original', ''],

View File

@ -11,18 +11,18 @@
namespace app\adminapi\controller\weapp;
use app\service\admin\weapp\WeappConfigService;
use core\base\BaseAdminController;
use think\Response;
class Package extends BaseAdminController
{
public function lists(){
public function lists()
{
return success();
}
public function add(){
public function add()
{
$data = $this->request->params([
['version', ''],
['path', ''],

View File

@ -13,6 +13,7 @@ namespace app\adminapi\controller\weapp;
use app\service\admin\weapp\WeappTemplateService;
use core\base\BaseAdminController;
use think\Response;
/**
* 微信小程序订阅消息
@ -22,9 +23,10 @@ class Template extends BaseAdminController
/**
* 订阅消息
* @return \think\Response
* @return Response
*/
public function lists(){
public function lists()
{
$wechat_template_service = new WeappTemplateService();
return success($wechat_template_service->getList());
}
@ -32,9 +34,10 @@ class Template extends BaseAdminController
/**
* 菜单信息
* @return \think\Response
* @return Response
*/
public function sync(){
public function sync()
{
$data = $this->request->params([
['keys', []]
]);

View File

@ -21,7 +21,8 @@ class Config extends BaseAdminController
* 获取微信配置信息
* @return Response
*/
public function get(){
public function get()
{
return success((new WechatConfigService())->getWechatConfig());
}
@ -29,7 +30,8 @@ class Config extends BaseAdminController
* 设置微信配置信息
* @return Response
*/
public function set(){
public function set()
{
$data = $this->request->params([
['wechat_name', ''],
['wechat_original', ''],
@ -49,7 +51,8 @@ class Config extends BaseAdminController
* 获取微信静态资源
* @return Response
*/
public function static(){
public function static()
{
return success((new WechatConfigService())->getWechatStaticInfo());
}

View File

@ -13,6 +13,9 @@ namespace app\adminapi\controller\wechat;
use app\service\admin\wechat\WechatMenuService;
use core\base\BaseAdminController;
use EasyWeChat\Kernel\Exceptions\InvalidConfigException;
use GuzzleHttp\Exception\GuzzleException;
use think\Response;
/**
* 微信公众号管理菜单
@ -22,18 +25,22 @@ class Menu extends BaseAdminController
/**
* 菜单信息
* @return void
* @return Response
*/
public function info(){
public function info()
{
$wechat_menu_service = new WechatMenuService();
return success($wechat_menu_service->getInfo());
}
/**
* 设置菜单
* @return void
* @return Response
* @throws InvalidConfigException
* @throws GuzzleException
*/
public function edit(){
public function edit()
{
$wechat_menu_service = new WechatMenuService();
$data = $this->request->params([
['button', []]

View File

@ -23,14 +23,16 @@ class Reply extends BaseAdminController
/**
* 关键词回复
* @return void
* @return Response
*/
public function keyword($id){
public function keyword($id)
{
$wechat_reply_service = new WechatReplyService();
return success($wechat_reply_service->getKeywordInfo($id));
}
public function getKeywordLists(){
public function getKeywordLists()
{
$data = $this->request->params([
['keyword', ''],
['name', '']
@ -38,11 +40,13 @@ class Reply extends BaseAdminController
$wechat_reply_service = new WechatReplyService();
return success($wechat_reply_service->getKeywordPage($data));
}
/**
* 新增关键词回复
* @return void
* @return Response
*/
public function addKeyword(){
public function addKeyword()
{
$wechat_reply_service = new WechatReplyService();
$data = $this->request->params([
['name', ''],
@ -58,9 +62,10 @@ class Reply extends BaseAdminController
/**
* 更新关键词回复
* @return void
* @return Response
*/
public function editKeyword($id){
public function editKeyword($id)
{
$wechat_reply_service = new WechatReplyService();
$data = $this->request->params([
['name', ''],
@ -76,9 +81,10 @@ class Reply extends BaseAdminController
/**
* 删除关键字回复
* @return void
* @return Response
*/
public function delKeyword($id){
public function delKeyword($id)
{
$wechat_reply_service = new WechatReplyService();
return success($wechat_reply_service->delKeyword($id));
}
@ -87,7 +93,8 @@ class Reply extends BaseAdminController
* 获取默认回复
* @return Response
*/
public function default(){
public function default()
{
$wechat_reply_service = new WechatReplyService();
return success($wechat_reply_service->getDefault());
}
@ -96,7 +103,8 @@ class Reply extends BaseAdminController
* 更新默认回复
* @return Response
*/
public function editDefault(){
public function editDefault()
{
$data = $this->request->params([
['content_type', ''],
['content', ''],
@ -110,7 +118,8 @@ class Reply extends BaseAdminController
* 获取关注回复
* @return Response
*/
public function subscribe(){
public function subscribe()
{
$wechat_reply_service = new WechatReplyService();
return success($wechat_reply_service->getSubscribe());
}
@ -119,7 +128,8 @@ class Reply extends BaseAdminController
* 更新关注回复
* @return Response
*/
public function editSubscribe(){
public function editSubscribe()
{
$data = $this->request->params([
['content_type', ''],
['content', ''],
@ -130,5 +140,4 @@ class Reply extends BaseAdminController
}
}

View File

@ -13,6 +13,7 @@ namespace app\adminapi\controller\wechat;
use app\service\admin\wechat\WechatTemplateService;
use core\base\BaseAdminController;
use think\Response;
/**
* 微信公众号管理菜单
@ -22,9 +23,10 @@ class Template extends BaseAdminController
/**
* 菜单信息
* @return void
* @return Response
*/
public function sync(){
public function sync()
{
$data = $this->request->params([
['keys', []]
]);
@ -34,9 +36,10 @@ class Template extends BaseAdminController
/**
* 模板消息
* @return \think\Response
* @return Response
*/
public function lists(){
public function lists()
{
$wechat_template_service = new WechatTemplateService();
return success($wechat_template_service->getList());
}

View File

@ -2,6 +2,7 @@
// 全局中间件定义文件
use app\adminapi\middleware\AllowCrossDomain;
use think\middleware\LoadLangPack;
return [
//跨域请求中间件
AllowCrossDomain::class,

View File

@ -13,7 +13,6 @@ namespace app\adminapi\middleware;
use app\Request;
use app\service\admin\auth\AuthService;
use Closure;

View File

@ -26,8 +26,7 @@ class AdminLog
public function handle(Request $request, Closure $next)
{
//写入日志
if($request->method() != 'GET')
{
if ($request->method() != 'GET') {
$data = [
'uid' => $request->uid(),
'username' => $request->username(),

View File

@ -13,7 +13,6 @@ namespace app\adminapi\middleware;
use app\Request;
use Closure;
use core\exception\ServerException;
/**
* http跨域请求中间件
@ -30,7 +29,7 @@ class AllowCrossDomain
system_name('channel_name'),
'lang'
];
header("Access-Control-Allow-Headers: Authorization, Sec-Fetch-Mode, DNT, X-Mx-ReqToken, Keep-Alive, User-Agent, If-Match, If-None-Match, If-Unmodified-Since, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Accept-Language, Origin, Accept-Encoding,Access-Token,version,".implode(',', $allow_header));
header("Access-Control-Allow-Headers: Authorization, Sec-Fetch-Mode, DNT, X-Mx-ReqToken, Keep-Alive, User-Agent, If-Match, If-None-Match, If-Unmodified-Since, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Accept-Language, Origin, Accept-Encoding,Access-Token,version," . implode(',', $allow_header));
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, post');
header('Access-Control-Max-Age: 1728000');
header('Access-Control-Allow-Credentials:true');

View File

@ -34,6 +34,8 @@ Route::group(function () {
Route::post('addon/install/execute/:addon', 'addon.Addon/execute');
//插件安装状态
Route::get('addon/install/:addon/status/:key', 'addon.Addon/getInstallState');
//下载插件
Route::post('addon/download/:addon', 'addon.Addon/download');
//卸载插件
Route::post('addon/uninstall/:addon', 'addon.Addon/uninstall');
@ -41,6 +43,8 @@ Route::group(function () {
Route::post('addon/edit/:addon', 'addon.Addon/edit');
//应用列表(...)
Route::get('app/list', 'addon.App/getAppList');
})->middleware([
AdminCheckToken::class,
AdminCheckRole::class,

View File

@ -9,10 +9,11 @@
// | Author: Niucloud Team
// +----------------------------------------------------------------------
use think\facade\Route;
use core\exception\CommonException;
use think\facade\Request;
$is_demo = env('system.is_demo', 0);
if ($is_demo && !\think\facade\Request::isGet()) {
if ($is_demo && !Request::isGet()) {
//加载插件路由
throw new \core\exception\CommonException("演示数据不能进行修改");
throw new CommonException("演示数据不能进行修改");
}

View File

@ -42,11 +42,12 @@ Route::group('applet', function () {
//详情
Route::get('site/version/:id', 'applet.SiteVersion/info');
//最后一个升级的版本
Route::post('site/version/last', 'applet.SiteVersion/getLastVersion');
Route::get('site/version/last', 'applet.SiteVersion/getLastVersion');
//查看最新的版本
Route::get('site/version/upgrade', 'applet.SiteVersion/getUpgradeVersion');
//下载
Route::post('version/download/:id', 'applet.VersionDownload/download');
Route::get('version/download/:id', 'applet.VersionDownload/download');
})->middleware([
AdminCheckToken::class,
AdminCheckRole::class,

View File

@ -18,7 +18,7 @@ use think\facade\Route;
/**
* 自定义页面控制器
*/
Route::group('diy', function() {
Route::group('diy', function () {
/***************************************************** 自定义页面管理 ****************************************************/
//自定义页面分页列表

View File

@ -0,0 +1,46 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud-admin.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
use app\adminapi\middleware\AdminCheckRole;
use app\adminapi\middleware\AdminCheckToken;
use app\adminapi\middleware\AdminLog;
use think\facade\Route;
/**
* 应用插件相关路由
*/
Route::group('niucloud', function () {
//设置 授权信息
Route::post('authinfo', 'niucloud.Module/setAuthorize');
//获取 授权设置
Route::get('admin/authinfo', 'niucloud.Module/getAuthorize');
//获取授权信息
Route::get('authinfo', 'niucloud.Module/authorize');
//获取应用插件列表
Route::get('module', 'addon.Addon/getLocalAddonList');
//获取应用详情
Route::get('module', 'addon.Addon/getLocalAddonList');
//获取插件插件列表
Route::get('module/version', 'addon.Addon/lists');
//下载
Route::get('module/download/:version_id', 'addon.Addon/info');
//更新
Route::put('addon/status/:version_id', 'addon.Addon/setStatus');
})->middleware([
AdminCheckToken::class,
AdminCheckRole::class,
AdminLog::class
]);

View File

@ -31,6 +31,14 @@ Route::group('pay', function () {
Route::post('channel/set/transfer', 'pay.PayChannel/setTransfer');
//多渠道设置
Route::post('channel/set/all', 'pay.PayChannel/setAll');
// 支付审核
Route::get('audit', 'pay.Pay/audit');
// 审核通过
Route::put('pass/:out_trade_no', 'pay.Pay/pass');
// 审核拒绝
Route::put('refuse/:out_trade_no', 'pay.Pay/refuse');
// 支付单据详情
Route::get('detail/:id', 'pay.Pay/detail');
})->middleware([
AdminCheckToken::class,
AdminCheckRole::class,

View File

@ -9,6 +9,7 @@
// | Author: Niucloud Team
// +----------------------------------------------------------------------
use core\dict\DictLoader;
use think\facade\Route;
/**
@ -30,4 +31,4 @@ Route::group(function () {
});
//加载插件路由
(new \core\dict\DictLoader("Route"))->load(['app_type' => 'adminapi']);
(new DictLoader("Route"))->load(['app_type' => 'adminapi']);

View File

@ -77,6 +77,11 @@ Route::group('sys', function () {
//获取首页加载
Route::get('config/site_index', 'sys.Config/getSiteIndexList');
//平台首页加载设置
Route::put('config/admin_index', 'sys.Config/setAdminIndex');
//获取平台首页加载
Route::get('config/admin_index', 'sys.Config/getAdminIndexList');
//快捷菜单设置
Route::put('config/shortcut_menu', 'sys.Config/setShortcutMenu');
//获取快捷菜单
@ -185,6 +190,9 @@ Route::group('sys', function () {
Route::get('date/month', 'sys.Common/getMonth');
Route::get('date/week', 'sys.Common/getWeek');
/***************************************************** 获取布局 ****************************************************/
Route::get('layout', 'sys.System/layout');
Route::put('layout', 'sys.System/setLayout');
})->middleware([
AdminCheckToken::class,
AdminCheckRole::class,

View File

@ -9,8 +9,3 @@
// | Author: Niucloud Team
// +----------------------------------------------------------------------
use app\adminapi\middleware\AdminCheckRole;
use app\adminapi\middleware\AdminCheckToken;
use app\adminapi\middleware\AdminLog;
use think\facade\Route;

View File

@ -47,6 +47,7 @@ class Article extends BaseApiController
/**
* 文章详情
* @param int $id
* @return Response
*/
public function info(int $id){
return success((new ArticleService())->getInfo($id));

View File

@ -36,6 +36,7 @@ class ArticleCategory extends BaseApiController
/**
* 文章分类详情
* @param int $id
* @return Response
*/
public function info(int $id){
return success((new ArticleCategoryService())->getInfo($id));

View File

@ -44,7 +44,7 @@ class Diy extends BaseApiController
/**
* 分享内容
* @return Response|void
* @return Response
*/
public function share()
{

View File

@ -21,7 +21,8 @@ class Config extends BaseController
* 获取登录注册设置
* @return Response
*/
public function getLoginConfig(){
public function getLoginConfig()
{
return success((new MemberConfigService())->getLoginConfig());
}

View File

@ -14,6 +14,7 @@ namespace app\api\controller\login;
use app\service\api\captcha\CaptchaService;
use app\service\api\login\LoginService;
use core\base\BaseController;
use Exception;
use think\Response;
class Login extends BaseController
@ -22,7 +23,8 @@ class Login extends BaseController
* 登录
* @return Response
*/
public function login(){
public function login()
{
$data = $this->request->params([
['username', ''],
@ -31,7 +33,7 @@ class Login extends BaseController
//参数验证
//验证码验证
$result = (new LoginService())->account($data['username'], $data['password']);
if(!$result){
if (!$result) {
//账号密码错误, 重置验证码
return fail('ACCOUNT_OR_PASSWORD_ERROR');
}
@ -43,7 +45,8 @@ class Login extends BaseController
* 登出
* @return Response
*/
public function logout(){
public function logout()
{
(new LoginService)->logout();
return success('MEMBER_LOGOUT');
}
@ -52,28 +55,33 @@ class Login extends BaseController
* 创建验证码
* @return Response
*/
public function captcha(){
public function captcha()
{
return success((new CaptchaService())->create());
}
/**
* 发送手机验证码
* @return void
* @param $type
* @return Response
* @throws Exception
*/
public function sendMobileCode($type){
public function sendMobileCode($type)
{
$data = $this->request->params([
['mobile', ''],
['mobile', ''],
]);
return success((new LoginService())->sendMobileCode($data['mobile'], $type));
}
/**
* 手机号登录
* @return void
* @return Response
*/
public function mobile(){
public function mobile()
{
$data = $this->request->params([
['mobile', ''],
['mobile', ''],
]);
return success((new LoginService())->mobile($data['mobile']));
}
@ -82,9 +90,10 @@ class Login extends BaseController
* 重置密码
* @return Response
*/
public function resetPassword(){
public function resetPassword()
{
$data = $this->request->params([
['mobile', ''],
['mobile', ''],
['password', '']
]);
//参数验证

View File

@ -22,12 +22,13 @@ class Register extends BaseController
* 账号密码注册
* @return Response
*/
public function account(){
public function account()
{
$data = $this->request->params([
['username', ''],
['password', ''],
['mobile', ''],
['mobile', ''],
]);
//参数验证
$this->validate($data, 'app\validate\member\Member.account_register');
@ -40,9 +41,10 @@ class Register extends BaseController
* 手机号注册
* @return Response
*/
public function mobile(){
public function mobile()
{
$data = $this->request->params([
['mobile', ''],
['mobile', ''],
]);
//参数验证
$this->validate($data, [
@ -54,9 +56,4 @@ class Register extends BaseController
}
}

View File

@ -15,6 +15,7 @@ use app\dict\member\MemberAccountChangeTypeDict;
use app\dict\member\MemberAccountTypeDict;
use app\service\api\member\MemberAccountService;
use core\base\BaseApiController;
use think\db\exception\DbException;
use think\Response;
/**
@ -28,7 +29,8 @@ class Account extends BaseApiController
* 积分流水
* @return Response
*/
public function point(){
public function point(): Response
{
$data = $this->request->params([
['from_type', '']
]);
@ -40,7 +42,8 @@ class Account extends BaseApiController
* 余额流水
* @return Response
*/
public function balance(){
public function balance(): Response
{
$data = $this->request->params([
['from_type', '']
]);
@ -52,7 +55,8 @@ class Account extends BaseApiController
* 零钱流水
* @return Response
*/
public function money(){
public function money(): Response
{
$data = $this->request->params([
['from_type', '']
]);
@ -63,8 +67,10 @@ class Account extends BaseApiController
/**
* 账户记录数量
* @return Response
* @throws DbException
*/
public function count(){
public function count(): Response
{
$data = $this->request->params([
['from_type', ''],
['account_type', '']
@ -76,7 +82,8 @@ class Account extends BaseApiController
* 佣金流水
* @return Response
*/
public function commission(){
public function commission(): Response
{
$data = $this->request->params([
['from_type', '']
]);
@ -89,7 +96,8 @@ class Account extends BaseApiController
* @param $account_type
* @return Response
*/
public function getFromType($account_type){
public function getFromType($account_type): Response
{
return success(MemberAccountChangeTypeDict::getType($account_type));
}

View File

@ -13,6 +13,7 @@ namespace app\api\controller\member;
use app\service\api\member\MemberCashOutAccountService;
use core\base\BaseApiController;
use think\Response;
class CashOutAccount extends BaseApiController
{
@ -30,7 +31,7 @@ class CashOutAccount extends BaseApiController
/**
* 提现账户信息
* @param int $account_id
* @return \think\Response
* @return Response
*/
public function info(int $account_id){
return success((new MemberCashOutAccountService())->getInfo($account_id));
@ -38,7 +39,7 @@ class CashOutAccount extends BaseApiController
/**
* 查询首条提现账户按账户类型
* @return void
* @return Response
*/
public function firstInfo(){
$data = $this->request->params([
@ -49,7 +50,7 @@ class CashOutAccount extends BaseApiController
/**
* 添加提现账号
* @return void
* @return Response
*/
public function add(){
$data = $this->request->params([
@ -66,7 +67,7 @@ class CashOutAccount extends BaseApiController
/**
* 编辑提现账号
* @param int $account_id
* @return void
* @return Response
*/
public function edit(int $account_id){
$data = $this->request->params([
@ -83,7 +84,7 @@ class CashOutAccount extends BaseApiController
/**
* 删除提现账号
* @param int $account_id
* @return \think\Response
* @return Response
*/
public function del(int $account_id){
(new MemberCashOutAccountService())->del($account_id);

View File

@ -15,6 +15,9 @@ use app\service\api\login\AuthService;
use app\service\api\member\MemberLogService;
use app\service\api\member\MemberService;
use core\base\BaseApiController;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\Response;
class Member extends BaseApiController
@ -38,7 +41,6 @@ class Member extends BaseApiController
/**
* 修改会员
* @param $member_id
* @param $field
* @return Response
*/
@ -67,7 +69,7 @@ class Member extends BaseApiController
/**
* 绑定手机号
* @return void
* @return Response
*/
public function mobile(){
$data = $this->request->params([
@ -88,6 +90,13 @@ class Member extends BaseApiController
['pre_route', '']
]);
(new MemberLogService())->log($data);
return success('SUCCESS');
return success();
}
/**
* 获取会员码
*/
public function qrcode(){
return success((new MemberService())->getQrcode());
}
}

View File

@ -64,7 +64,7 @@ class MemberCashOut extends BaseApiController
/**
* 申请提现
* @return void
* @return Response
*/
public function apply()
{

View File

@ -13,6 +13,10 @@ namespace app\api\controller\pay;
use app\service\api\pay\PayService;
use core\base\BaseApiController;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\Response;
/**
* 微信服务端通信以及网页授权
@ -22,7 +26,7 @@ class Pay extends BaseApiController
/**
* 接收消息并推送
* @return void
* @return void|null
*/
public function notify($site_id, $channel, $type, $action)
{
@ -31,26 +35,39 @@ class Pay extends BaseApiController
/**
* 去支付
* @return \think\Response
* @return Response
*/
public function pay()
{
$data = $this->request->params([
['type', ''],
['out_trade_no', ''],
// ['out_trade_no', ''],
['trade_type', ''],//业务类型
['trade_id', ''],//业务id
['quit_url', ''],
['buyer_id', ''],
['return_url', '']
['return_url', ''],
['voucher', '']
]);
return success('SUCCESS',(new PayService())->pay($data['type'], $data['out_trade_no'], $data['return_url'], $data['quit_url'], $data['buyer_id']));
return success('SUCCESS',(new PayService())->pay($data['type'], $data['trade_type'], $data['trade_id'], $data['return_url'], $data['quit_url'], $data['buyer_id'], $data['voucher']));
}
public function info($out_trade_no)
public function info($trade_type, $trade_id)
{
return success((new PayService())->getInfoByTrade($trade_type, $trade_id));
}
return success((new PayService())->getInfoByOutTradeNo($out_trade_no));
/**
* 获取可用的支付方法
* @param $trade_type
* @return Response
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function getPayType($trade_type){
return success((new PayService())->getPayTypeByTrade($trade_type));
}
}

View File

@ -15,13 +15,14 @@ use app\service\api\upload\Base64Service;
use app\service\api\upload\FetchService;
use app\service\api\upload\UploadService;
use core\base\BaseApiController;
use think\Response;
class Upload extends BaseApiController
{
/**
* 图片上传
* @return \think\Response
* @return Response
*/
public function image(){
$data = $this->request->params([
@ -33,7 +34,7 @@ class Upload extends BaseApiController
/**
* 远程图片拉取
* @return \think\Response
* @return Response
*/
public function imageFetch(){
$data = $this->request->params([
@ -46,7 +47,7 @@ class Upload extends BaseApiController
/**
* base64图片上传
* @return \think\Response
* @return Response
*/
public function imageBase64(){
$data = $this->request->params([

View File

@ -22,7 +22,7 @@ class Weapp extends BaseApiController
/**
* 授权登录
* @return void
* @return Response
*/
public function login(){
$data = $this->request->params([['code', '']]);
@ -33,7 +33,6 @@ class Weapp extends BaseApiController
/**
* 注册
* @return Response
* @throws InvalidArgumentException
*/
public function register(){
$data = $this->request->params([

View File

@ -13,6 +13,12 @@ namespace app\api\controller\wechat;
use app\service\api\wechat\WechatServeService;
use core\base\BaseController;
use EasyWeChat\Kernel\Exceptions\BadRequestException;
use EasyWeChat\Kernel\Exceptions\InvalidArgumentException;
use EasyWeChat\Kernel\Exceptions\RuntimeException;
use ReflectionException;
use Symfony\Component\HttpFoundation\Response;
use Throwable;
/**
* 微信服务端通信以及网页授权
@ -22,7 +28,13 @@ class Serve extends BaseController
/**
* 接收消息并推送
* @return void
* @param $site_id
* @return Response
* @throws BadRequestException
* @throws InvalidArgumentException
* @throws RuntimeException
* @throws ReflectionException
* @throws Throwable
*/
public function serve($site_id){

View File

@ -14,6 +14,9 @@ namespace app\api\controller\wechat;
use app\service\api\wechat\WechatAuthService;
use core\base\BaseController;
use EasyWeChat\Kernel\Exceptions\InvalidArgumentException;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\Response;
class Wechat extends BaseController
@ -23,7 +26,6 @@ class Wechat extends BaseController
/**
* 获取跳转获取code
* @return Response
* @throws InvalidArgumentException
*/
public function getCodeUrl(){
$data = $this->request->params([
@ -36,7 +38,10 @@ class Wechat extends BaseController
/**
* 授权登录
* @return void
* @return Response
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function login(){
$data = $this->request->params([
@ -49,7 +54,6 @@ class Wechat extends BaseController
/**
* 注册
* @return Response
* @throws InvalidArgumentException
*/
public function register(){
$data = $this->request->params([
@ -67,7 +71,6 @@ class Wechat extends BaseController
/**
* 同步
* @return Response
* @throws InvalidArgumentException
*/
public function sync(){
$data = $this->request->params([
@ -91,7 +94,7 @@ class Wechat extends BaseController
/**
* 扫码登录
* @return void
* @return Response
*/
public function scanLogin(){
$wechat_auth_service = new WechatAuthService();

View File

@ -13,7 +13,6 @@ namespace app\api\middleware;
use app\Request;
use Closure;
use core\exception\ServerException;
/**
* http跨域请求中间件

View File

@ -12,11 +12,8 @@
namespace app\api\middleware;
use app\Request;
use app\service\core\site\CoreSiteService;
use Closure;
use core\exception\AuthException;
use Exception;
use think\facade\Log;
/**
@ -40,7 +37,7 @@ class ApiChannel
if (in_array($request->rule()->getRule(), $channel_rules)) {
$site_id = $request->param('site_id', -1);
if ($site_id != -1) {
$request->pushHeader([ system_name('api_site_id_name') => $site_id ]);
$request->pushHeader([system_name('api_site_id_name') => $site_id]);
}
}
return $next($request);

View File

@ -18,7 +18,7 @@ use think\facade\Route;
/**
* 路由
*/
Route::group('auth',function () {
Route::group('auth', function () {
Route::put('logout', 'login.Login/logout');

View File

@ -18,7 +18,7 @@ use think\facade\Route;
/**
* 会员个人信息管理
*/
Route::group('member', function() {
Route::group('member', function () {
/***************************************************** 会员管理 ****************************************************/
//会员个人详情
@ -31,6 +31,8 @@ Route::group('member', function() {
Route::put('edit', 'member.Member/edit');
//绑定手机号
Route::put('mobile', 'member.Member/mobile');
//获取会员码
Route::get('qrcode', 'member.Member/qrcode');
/***************************************************** 会员账户 ****************************************************/
//会员积分流水
@ -76,7 +78,7 @@ Route::group('member', function() {
->middleware(ApiLog::class);
Route::group('member', function() {
Route::group('member', function () {
/***************************************************** 会员管理 ****************************************************/
//会员日志

View File

@ -26,7 +26,9 @@ Route::group('pay',function () {
//去支付
Route::post('', 'pay.Pay/pay');
//支付信息
Route::get('info/:out_trade_no', 'pay.Pay/info');
Route::get('info/:trade_type/:trade_id', 'pay.Pay/info');
//
Route::get('type/:trade_type', 'pay.Pay/getPayType');
})->middleware(ApiChannel::class)
->middleware(ApiCheckToken::class)

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