mirror of
https://gitee.com/niucloud-team/niucloud-admin.git
synced 2025-12-11 18:32:49 +00:00
update niucloud
This commit is contained in:
parent
07292e4188
commit
c1e13b7b46
@ -57,7 +57,7 @@ class Request extends \think\Request
|
||||
$filter_rule = [
|
||||
"/<(\\/?)(script|i?frame|style|html|body|title|link|metaf|alert|font|object|\\?|\\%)([^>]*?)>/isU",
|
||||
"/(<[^>]*)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"
|
||||
"/\\b(select|join|where|drop|like|modify|rename|insert|update|table|database|alter|truncate|\'|\/\*|\.\.\/|\.\/|union|into|load_file|outfile)\\b/is"
|
||||
];
|
||||
return preg_replace($filter_rule, '', $param);
|
||||
}
|
||||
|
||||
@ -13,7 +13,6 @@ namespace app\adminapi\controller\addon;
|
||||
|
||||
use app\dict\addon\AddonDict;
|
||||
use app\service\admin\addon\AddonDevelopService;
|
||||
use app\service\admin\niucloud\AppService;
|
||||
use core\base\BaseAdminController;
|
||||
use think\Response;
|
||||
|
||||
|
||||
@ -25,34 +25,20 @@ class Auth extends BaseAdminController
|
||||
public function authMenuList()
|
||||
{
|
||||
$data = $this->request->params([
|
||||
['status', 1],
|
||||
['is_tree', 1],
|
||||
['is_button', 1]
|
||||
[ 'status', 1 ],
|
||||
[ 'is_tree', 1 ],
|
||||
[ 'is_button', 1 ]
|
||||
]);
|
||||
return success((new AuthService())->getAuthMenuList($data['status'], $data['is_tree'], $data['is_button']));
|
||||
return success(( new AuthService() )->getAuthMenuList($data[ 'status' ], $data[ 'is_tree' ], $data[ 'is_button' ]));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取授权应用
|
||||
* @return void
|
||||
*/
|
||||
public function getAuthAddonList(){
|
||||
$data = $this->request->params([
|
||||
['type', ''],
|
||||
['title', ''],
|
||||
['support_app','']
|
||||
]);
|
||||
return success((new AuthService())->getAuthAddonList($data));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取登录用户信息
|
||||
* @return Response
|
||||
*/
|
||||
public function get()
|
||||
{
|
||||
return success((new AuthService())->getAuthInfo());
|
||||
return success(( new AuthService() )->getAuthInfo());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -63,11 +49,11 @@ class Auth extends BaseAdminController
|
||||
public function modify($field)
|
||||
{
|
||||
$data = $this->request->params([
|
||||
['value', ''],
|
||||
['field', $field]
|
||||
[ 'value', '' ],
|
||||
[ 'field', $field ]
|
||||
]);
|
||||
// $this->validate($data, 'app\validate\sys\User.modify');
|
||||
(new AuthService())->modifyAuth($field, $data['value']);
|
||||
( new AuthService() )->modifyAuth($field, $data[ 'value' ]);
|
||||
return success('MODIFY_SUCCESS');
|
||||
}
|
||||
|
||||
@ -77,23 +63,12 @@ class Auth extends BaseAdminController
|
||||
public function edit()
|
||||
{
|
||||
$data = $this->request->params([
|
||||
['real_name', ''],
|
||||
['head_img', ''],
|
||||
['password', ''],
|
||||
['original_password', '']
|
||||
[ 'real_name', '' ],
|
||||
[ 'head_img', '' ],
|
||||
[ 'password', '' ],
|
||||
[ 'original_password', '' ]
|
||||
]);
|
||||
(new AuthService())->editAuth($data);
|
||||
( new AuthService() )->editAuth($data);
|
||||
return success('MODIFY_SUCCESS');
|
||||
}
|
||||
|
||||
/**
|
||||
* 授权应用加星
|
||||
*/
|
||||
public function setStar(){
|
||||
$data = $this->request->params([
|
||||
['key', ''],
|
||||
]);
|
||||
(new AuthService())->setAddonStat($data['key']);
|
||||
return success('SUCCESS');
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,7 +13,6 @@ namespace app\adminapi\controller\login;
|
||||
|
||||
use app\service\admin\auth\ConfigService;
|
||||
use app\service\admin\auth\LoginService;
|
||||
use app\service\core\menu\CoreMenuService;
|
||||
use core\base\BaseAdminController;
|
||||
use think\Response;
|
||||
|
||||
@ -27,12 +26,12 @@ class Login extends BaseAdminController
|
||||
{
|
||||
|
||||
$data = $this->request->params([
|
||||
['username', ''],
|
||||
['password', ''],
|
||||
[ 'username', '' ],
|
||||
[ 'password', '' ],
|
||||
]);
|
||||
//参数验证
|
||||
//验证码验证
|
||||
$result = (new LoginService())->login($data['username'], $data['password']);
|
||||
$result = ( new LoginService() )->login($data[ 'username' ], $data[ 'password' ]);
|
||||
if (!$result) {
|
||||
//账号密码错误...., 重置验证码
|
||||
return fail('USER_ERROR');
|
||||
@ -47,7 +46,7 @@ class Login extends BaseAdminController
|
||||
*/
|
||||
public function logout()
|
||||
{
|
||||
(new LoginService)->logout();
|
||||
( new LoginService )->logout();
|
||||
return success('LOGOUT');
|
||||
}
|
||||
|
||||
@ -58,10 +57,6 @@ class Login extends BaseAdminController
|
||||
*/
|
||||
public function getConfig()
|
||||
{
|
||||
return success((new ConfigService())->getConfig());
|
||||
}
|
||||
|
||||
public function test() {
|
||||
|
||||
return success(( new ConfigService() )->getConfig());
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,7 +15,6 @@ use app\dict\member\MemberDict;
|
||||
use app\dict\member\MemberRegisterChannelDict;
|
||||
use app\dict\member\MemberRegisterTypeDict;
|
||||
use app\service\admin\member\MemberService;
|
||||
use app\service\core\sys\CoreExportService;
|
||||
use core\base\BaseAdminController;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
|
||||
@ -94,21 +94,6 @@ class Notice extends BaseAdminController
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 消息列表
|
||||
* @return Response
|
||||
*/
|
||||
public function getLogList()
|
||||
{
|
||||
$data = $this->request->params([
|
||||
['key', ''],
|
||||
['receiver', ''],
|
||||
]);
|
||||
|
||||
$res = (new NoticeService())->getLogPage($data);
|
||||
return success($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 消息修改
|
||||
* @return Response
|
||||
|
||||
@ -134,46 +134,6 @@ class Config extends BaseAdminController
|
||||
return success((new ConfigService())->getMap());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取站点首页列表(如果正在使用is_use = 1)
|
||||
*/
|
||||
public function getSiteIndexList()
|
||||
{
|
||||
return success((new ConfigService())->getSiteIndexList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 首页配置
|
||||
*/
|
||||
public function setSiteIndex()
|
||||
{
|
||||
$data = $this->request->params([
|
||||
['view_path', ''],
|
||||
]);
|
||||
(new ConfigService())->setSiteIndexConfig($data);
|
||||
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();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取手机端首页列表
|
||||
*/
|
||||
@ -186,26 +146,6 @@ class Config extends BaseAdminController
|
||||
return success(( new ConfigService() )->getWapIndexList($data));
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置快捷菜单
|
||||
*/
|
||||
public function setShortcutMenu()
|
||||
{
|
||||
$data = $this->request->params([
|
||||
['menu', []],
|
||||
]);
|
||||
(new ConfigService())->setShortcutMenu($data['menu']);
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取站点快捷菜单
|
||||
*/
|
||||
public function getShortcutMenu()
|
||||
{
|
||||
return success(data: (new ConfigService())->getShortcutMenu());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取开发者key
|
||||
* @return Response
|
||||
|
||||
@ -190,7 +190,7 @@ class Poster extends BaseAdminController
|
||||
] ], // 数据参数
|
||||
[ 'channel', 'h5' ]
|
||||
]);
|
||||
return success(data: poster($this->request->siteId(), ...$data));
|
||||
return success(data: poster(...$data));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
279
niucloud/app/adminapi/controller/sys/Printer.php
Normal file
279
niucloud/app/adminapi/controller/sys/Printer.php
Normal file
@ -0,0 +1,279 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | Niucloud-admin 企业快速开发的多应用管理平台
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网址:https://www.niucloud.com
|
||||
// +----------------------------------------------------------------------
|
||||
// | niucloud团队 版权所有 开源版本可自由商用
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: Niucloud Team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\controller\sys;
|
||||
|
||||
use app\service\admin\sys\PrinterService;
|
||||
use app\service\admin\sys\PrinterTemplateService;
|
||||
use core\base\BaseAdminController;
|
||||
|
||||
|
||||
/**
|
||||
* 小票打印机控制器
|
||||
* Class Printer
|
||||
* @package app\adminapi\controller\sys
|
||||
*/
|
||||
class Printer extends BaseAdminController
|
||||
{
|
||||
|
||||
/**
|
||||
* 获取小票打印机分页列表
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function pages()
|
||||
{
|
||||
$data = $this->request->params([
|
||||
[ "printer_name", "" ],
|
||||
]);
|
||||
return success(( new PrinterService() )->getPage($data));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取小票打印机列表
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
$data = $this->request->params([
|
||||
[ "printer_name", "" ],
|
||||
]);
|
||||
return success(( new PrinterService() )->getList($data));
|
||||
}
|
||||
|
||||
/**
|
||||
* 小票打印机详情
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function info(int $id)
|
||||
{
|
||||
return success(( new PrinterService() )->getInfo($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加小票打印机
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$data = $this->request->params([
|
||||
[ "brand", "" ],
|
||||
[ "printer_name", "" ],
|
||||
[ "printer_code", "" ],
|
||||
[ "printer_key", "" ],
|
||||
[ "open_id", "" ],
|
||||
[ "apikey", "" ],
|
||||
[ 'template_type', '' ],
|
||||
[ 'trigger', '' ],
|
||||
[ "value", "" ],
|
||||
[ "print_width", "" ],
|
||||
[ "status", 0 ],
|
||||
]);
|
||||
$this->validate($data, 'app\validate\sys\Printer.add');
|
||||
$id = ( new PrinterService() )->add($data);
|
||||
return success('ADD_SUCCESS', [ 'id' => $id ]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 小票打印机编辑
|
||||
* @param $id 小票打印机id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function edit(int $id)
|
||||
{
|
||||
$data = $this->request->params([
|
||||
[ "brand", "" ],
|
||||
[ "printer_name", "" ],
|
||||
[ "printer_code", "" ],
|
||||
[ "printer_key", "" ],
|
||||
[ "open_id", "" ],
|
||||
[ "apikey", "" ],
|
||||
[ 'template_type', '' ],
|
||||
[ 'trigger', '' ],
|
||||
[ "value", "" ],
|
||||
[ "print_width", "" ],
|
||||
[ "status", 0 ],
|
||||
]);
|
||||
$this->validate($data, 'app\validate\sys\Printer.edit');
|
||||
( new PrinterService() )->edit($id, $data);
|
||||
return success('EDIT_SUCCESS');
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改小票打印机状态
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function modifyStatus()
|
||||
{
|
||||
$data = $this->request->params([
|
||||
[ "printer_id", 0 ],
|
||||
[ "status", 0 ],
|
||||
]);
|
||||
( new PrinterService() )->modifyStatus($data);
|
||||
return success('SUCCESS');
|
||||
}
|
||||
|
||||
/**
|
||||
* 小票打印机删除
|
||||
* @param $id 小票打印机id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function del(int $id)
|
||||
{
|
||||
( new PrinterService() )->del($id);
|
||||
return success('DELETE_SUCCESS');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取小票打印模板分页列表
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function templatePageLists()
|
||||
{
|
||||
$data = $this->request->params([
|
||||
[ "template_type", "" ],
|
||||
[ "template_name", "" ],
|
||||
]);
|
||||
return success(( new PrinterTemplateService() )->getPage($data));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取小票打印模板列表
|
||||
* @return \think\Response
|
||||
* @throws \think\db\exception\DbException
|
||||
*/
|
||||
public function templateLists()
|
||||
{
|
||||
$data = $this->request->params([
|
||||
[ "template_type", "" ],
|
||||
[ "template_name", "" ],
|
||||
]);
|
||||
return success(( new PrinterTemplateService() )->getList($data));
|
||||
}
|
||||
|
||||
/**
|
||||
* 小票打印模板详情
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function templateInfo(int $id)
|
||||
{
|
||||
return success(( new PrinterTemplateService() )->getInfo($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加小票打印模板
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function templateAdd()
|
||||
{
|
||||
$data = $this->request->params([
|
||||
[ "template_type", "" ],
|
||||
[ "template_name", "" ],
|
||||
[ "value", "" ],
|
||||
]);
|
||||
$this->validate($data, 'app\validate\sys\PrinterTemplate.add');
|
||||
$id = ( new PrinterTemplateService() )->add($data);
|
||||
return success('ADD_SUCCESS', [ 'id' => $id ]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 小票打印模板编辑
|
||||
* @param $id 小票打印模板id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function templateEdit(int $id)
|
||||
{
|
||||
$data = $this->request->params([
|
||||
[ "template_type", "" ],
|
||||
[ "template_name", "" ],
|
||||
[ "value", "" ],
|
||||
]);
|
||||
$this->validate($data, 'app\validate\sys\PrinterTemplate.edit');
|
||||
( new PrinterTemplateService() )->edit($id, $data);
|
||||
return success('EDIT_SUCCESS');
|
||||
}
|
||||
|
||||
/**
|
||||
* 小票打印模板删除
|
||||
* @param $id 小票打印模板id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function templateDel(int $id)
|
||||
{
|
||||
( new PrinterTemplateService() )->del($id);
|
||||
return success('DELETE_SUCCESS');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取小票打印模板类型
|
||||
* @return array|\think\Response
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return success(( new PrinterService() )->getType());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取小票打印机设备品牌
|
||||
* @return array|\think\Response
|
||||
*/
|
||||
public function getBrand()
|
||||
{
|
||||
$data = $this->request->params([
|
||||
[ "brand", "" ],
|
||||
]);
|
||||
return success(( new PrinterService() )->getBrand($data[ 'brand' ]));
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试打印
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function testPrint(int $id)
|
||||
{
|
||||
( new PrinterService() )->testPrint($id);
|
||||
return success('SUCCESS');
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新打印机token
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function refreshToken(int $id)
|
||||
{
|
||||
( new PrinterService() )->refreshToken($id);
|
||||
return success('SUCCESS');
|
||||
}
|
||||
|
||||
/**
|
||||
* 打印小票内容
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function printTicket()
|
||||
{
|
||||
$data = $this->request->params([
|
||||
[ "type", "" ], // 小票模板类型
|
||||
[ "trigger", "" ], // 触发时机
|
||||
[ 'business', [] ] // 业务参数,根据自身业务传值
|
||||
]);
|
||||
|
||||
$res = ( new PrinterService() )->printTicket($data);
|
||||
if ($res[ 'code' ] == 0) {
|
||||
return success('SUCCESS');
|
||||
} else {
|
||||
return fail($res[ 'message' ]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -50,6 +50,17 @@ class User extends BaseAdminController
|
||||
return success((new UserService())->getInfo($uid));
|
||||
}
|
||||
|
||||
public function getUserAll()
|
||||
{
|
||||
$data = $this->request->params([
|
||||
['username', ''],
|
||||
['realname', ''],
|
||||
['create_time', []],
|
||||
]);
|
||||
$list = (new UserService())->getUserAll($data);
|
||||
return success($list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户
|
||||
* @return Response
|
||||
|
||||
@ -13,7 +13,6 @@ namespace app\adminapi\controller\weapp;
|
||||
|
||||
use app\service\admin\weapp\WeappDeliveryService;
|
||||
use core\base\BaseAdminController;
|
||||
use think\Response;
|
||||
|
||||
/**
|
||||
* 小程序发货信息管理服务
|
||||
|
||||
@ -13,7 +13,6 @@ namespace app\adminapi\controller\weapp;
|
||||
|
||||
use app\service\admin\weapp\WeappVersionService;
|
||||
use core\base\BaseAdminController;
|
||||
use Exception;
|
||||
use think\Response;
|
||||
|
||||
/**
|
||||
|
||||
@ -24,8 +24,6 @@ Route::group('auth', function () {
|
||||
/***************************************************** 授权信息 ****************************************************/
|
||||
//授权用户站点菜单
|
||||
Route::get('authmenu', 'auth.Auth/authMenuList');
|
||||
//授权用户站点应用
|
||||
Route::get('authaddon', 'auth.Auth/getAuthAddonList');
|
||||
//授权用户信息
|
||||
Route::get('get', 'auth.Auth/get');
|
||||
//授权用户信息
|
||||
|
||||
@ -16,7 +16,6 @@ use app\adminapi\middleware\AdminCheckToken;
|
||||
use app\adminapi\middleware\AdminLog;
|
||||
|
||||
|
||||
// USER_CODE_BEGIN -- sys_dict
|
||||
Route::group('dict', function () {
|
||||
|
||||
//数据字典列表
|
||||
@ -39,5 +38,4 @@ Route::group('dict', function () {
|
||||
AdminCheckToken::class,
|
||||
AdminCheckRole::class,
|
||||
AdminLog::class
|
||||
]);
|
||||
// USER_CODE_END -- sys_dict
|
||||
]);
|
||||
@ -54,7 +54,7 @@ Route::group('diy', function() {
|
||||
Route::get('link', 'diy.Diy/getLink');
|
||||
|
||||
// 设为使用
|
||||
Route::put('use', 'diy.Diy/setUse');
|
||||
Route::put('use/:id', 'diy.Diy/setUse');
|
||||
|
||||
// 获取页面模板
|
||||
Route::get('template', 'diy.Diy/getTemplate');
|
||||
|
||||
@ -18,7 +18,7 @@ use think\facade\Route;
|
||||
/**
|
||||
* 路由
|
||||
*/
|
||||
Route::group('member', function () {
|
||||
Route::group('member', function() {
|
||||
/***************************************************** 会员管理 ****************************************************/
|
||||
//会员列表
|
||||
Route::get('member', 'member.Member/lists');
|
||||
|
||||
@ -32,8 +32,6 @@ Route::group('notice', function () {
|
||||
Route::get('notice/sms/:sms_type', 'notice.Notice/smsConfig');
|
||||
//短信配置修改
|
||||
Route::put('notice/sms/:sms_type', 'notice.Notice/editSms');
|
||||
//消息发送记录
|
||||
Route::get('notice/log', 'notice.Notice/getLogList');
|
||||
//消息修改
|
||||
Route::post('notice/edit', 'notice.Notice/edit');
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ use think\facade\Route;
|
||||
/**
|
||||
* 路由
|
||||
*/
|
||||
Route::group(function () {
|
||||
Route::group(function() {
|
||||
//用户登录
|
||||
Route::get('login', 'login.Login/login');
|
||||
|
||||
@ -26,9 +26,7 @@ Route::group(function () {
|
||||
Route::get('captcha/create', 'login.Captcha/create');
|
||||
//一次校验验证码
|
||||
Route::get('captcha/check', 'login.Captcha/check');
|
||||
|
||||
Route::get('test', 'login.Login/test');
|
||||
});
|
||||
|
||||
//加载插件路由
|
||||
(new DictLoader("Route"))->load(['app_type' => 'adminapi']);
|
||||
( new DictLoader("Route") )->load([ 'app_type' => 'adminapi' ]);
|
||||
|
||||
@ -1,34 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | Niucloud-admin 企业快速开发的多应用管理平台
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网址:https://www.niucloud.com
|
||||
// +----------------------------------------------------------------------
|
||||
// | niucloud团队 版权所有 开源版本可自由商用
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: Niucloud Team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
use app\adminapi\middleware\AdminCheckRole;
|
||||
use app\adminapi\middleware\AdminCheckToken;
|
||||
use app\adminapi\middleware\AdminLog;
|
||||
use think\facade\Route;
|
||||
|
||||
|
||||
/**
|
||||
* 站点相关(平台0)
|
||||
*/
|
||||
Route::group('stat', function () {
|
||||
|
||||
/***************************************************** 统计 ****************************************************/
|
||||
//控制台
|
||||
Route::get('index', 'stat.Stat/index');
|
||||
//站点控制台
|
||||
Route::get('siteindex', 'stat.SiteStat/index');
|
||||
|
||||
|
||||
})->middleware([
|
||||
AdminCheckToken::class,
|
||||
AdminCheckRole::class,
|
||||
AdminLog::class
|
||||
]);
|
||||
@ -86,24 +86,6 @@ Route::group('sys', function() {
|
||||
//地图设置
|
||||
Route::get('config/map', 'sys.Config/getMap');
|
||||
|
||||
//首页加载设置
|
||||
Route::put('config/site_index', 'sys.Config/setSiteIndex');
|
||||
//获取首页加载
|
||||
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::get('config/wap_index', 'sys.Config/getWapIndexList');
|
||||
|
||||
//快捷菜单设置
|
||||
Route::put('config/shortcut_menu', 'sys.Config/setShortcutMenu');
|
||||
//获取快捷菜单
|
||||
Route::get('config/shortcut_menu', 'sys.Config/getShortcutMenu');
|
||||
|
||||
//登录注册设置
|
||||
Route::get('config/login', 'login.Config/getConfig');
|
||||
//登录注册设置
|
||||
@ -274,6 +256,63 @@ Route::group('sys', function() {
|
||||
/***************************************************** 获取布局 ****************************************************/
|
||||
Route::get('layout', 'sys.System/layout');
|
||||
Route::put('layout', 'sys.System/setLayout');
|
||||
|
||||
/***************************************************** 小票打印管理 ****************************************************/
|
||||
|
||||
// 小票打印机分页列表
|
||||
Route::get('printer', 'sys.Printer/pages');
|
||||
|
||||
// 小票打印机列表
|
||||
Route::get('printer/list', 'sys.Printer/lists');
|
||||
|
||||
// 小票打印机详情
|
||||
Route::get('printer/:id', 'sys.Printer/info');
|
||||
|
||||
// 添加小票打印机
|
||||
Route::post('printer', 'sys.Printer/add');
|
||||
|
||||
// 编辑小票打印机
|
||||
Route::put('printer/:id', 'sys.Printer/edit');
|
||||
|
||||
// 修改小票打印机状态
|
||||
Route::put('printer/status', 'sys.Printer/modifyStatus');
|
||||
|
||||
// 删除小票打印机
|
||||
Route::delete('printer/:id', 'sys.Printer/del');
|
||||
|
||||
// 小票打印模板分页列表
|
||||
Route::get('printer/template', 'sys.Printer/templatePageLists');
|
||||
|
||||
// 小票打印模板列表
|
||||
Route::get('printer/template/list', 'sys.Printer/templateLists');
|
||||
|
||||
// 小票打印模板详情
|
||||
Route::get('printer/template/:id', 'sys.Printer/templateInfo');
|
||||
|
||||
// 添加小票打印模板
|
||||
Route::post('printer/template', 'sys.Printer/templateAdd');
|
||||
|
||||
// 编辑小票打印模板
|
||||
Route::put('printer/template/:id', 'sys.Printer/templateEdit');
|
||||
|
||||
// 删除小票打印模板
|
||||
Route::delete('printer/template/:id', 'sys.Printer/templateDel');
|
||||
|
||||
// 获取小票打印模板类型
|
||||
Route::get('printer/type', 'sys.Printer/getType');
|
||||
|
||||
// 获取小票打印机设备品牌
|
||||
Route::get('printer/brand', 'sys.Printer/getBrand');
|
||||
|
||||
// 刷新易联云打印机token
|
||||
Route::put('printer/refreshtoken/:id', 'sys.Printer/refreshToken');
|
||||
|
||||
// 测试易联云打印
|
||||
Route::put('printer/testprint/:id', 'sys.Printer/testPrint');
|
||||
|
||||
// 打印小票内容
|
||||
Route::post('printer/printticket', 'sys.Printer/printTicket');
|
||||
|
||||
})->middleware([
|
||||
AdminCheckToken::class,
|
||||
AdminCheckRole::class,
|
||||
|
||||
@ -19,6 +19,8 @@ use think\facade\Route;
|
||||
Route::group('user', function () {
|
||||
/***************************************************** 用户 ****************************************************/
|
||||
Route::get('', 'user.User/lists');
|
||||
//全部用户列表
|
||||
Route::get('user_all', 'user.User/getUserAll');
|
||||
//用户详情
|
||||
Route::get(':uid', 'user.User/info');
|
||||
//用户新增
|
||||
|
||||
@ -11,7 +11,9 @@
|
||||
|
||||
namespace app\api\controller\login;
|
||||
|
||||
use app\dict\member\MemberLoginTypeDict;
|
||||
use app\service\api\captcha\CaptchaService;
|
||||
use app\service\api\login\ConfigService;
|
||||
use app\service\api\login\LoginService;
|
||||
use core\base\BaseController;
|
||||
use Exception;
|
||||
@ -25,20 +27,20 @@ class Login extends BaseController
|
||||
*/
|
||||
public function login()
|
||||
{
|
||||
|
||||
$data = $this->request->params([
|
||||
['username', ''],
|
||||
['password', ''],
|
||||
[ 'username', '' ],
|
||||
[ 'password', '' ],
|
||||
]);
|
||||
//校验登录注册配置
|
||||
( new ConfigService() )->checkLoginConfig(MemberLoginTypeDict::USERNAME);
|
||||
//参数验证
|
||||
//验证码验证
|
||||
$result = (new LoginService())->account($data['username'], $data['password']);
|
||||
$result = ( new LoginService() )->account($data[ 'username' ], $data[ 'password' ]);
|
||||
if (!$result) {
|
||||
//账号密码错误, 重置验证码
|
||||
return fail('ACCOUNT_OR_PASSWORD_ERROR');
|
||||
}
|
||||
return success($result);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -47,7 +49,7 @@ class Login extends BaseController
|
||||
*/
|
||||
public function logout()
|
||||
{
|
||||
(new LoginService)->logout();
|
||||
( new LoginService )->logout();
|
||||
return success('MEMBER_LOGOUT');
|
||||
}
|
||||
|
||||
@ -57,7 +59,7 @@ class Login extends BaseController
|
||||
*/
|
||||
public function captcha()
|
||||
{
|
||||
return success((new CaptchaService())->create());
|
||||
return success(( new CaptchaService() )->create());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -69,9 +71,9 @@ class Login extends BaseController
|
||||
public function sendMobileCode($type)
|
||||
{
|
||||
$data = $this->request->params([
|
||||
['mobile', ''],
|
||||
[ 'mobile', '' ],
|
||||
]);
|
||||
return success((new LoginService())->sendMobileCode($data['mobile'], $type));
|
||||
return success(( new LoginService() )->sendMobileCode($data[ 'mobile' ], $type));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -81,9 +83,11 @@ class Login extends BaseController
|
||||
public function mobile()
|
||||
{
|
||||
$data = $this->request->params([
|
||||
['mobile', ''],
|
||||
[ 'mobile', '' ],
|
||||
]);
|
||||
return success((new LoginService())->mobile($data['mobile']));
|
||||
//校验登录注册配置
|
||||
( new ConfigService() )->checkLoginConfig(MemberLoginTypeDict::MOBILE);
|
||||
return success(( new LoginService() )->mobile($data[ 'mobile' ]));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -93,12 +97,12 @@ class Login extends BaseController
|
||||
public function resetPassword()
|
||||
{
|
||||
$data = $this->request->params([
|
||||
['mobile', ''],
|
||||
['password', '']
|
||||
[ 'mobile', '' ],
|
||||
[ 'password', '' ]
|
||||
]);
|
||||
//参数验证
|
||||
$this->validate($data, 'app\validate\member\Member.reset_password');
|
||||
(new LoginService())->resetPassword($data['mobile'], $data['password']);
|
||||
( new LoginService() )->resetPassword($data[ 'mobile' ], $data[ 'password' ]);
|
||||
return success('PASSWORD_RESET_SUCCESS');
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
|
||||
namespace app\api\controller\login;
|
||||
|
||||
use app\dict\member\MemberLoginTypeDict;
|
||||
use app\service\api\login\ConfigService;
|
||||
use app\service\api\login\RegisterService;
|
||||
use core\base\BaseController;
|
||||
use think\Response;
|
||||
@ -26,14 +28,16 @@ class Register extends BaseController
|
||||
{
|
||||
|
||||
$data = $this->request->params([
|
||||
['username', ''],
|
||||
['password', ''],
|
||||
['mobile', ''],
|
||||
[ 'username', '' ],
|
||||
[ 'password', '' ],
|
||||
[ 'mobile', '' ],
|
||||
]);
|
||||
//校验登录注册配置
|
||||
( new ConfigService() )->checkLoginConfig(MemberLoginTypeDict::USERNAME);
|
||||
//参数验证
|
||||
$this->validate($data, 'app\validate\member\Member.account_register');
|
||||
//验证码验证
|
||||
$result = (new RegisterService())->account($data['username'], $data['password'], $data['mobile']);
|
||||
$result = ( new RegisterService() )->account($data[ 'username' ], $data[ 'password' ], $data[ 'mobile' ]);
|
||||
return success($result);
|
||||
}
|
||||
|
||||
@ -44,16 +48,17 @@ class Register extends BaseController
|
||||
public function mobile()
|
||||
{
|
||||
$data = $this->request->params([
|
||||
['mobile', ''],
|
||||
[ 'mobile', '' ],
|
||||
]);
|
||||
//校验登录注册配置
|
||||
( new ConfigService() )->checkLoginConfig(MemberLoginTypeDict::MOBILE);
|
||||
//参数验证
|
||||
$this->validate($data, [
|
||||
'mobile' => 'require|mobile'
|
||||
]);
|
||||
//验证码验证
|
||||
$result = (new RegisterService())->mobile($data['mobile']);
|
||||
$result = ( new RegisterService() )->mobile($data[ 'mobile' ]);
|
||||
return success($result);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -33,10 +33,12 @@ class Account extends BaseApiController
|
||||
public function point(): Response
|
||||
{
|
||||
$data = $this->request->params([
|
||||
['from_type', '']
|
||||
['from_type', ''],
|
||||
['amount_type', 'all'],//全部all 收入income 支出disburse
|
||||
['create_time', []],
|
||||
]);
|
||||
$data['account_type'] = MemberAccountTypeDict::POINT;
|
||||
return success((new MemberAccountService())->getPage($data));
|
||||
return success((new MemberAccountService())->getPointPage($data));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -59,9 +61,11 @@ class Account extends BaseApiController
|
||||
public function balanceList(): Response
|
||||
{
|
||||
$data = $this->request->params([
|
||||
['from_type', '']
|
||||
['from_type', ''],
|
||||
['trade_type', ''],
|
||||
['create_time', []]
|
||||
]);
|
||||
return success((new MemberAccountService())->getPages($data));
|
||||
return success((new MemberAccountService())->getBalancePage($data));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -98,9 +102,11 @@ class Account extends BaseApiController
|
||||
public function commission(): Response
|
||||
{
|
||||
$data = $this->request->params([
|
||||
['keyword', ''],
|
||||
['from_type', ''],
|
||||
['account_data_gt', ''],
|
||||
['account_data_lt', ''],
|
||||
['create_time', []],
|
||||
]);
|
||||
$data['account_type'] = MemberAccountTypeDict::COMMISSION;
|
||||
return success((new MemberAccountService())->getPage($data));
|
||||
|
||||
@ -15,9 +15,6 @@ 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
|
||||
|
||||
@ -11,7 +11,6 @@
|
||||
|
||||
namespace app\api\controller\sys;
|
||||
|
||||
use app\service\api\scan\ScanService;
|
||||
use app\service\api\verify\VerifyService;
|
||||
use core\base\BaseApiController;
|
||||
use think\Response;
|
||||
@ -64,6 +63,7 @@ class Verify extends BaseApiController
|
||||
['relate_tag', 0],
|
||||
['type', ''],
|
||||
['code', ''],
|
||||
['keyword', ''],
|
||||
['create_time', []]
|
||||
]);
|
||||
return success(data:(new VerifyService())->getRecordsPageByVerifier($data));
|
||||
|
||||
@ -48,7 +48,6 @@ class Weapp extends BaseApiController
|
||||
return success($weapp_auth_service->register($data[ 'openid' ], $data[ 'mobile' ], $data[ 'mobile_code' ], $data[ 'unionid' ]));
|
||||
}
|
||||
|
||||
|
||||
public function subscribeMessage()
|
||||
{
|
||||
$data = $this->request->params([ [ 'keys', '' ] ]);
|
||||
@ -68,7 +67,6 @@ class Weapp extends BaseApiController
|
||||
if ($result) {
|
||||
return success([ 'is_trade_managed' => true ]);
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
}
|
||||
return success([ 'is_trade_managed' => false ]);
|
||||
@ -86,7 +84,17 @@ class Weapp extends BaseApiController
|
||||
$wechat_template_service = new WeappDeliveryService();
|
||||
$result = $wechat_template_service->getMsgJumpPath($data[ 'out_trade_no' ]);
|
||||
return success([ 'path' => $result ]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新openid
|
||||
* @return Response
|
||||
*/
|
||||
public function updateOpenid()
|
||||
{
|
||||
$data = $this->request->params([ [ 'code', '' ] ]);
|
||||
$weapp_auth_service = new WeappAuthService();
|
||||
return success($weapp_auth_service->updateOpenid($data[ 'code' ]));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -13,7 +13,6 @@ 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;
|
||||
@ -27,38 +26,41 @@ class Wechat extends BaseController
|
||||
* 获取跳转获取code
|
||||
* @return Response
|
||||
*/
|
||||
public function getCodeUrl(){
|
||||
public function getCodeUrl()
|
||||
{
|
||||
$data = $this->request->params([
|
||||
['url', ''],
|
||||
['scopes', '']
|
||||
[ 'url', '' ],
|
||||
[ 'scopes', '' ]
|
||||
]);
|
||||
$wechat_auth_service = new WechatAuthService();
|
||||
return success($wechat_auth_service->authorization($data['url'], $data['scopes']));
|
||||
return success($wechat_auth_service->authorization($data[ 'url' ], $data[ 'scopes' ]));
|
||||
}
|
||||
|
||||
/**
|
||||
* code获取微信信息
|
||||
* @return Response
|
||||
*/
|
||||
public function getWechatUser(){
|
||||
public function getWechatUser()
|
||||
{
|
||||
$data = $this->request->params([
|
||||
['code', ''],
|
||||
[ 'code', '' ],
|
||||
]);
|
||||
$wechat_auth_service = new WechatAuthService();
|
||||
$data = $wechat_auth_service->userFromCode($data['code']);
|
||||
return success(['data'=> json_encode($data)]);
|
||||
$data = $wechat_auth_service->userFromCode($data[ 'code' ]);
|
||||
return success([ 'data' => json_encode($data) ]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 授权信息登录
|
||||
* @return Response
|
||||
*/
|
||||
public function wechatLogin(){
|
||||
public function wechatLogin()
|
||||
{
|
||||
$data = $this->request->params([
|
||||
['data', ''],
|
||||
[ 'data', '' ],
|
||||
]);
|
||||
$wechat_auth_service = new WechatAuthService();
|
||||
[$avatar, $nickname, $openid, $unionid] = json_decode($data['data'], true);
|
||||
[ $avatar, $nickname, $openid, $unionid ] = json_decode($data[ 'data' ], true);
|
||||
return success($wechat_auth_service->login($openid, $nickname, $avatar, $unionid));
|
||||
}
|
||||
|
||||
@ -69,63 +71,78 @@ class Wechat extends BaseController
|
||||
* @throws DbException
|
||||
* @throws ModelNotFoundException
|
||||
*/
|
||||
public function login(){
|
||||
public function login()
|
||||
{
|
||||
$data = $this->request->params([
|
||||
['code', ''],
|
||||
[ 'code', '' ],
|
||||
]);
|
||||
$wechat_auth_service = new WechatAuthService();
|
||||
return success($wechat_auth_service->loginByCode($data['code']));
|
||||
return success($wechat_auth_service->loginByCode($data[ 'code' ]));
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册
|
||||
* @return Response
|
||||
*/
|
||||
public function register(){
|
||||
public function register()
|
||||
{
|
||||
$data = $this->request->params([
|
||||
['openid', ''],
|
||||
['unionid', ''],
|
||||
['mobile', ''],
|
||||
[ 'openid', '' ],
|
||||
[ 'unionid', '' ],
|
||||
[ 'mobile', '' ],
|
||||
]);
|
||||
//参数验证
|
||||
$this->validate($data, [
|
||||
'mobile' => 'mobile'
|
||||
]);
|
||||
$wechat_auth_service = new WechatAuthService();
|
||||
return success($wechat_auth_service->register($data['openid'], $data['mobile'], wx_unionid: $data['unionid']));
|
||||
return success($wechat_auth_service->register($data[ 'openid' ], $data[ 'mobile' ], wx_unionid: $data[ 'unionid' ]));
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步
|
||||
* @return Response
|
||||
*/
|
||||
public function sync(){
|
||||
public function sync()
|
||||
{
|
||||
$data = $this->request->params([
|
||||
['code', ''],
|
||||
[ 'code', '' ],
|
||||
]);
|
||||
$wechat_auth_service = new WechatAuthService();
|
||||
return success($wechat_auth_service->sync($data['code']));
|
||||
return success($wechat_auth_service->sync($data[ 'code' ]));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取jssdk config
|
||||
* @return Response
|
||||
*/
|
||||
public function jssdkConfig(){
|
||||
public function jssdkConfig()
|
||||
{
|
||||
$data = $this->request->params([
|
||||
['url', ''],
|
||||
[ 'url', '' ],
|
||||
]);
|
||||
$wechat_auth_service = new WechatAuthService();
|
||||
return success($wechat_auth_service->jssdkConfig($data['url']));
|
||||
return success($wechat_auth_service->jssdkConfig($data[ 'url' ]));
|
||||
}
|
||||
|
||||
/**
|
||||
* 扫码登录
|
||||
* @return Response
|
||||
*/
|
||||
public function scanLogin(){
|
||||
public function scanLogin()
|
||||
{
|
||||
$wechat_auth_service = new WechatAuthService();
|
||||
return success($wechat_auth_service->scanLogin());
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新openid
|
||||
* @return Response
|
||||
*/
|
||||
public function updateOpenid()
|
||||
{
|
||||
$data = $this->request->params([ [ 'code', '' ] ]);
|
||||
$wechat_auth_service = new WechatAuthService();
|
||||
return success($wechat_auth_service->updateOpenid($data[ 'code' ]));
|
||||
}
|
||||
}
|
||||
|
||||
@ -100,8 +100,6 @@ Route::group(function() {
|
||||
Route::get('site', 'sys.Config/site');
|
||||
//场景域名
|
||||
Route::get('scene_domain', 'sys.Config/getSceneDomain');
|
||||
// 获取手机端首页列表
|
||||
Route::get('wap_index', 'sys.Config/getWapIndexList');
|
||||
|
||||
// 获取地图设置
|
||||
Route::get('map', 'sys.Config/getMap');
|
||||
@ -144,5 +142,15 @@ Route::group(function() {
|
||||
})->middleware(ApiChannel::class)
|
||||
->middleware(ApiCheckToken::class)
|
||||
->middleware(ApiLog::class);
|
||||
|
||||
Route::group(function() {
|
||||
//公众号更新用户openid
|
||||
Route::put('wechat/update_openid', 'wechat.Wechat/updateOpenid');
|
||||
//小程序更新用户openid
|
||||
Route::put('weapp/update_openid', 'weapp.Weapp/updateOpenid');
|
||||
|
||||
})->middleware(ApiChannel::class)
|
||||
->middleware(ApiCheckToken::class, true)
|
||||
->middleware(ApiLog::class);
|
||||
//加载插件路由
|
||||
( new DictLoader("Route") )->load([ 'app_type' => 'api' ]);
|
||||
|
||||
@ -7,7 +7,6 @@ use app\service\admin\install\InstallSystemService;
|
||||
use app\service\core\menu\CoreMenuService;
|
||||
use think\console\Command;
|
||||
use think\console\Input;
|
||||
use think\console\input\Argument;
|
||||
use think\console\input\Option;
|
||||
use think\console\Output;
|
||||
|
||||
|
||||
@ -18,17 +18,16 @@ use Workerman\Worker;
|
||||
class Queue extends Command
|
||||
{
|
||||
use WorkerCommand;
|
||||
|
||||
public function configure()
|
||||
{
|
||||
// 指令配置
|
||||
// 指令配置
|
||||
$this->setName('queue:listen')
|
||||
->addArgument('action', Argument::OPTIONAL, "start|stop|restart|reload|status|connections", 'start')
|
||||
->addOption('mode', 'm', Option::VALUE_OPTIONAL, 'Run the workerman server in daemon mode.')
|
||||
->setDescription('基于Redis的消息队列,支持消息延迟处理。');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 执行任务
|
||||
* @return void
|
||||
@ -36,16 +35,15 @@ class Queue extends Command
|
||||
protected function execute(Input $input, Output $output)
|
||||
{
|
||||
$this->resetCli($input, $output);
|
||||
Worker::$pidFile = runtime_path() .'workerman_queue.pid';
|
||||
Worker::$logFile = runtime_path().'workerman.log';
|
||||
Worker::$pidFile = runtime_path() . 'workerman_queue.pid';
|
||||
Worker::$logFile = runtime_path() . 'workerman.log';
|
||||
$worker = new Worker();
|
||||
$worker->name = 'queue_work';
|
||||
// $worker->count = 3;
|
||||
$worker->onWorkerStart = function () use($output){
|
||||
$worker->onWorkerStart = function() use ($output) {
|
||||
// 定时,每10秒一次
|
||||
Timer::add(30, function()use($output)
|
||||
{
|
||||
(new SysSchedule())->select();
|
||||
Timer::add(30, function() use ($output) {
|
||||
( new SysSchedule() )->select();
|
||||
});
|
||||
$redis_option = [
|
||||
'connect_timeout' => 10,
|
||||
@ -53,31 +51,31 @@ class Queue extends Command
|
||||
'retry_seconds' => 5,
|
||||
'prefix' => md5(root_path())
|
||||
];
|
||||
if(!empty(env('redis.redis_password'))){
|
||||
$redis_option['auth'] = env('redis.redis_password');
|
||||
if (!empty(env('redis.redis_password'))) {
|
||||
$redis_option[ 'auth' ] = env('redis.redis_password');
|
||||
}
|
||||
$redis_option['db'] = env('redis.select');
|
||||
$client = new Client('redis://'.env('redis.redis_hostname').':'.env('redis.port'), $redis_option);
|
||||
$redis_option[ 'db' ] = env('redis.select');
|
||||
$client = new Client('redis://' . env('redis.redis_hostname') . ':' . env('redis.port'), $redis_option);
|
||||
$queue_list = $this->getAllQueue();
|
||||
|
||||
foreach ($queue_list as $queue_class_name){
|
||||
foreach ($queue_list as $queue_class_name) {
|
||||
$queue_class_name = str_replace('.php', '', $queue_class_name);
|
||||
// 订阅
|
||||
$client->subscribe($queue_class_name, function($data) use($queue_class_name, $output){
|
||||
echo "\n".'['.date('Y-m-d H:i:s').']'." Processing:" . $queue_class_name;
|
||||
try{
|
||||
$class_name = '\\' .$queue_class_name;
|
||||
$client->subscribe($queue_class_name, function($data) use ($queue_class_name, $output) {
|
||||
echo "\n" . '[' . date('Y-m-d H:i:s') . ']' . " Processing:" . $queue_class_name;
|
||||
try {
|
||||
$class_name = '\\' . $queue_class_name;
|
||||
$class = new $class_name();
|
||||
$class->fire($data);
|
||||
} catch (\Throwable $e) {
|
||||
Log::write(date('Y-m-d H:i:s').',队列有错误:'.$queue_class_name.'_'.$e->getMessage().'_'.$e->getFile().'_'.$e->getLine());
|
||||
Log::write(date('Y-m-d H:i:s') . ',队列有错误:' . $queue_class_name . '_' . $e->getMessage() . '_' . $e->getFile() . '_' . $e->getLine());
|
||||
}
|
||||
echo "\n".'['.date('Y-m-d H:i:s').']'." Processed:" . $queue_class_name;
|
||||
echo "\n" . '[' . date('Y-m-d H:i:s') . ']' . " Processed:" . $queue_class_name;
|
||||
});
|
||||
}
|
||||
// 消费失败触发的回调(可选)
|
||||
$client->onConsumeFailure(function (\Throwable $exception, $package) use($output){
|
||||
echo "\n"."队列 " . $package['queue'] . " 消费失败,".$exception->getMessage();
|
||||
$client->onConsumeFailure(function(\Throwable $exception, $package) use ($output) {
|
||||
echo "\n" . "队列 " . $package[ 'queue' ] . " 消费失败," . $exception->getMessage();
|
||||
});
|
||||
};
|
||||
Worker::runAll();
|
||||
@ -87,26 +85,27 @@ class Queue extends Command
|
||||
* 捕获所有队列任务
|
||||
* @return array
|
||||
*/
|
||||
public function getAllQueue(){
|
||||
public function getAllQueue()
|
||||
{
|
||||
$class_list = [];
|
||||
$system_dir = root_path() . 'app' . DIRECTORY_SEPARATOR . 'job';
|
||||
$addon_dir = root_path() . 'addon' . DIRECTORY_SEPARATOR;
|
||||
if(is_dir($system_dir)){
|
||||
if (is_dir($system_dir)) {
|
||||
search_dir($system_dir, $app_data, root_path());
|
||||
$class_list = array_merge($class_list, $app_data);
|
||||
}
|
||||
|
||||
$addons = (new CoreAddonService())->getInstallAddonList();
|
||||
$addons = ( new CoreAddonService() )->getInstallAddonList();
|
||||
foreach ($addons as $v) {
|
||||
|
||||
$addon_path = $addon_dir .$v['key']. DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR. 'job';
|
||||
$addon_path = $addon_dir . $v[ 'key' ] . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'job';
|
||||
if (is_dir($addon_path)) {
|
||||
search_dir($addon_path, $addon_data, root_path());
|
||||
$class_list = array_merge($class_list, $addon_data);
|
||||
}
|
||||
}
|
||||
|
||||
foreach($class_list as &$v){
|
||||
foreach ($class_list as &$v) {
|
||||
$v = str_replace('.php', '', $v);
|
||||
$v = str_replace('/', '\\', $v);
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@ use Workerman\Worker;
|
||||
class Schedule extends Command
|
||||
{
|
||||
use WorkerCommand;
|
||||
|
||||
public function configure()
|
||||
{
|
||||
// 指令配置
|
||||
@ -25,8 +26,6 @@ class Schedule extends Command
|
||||
->setDescription('定时任务,类似linux的crontab。支持秒级别定时。');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 执行任务
|
||||
* @return void
|
||||
@ -34,27 +33,27 @@ class Schedule extends Command
|
||||
protected function execute(Input $input, Output $output)
|
||||
{
|
||||
$this->resetCli($input, $output);
|
||||
Worker::$pidFile = runtime_path() .'workerman_schedule.pid';
|
||||
Worker::$pidFile = runtime_path() . 'workerman_schedule.pid';
|
||||
$worker = new Worker();
|
||||
$worker->name = 'schedule_work';
|
||||
$worker->count = 1;
|
||||
$output->writeln('['.date('Y-m-d H:i:s').']'." Schedule Starting...");
|
||||
$output->writeln('[' . date('Y-m-d H:i:s') . ']' . " Schedule Starting...");
|
||||
// 设置时区,避免运行结果与预期不一致
|
||||
date_default_timezone_set('PRC');
|
||||
$worker->onWorkerStart = function () use($output){
|
||||
$worker->onWorkerStart = function() use ($output) {
|
||||
// // 每分钟的第1秒执行.用于计划任务是否仍在执行
|
||||
new Crontab('*/10 * * * * *', function(){
|
||||
$file = root_path('runtime').'.schedule';
|
||||
new Crontab('*/10 * * * * *', function() {
|
||||
$file = root_path('runtime') . '.schedule';
|
||||
file_put_contents($file, time());
|
||||
});
|
||||
$core_schedule_service = new CoreScheduleService();
|
||||
//查询所有的计划任务
|
||||
$task_list = $core_schedule_service->getList(['status' => ScheduleDict::ON]);
|
||||
$output->writeln('['.date('Y-m-d H:i:s').']'." Schedule Started.");
|
||||
$task_list = $core_schedule_service->getList([ 'status' => ScheduleDict::ON ]);
|
||||
$output->writeln('[' . date('Y-m-d H:i:s') . ']' . " Schedule Started.");
|
||||
foreach ($task_list as $item) {
|
||||
//获取定时任务时间字符串
|
||||
new Crontab($this->getCrontab($item['time']), function () use ($core_schedule_service, $item, $output) {
|
||||
if(!empty($item['class'])){
|
||||
new Crontab($this->getCrontab($item[ 'time' ]), function() use ($core_schedule_service, $item, $output) {
|
||||
if (!empty($item[ 'class' ])) {
|
||||
$core_schedule_service->execute($item, $output);
|
||||
}
|
||||
|
||||
@ -77,14 +76,14 @@ class Schedule extends Command
|
||||
* @param $data
|
||||
* @return string
|
||||
*/
|
||||
protected function getCrontab($data): string
|
||||
protected function getCrontab($data) : string
|
||||
{
|
||||
$sec = $data['sec'] ?? '*';
|
||||
$min = $data['min'] ?? '*';
|
||||
$hour = $data['hour'] ?? '*';
|
||||
$day = $data['day'] ?? '*';
|
||||
$week = $data['week'] ?? '*';
|
||||
$type = $data['type'] ?? '';
|
||||
$sec = $data[ 'sec' ] ?? '*';
|
||||
$min = $data[ 'min' ] ?? '*';
|
||||
$hour = $data[ 'hour' ] ?? '*';
|
||||
$day = $data[ 'day' ] ?? '*';
|
||||
$week = $data[ 'week' ] ?? '*';
|
||||
$type = $data[ 'type' ] ?? '';
|
||||
switch ($type) {
|
||||
case 'sec':// 每隔几秒
|
||||
$crontab = '*/' . $sec . ' * * * * *';
|
||||
@ -99,10 +98,10 @@ class Schedule extends Command
|
||||
$crontab = '0 ' . $min . ' ' . $hour . ' */' . $day . ' * *';
|
||||
break;
|
||||
case 'week':// 每周一次,周几具体时间执行
|
||||
$crontab = '0 ' .$min . ' ' . $hour . ' * * ' . $week;
|
||||
$crontab = '0 ' . $min . ' ' . $hour . ' * * ' . $week;
|
||||
break;
|
||||
case 'month':// 每月一次,某日具体时间执行
|
||||
$crontab = '0 ' .$min . ' ' . $hour . ' ' . $day . ' * *';
|
||||
$crontab = '0 ' . $min . ' ' . $hour . ' ' . $day . ' * *';
|
||||
break;
|
||||
}
|
||||
return $crontab ?? '0 */1 * * * *';
|
||||
|
||||
@ -21,6 +21,7 @@ use Workerman\Worker;
|
||||
class Workerman extends Command
|
||||
{
|
||||
use WorkerCommand;
|
||||
|
||||
public function configure()
|
||||
{
|
||||
// 指令配置
|
||||
@ -30,8 +31,6 @@ class Workerman extends Command
|
||||
->setDescription('Workerman,高性能PHP应用容器');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 执行任务
|
||||
* @return void
|
||||
@ -40,48 +39,47 @@ class Workerman extends Command
|
||||
{
|
||||
$this->resetCli($input, $output);
|
||||
//计划任务
|
||||
Worker::$pidFile = runtime_path() .'workerman_schedule.pid';
|
||||
Worker::$pidFile = runtime_path() . 'workerman_schedule.pid';
|
||||
$worker = new Worker();
|
||||
$worker->name = 'schedule_work';
|
||||
$worker->count = 1;
|
||||
|
||||
// 设置时区,避免运行结果与预期不一致
|
||||
date_default_timezone_set('PRC');
|
||||
$worker->onWorkerStart = function () use($output){
|
||||
$output->writeln('['.date('Y-m-d H:i:s').']'." Schedule Starting...");
|
||||
$worker->onWorkerStart = function() use ($output) {
|
||||
$output->writeln('[' . date('Y-m-d H:i:s') . ']' . " Schedule Starting...");
|
||||
// // 每分钟的第1秒执行.用于计划任务是否仍在执行
|
||||
new Crontab('*/10 * * * * *', function(){
|
||||
$file = root_path('runtime').'.schedule';
|
||||
new Crontab('*/10 * * * * *', function() {
|
||||
$file = root_path('runtime') . '.schedule';
|
||||
file_put_contents($file, time());
|
||||
});
|
||||
$core_schedule_service = new CoreScheduleService();
|
||||
//查询所有的计划任务
|
||||
$task_list = $core_schedule_service->getList(['status' => ScheduleDict::ON]);
|
||||
$task_list = $core_schedule_service->getList([ 'status' => ScheduleDict::ON ]);
|
||||
|
||||
foreach ($task_list as $item) {
|
||||
//获取定时任务时间字符串
|
||||
new Crontab($this->getCrontab($item['time']), function () use ($core_schedule_service, $item, $output) {
|
||||
if(!empty($item['class'])){
|
||||
new Crontab($this->getCrontab($item[ 'time' ]), function() use ($core_schedule_service, $item, $output) {
|
||||
if (!empty($item[ 'class' ])) {
|
||||
$core_schedule_service->execute($item, $output);
|
||||
}
|
||||
});
|
||||
}
|
||||
$output->writeln('['.date('Y-m-d H:i:s').']'." Schedule Started.");
|
||||
$output->writeln('[' . date('Y-m-d H:i:s') . ']' . " Schedule Started.");
|
||||
};
|
||||
|
||||
//消息队列
|
||||
Worker::$pidFile = runtime_path() .'workerman_queue.pid';
|
||||
Worker::$logFile = runtime_path().'workerman.log';
|
||||
Worker::$pidFile = runtime_path() . 'workerman_queue.pid';
|
||||
Worker::$logFile = runtime_path() . 'workerman.log';
|
||||
$worker = new Worker();
|
||||
$worker->name = 'queue_work';
|
||||
// $worker->count = 3;
|
||||
|
||||
$worker->onWorkerStart = function () use($output){
|
||||
$output->writeln('['.date('Y-m-d H:i:s').']'." Queue Starting...");
|
||||
$worker->onWorkerStart = function() use ($output) {
|
||||
$output->writeln('[' . date('Y-m-d H:i:s') . ']' . " Queue Starting...");
|
||||
// 定时,每10秒一次
|
||||
Timer::add(30, function()use($output)
|
||||
{
|
||||
(new SysSchedule())->select();
|
||||
Timer::add(30, function() use ($output) {
|
||||
( new SysSchedule() )->select();
|
||||
});
|
||||
$redis_option = [
|
||||
'connect_timeout' => 10,
|
||||
@ -89,33 +87,33 @@ class Workerman extends Command
|
||||
'retry_seconds' => 5,
|
||||
'prefix' => md5(root_path())
|
||||
];
|
||||
if(!empty(env('redis.redis_password'))){
|
||||
$redis_option['auth'] = env('redis.redis_password');
|
||||
if (!empty(env('redis.redis_password'))) {
|
||||
$redis_option[ 'auth' ] = env('redis.redis_password');
|
||||
}
|
||||
$redis_option['db'] = env('redis.select');
|
||||
$client = new Client('redis://'.env('redis.redis_hostname').':'.env('redis.port'), $redis_option);
|
||||
$redis_option[ 'db' ] = env('redis.select');
|
||||
$client = new Client('redis://' . env('redis.redis_hostname') . ':' . env('redis.port'), $redis_option);
|
||||
$queue_list = $this->getAllQueue();
|
||||
|
||||
foreach ($queue_list as $queue_class_name){
|
||||
foreach ($queue_list as $queue_class_name) {
|
||||
$queue_class_name = str_replace('.php', '', $queue_class_name);
|
||||
// 订阅
|
||||
$client->subscribe($queue_class_name, function($data) use($queue_class_name, $output){
|
||||
$output->writeln('[queue]['.date('Y-m-d H:i:s').']'." Processing:" . $queue_class_name);
|
||||
try{
|
||||
$class_name = '\\' .$queue_class_name;
|
||||
$client->subscribe($queue_class_name, function($data) use ($queue_class_name, $output) {
|
||||
$output->writeln('[queue][' . date('Y-m-d H:i:s') . ']' . " Processing:" . $queue_class_name);
|
||||
try {
|
||||
$class_name = '\\' . $queue_class_name;
|
||||
$class = new $class_name();
|
||||
$class->fire($data);
|
||||
} catch (\Throwable $e) {
|
||||
Log::write(date('Y-m-d H:i:s').',队列有错误:'.$queue_class_name.'_'.$e->getMessage().'_'.$e->getFile().'_'.$e->getLine());
|
||||
Log::write(date('Y-m-d H:i:s') . ',队列有错误:' . $queue_class_name . '_' . $e->getMessage() . '_' . $e->getFile() . '_' . $e->getLine());
|
||||
}
|
||||
$output->writeln('[queue]['.date('Y-m-d H:i:s').']'." Processed:" . $queue_class_name);
|
||||
$output->writeln('[queue][' . date('Y-m-d H:i:s') . ']' . " Processed:" . $queue_class_name);
|
||||
});
|
||||
}
|
||||
// 消费失败触发的回调(可选)
|
||||
$client->onConsumeFailure(function (\Throwable $exception, $package) use($output){
|
||||
$output->writeln('[queue]队列 ' . $package['queue'] . " 消费失败,".$exception->getMessage());
|
||||
$client->onConsumeFailure(function(\Throwable $exception, $package) use ($output) {
|
||||
$output->writeln('[queue]队列 ' . $package[ 'queue' ] . " 消费失败," . $exception->getMessage());
|
||||
});
|
||||
$output->writeln('['.date('Y-m-d H:i:s').']'." Queue Started.");
|
||||
$output->writeln('[' . date('Y-m-d H:i:s') . ']' . " Queue Started.");
|
||||
};
|
||||
Worker::runAll();
|
||||
}
|
||||
@ -133,14 +131,14 @@ class Workerman extends Command
|
||||
* @param $data
|
||||
* @return string
|
||||
*/
|
||||
protected function getCrontab($data): string
|
||||
protected function getCrontab($data) : string
|
||||
{
|
||||
$sec = $data['sec'] ?? '*';
|
||||
$min = $data['min'] ?? '*';
|
||||
$hour = $data['hour'] ?? '*';
|
||||
$day = $data['day'] ?? '*';
|
||||
$week = $data['week'] ?? '*';
|
||||
$type = $data['type'] ?? '';
|
||||
$sec = $data[ 'sec' ] ?? '*';
|
||||
$min = $data[ 'min' ] ?? '*';
|
||||
$hour = $data[ 'hour' ] ?? '*';
|
||||
$day = $data[ 'day' ] ?? '*';
|
||||
$week = $data[ 'week' ] ?? '*';
|
||||
$type = $data[ 'type' ] ?? '';
|
||||
switch ($type) {
|
||||
case 'sec':// 每隔几秒
|
||||
$crontab = '*/' . $sec . ' * * * * *';
|
||||
@ -155,10 +153,10 @@ class Workerman extends Command
|
||||
$crontab = '0 ' . $min . ' ' . $hour . ' */' . $day . ' * *';
|
||||
break;
|
||||
case 'week':// 每周一次,周几具体时间执行
|
||||
$crontab = '0 ' .$min . ' ' . $hour . ' * * ' . $week;
|
||||
$crontab = '0 ' . $min . ' ' . $hour . ' * * ' . $week;
|
||||
break;
|
||||
case 'month':// 每月一次,某日具体时间执行
|
||||
$crontab = '0 ' .$min . ' ' . $hour . ' ' . $day . ' * *';
|
||||
$crontab = '0 ' . $min . ' ' . $hour . ' ' . $day . ' * *';
|
||||
break;
|
||||
}
|
||||
return $crontab ?? '0 */1 * * * *';
|
||||
@ -168,26 +166,27 @@ class Workerman extends Command
|
||||
* 捕获所有队列任务
|
||||
* @return array
|
||||
*/
|
||||
public function getAllQueue(){
|
||||
public function getAllQueue()
|
||||
{
|
||||
$class_list = [];
|
||||
$system_dir = root_path() . 'app' . DIRECTORY_SEPARATOR . 'job';
|
||||
$addon_dir = root_path() . 'addon' . DIRECTORY_SEPARATOR;
|
||||
if(is_dir($system_dir)){
|
||||
if (is_dir($system_dir)) {
|
||||
search_dir($system_dir, $app_data, root_path());
|
||||
$class_list = array_merge($class_list, $app_data);
|
||||
}
|
||||
|
||||
$addons = (new CoreAddonService())->getInstallAddonList();
|
||||
$addons = ( new CoreAddonService() )->getInstallAddonList();
|
||||
foreach ($addons as $v) {
|
||||
|
||||
$addon_path = $addon_dir .$v['key']. DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR. 'job';
|
||||
$addon_path = $addon_dir . $v[ 'key' ] . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'job';
|
||||
if (is_dir($addon_path)) {
|
||||
search_dir($addon_path, $addon_data, root_path());
|
||||
$class_list = array_merge($class_list, $addon_data);
|
||||
}
|
||||
}
|
||||
|
||||
foreach($class_list as &$v){
|
||||
foreach ($class_list as &$v) {
|
||||
$v = str_replace('.php', '', $v);
|
||||
$v = str_replace('/', '\\', $v);
|
||||
}
|
||||
|
||||
@ -36,7 +36,7 @@ class AddonDict
|
||||
|
||||
// 插件关键字黑名单
|
||||
const ADDON_KEY_BLACK_LIST = [
|
||||
'addon', 'aliapp', 'app', 'applet', 'auht', 'channel', 'dict', 'diy', 'generator', 'home', 'member', 'niucloud',
|
||||
'addon', 'aliapp', 'app', 'applet', 'auth', 'channel', 'dict', 'diy', 'generator', 'home', 'member', 'niucloud',
|
||||
'notice', 'pay', 'site', 'sys', 'upload', 'home', 'user', 'weapp', 'wechat'
|
||||
];
|
||||
|
||||
|
||||
@ -552,6 +552,8 @@ class ComponentDict
|
||||
'value' => [
|
||||
"imageSize" => 40,
|
||||
"aroundRadius" => 0,
|
||||
'style' => 'style-1',
|
||||
"styleName" => "风格一",
|
||||
"bottomPosition" => "lowerRight", // 左上:upperLeft,右上:upperRight,左下:lowerLeft,右下:lowerRight
|
||||
"list" => [
|
||||
[
|
||||
|
||||
@ -114,7 +114,14 @@ class LinkDict
|
||||
'url' => '/app/pages/verify/index',
|
||||
'is_share' => 1,
|
||||
'action' => ''
|
||||
]
|
||||
],
|
||||
[
|
||||
'name' => 'MEMBER_CONTACT',
|
||||
'title' => get_lang('dict_diy.member_contact'),
|
||||
'url' => '/app/pages/member/contact',
|
||||
'is_share' => 1,
|
||||
'action' => ''
|
||||
],
|
||||
]
|
||||
],
|
||||
'DIY_PAGE' => [
|
||||
|
||||
@ -62,7 +62,7 @@ class PagesDict
|
||||
"margin" => [
|
||||
"top" => 10,
|
||||
"bottom" => 10,
|
||||
"both" => 16
|
||||
"both" => 10
|
||||
],
|
||||
"ignore" => [],
|
||||
"list" => []
|
||||
@ -152,10 +152,11 @@ class PagesDict
|
||||
'topStatusBar' => [
|
||||
'isShow' => true,
|
||||
'bgColor' => "#ffffff",
|
||||
'isTransparent' => false,
|
||||
'rollBgColor' => "#ffffff",
|
||||
'style' => 'style-1',
|
||||
'styleName' => '风格1',
|
||||
'textColor' => "#333333",
|
||||
'rollTextColor' => "#333333",
|
||||
'textAlign' => 'center',
|
||||
'inputPlaceholder' => '请输入搜索关键词',
|
||||
'imgUrl' => '',
|
||||
@ -217,16 +218,17 @@ class PagesDict
|
||||
"margin" => [
|
||||
"top" => 0,
|
||||
"bottom" => 0,
|
||||
"both" => 12
|
||||
"both" => 10
|
||||
]
|
||||
],
|
||||
'topStatusBar' => [
|
||||
"topStatusBar" => [
|
||||
'isShow' => true,
|
||||
'bgColor' => "#ffffff",
|
||||
'isTransparent' => false,
|
||||
'rollBgColor' => "#ffffff",
|
||||
'style' => 'style-1',
|
||||
'styleName' => '风格1',
|
||||
'textColor' => "#333333",
|
||||
'rollTextColor' => "#333333",
|
||||
'textAlign' => 'center',
|
||||
'inputPlaceholder' => '请输入搜索关键词',
|
||||
'imgUrl' => '',
|
||||
@ -269,7 +271,7 @@ class PagesDict
|
||||
"margin" => [
|
||||
"top" => 12,
|
||||
"bottom" => 6,
|
||||
"both" => 16
|
||||
"both" => 10
|
||||
],
|
||||
"style" => "style-1",
|
||||
"styleName" => "风格1",
|
||||
@ -306,7 +308,7 @@ class PagesDict
|
||||
"margin" => [
|
||||
"top" => 6,
|
||||
"bottom" => 0,
|
||||
"both" => 16
|
||||
"both" => 10
|
||||
]
|
||||
],
|
||||
[
|
||||
@ -359,7 +361,7 @@ class PagesDict
|
||||
"margin" => [
|
||||
"top" => 0,
|
||||
"bottom" => 0,
|
||||
"both" => 16
|
||||
"both" => 10
|
||||
]
|
||||
],
|
||||
[
|
||||
@ -400,7 +402,7 @@ class PagesDict
|
||||
"margin" => [
|
||||
"top" => 0,
|
||||
"bottom" => 6,
|
||||
"both" => 16
|
||||
"both" => 10
|
||||
],
|
||||
"ignore" => [],
|
||||
"list" => [
|
||||
@ -467,7 +469,11 @@ class PagesDict
|
||||
[
|
||||
"title" => "联系客服",
|
||||
"link" => [
|
||||
"name" => ""
|
||||
"name" => "MEMBER_CONTACT",
|
||||
"parent" => "MEMBER_LINK",
|
||||
"title" => "客服",
|
||||
"url" => "/app/pages/member/contact",
|
||||
"action" => ""
|
||||
],
|
||||
"imageUrl" => "static/resource/images/diy/horz_m_service.png",
|
||||
"label" => [
|
||||
@ -570,7 +576,11 @@ class PagesDict
|
||||
[
|
||||
"title" => "联系客服",
|
||||
"link" => [
|
||||
"name" => ""
|
||||
"name" => "MEMBER_CONTACT",
|
||||
"parent" => "MEMBER_LINK",
|
||||
"title" => "客服",
|
||||
"url" => "/app/pages/member/contact",
|
||||
"action" => ""
|
||||
],
|
||||
"imageUrl" => "static/resource/images/diy/vert_m_service.png",
|
||||
"label" => [
|
||||
@ -618,7 +628,7 @@ class PagesDict
|
||||
"margin" => [
|
||||
"top" => 6,
|
||||
"bottom" => 12,
|
||||
"both" => 16
|
||||
"both" => 10
|
||||
]
|
||||
]
|
||||
]
|
||||
@ -660,7 +670,7 @@ class PagesDict
|
||||
"margin" => [
|
||||
"top" => 0,
|
||||
"bottom" => 0,
|
||||
"both" => 12
|
||||
"both" => 10
|
||||
]
|
||||
],
|
||||
'topStatusBar' => [
|
||||
@ -749,7 +759,7 @@ class PagesDict
|
||||
"margin" => [
|
||||
"top" => 0,
|
||||
"bottom" => 0,
|
||||
"both" => 16
|
||||
"both" => 10
|
||||
]
|
||||
],
|
||||
[
|
||||
@ -802,7 +812,7 @@ class PagesDict
|
||||
"margin" => [
|
||||
"top" => 0,
|
||||
"bottom" => 0,
|
||||
"both" => 16
|
||||
"both" => 10
|
||||
]
|
||||
],
|
||||
[
|
||||
@ -843,7 +853,7 @@ class PagesDict
|
||||
"margin" => [
|
||||
"top" => 0,
|
||||
"bottom" => 6,
|
||||
"both" => 16
|
||||
"both" => 10
|
||||
],
|
||||
"ignore" => [],
|
||||
"list" => [
|
||||
@ -910,7 +920,11 @@ class PagesDict
|
||||
[
|
||||
"title" => "联系客服",
|
||||
"link" => [
|
||||
"name" => ""
|
||||
"name" => "MEMBER_CONTACT",
|
||||
"parent" => "MEMBER_LINK",
|
||||
"title" => "客服",
|
||||
"url" => "/app/pages/member/contact",
|
||||
"action" => ""
|
||||
],
|
||||
"imageUrl" => "static/resource/images/diy/horz_m_service.png",
|
||||
"label" => [
|
||||
@ -1013,7 +1027,11 @@ class PagesDict
|
||||
[
|
||||
"title" => "联系客服",
|
||||
"link" => [
|
||||
"name" => ""
|
||||
"name" => "MEMBER_CONTACT",
|
||||
"parent" => "MEMBER_LINK",
|
||||
"title" => "客服",
|
||||
"url" => "/app/pages/member/contact",
|
||||
"action" => ""
|
||||
],
|
||||
"imageUrl" => "static/resource/images/diy/vert_m_service.png",
|
||||
"label" => [
|
||||
@ -1061,7 +1079,7 @@ class PagesDict
|
||||
"margin" => [
|
||||
"top" => 6,
|
||||
"bottom" => 12,
|
||||
"both" => 16
|
||||
"both" => 10
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
@ -24,49 +24,49 @@ class MemberLevelDict
|
||||
{
|
||||
|
||||
return [
|
||||
// 'level_1' => [
|
||||
// 'bg_color' => '#414852',
|
||||
// 'level_color' => '#666666',
|
||||
// 'progress' => ['#999999','#666666'],
|
||||
// 'gift'=> '#ECEBEB',
|
||||
// ],
|
||||
'level_1' => [
|
||||
'bg_color' => '#414852',
|
||||
'level_color' => '#666666',
|
||||
'progress' => ['#999999','#666666'],
|
||||
'gift'=> '#ECEBEB',
|
||||
],
|
||||
'level_2' => [
|
||||
'bg_color' => '#354B54',
|
||||
'level_color' => '#116787',
|
||||
'progress' => ['#4BA5C7','#116787'],
|
||||
'gift'=> '#F1FDFF',
|
||||
],
|
||||
'level_3' => [
|
||||
'level_2' => [
|
||||
'bg_color' => '#203B54',
|
||||
'level_color' => '#286BAA',
|
||||
'progress' => ['#529BDF','#286BAA'],
|
||||
'gift'=> '#E3F2FF',
|
||||
],
|
||||
'level_4' => [
|
||||
'level_3' => [
|
||||
'bg_color' => '#403E32',
|
||||
'level_color' => '#967600',
|
||||
'progress' => ['#D1A400','#967600'],
|
||||
'gift'=> '#FFFAE3',
|
||||
],
|
||||
'level_5' => [
|
||||
'level_4' => [
|
||||
'bg_color' => '#36354B',
|
||||
'level_color' => '#4B3EF9',
|
||||
'progress' => ['#8F87FF','#4B3EF9'],
|
||||
'gift'=> '#E7EEFF',
|
||||
],
|
||||
'level_6' => [
|
||||
'level_5' => [
|
||||
'bg_color' => '#362F28',
|
||||
'level_color' => '#9F5300',
|
||||
'progress' => ['#EFA244','#9F5300'],
|
||||
'gift'=> '#FFF5DC',
|
||||
],
|
||||
'level_7' => [
|
||||
'level_6' => [
|
||||
'bg_color' => '#322432',
|
||||
'level_color' => '#DE43D6',
|
||||
'progress' => ['#FFA0FA','#DE43D6'],
|
||||
'gift'=> '#FFEAFF',
|
||||
],
|
||||
'level_8' => [
|
||||
'level_7' => [
|
||||
'bg_color' => '#301C1E',
|
||||
'level_color' => '#DE000B',
|
||||
'progress' => ['#FF8B36','#DE000B'],
|
||||
@ -74,4 +74,4 @@ class MemberLevelDict
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -112,6 +112,8 @@ return [
|
||||
'inc' => 1,
|
||||
//是否减少
|
||||
'dec' => 0,
|
||||
//是否累增
|
||||
'is_change_get' => 0,
|
||||
],
|
||||
//会员升级礼包
|
||||
'level_upgrade' => [
|
||||
@ -160,6 +162,8 @@ return [
|
||||
'inc' => 0,
|
||||
//是否减少
|
||||
'dec' => 1,
|
||||
//是否累增
|
||||
'is_change_get' => 0,
|
||||
],
|
||||
],
|
||||
//会员佣金
|
||||
@ -182,6 +186,8 @@ return [
|
||||
'inc' => 0,
|
||||
//是否减少
|
||||
'dec' => 1,
|
||||
//是否累增
|
||||
'is_change_get' => 0,
|
||||
],
|
||||
]
|
||||
];
|
||||
|
||||
@ -2201,7 +2201,7 @@ return [
|
||||
'router_path' => 'setting/agreement',
|
||||
'view_path' => 'setting/agreement',
|
||||
'methods' => 'get',
|
||||
'sort' => '80',
|
||||
'sort' => '100',
|
||||
'status' => '1',
|
||||
'is_show' => '1',
|
||||
],
|
||||
@ -2289,7 +2289,7 @@ return [
|
||||
'router_path' => 'setting/storage',
|
||||
'view_path' => 'setting/storage',
|
||||
'methods' => 'get',
|
||||
'sort' => '30',
|
||||
'sort' => '98',
|
||||
'status' => '1',
|
||||
'is_show' => '1',
|
||||
'children' => [
|
||||
@ -2333,7 +2333,7 @@ return [
|
||||
'router_path' => 'setting/export',
|
||||
'view_path' => 'setting/export',
|
||||
'methods' => 'get',
|
||||
'sort' => '30',
|
||||
'sort' => '97',
|
||||
'status' => '1',
|
||||
'is_show' => '1',
|
||||
'children' => [
|
||||
@ -2352,7 +2352,123 @@ return [
|
||||
'is_show' => '1',
|
||||
]
|
||||
]
|
||||
]
|
||||
],
|
||||
[
|
||||
'menu_name' => '小票打印',
|
||||
'menu_key' => 'printer_management',
|
||||
'menu_short_name' => '小票打印',
|
||||
'menu_type' => '1',
|
||||
'icon' => 'element FolderChecked',
|
||||
'api_url' => 'printer',
|
||||
'router_path' => 'printer/list',
|
||||
'view_path' => 'printer/list',
|
||||
'methods' => 'get',
|
||||
'sort' => '97',
|
||||
'status' => '1',
|
||||
'is_show' => '1',
|
||||
'children' => [
|
||||
[
|
||||
'menu_name' => '删除打印机',
|
||||
'menu_key' => 'delete_printer',
|
||||
'menu_short_name' => '删除打印机',
|
||||
'menu_type' => '2',
|
||||
'icon' => '',
|
||||
'api_url' => 'printer/<id>',
|
||||
'router_path' => '',
|
||||
'view_path' => '',
|
||||
'methods' => 'delete',
|
||||
'sort' => '100',
|
||||
'status' => '1',
|
||||
'is_show' => '1',
|
||||
]
|
||||
]
|
||||
],
|
||||
[
|
||||
'menu_name' => '添加打印机',
|
||||
'menu_key' => 'printer_add',
|
||||
'menu_short_name' => '添加打印机',
|
||||
'menu_type' => '1',
|
||||
'icon' => '',
|
||||
'api_url' => 'printer',
|
||||
'router_path' => 'printer/add',
|
||||
'view_path' => 'printer/edit',
|
||||
'methods' => 'post',
|
||||
'sort' => '0',
|
||||
'status' => '1',
|
||||
'is_show' => '0',
|
||||
],
|
||||
[
|
||||
'menu_name' => '编辑打印机',
|
||||
'menu_key' => 'printer_edit',
|
||||
'menu_short_name' => '添加打印机',
|
||||
'menu_type' => '1',
|
||||
'icon' => '',
|
||||
'api_url' => 'printer/<id>',
|
||||
'router_path' => 'printer/edit',
|
||||
'view_path' => 'printer/edit',
|
||||
'methods' => 'put',
|
||||
'sort' => '0',
|
||||
'status' => '1',
|
||||
'is_show' => '0',
|
||||
],
|
||||
[
|
||||
'menu_name' => '小票打印模板',
|
||||
'menu_key' => 'printer_template_management',
|
||||
'menu_short_name' => '小票打印模板',
|
||||
'menu_type' => '1',
|
||||
'icon' => 'element FolderChecked',
|
||||
'api_url' => 'printer/template',
|
||||
'router_path' => 'printer/template/list',
|
||||
'view_path' => 'printer/template_list',
|
||||
'methods' => 'get',
|
||||
'sort' => '96',
|
||||
'status' => '1',
|
||||
'is_show' => '0',
|
||||
'children' => [
|
||||
[
|
||||
'menu_name' => '删除打印模板',
|
||||
'menu_key' => 'delete_printer_template',
|
||||
'menu_short_name' => '删除打印模板',
|
||||
'menu_type' => '2',
|
||||
'icon' => '',
|
||||
'api_url' => 'printer/template/<id>',
|
||||
'router_path' => '',
|
||||
'view_path' => '',
|
||||
'methods' => 'delete',
|
||||
'sort' => '100',
|
||||
'status' => '1',
|
||||
'is_show' => '1',
|
||||
]
|
||||
]
|
||||
],
|
||||
[
|
||||
'menu_name' => '添加打印模板',
|
||||
'menu_key' => 'printer_template_add',
|
||||
'menu_short_name' => '添加打印模板',
|
||||
'menu_type' => '1',
|
||||
'icon' => '',
|
||||
'api_url' => 'printer/template',
|
||||
'router_path' => 'printer/template/add',
|
||||
'view_path' => 'printer/template_edit',
|
||||
'methods' => 'post',
|
||||
'sort' => '0',
|
||||
'status' => '1',
|
||||
'is_show' => '0',
|
||||
],
|
||||
[
|
||||
'menu_name' => '编辑打印模板',
|
||||
'menu_key' => 'printer_template_edit',
|
||||
'menu_short_name' => '编辑打印模板',
|
||||
'menu_type' => '1',
|
||||
'icon' => '',
|
||||
'api_url' => 'printer/template/<id>',
|
||||
'router_path' => 'printer/template/edit',
|
||||
'view_path' => 'printer/template_edit',
|
||||
'methods' => 'put',
|
||||
'sort' => '0',
|
||||
'status' => '1',
|
||||
'is_show' => '0',
|
||||
],
|
||||
]
|
||||
],
|
||||
|
||||
|
||||
@ -37,6 +37,10 @@ class ComponentDict
|
||||
'sort' => 10000,
|
||||
'relate' => '', // 关联字段,空为不处理// 组件属性
|
||||
'value' => '文本内容',
|
||||
'template' => [
|
||||
"width" => 165, // 宽度
|
||||
'height' => 53 // 高度
|
||||
]
|
||||
],
|
||||
'Image' => [
|
||||
'title' => "图片",
|
||||
@ -68,10 +72,11 @@ class ComponentDict
|
||||
'relate' => 'headimg', // 关联字段,空为不处理
|
||||
'value' => '',
|
||||
'template' => [
|
||||
"width" => 50, // 宽度
|
||||
'height' => 50, // 高度
|
||||
'minWidth' => 30, // 最小宽度
|
||||
'minHeight' => 30, // 最小高度
|
||||
"width" => 100, // 宽度
|
||||
'height' => 100, // 高度
|
||||
'minWidth' => 60, // 最小宽度
|
||||
'minHeight' => 60, // 最小高度
|
||||
'shape' => 'circle'
|
||||
],
|
||||
],
|
||||
'NickName' => [
|
||||
@ -84,10 +89,10 @@ class ComponentDict
|
||||
'relate' => 'nickname', // 关联字段,空为不处理
|
||||
'value' => '',
|
||||
'template' => [
|
||||
"width" => 50, // 宽度
|
||||
'height' => 50, // 高度
|
||||
'minWidth' => 30, // 最小宽度
|
||||
'minHeight' => 30, // 最小高度
|
||||
"width" => 164, // 宽度
|
||||
'height' => 55, // 高度
|
||||
'minWidth' => 120, // 最小宽度
|
||||
'minHeight' => 50, // 最小高度
|
||||
],
|
||||
],
|
||||
'Draw' => [
|
||||
@ -100,10 +105,10 @@ class ComponentDict
|
||||
'relate' => '', // 关联字段,空为不处理
|
||||
'value' => '',
|
||||
'template' => [
|
||||
"width" => 100, // 宽度
|
||||
'height' => 100, // 高度
|
||||
'minWidth' => 30, // 最小宽度
|
||||
'minHeight' => 30, // 最小高度
|
||||
"width" => 200, // 宽度
|
||||
'height' => 200, // 高度
|
||||
'minWidth' => 60, // 最小宽度
|
||||
'minHeight' => 60, // 最小高度
|
||||
'drawType' => 'Polygon',
|
||||
'bgColor' => '#eeeeee',
|
||||
'points' => [], // [x,y]:左上,右上,右下,左下
|
||||
|
||||
@ -12,28 +12,5 @@ return [
|
||||
'class' => '',
|
||||
'function' => ''
|
||||
],
|
||||
[
|
||||
'key' => 'site_expire_close',
|
||||
'name' => '站点到期自动关闭',
|
||||
'desc' => '',
|
||||
'time' => [
|
||||
'type' => 'day',
|
||||
'day' => 1,
|
||||
'hour' => 1,
|
||||
'min' => 1
|
||||
],
|
||||
'class' => 'app\job\schedule\SiteExpireClose',
|
||||
'function' => ''
|
||||
],
|
||||
[
|
||||
'key' => 'site_stat',
|
||||
'name' => '站点统计',
|
||||
'desc' => '',
|
||||
'time' => [
|
||||
'type' => 'hour',
|
||||
'hour' => 1,
|
||||
],
|
||||
'class' => 'app\job\schedule\SiteStatJob',
|
||||
'function' => ''
|
||||
]
|
||||
];
|
||||
|
||||
|
||||
@ -1,33 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | Niucloud-admin 企业快速开发的多应用管理平台
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网址:https://www.niucloud.com
|
||||
// +----------------------------------------------------------------------
|
||||
// | niucloud团队 版权所有 开源版本可自由商用
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: Niucloud Team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\dict\site;
|
||||
|
||||
class SiteAccountLogDict
|
||||
{
|
||||
const PAY = 'pay';//支付
|
||||
const REFUND = 'refund'; //退款
|
||||
const TRANSFER = 'transfer'; //转账
|
||||
|
||||
/**
|
||||
* 站点状态
|
||||
* @return array
|
||||
*/
|
||||
public static function getType()
|
||||
{
|
||||
return [
|
||||
self::PAY => get_lang('dict_site.pay'),//支付
|
||||
self::REFUND => get_lang('dict_site.refund'),//退款
|
||||
self::TRANSFER => get_lang('dict_site.transfer'),//转账
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,35 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | Niucloud-admin 企业快速开发的多应用管理平台
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网址:https://www.niucloud.com
|
||||
// +----------------------------------------------------------------------
|
||||
// | niucloud团队 版权所有 开源版本可自由商用
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: Niucloud Team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\dict\site;
|
||||
|
||||
class SiteDict
|
||||
{
|
||||
public const EXPIRE = 2;//过期
|
||||
|
||||
public const ON = 1;//正常
|
||||
public const CLOSE = 3;//停止
|
||||
|
||||
|
||||
/**
|
||||
* 站点状态
|
||||
* @return array
|
||||
*/
|
||||
public static function getStatus()
|
||||
{
|
||||
return [
|
||||
self::ON => get_lang('dict_site.status_on'),//正常
|
||||
self::EXPIRE => get_lang('dict_site.status_expire'),//过期
|
||||
self::CLOSE => get_lang('dict_site.status_close'),//停止
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@ -30,8 +30,6 @@ class ConfigKeyDict
|
||||
|
||||
public const H5 = 'h5';//h5
|
||||
|
||||
public const WXOPLATFORM = 'WXOPLATFORM'; // 微信开放平台
|
||||
|
||||
public const WEAPP_AUTHORIZATION_INFO = 'weapp_authorization_info';
|
||||
|
||||
public const WECHAT_AUTHORIZATION_INFO = 'wechat_authorization_info';
|
||||
|
||||
@ -30,6 +30,8 @@ class FileDict
|
||||
public const MID = 'mid';//小程序上传
|
||||
public const SMALL = 'small';
|
||||
|
||||
public const EXCEL = 'excel';//excel导入
|
||||
|
||||
/**
|
||||
* 附件类型
|
||||
* @return array
|
||||
@ -68,6 +70,7 @@ class FileDict
|
||||
self::IMAGE,//图片上传
|
||||
self::VIDEO,//视频上传
|
||||
self::APPLET,//小程序包上传
|
||||
self::EXCEL,//excel导入
|
||||
];
|
||||
}
|
||||
|
||||
@ -83,4 +86,4 @@ class FileDict
|
||||
self::SMALL,//图片上传
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
62
niucloud/app/dict/sys/PrinterDict.php
Normal file
62
niucloud/app/dict/sys/PrinterDict.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | Niucloud-admin 企业快速开发的多应用管理平台
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网址:https://www.niucloud.com
|
||||
// +----------------------------------------------------------------------
|
||||
// | niucloud团队 版权所有 开源版本可自由商用
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: Niucloud Team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\dict\sys;
|
||||
|
||||
|
||||
use core\dict\DictLoader;
|
||||
|
||||
class PrinterDict
|
||||
{
|
||||
|
||||
public const YI_LIAN_YUN = 'yilianyun'; // 易联云打印机
|
||||
|
||||
/**
|
||||
* 打印机品牌
|
||||
* @param string $brand
|
||||
* @return array|mixed|string
|
||||
*/
|
||||
public static function getBrandName($brand = '')
|
||||
{
|
||||
$list = [
|
||||
self::YI_LIAN_YUN => get_lang('dict_printer.yilianyun'), // 易联云打印机
|
||||
];
|
||||
if ($brand == '') return $list;
|
||||
return $list[ $brand ] ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取打印机模板类型
|
||||
* @param string $type
|
||||
* @return array|null
|
||||
*/
|
||||
public static function getType($type = '')
|
||||
{
|
||||
$system_type = [];
|
||||
|
||||
$type_list = ( new DictLoader("Printer") )->load($system_type);
|
||||
|
||||
if ($type == '') {
|
||||
return $type_list;
|
||||
} else {
|
||||
$data = [];
|
||||
foreach ($type_list as $k => $v) {
|
||||
if ($v[ 'key' ] == $type) {
|
||||
$data = $v;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -47,18 +47,10 @@ $system_event = [
|
||||
],
|
||||
//协议类型加载
|
||||
'AgreementType' => [],
|
||||
//站点首页加载
|
||||
'SiteIndex' => [
|
||||
'app\listener\system\SiteIndexListener'
|
||||
],
|
||||
// 站点端布局
|
||||
'SiteLayout' => [
|
||||
'app\listener\system\SiteLayout'
|
||||
],
|
||||
//平台首页加载
|
||||
'AdminIndex' => [
|
||||
'app\listener\system\AdminIndexListener'
|
||||
],
|
||||
'BottomNavigation' => [
|
||||
'app\listener\system\BottomNavigationListener'
|
||||
],
|
||||
@ -88,12 +80,12 @@ $system_event = [
|
||||
//导出数据类型
|
||||
'ExportDataType' => [
|
||||
//会员导出
|
||||
'app\listener\member\MemberExportTypeListener',
|
||||
'app\listener\member_export\MemberExportTypeListener',
|
||||
],
|
||||
//导出数据源
|
||||
'ExportData' => [
|
||||
//会员导出
|
||||
'app\listener\member\MemberExportDataListener',
|
||||
'app\listener\member_export\MemberExportDataListener',
|
||||
],
|
||||
//统计执行
|
||||
'StatExecute' => [],
|
||||
|
||||
@ -38,7 +38,7 @@ class Index extends BaseInstall
|
||||
$host = ( empty($_SERVER[ 'REMOTE_ADDR' ]) ? $_SERVER[ 'REMOTE_HOST' ] : $_SERVER[ 'REMOTE_ADDR' ] );
|
||||
$name = $_SERVER[ 'SERVER_NAME' ];
|
||||
|
||||
$verison = !(version_compare(PHP_VERSION, '8.0.0') == -1);
|
||||
$verison = !( version_compare(PHP_VERSION, '8.0.0') == -1 );
|
||||
//pdo
|
||||
$pdo = extension_loaded('pdo') && extension_loaded('pdo_mysql');
|
||||
$system_variables[] = [ "name" => "pdo", "need" => "开启", "status" => $pdo ];
|
||||
@ -71,9 +71,9 @@ class Index extends BaseInstall
|
||||
[ "path" => $project_path . DIRECTORY_SEPARATOR . 'web', "path_name" => "web/", "name" => "web端源码目录" ],
|
||||
[ "path" => $root_path . DIRECTORY_SEPARATOR . ".env", "path_name" => "niucloud/.env", "name" => "env" ],
|
||||
[ "path" => $root_path . DIRECTORY_SEPARATOR . ".example.env", "path_name" => "niucloud/.example_env", "name" => "env" ],
|
||||
[ "path" => $root_path . DIRECTORY_SEPARATOR . 'runtime'.DIRECTORY_SEPARATOR, "path_name" => "niucloud/runtime", "name" => "runtime" ],
|
||||
[ "path" => $root_path . DIRECTORY_SEPARATOR . 'public'.DIRECTORY_SEPARATOR.'upload'.DIRECTORY_SEPARATOR, "path_name" => "niucloud/public/upload", "name" => "upload" ],
|
||||
[ "path" => $root_path . DIRECTORY_SEPARATOR . 'app'.DIRECTORY_SEPARATOR.'install'.DIRECTORY_SEPARATOR, "path_name" => "niucloud/app/install", "name" => "安装目录" ]
|
||||
[ "path" => $root_path . DIRECTORY_SEPARATOR . 'runtime' . DIRECTORY_SEPARATOR, "path_name" => "niucloud/runtime", "name" => "runtime" ],
|
||||
[ "path" => $root_path . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . 'upload' . DIRECTORY_SEPARATOR, "path_name" => "niucloud/public/upload", "name" => "upload" ],
|
||||
[ "path" => $root_path . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'install' . DIRECTORY_SEPARATOR, "path_name" => "niucloud/app/install", "name" => "安装目录" ]
|
||||
];
|
||||
//目录 可读 可写检测
|
||||
$is_dir = true;
|
||||
@ -109,10 +109,11 @@ class Index extends BaseInstall
|
||||
}
|
||||
}
|
||||
|
||||
public function build() {
|
||||
public function build()
|
||||
{
|
||||
$install_user = Cache::get('install_user');
|
||||
$token = (new LoginService())->login($install_user['username'], $install_user['password']);
|
||||
$this->assign('token', $token['token']);
|
||||
$token = ( new LoginService() )->login($install_user[ 'username' ], $install_user[ 'password' ]);
|
||||
$this->assign('token', $token[ 'token' ]);
|
||||
return $this->fetch('index/step-4');
|
||||
}
|
||||
|
||||
@ -169,16 +170,24 @@ class Index extends BaseInstall
|
||||
];
|
||||
|
||||
} else {
|
||||
if (@mysqli_select_db($conn, $dbname)) {
|
||||
$result = [
|
||||
"status" => 2,
|
||||
"message" => "数据库存在,系统将覆盖数据库"
|
||||
];
|
||||
} else {
|
||||
try {
|
||||
if (@mysqli_select_db($conn, $dbname)) {
|
||||
$result = [
|
||||
"status" => 2,
|
||||
"message" => "数据库存在,系统将覆盖数据库"
|
||||
];
|
||||
} else {
|
||||
$result = [
|
||||
"status" => 1,
|
||||
"message" => "数据库不存在,系统将自动创建"
|
||||
];
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$result = [
|
||||
"status" => 1,
|
||||
"message" => "数据库不存在,系统将自动创建"
|
||||
];
|
||||
return fail($result);
|
||||
}
|
||||
}
|
||||
@mysqli_close($conn);
|
||||
@ -191,7 +200,7 @@ class Index extends BaseInstall
|
||||
}
|
||||
|
||||
return success($result);
|
||||
} catch ( Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$result = [
|
||||
"status" => -1,
|
||||
"message" => $e->getMessage()
|
||||
@ -219,7 +228,7 @@ class Index extends BaseInstall
|
||||
$sqls = explode("\n", trim($sql));
|
||||
$sqls = array_filter($sqls);
|
||||
foreach ($sqls as $query) {
|
||||
$str1 = $query[0] ?? '';
|
||||
$str1 = $query[ 0 ] ?? '';
|
||||
if ($str1 != '#' && $str1 != '-')
|
||||
$sql_query[ $num ] .= $query;
|
||||
}
|
||||
@ -272,9 +281,9 @@ class Index extends BaseInstall
|
||||
}
|
||||
|
||||
Cache::set('install_status', 1);//成功
|
||||
Cache::set('install_user', ['username' => $username, 'password' => $password]);
|
||||
Cache::set('install_user', [ 'username' => $username, 'password' => $password ]);
|
||||
return success();
|
||||
} catch ( Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->setSuccessLog([ '安装失败' . $e->getMessage(), 'error' ]);
|
||||
return fail('安装失败' . $e->getMessage());
|
||||
}
|
||||
@ -304,7 +313,7 @@ class Index extends BaseInstall
|
||||
return fail('菜单初始化失败');
|
||||
}
|
||||
//初始化计划任务
|
||||
$res = ( new CoreScheduleInstallService())->installSystemSchedule();
|
||||
$res = ( new CoreScheduleInstallService() )->installSystemSchedule();
|
||||
if (!$res) {
|
||||
$this->setSuccessLog([ '计划任务初始化失败', 'error' ]);
|
||||
return fail('计划任务初始化失败');
|
||||
@ -333,7 +342,7 @@ class Index extends BaseInstall
|
||||
|
||||
Cache::set('install_status', 2);//成功
|
||||
return success();
|
||||
} catch ( Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->setSuccessLog([ '安装失败' . $e->getMessage(), 'error' ]);
|
||||
return fail('安装失败' . $e->getMessage());
|
||||
}
|
||||
@ -343,7 +352,8 @@ class Index extends BaseInstall
|
||||
* 安装插件
|
||||
* @return true
|
||||
*/
|
||||
public function installAddon() {
|
||||
public function installAddon()
|
||||
{
|
||||
$root_path = str_replace("\\", DIRECTORY_SEPARATOR, dirname(__FILE__, 4));
|
||||
$root_path = str_replace("../", DIRECTORY_SEPARATOR, $root_path);
|
||||
$addon_path = $root_path . DIRECTORY_SEPARATOR . 'addon';
|
||||
@ -351,9 +361,9 @@ class Index extends BaseInstall
|
||||
$files = get_files_by_dir($addon_path);
|
||||
if (!empty($files)) {
|
||||
foreach ($files as $path) {
|
||||
$data = (new CoreAddonService())->getAddonConfig($path);
|
||||
if (isset($data['key'])) {
|
||||
$install_service = (new CoreAddonInstallService($data['key']));
|
||||
$data = ( new CoreAddonService() )->getAddonConfig($path);
|
||||
if (isset($data[ 'key' ])) {
|
||||
$install_service = ( new CoreAddonInstallService($data[ 'key' ]) );
|
||||
$install_service->installCheck();
|
||||
$install_service->install();
|
||||
}
|
||||
@ -434,7 +444,7 @@ class Index extends BaseInstall
|
||||
$sql_item = $this->str_replace_first($table_name, $new_table_name, $sql);
|
||||
@mysqli_query($conn, $sql_item);
|
||||
if ($is_write) $this->setSuccessLog([ '创建表' . $table_name, 'success' ]);
|
||||
} catch ( Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->setSuccessLog([ $e->getMessage(), 'error' ]);
|
||||
return fail('数据库解析失败' . $e->getMessage());
|
||||
}
|
||||
@ -506,7 +516,7 @@ class Index extends BaseInstall
|
||||
if ($data[ 1 ] == 'error') {
|
||||
Cache::set('install_status', -1);
|
||||
}
|
||||
$time = @(int)microtime(true);
|
||||
$time = @(int) microtime(true);
|
||||
$data[] = date('Y-m-d H:i:s', $time);
|
||||
$install_data = Cache::get('install_data') ?? [];
|
||||
$install_data[] = $data;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -4,7 +4,6 @@
|
||||
<meta name="renderer" content="webkit" />
|
||||
<meta http-equiv="X-UA-COMPATIBLE" content="IE=edge,chrome=1" />
|
||||
<title>安装程序 - {$install_config['website_name']}</title>
|
||||
<!-- <script src="INSTALL_JS/jquery-2.2.js"></script>-->
|
||||
<link rel="icon" type="image/x-icon" href="INSTALL_IMG/shop_bitbug_favicon.ico" />
|
||||
<link rel="stylesheet" type="text/css" href="INSTALL_CSS/style.css" />
|
||||
<link rel="stylesheet" type="text/css" href="INSTALL_CSS/layui.css" />
|
||||
|
||||
@ -159,13 +159,13 @@
|
||||
</div>
|
||||
<div class="btn-box">
|
||||
<input type="button" class="btn-back" value="后退" onclick="window.location.href='{$root_url}/install.php/index/index?step=2'" />
|
||||
<input type="button" class="btn-next" lay-submit lay-filter="install"value="开始安装" id="form_submit">
|
||||
<input type="button" class="btn-next" lay-submit lay-filter="install" value="开始安装" id="form_submit">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/block}
|
||||
{block name='script'}
|
||||
<script language="javascript" type="text/javascript">
|
||||
<script type="text/javascript">
|
||||
ControlContent(2);
|
||||
var is_existdb = 1;//数据库是否存在
|
||||
var message = '数据库账号或密码不能为空';
|
||||
|
||||
@ -30,10 +30,12 @@
|
||||
.pop-link-wrap .link-text:nth-child(2) a{
|
||||
color: var(--base-color);
|
||||
}
|
||||
|
||||
.pop-link-wrap button{
|
||||
.pop-link-wrap .link-btn{
|
||||
margin-top: 40px;
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
.pop-link-wrap button{
|
||||
width: 160px;
|
||||
height: 40px;
|
||||
background: var(--base-color);
|
||||
color: #fff !important;
|
||||
@ -97,6 +99,11 @@
|
||||
<script>
|
||||
ControlContent(4);
|
||||
const visitFn = (type)=>{
|
||||
let tips = window.localStorage.getItem('pageToLinkTips')
|
||||
if(tips){
|
||||
pageToLink(type)
|
||||
return false
|
||||
}
|
||||
layer.open({
|
||||
type: 1, // page 层类型
|
||||
area: ['400px', '230px'],
|
||||
@ -108,20 +115,30 @@
|
||||
<div class="pop-link-wrap">
|
||||
<p class="link-text">首次运行,请配置伪静态,才能正常使用。</p>
|
||||
<p class="link-text">伪静态如何配置请<a href="https://www.kancloud.cn/niushop/niucloud-admin-app/3199831" class="other-links-text" target="_blank">参考手册</a></p>
|
||||
<button onclick="pageToLink('${type}')" class="layui-btn visit-btn layui-border">确定</button>
|
||||
<p class="link-btn">
|
||||
<button onclick="pageToLink('${type}')" class="layui-btn visit-btn layui-border">确定</button>
|
||||
<button onclick="pageToLink('${type}', ${true})" class="layui-btn visit-btn layui-border">已配置,不需要在提示</button>
|
||||
</p>
|
||||
</div>
|
||||
`
|
||||
});
|
||||
}
|
||||
|
||||
// 页面跳转
|
||||
function pageToLink(type){
|
||||
if(type == 'admin')
|
||||
function pageToLink(type,flag = false){
|
||||
if(flag){
|
||||
window.localStorage.setItem('pageToLinkTips', true)
|
||||
}
|
||||
if(type == 'admin'){
|
||||
layer.closeAll()
|
||||
window.open('{$root_url}/admin/login')
|
||||
else if(type == 'web')
|
||||
}else if(type == 'web'){
|
||||
layer.closeAll()
|
||||
window.open('{$root_url}/web/')
|
||||
else if(type == 'wap')
|
||||
}else if(type == 'wap'){
|
||||
layer.closeAll()
|
||||
window.open('{$root_url}/wap/')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
|
||||
@ -9,23 +9,19 @@
|
||||
// | Author: Niucloud Team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\job\sys;
|
||||
namespace app\job\member;
|
||||
|
||||
use app\service\core\addon\CoreAddonInstallService;
|
||||
use app\service\core\member\CoreMemberService;
|
||||
use core\base\BaseJob;
|
||||
|
||||
/**
|
||||
* 队列异步执行插件安装任务
|
||||
* 队列设置会员会员码
|
||||
*/
|
||||
class AddonInstall extends BaseJob
|
||||
class SetMemberNoJob extends BaseJob
|
||||
{
|
||||
public function doJob($addon, $task)
|
||||
public function doJob($member_id)
|
||||
{
|
||||
(new CoreAddonInstallService($addon))->executeTask($task);
|
||||
}
|
||||
|
||||
public function failed($data)
|
||||
{
|
||||
|
||||
CoreMemberService::setMemberNo($member_id);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -28,7 +28,7 @@ return [
|
||||
'DOWNLOAD_FAIL' => 'download fail',
|
||||
'SET_SUCCESS' => 'set success',
|
||||
'AGREEMENT_TYPE_NOT_EXIST' => 'agreement type is not exit',
|
||||
'FIELD_NOT_FOUND' => 'cloumn is not exit',
|
||||
'FIELD_NOT_FOUND' => 'column is not exit',
|
||||
'REFRESH_SUCCESS' => 'refresh success',
|
||||
'CAPTCHA_ERROR' => 'captcha fail',
|
||||
|
||||
|
||||
@ -35,14 +35,6 @@ return [
|
||||
'status_on' => 'on',
|
||||
'status_off' => 'off'
|
||||
],
|
||||
// 站点
|
||||
'dict_site' => [
|
||||
//站点类型
|
||||
'type_cms' => 'cms',
|
||||
'status_on' => 'on',
|
||||
'status_experience' => 'experience',
|
||||
'status_expire' => 'expire'
|
||||
],
|
||||
'dict_notice' => [
|
||||
'type_sms' => 'sms',
|
||||
'type_wechat' => 'wechat',
|
||||
|
||||
@ -91,7 +91,7 @@ return [
|
||||
'USER_NOT_EXIST' => '用户不存在',
|
||||
'NO_SITE_USER_ROLE' => '用户不存在关联权限',
|
||||
'ADMIN_NOT_ALLOW_EDIT_ROLE' => '超级管理员不允许改动权限',
|
||||
'USERNAME_REPEAT' => '用户名重复',
|
||||
'USERNAME_REPEAT' => '账号重复',
|
||||
'SITE_USER_EXIST' => '该用户已存在',
|
||||
|
||||
//角色管理
|
||||
@ -110,7 +110,7 @@ return [
|
||||
'OSS_FILE_URL_NOT_EXIST' => '远程资源文件地址不能为空',
|
||||
'BASE_IMAGE_FILE_NOT_EXIST' => 'base图片资源不能为空',
|
||||
'UPLOAD_TYPE_NOT_SUPPORT' => '不支持的上传类型',
|
||||
'FILE_ERROE' => '无效的资源',
|
||||
'FILE_ERROR' => '无效的资源',
|
||||
'UPLOAD_STORAGE_TYPE_ALL_CLOSE' => '至少要有一个启用的存储方式',
|
||||
'STORAGE_NOT_HAS_HTTP_OR_HTTPS' => '空间域名请补全http://或https://',
|
||||
|
||||
@ -137,6 +137,7 @@ return [
|
||||
'ACCOUNT_OR_PASSWORD_ERROR' => '账号或密码错误',
|
||||
'MEMBER_LOCK' => '账号被锁定',
|
||||
'MEMBER_NOT_EXIST' => '账号不存在',
|
||||
'MEMBER_OPENID_EXIST' => 'openid已存在',
|
||||
'MEMBER_LOGOUT' => '账号退出',
|
||||
'MEMBER_TYPE_NOT_EXIST' => '账户类型不存在',
|
||||
'MEMBER_IS_EXIST' => '账号已存在',
|
||||
@ -204,7 +205,7 @@ return [
|
||||
'PAY_SUCCESS' => '当前支付已完成',
|
||||
'PAY_IS_REMOVE' => '当前支付已取消',
|
||||
'PAYMENT_METHOD_NOT_EXIST' => '你选择的支付方式未启用',
|
||||
'PAYMENT_METHOD_NOT_SCENE'=> '你选择的支付方式不适用于当前场景',
|
||||
'PAYMENT_METHOD_NOT_SCENE' => '你选择的支付方式不适用于当前场景',
|
||||
'TREAT_PAYMENT_IS_OPEN' => '只有待支付时可以关闭',
|
||||
'TRANFER_STATUS_NOT_IN_WAIT_TANSFER' => '当前转账未处于待转账状态',
|
||||
'TRANSFER_ORDER_INVALID' => '无效的转账单据',
|
||||
@ -277,7 +278,9 @@ return [
|
||||
'CONTINUE_SIGN' => '连签',
|
||||
'DAYS' => '天!',
|
||||
'SIGN_SUCCESS' => '签到成功',
|
||||
'SIGN_AWARD' => '签到奖励',
|
||||
'GET_AWARD' => '恭喜您获得以下奖励',
|
||||
'WILL_GET_AWARD' => '您将获得以下奖励',
|
||||
|
||||
//导出相关
|
||||
'EXPORT_SUCCESS' => '导出成功',
|
||||
@ -290,5 +293,7 @@ return [
|
||||
'WECHAT_OPLATFORM_NOT_EXIST' => '未配置微信开放平台',
|
||||
'WEAPP_EXIST' => '该小程序已经授权给其他站点',
|
||||
'WECHAT_EXIST' => '该公众号已经授权给其他站点',
|
||||
'PLEASE_ADD_FIRST_SITE_GROUP' => '请先添加站点套餐'
|
||||
'PLEASE_ADD_FIRST_SITE_GROUP' => '请先添加站点套餐',
|
||||
|
||||
'PRINTER_NOT_EXIST' => '打印机不存在'
|
||||
];
|
||||
|
||||
@ -38,18 +38,6 @@ return [
|
||||
'status_off' => '停用'
|
||||
],
|
||||
// 站点
|
||||
'dict_site' => [
|
||||
//站点类型
|
||||
'type_cms' => 'cms',
|
||||
'status_on' => '正常',
|
||||
'status_experience' => '体验期',
|
||||
'status_expire' => '已到期',
|
||||
'status_close' => '已停止',
|
||||
'pay' => '支付',
|
||||
'refund' => '退款',
|
||||
'transfer' => '转账',
|
||||
],
|
||||
// 站点
|
||||
'dict_site_index' => [
|
||||
//站点类型
|
||||
'system' => '框架首页',
|
||||
@ -232,6 +220,7 @@ return [
|
||||
'member_my_level' => '会员等级',
|
||||
'member_my_sign_in' => '我的签到',
|
||||
'member_verify_index' => '核销台',
|
||||
'member_contact' => '客服',
|
||||
|
||||
'diy_page' => '自定义页面',
|
||||
'diy_link' => '自定义链接',
|
||||
@ -239,7 +228,7 @@ return [
|
||||
'diy_make_phone_call' => '拨打电话'
|
||||
],
|
||||
// 自定义海报
|
||||
'dict_diy_poster'=>[
|
||||
'dict_diy_poster' => [
|
||||
'component_type_basic' => '基础组件',
|
||||
],
|
||||
//短信相关
|
||||
@ -379,4 +368,8 @@ return [
|
||||
'status_not_sign' => '未签到',
|
||||
'status_signed' => '已签到'
|
||||
],
|
||||
// 打印机品牌
|
||||
'dict_printer' => [
|
||||
'yilianyun' => '易联云打印机'
|
||||
]
|
||||
];
|
||||
|
||||
@ -30,11 +30,11 @@ return [
|
||||
'limit_between' => 'limit必须是正整数并且不能超过120',
|
||||
],
|
||||
'validate_user' => [
|
||||
'username_require' => '用户名必须填写',
|
||||
'username_unique' => '用户名必须是惟一的',
|
||||
'username_max' => '用户名最多不能超过15个字符',
|
||||
'username_require' => '账号必须填写',
|
||||
'username_unique' => '账号必须是唯一的',
|
||||
'username_max' => '账号最多不能超过15个字符',
|
||||
'real_name_require' => '实际姓名必须填写',
|
||||
'password_require' => '用户密码必须填写',
|
||||
'password_require' => '账号密码必须填写',
|
||||
],
|
||||
//站点
|
||||
'validate_site' => [
|
||||
|
||||
@ -9,14 +9,14 @@
|
||||
// | Author: Niucloud Team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\listener\member;
|
||||
namespace app\listener\member_export;
|
||||
|
||||
use app\model\member\Member;
|
||||
|
||||
/**
|
||||
* 会员导出数据源查询
|
||||
* Class MemberExportTypeListener
|
||||
* @package app\listener\member
|
||||
* Class MemberExportDataListener
|
||||
* @package app\listener\member_export
|
||||
*/
|
||||
class MemberExportDataListener
|
||||
{
|
||||
@ -26,7 +26,7 @@ class MemberExportDataListener
|
||||
$data = [];
|
||||
if ($param['type'] == 'member') {
|
||||
$model = new Member();
|
||||
$field = 'member_id, member_no, username, mobile, nickname, birthday, member_level, point, balance, money, growth, commission, register_channel, status, create_time, last_visit_time';
|
||||
$field = 'member_id, member_no, mobile, nickname, birthday, member_level, point, balance, money, growth, commission, register_channel, status, create_time, last_visit_time';
|
||||
//查询导出数据
|
||||
$search_model = $model->withSearch(['keyword','register_type', 'create_time', 'is_del', 'member_label', 'register_channel'], $param['where'])
|
||||
->with(['memberLevelNameBind'])->field($field)->append(['register_channel_name', 'sex_name', 'status_name']);
|
||||
@ -36,12 +36,11 @@ class MemberExportDataListener
|
||||
$data = $search_model->select()->toArray();
|
||||
}
|
||||
foreach ($data as $key => $value) {
|
||||
$data[$key]['username'] = !empty($value['username']) ? $value['username'] : '-';
|
||||
$data[$key]['mobile'] = $value['mobile']."\t";
|
||||
$data[$key]['create_time'] = !empty($value['create_time']) ? $value['create_time'] : '0000-00-00 00:00:00';
|
||||
$data[$key]['last_visit_time'] = !empty($value['last_visit_time']) ? $value['last_visit_time'] : '0000-00-00 00:00:00';
|
||||
$data[$key]['create_time'] = !empty($value['create_time']) ? $value['create_time'] : '';
|
||||
$data[$key]['last_visit_time'] = !empty($value['last_visit_time']) ? $value['last_visit_time'] : '';
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -9,7 +9,7 @@
|
||||
// | Author: Niucloud Team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\listener\member;
|
||||
namespace app\listener\member_export;
|
||||
|
||||
/**
|
||||
* 会员导出数据类型查询
|
||||
@ -1,30 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | Niucloud-admin 企业快速开发的多应用管理平台
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网址:https://www.niucloud.com
|
||||
// +----------------------------------------------------------------------
|
||||
// | niucloud团队 版权所有 开源版本可自由商用
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: Niucloud Team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\listener\system;
|
||||
|
||||
/**
|
||||
* 平台首页加载事件
|
||||
* Class AdminIndexListenerIndex
|
||||
* @package app\listener\system
|
||||
*/
|
||||
class AdminIndexListener
|
||||
{
|
||||
public function handle()
|
||||
{
|
||||
return [
|
||||
[
|
||||
"name" => get_lang("dict_admin_index.system"),
|
||||
"view_path" => "index/index"
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
@ -38,7 +38,7 @@ class Poster
|
||||
|
||||
$headimg = $member_info[ 'headimg' ];
|
||||
if (empty($headimg)) {
|
||||
$headimg = 'static/resource/images/default_headimg.jpg';
|
||||
$headimg = 'static/resource/images/default_headimg.png';
|
||||
}
|
||||
$return_data = [
|
||||
'nickname' => $nickname,
|
||||
|
||||
@ -77,7 +77,7 @@ class Addon extends BaseModel
|
||||
*/
|
||||
public function searchTitleAttr($query, $value, $data)
|
||||
{
|
||||
if ($value) {
|
||||
if ($value != '') {
|
||||
$query->whereLike('title', '%' . $value . '%');
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,9 +12,6 @@
|
||||
namespace app\model\dict;
|
||||
|
||||
use core\base\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
use think\model\relation\HasMany;
|
||||
use think\model\relation\HasOne;
|
||||
|
||||
/**
|
||||
* 数据字典模型
|
||||
@ -24,8 +21,6 @@ use think\model\relation\HasOne;
|
||||
class Dict extends BaseModel
|
||||
{
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 数据表主键
|
||||
* @var string
|
||||
@ -43,7 +38,7 @@ class Dict extends BaseModel
|
||||
];
|
||||
|
||||
// 设置json类型字段
|
||||
protected $json = ['dictionary'];
|
||||
protected $json = [ 'dictionary' ];
|
||||
// 设置JSON数据返回数组
|
||||
protected $jsonAssoc = true;
|
||||
|
||||
@ -54,7 +49,7 @@ class Dict extends BaseModel
|
||||
*/
|
||||
public function searchNameAttr($query, $value, $data)
|
||||
{
|
||||
if ($value) {
|
||||
if ($value != '') {
|
||||
$query->where("name", $value);
|
||||
}
|
||||
}
|
||||
@ -66,12 +61,9 @@ class Dict extends BaseModel
|
||||
*/
|
||||
public function searchKeyAttr($query, $value, $data)
|
||||
{
|
||||
if ($value) {
|
||||
if ($value != '') {
|
||||
$query->where("key", $value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -174,8 +174,8 @@ class Diy extends BaseModel
|
||||
*/
|
||||
public function searchTitleAttr($query, $value, $data)
|
||||
{
|
||||
if ($value) {
|
||||
$query->where("title|page_title", 'like', '%' . $value . '%');
|
||||
if ($value != '') {
|
||||
$query->where("title|page_title", 'like', '%' . $this->handelSpecialCharacter($value) . '%');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -55,7 +55,7 @@ class DiyRoute extends BaseModel
|
||||
*/
|
||||
public function searchTitleAttr($query, $value, $data)
|
||||
{
|
||||
if ($value) {
|
||||
if ($value != '') {
|
||||
$query->where("title", 'like', '%' . $value . '%');
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ class GenerateTable extends BaseModel
|
||||
*/
|
||||
public function searchTableNameAttr($query, $value, $data)
|
||||
{
|
||||
if ($value) {
|
||||
if ($value != '') {
|
||||
$query->where('table_name', 'like', '%' . $value . '%');
|
||||
}
|
||||
}
|
||||
@ -57,7 +57,7 @@ class GenerateTable extends BaseModel
|
||||
*/
|
||||
public function searchTableContentAttr($query, $value, $data)
|
||||
{
|
||||
if ($value) {
|
||||
if ($value != '') {
|
||||
$query->where('table_content', 'like', '%' . $value . '%');
|
||||
}
|
||||
}
|
||||
@ -70,7 +70,7 @@ class GenerateTable extends BaseModel
|
||||
*/
|
||||
public function searchAddonNameAttr($query, $value, $data)
|
||||
{
|
||||
if ($value) {
|
||||
if ($value != '') {
|
||||
if($value == 2)
|
||||
{
|
||||
$query->where('addon_name','=','');
|
||||
|
||||
@ -62,7 +62,7 @@ class Member extends BaseModel
|
||||
protected $defaultSoftDelete = 0;
|
||||
|
||||
// 设置json类型字段
|
||||
protected $json = ['member_label'];
|
||||
protected $json = [ 'member_label' ];
|
||||
// 设置JSON数据返回数组
|
||||
protected $jsonAssoc = true;
|
||||
|
||||
@ -74,9 +74,9 @@ class Member extends BaseModel
|
||||
*/
|
||||
public function getStatusNameAttr($value, $data)
|
||||
{
|
||||
if (empty($data['status']))
|
||||
if (empty($data[ 'status' ]))
|
||||
return '';
|
||||
return MemberDict::getStatus()[$data['status']] ?? '';
|
||||
return MemberDict::getStatus()[ $data[ 'status' ] ] ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -87,9 +87,9 @@ class Member extends BaseModel
|
||||
*/
|
||||
public function getRegisterChannelNameAttr($value, $data)
|
||||
{
|
||||
if (empty($data['register_channel']))
|
||||
if (empty($data[ 'register_channel' ]))
|
||||
return '';
|
||||
return MemberRegisterChannelDict::getType()[$data['register_channel']] ?? '';
|
||||
return MemberRegisterChannelDict::getType()[ $data[ 'register_channel' ] ] ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -100,9 +100,9 @@ class Member extends BaseModel
|
||||
*/
|
||||
public function getRegisterTypeNameAttr($value, $data)
|
||||
{
|
||||
if (empty($data['register_type']))
|
||||
if (empty($data[ 'register_type' ]))
|
||||
return '';
|
||||
return MemberRegisterTypeDict::getType()[$data['register_type']] ?? '';
|
||||
return MemberRegisterTypeDict::getType()[ $data[ 'register_type' ] ] ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -113,9 +113,9 @@ class Member extends BaseModel
|
||||
*/
|
||||
public function getLoginChannelNameAttr($value, $data)
|
||||
{
|
||||
if (empty($data['login_channel']))
|
||||
if (empty($data[ 'login_channel' ]))
|
||||
return '';
|
||||
return ChannelDict::getType()[$data['login_channel']] ?? '';
|
||||
return ChannelDict::getType()[ $data[ 'login_channel' ] ] ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -126,9 +126,9 @@ class Member extends BaseModel
|
||||
*/
|
||||
public function getLoginTypeNameAttr($value, $data)
|
||||
{
|
||||
if (empty($data['login_type']))
|
||||
if (empty($data[ 'login_type' ]))
|
||||
return '';
|
||||
return MemberLoginTypeDict::getType()[$data['login_type']] ?? '';
|
||||
return MemberLoginTypeDict::getType()[ $data[ 'login_type' ] ] ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -139,9 +139,9 @@ class Member extends BaseModel
|
||||
*/
|
||||
public function getSexNameAttr($value, $data)
|
||||
{
|
||||
if (empty($data['sex']))
|
||||
if (empty($data[ 'sex' ]))
|
||||
return '';
|
||||
return CommonDict::getSexType()[$data['sex']] ?? '';
|
||||
return CommonDict::getSexType()[ $data[ 'sex' ] ] ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -161,8 +161,8 @@ class Member extends BaseModel
|
||||
*/
|
||||
public function searchKeywordAttr($query, $value, $data)
|
||||
{
|
||||
if ($value) {
|
||||
$query->where('member_no|username|nickname|mobile', 'like', '%' . $value . '%');
|
||||
if ($value != '') {
|
||||
$query->where('member_no|username|nickname|mobile', 'like', '%' . $this->handelSpecialCharacter($value) . '%');
|
||||
}
|
||||
}
|
||||
|
||||
@ -217,7 +217,7 @@ class Member extends BaseModel
|
||||
public function searchMemberLevelAttr(Query $query, $value, $data)
|
||||
{
|
||||
if ($value) {
|
||||
$query->where('member_level', '=', $value);
|
||||
$query->where('member_level', '=', $value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -229,14 +229,14 @@ class Member extends BaseModel
|
||||
*/
|
||||
public function searchCreateTimeAttr(Query $query, $value, $data)
|
||||
{
|
||||
$start_time = empty($value[0]) ? 0 : strtotime($value[0]);
|
||||
$end_time = empty($value[1]) ? 0 : strtotime($value[1]);
|
||||
$start_time = empty($value[ 0 ]) ? 0 : strtotime($value[ 0 ]);
|
||||
$end_time = empty($value[ 1 ]) ? 0 : strtotime($value[ 1 ]);
|
||||
if ($start_time > 0 && $end_time > 0) {
|
||||
$query->whereBetweenTime('create_time', $start_time, $end_time);
|
||||
} else if ($start_time > 0 && $end_time == 0) {
|
||||
$query->where([['create_time', '>=', $start_time]]);
|
||||
$query->where([ [ 'create_time', '>=', $start_time ] ]);
|
||||
} else if ($start_time == 0 && $end_time > 0) {
|
||||
$query->where([['create_time', '<=', $end_time]]);
|
||||
$query->where([ [ 'create_time', '<=', $end_time ] ]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -248,22 +248,24 @@ class Member extends BaseModel
|
||||
*/
|
||||
public function searchJoinCreateTimeAttr(Query $query, $value, $data)
|
||||
{
|
||||
$start_time = empty($value[0]) ? 0 : strtotime($value[0]);
|
||||
$end_time = empty($value[1]) ? 0 : strtotime($value[1]);
|
||||
$start_time = empty($value[ 0 ]) ? 0 : strtotime($value[ 0 ]);
|
||||
$end_time = empty($value[ 1 ]) ? 0 : strtotime($value[ 1 ]);
|
||||
if ($start_time > 0 && $end_time > 0) {
|
||||
$query->whereBetweenTime('member.create_time', $start_time, $end_time);
|
||||
} else if ($start_time > 0 && $end_time == 0) {
|
||||
$query->where([['member.create_time', '>=', $start_time]]);
|
||||
$query->where([ [ 'member.create_time', '>=', $start_time ] ]);
|
||||
} else if ($start_time == 0 && $end_time > 0) {
|
||||
$query->where([['member.create_time', '<=', $end_time]]);
|
||||
$query->where([ [ 'member.create_time', '<=', $end_time ] ]);
|
||||
}
|
||||
}
|
||||
|
||||
public function memberLevelData() {
|
||||
public function memberLevelData()
|
||||
{
|
||||
return $this->hasOne(MemberLevel::class, 'level_id', 'member_level');
|
||||
}
|
||||
|
||||
public function memberLevelNameBind() {
|
||||
return $this->hasOne(MemberLevel::class, 'level_id', 'member_level')->bind(['member_level_name' => 'level_name']);
|
||||
public function memberLevelNameBind()
|
||||
{
|
||||
return $this->hasOne(MemberLevel::class, 'level_id', 'member_level')->bind([ 'member_level_name' => 'level_name' ]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,6 +14,7 @@ namespace app\model\member;
|
||||
use app\dict\member\MemberAccountChangeTypeDict;
|
||||
use app\dict\member\MemberAccountTypeDict;
|
||||
use core\base\BaseModel;
|
||||
use think\db\Query;
|
||||
use think\model\relation\HasOne;
|
||||
|
||||
/**
|
||||
@ -125,6 +126,19 @@ class MemberAccountLog extends BaseModel
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 关键词搜索
|
||||
* @param $query
|
||||
* @param $value
|
||||
* @param $data
|
||||
*/
|
||||
public function searchKeywordAttr(Query $query, $value, $data)
|
||||
{
|
||||
if ($value != '') {
|
||||
$query->whereLike('memo', '%'.$value.'%');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 金额大于
|
||||
* @param $query
|
||||
|
||||
@ -157,7 +157,7 @@ class MemberCashOut extends BaseModel
|
||||
*/
|
||||
public function searchCashOutNoAttr($query, $value, $data)
|
||||
{
|
||||
if ($value) {
|
||||
if ($value != '') {
|
||||
$query->where('cash_out_no', $value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,8 +62,8 @@ class MemberLabel extends BaseModel
|
||||
*/
|
||||
public function searchLabelNameAttr($query, $value, $data)
|
||||
{
|
||||
if ($value) {
|
||||
$query->where('label_name', 'like', '%' . $value . '%');
|
||||
if ($value != '') {
|
||||
$query->where('label_name', 'like', '%' . $this->handelSpecialCharacter($value) . '%');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -11,7 +11,6 @@
|
||||
|
||||
namespace app\model\member;
|
||||
|
||||
use app\service\core\member\CoreMemberService;
|
||||
use core\base\BaseModel;
|
||||
|
||||
/**
|
||||
@ -63,7 +62,7 @@ class MemberLevel extends BaseModel
|
||||
public function searchLevelNameAttr($query, $value, $data)
|
||||
{
|
||||
if ($value != '') {
|
||||
$query->where('level_name', 'like', '%'.$value.'%');
|
||||
$query->where('level_name', 'like', '%' . $this->handelSpecialCharacter($value) . '%');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,8 +66,8 @@ class Poster extends BaseModel
|
||||
*/
|
||||
public function searchNameAttr($query, $value, $data)
|
||||
{
|
||||
if ($value) {
|
||||
$query->where("name", 'like', '%' . $value . '%');
|
||||
if ($value != '') {
|
||||
$query->where("name", 'like', '%' . $this->handelSpecialCharacter($value) . '%');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -70,7 +70,7 @@ class SysExport extends BaseModel
|
||||
public function searchExportKeyAttr(Query $query, $value, $data)
|
||||
{
|
||||
if ($value) {
|
||||
$query->whereLike('export_key', '%' . $value . '%');
|
||||
$query->where('export_key', $value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -112,7 +112,7 @@ class SysNoticeLog extends BaseModel
|
||||
*/
|
||||
public function searchReceiverAttr($query, $value)
|
||||
{
|
||||
if ($value) {
|
||||
if ($value != '') {
|
||||
$query->where('receiver', $value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -143,7 +143,7 @@ class SysNoticeSmsLog extends BaseModel
|
||||
*/
|
||||
public function searchMobileAttr($query, $value)
|
||||
{
|
||||
if ($value) {
|
||||
if ($value != '') {
|
||||
$query->where('mobile', $value);
|
||||
}
|
||||
}
|
||||
|
||||
106
niucloud/app/model/sys/SysPrinter.php
Normal file
106
niucloud/app/model/sys/SysPrinter.php
Normal file
@ -0,0 +1,106 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | Niucloud-admin 企业快速开发的多应用管理平台
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网址:https://www.niucloud.com
|
||||
// +----------------------------------------------------------------------
|
||||
// | niucloud团队 版权所有 开源版本可自由商用
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: Niucloud Team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\model\sys;
|
||||
|
||||
use app\dict\sys\PrinterDict;
|
||||
use core\base\BaseModel;
|
||||
|
||||
/**
|
||||
* 小票打印机模型
|
||||
* Class SysPrinter
|
||||
* @package app\model\sys
|
||||
*/
|
||||
class SysPrinter extends BaseModel
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* 数据表主键
|
||||
* @var string
|
||||
*/
|
||||
protected $pk = 'printer_id';
|
||||
|
||||
/**
|
||||
* 模型名称
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'sys_printer';
|
||||
|
||||
// 设置json类型字段
|
||||
protected $json = [ 'template_type', 'trigger', 'value' ];
|
||||
|
||||
// 设置JSON数据返回数组
|
||||
protected $jsonAssoc = true;
|
||||
|
||||
/**
|
||||
* 状态字段转化
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return mixed
|
||||
*/
|
||||
public function getBrandNameAttr($value, $data)
|
||||
{
|
||||
if (!empty($data[ 'brand' ])) {
|
||||
return PrinterDict::getBrandName($data[ 'brand' ]) ?? '';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索器:小票打印机
|
||||
* @param $value
|
||||
* @param $data
|
||||
*/
|
||||
public function searchPrinterIdAttr($query, $value, $data)
|
||||
{
|
||||
if ($value) {
|
||||
$query->where("printer_id", $value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索器:小票打印机设备品牌(易联云,365,飞鹅)
|
||||
* @param $value
|
||||
* @param $data
|
||||
*/
|
||||
public function searchBrandAttr($query, $value, $data)
|
||||
{
|
||||
if ($value) {
|
||||
$query->where("brand", $value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索器:小票打印机打印机名称
|
||||
* @param $value
|
||||
* @param $data
|
||||
*/
|
||||
public function searchPrinterNameAttr($query, $value, $data)
|
||||
{
|
||||
if ($value != '') {
|
||||
$query->where("printer_name", 'like', '%' . $value . '%');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索器:小票打印机状态(0,关闭,1:开启)
|
||||
* @param $value
|
||||
* @param $data
|
||||
*/
|
||||
public function searchStatusAttr($query, $value, $data)
|
||||
{
|
||||
if ($value !== '') {
|
||||
$query->where("status", $value);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
94
niucloud/app/model/sys/SysPrinterTemplate.php
Normal file
94
niucloud/app/model/sys/SysPrinterTemplate.php
Normal file
@ -0,0 +1,94 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | Niucloud-admin 企业快速开发的多应用管理平台
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网址:https://www.niucloud.com
|
||||
// +----------------------------------------------------------------------
|
||||
// | niucloud团队 版权所有 开源版本可自由商用
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: Niucloud Team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\model\sys;
|
||||
|
||||
use app\dict\sys\PrinterDict;
|
||||
use core\base\BaseModel;
|
||||
|
||||
/**
|
||||
* 小票打印模板模型
|
||||
* Class SysPrinterTemplate
|
||||
* @package app\model\sys
|
||||
*/
|
||||
class SysPrinterTemplate extends BaseModel
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* 数据表主键
|
||||
* @var string
|
||||
*/
|
||||
protected $pk = 'template_id';
|
||||
|
||||
/**
|
||||
* 模型名称
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'sys_printer_template';
|
||||
|
||||
// 设置json类型字段
|
||||
protected $json = [ 'value' ];
|
||||
|
||||
// 设置JSON数据返回数组
|
||||
protected $jsonAssoc = true;
|
||||
|
||||
/**
|
||||
* 状态字段转化
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return mixed
|
||||
*/
|
||||
public function getTemplateTypeNameAttr($value, $data)
|
||||
{
|
||||
if (!empty($data[ 'template_type' ])) {
|
||||
return PrinterDict::getType($data[ 'template_type' ])[ 'title' ] ?? '';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索器:小票打印模板
|
||||
* @param $value
|
||||
* @param $data
|
||||
*/
|
||||
public function searchTemplateIdAttr($query, $value, $data)
|
||||
{
|
||||
if ($value) {
|
||||
$query->where("template_id", $value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索器:小票打印模板模板类型
|
||||
* @param $value
|
||||
* @param $data
|
||||
*/
|
||||
public function searchTemplateTypeAttr($query, $value, $data)
|
||||
{
|
||||
if ($value) {
|
||||
$query->where("template_type", $value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索器:小票打印模板模板名称
|
||||
* @param $value
|
||||
* @param $data
|
||||
*/
|
||||
public function searchTemplateNameAttr($query, $value, $data)
|
||||
{
|
||||
if ($value != '') {
|
||||
$query->where("template_name", 'like', '%' . $value . '%');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -34,20 +34,13 @@ class SysRole extends BaseModel
|
||||
*/
|
||||
protected $name = 'sys_role';
|
||||
// 设置json类型字段
|
||||
protected $json = ['rules','addon_keys'];
|
||||
protected $json = [ 'rules', 'addon_keys' ];
|
||||
// 设置JSON数据返回数组
|
||||
protected $jsonAssoc = true;
|
||||
|
||||
/**
|
||||
* 角色状态
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return string
|
||||
*/
|
||||
public function getStatusNameAttr($value, $data)
|
||||
{
|
||||
return RoleStatusDict::getStatus()[$data['status']] ?? '';
|
||||
return RoleStatusDict::getStatus()[ $data[ 'status' ] ] ?? '';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -14,7 +14,6 @@ namespace app\model\sys;
|
||||
use app\dict\sys\UserDict;
|
||||
use core\base\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
use think\model\relation\HasMany;
|
||||
|
||||
/**
|
||||
* 系统用户模型
|
||||
@ -47,17 +46,16 @@ class SysUser extends BaseModel
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
// 设置json类型字段
|
||||
protected $json = ['role_ids'];
|
||||
protected $json = [ 'role_ids' ];
|
||||
// 设置JSON数据返回数组
|
||||
protected $jsonAssoc = true;
|
||||
|
||||
/**
|
||||
* 定义软删除字段的默认值
|
||||
* @var int
|
||||
*/
|
||||
protected $defaultSoftDelete = 0;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 状态字段转化
|
||||
* @param $value
|
||||
@ -66,13 +64,14 @@ class SysUser extends BaseModel
|
||||
*/
|
||||
public function getStatusNameAttr($value, $data)
|
||||
{
|
||||
if (empty($data['status'])) return '';
|
||||
return UserDict::getStatus()[$data['status']] ?? '';
|
||||
if (empty($data[ 'status' ])) return '';
|
||||
return UserDict::getStatus()[ $data[ 'status' ] ] ?? '';
|
||||
}
|
||||
|
||||
|
||||
public function getCreateTimeAttr($value, $data)
|
||||
{
|
||||
return $data['create_time'] ? get_date_by_time($data['create_time']) : '';
|
||||
return $data[ 'create_time' ] ? get_date_by_time($data[ 'create_time' ]) : '';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -82,8 +81,8 @@ class SysUser extends BaseModel
|
||||
*/
|
||||
public function searchUsernameAttr($query, $value)
|
||||
{
|
||||
if ($value) {
|
||||
$query->whereLike('username', '%' . $value . '%');
|
||||
if ($value != '') {
|
||||
$query->whereLike('username', '%' . $this->handelSpecialCharacter($value) . '%');
|
||||
}
|
||||
|
||||
}
|
||||
@ -95,26 +94,12 @@ class SysUser extends BaseModel
|
||||
*/
|
||||
public function searchRealnameAttr($query, $value)
|
||||
{
|
||||
if ($value) {
|
||||
if ($value != '') {
|
||||
$query->whereLike('real_name', '%' . $value . '%');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 角色组筛选
|
||||
* @param $query
|
||||
* @param $value
|
||||
* @return void
|
||||
*/
|
||||
public function searchRoleIdsAttr($query, $value)
|
||||
{
|
||||
if ($value) {
|
||||
$query->whereLike('role_ids', '%' . $value . '%');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否删除搜索器
|
||||
* @param $query
|
||||
@ -124,17 +109,6 @@ class SysUser extends BaseModel
|
||||
$query->where('is_del', 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态搜索器
|
||||
* @param $query
|
||||
* @param $value
|
||||
*/
|
||||
public function searchStatusAttr($query, $value)
|
||||
{
|
||||
$query->where('status', $value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 创建时间搜索器
|
||||
* @param $query
|
||||
@ -143,16 +117,33 @@ class SysUser extends BaseModel
|
||||
*/
|
||||
public function searchCreateTimeAttr($query, $value, $data)
|
||||
{
|
||||
$start_time = empty($value[0]) ? 0 : strtotime($value[0]);
|
||||
$end_time = empty($value[1]) ? 0 : strtotime($value[1]);
|
||||
$start_time = empty($value[ 0 ]) ? 0 : strtotime($value[ 0 ]);
|
||||
$end_time = empty($value[ 1 ]) ? 0 : strtotime($value[ 1 ]);
|
||||
if ($start_time > 0 && $end_time > 0) {
|
||||
$query->whereBetweenTime('sys_user.create_time', $start_time, $end_time);
|
||||
} else if ($start_time > 0 && $end_time == 0) {
|
||||
$query->where([['sys_user.create_time', '>=', $start_time]]);
|
||||
$query->where([ [ 'sys_user.create_time', '>=', $start_time ] ]);
|
||||
} else if ($start_time == 0 && $end_time > 0) {
|
||||
$query->where([['sys_user.create_time', '<=', $end_time]]);
|
||||
$query->where([ [ 'sys_user.create_time', '<=', $end_time ] ]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 创建时间搜索器
|
||||
* @param $query
|
||||
* @param $value
|
||||
* @param $data
|
||||
*/
|
||||
public function searchLastTimeAttr($query, $value, $data)
|
||||
{
|
||||
$start_time = empty($value[ 0 ]) ? 0 : strtotime($value[ 0 ]);
|
||||
$end_time = empty($value[ 1 ]) ? 0 : strtotime($value[ 1 ]);
|
||||
if ($start_time > 0 && $end_time > 0) {
|
||||
$query->whereBetweenTime('sys_user.last_time', $start_time, $end_time);
|
||||
} else if ($start_time > 0 && $end_time == 0) {
|
||||
$query->where([ [ 'sys_user.last_time', '>=', $start_time ] ]);
|
||||
} else if ($start_time == 0 && $end_time > 0) {
|
||||
$query->where([ [ 'sys_user.last_time', '<=', $end_time ] ]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ class SysUserLog extends BaseModel
|
||||
*/
|
||||
public function searchUsernameAttr(Query $query, $value, $data)
|
||||
{
|
||||
if ($value) {
|
||||
if ($value != '') {
|
||||
$query->whereLike('username', '%' . $value . '%');
|
||||
}
|
||||
}
|
||||
@ -87,7 +87,7 @@ class SysUserLog extends BaseModel
|
||||
*/
|
||||
public function searchUrlAttr(Query $query, $value, $data)
|
||||
{
|
||||
if ($value) {
|
||||
if ($value != '') {
|
||||
$query->whereLike('url', '%' . $value . '%');
|
||||
}
|
||||
}
|
||||
@ -100,7 +100,7 @@ class SysUserLog extends BaseModel
|
||||
*/
|
||||
public function searchIpAttr(Query $query, $value, $data)
|
||||
{
|
||||
if ($value) {
|
||||
if ($value != '') {
|
||||
$query->whereLike('ip', '%' . $value . '%');
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,7 +11,6 @@
|
||||
|
||||
namespace app\model\verify;
|
||||
|
||||
use app\dict\verify\VerifyDict;
|
||||
use app\model\member\Member;
|
||||
use core\base\BaseModel;
|
||||
|
||||
|
||||
@ -54,8 +54,21 @@ class Verify extends BaseModel
|
||||
*/
|
||||
public function searchCodeAttr(Query $query, $value, $data)
|
||||
{
|
||||
if ($value) {
|
||||
$query->whereLike('code', '%'.$value.'%');
|
||||
if ($value != '') {
|
||||
$query->whereLike('code', '%' . $this->handelSpecialCharacter($value) . '%');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 关键词搜索
|
||||
* @param $query
|
||||
* @param $value
|
||||
* @param $data
|
||||
*/
|
||||
public function searchKeywordAttr(Query $query, $value, $data)
|
||||
{
|
||||
if ($value != '') {
|
||||
$query->whereLike('code|body', '%' . $this->handelSpecialCharacter($value) . '%');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -24,7 +24,6 @@ class AppletDownloadService extends BaseAdminService
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -12,7 +12,6 @@
|
||||
namespace app\service\admin\auth;
|
||||
|
||||
use app\Request;
|
||||
use app\service\admin\addon\AddonService;
|
||||
use app\service\admin\sys\MenuService;
|
||||
use app\service\admin\sys\RoleService;
|
||||
use app\service\admin\user\UserService;
|
||||
@ -34,7 +33,8 @@ class AuthService extends BaseAdminService
|
||||
* @return bool
|
||||
* @throws Exception
|
||||
*/
|
||||
public function checkRole(Request $request){
|
||||
public function checkRole(Request $request)
|
||||
{
|
||||
|
||||
$rule = strtolower(trim($request->rule()->getRule()));
|
||||
$method = strtolower(trim($request->method()));
|
||||
@ -42,12 +42,12 @@ class AuthService extends BaseAdminService
|
||||
$menu_service = new MenuService();
|
||||
$all_menu_list = $menu_service->getAllApiList();
|
||||
//先判断当前访问的接口是否收到权限的限制
|
||||
$method_menu_list = $all_menu_list[$method] ?? [];
|
||||
if(!in_array($rule, $method_menu_list))
|
||||
$method_menu_list = $all_menu_list[ $method ] ?? [];
|
||||
if (!in_array($rule, $method_menu_list))
|
||||
return true;
|
||||
|
||||
$auth_role_list = $this->getAuthApiList();
|
||||
if(!empty($auth_role_list[$method]) && in_array($rule, $auth_role_list[$method]))
|
||||
if (!empty($auth_role_list[ $method ]) && in_array($rule, $auth_role_list[ $method ]))
|
||||
return true;
|
||||
|
||||
throw new AuthException('NO_PERMISSION');
|
||||
@ -58,18 +58,19 @@ class AuthService extends BaseAdminService
|
||||
* 当前授权用户接口权限
|
||||
* @return array
|
||||
*/
|
||||
public function getAuthApiList(){
|
||||
$user_info = ( new UserService())->getUserCache($this->uid);
|
||||
if(empty($user_info))
|
||||
public function getAuthApiList()
|
||||
{
|
||||
$user_info = ( new UserService() )->getUserCache($this->uid);
|
||||
if (empty($user_info))
|
||||
return [];
|
||||
|
||||
$is_admin = $user_info['is_admin'];//是否是超级管理员组
|
||||
$is_admin = $user_info[ 'is_admin' ];//是否是超级管理员组
|
||||
$menu_service = new MenuService();
|
||||
if($is_admin){//查询全部启用的权限
|
||||
if ($is_admin) {//查询全部启用的权限
|
||||
//获取站点信息
|
||||
return (new MenuService())->getAllApiList(1);
|
||||
}else{
|
||||
$user_role_ids = $user_info['role_ids'];
|
||||
return ( new MenuService() )->getAllApiList(1);
|
||||
} else {
|
||||
$user_role_ids = $user_info[ 'role_ids' ];
|
||||
$role_service = new RoleService();
|
||||
$menu_keys = $role_service->getMenuKeysByRoleIds($user_role_ids ?? []);
|
||||
return $menu_service->getApiListByMenuKeys($menu_keys);
|
||||
@ -80,16 +81,17 @@ class AuthService extends BaseAdminService
|
||||
* 当前授权用户菜单权限
|
||||
* @return array
|
||||
*/
|
||||
public function getAuthMenuList($status = 'all', int $is_tree = 0, int $is_button = 1){
|
||||
$user_info = ( new UserService())->getUserCache($this->uid);
|
||||
if(empty($user_info))
|
||||
public function getAuthMenuList($status = 'all', int $is_tree = 0, int $is_button = 1)
|
||||
{
|
||||
$user_info = ( new UserService() )->getUserCache($this->uid);
|
||||
if (empty($user_info))
|
||||
return [];
|
||||
$is_admin = $user_info['is_admin'];//是否是超级管理员组
|
||||
$is_admin = $user_info[ 'is_admin' ];//是否是超级管理员组
|
||||
$menu_service = new MenuService();
|
||||
if ($is_admin) {//查询全部启用的权限
|
||||
return (new MenuService())->getAllMenuList($status, $is_tree, $is_button);
|
||||
return ( new MenuService() )->getAllMenuList($status, $is_tree, $is_button);
|
||||
} else {
|
||||
$user_role_ids = $user_info['role_ids'];
|
||||
$user_role_ids = $user_info[ 'role_ids' ];
|
||||
$role_service = new RoleService();
|
||||
$menu_keys = $role_service->getMenuKeysByRoleIds($user_role_ids ?? []);
|
||||
return $menu_service->getMenuListByMenuKeys($menu_keys, $is_tree, is_button:$is_button);
|
||||
@ -99,8 +101,9 @@ class AuthService extends BaseAdminService
|
||||
/**
|
||||
* 获取授权用户信息
|
||||
*/
|
||||
public function getAuthInfo(){
|
||||
return ( new UserService())->getUserCache($this->uid);
|
||||
public function getAuthInfo()
|
||||
{
|
||||
return ( new UserService() )->getUserCache($this->uid);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -108,51 +111,15 @@ class AuthService extends BaseAdminService
|
||||
* @param array $data
|
||||
* @return true
|
||||
*/
|
||||
public function editAuth(array $data){
|
||||
if(!empty($data['password'])){
|
||||
public function editAuth(array $data)
|
||||
{
|
||||
if (!empty($data[ 'password' ])) {
|
||||
//检测原始密码是否正确
|
||||
$user = (new UserService())->find($this->uid);
|
||||
if(!check_password($data['original_password'], $user->password))
|
||||
$user = ( new UserService() )->find($this->uid);
|
||||
if (!check_password($data[ 'original_password' ], $user->password))
|
||||
throw new AuthException('OLD_PASSWORD_ERROR');
|
||||
|
||||
}
|
||||
return (new UserService())->edit($this->uid, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前账号授权的应用列表
|
||||
* @return array|mixed|string
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function getAuthAddonList($data= []){
|
||||
$user_info = ( new UserService())->getUserCache($this->uid);
|
||||
if(empty($user_info))
|
||||
return [];
|
||||
$is_admin = $user_info['is_admin'];//是否是超级管理员组
|
||||
if($is_admin){//查询全部启用的权限
|
||||
if(empty($data['type'])){
|
||||
return (new AddonService())->getInstallAddonList($data);
|
||||
}else{
|
||||
return (new AddonService())->getInstallStarAddonList($data);
|
||||
}
|
||||
}else{
|
||||
$user_role_ids = $user_info['role_ids'];
|
||||
$role_service = new RoleService();
|
||||
$addon_keys = $role_service->getAddonKeysByRoleIds($user_role_ids ?? []);
|
||||
if(empty($data['type'])){
|
||||
return (new AddonService())->getAddonListByKeys($addon_keys, $data);
|
||||
}else{
|
||||
return (new AddonService())->getStatAddonLists($addon_keys, $data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 应用插件加星
|
||||
*/
|
||||
public function setAddonStat($key){
|
||||
return (new AddonService())->setAddonStat($key);
|
||||
return ( new UserService() )->edit($this->uid, $data);
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,10 +34,10 @@ class DiyConfigService extends BaseAdminService
|
||||
{
|
||||
$list = ( new CoreDiyConfigService() )->getBottomList($params);
|
||||
|
||||
$apps = (new CoreAddonService())->getList([ ['type', '=', 'app'] ]);
|
||||
$apps = ( new CoreAddonService() )->getList([ [ 'type', '=', 'app' ] ]);
|
||||
|
||||
// 单应用,排除 系统 底部导航设置
|
||||
if (count($apps) == 1) {
|
||||
if (count($list) > 1 && count($apps) == 1) {
|
||||
foreach ($list as $k => $v) {
|
||||
if ($v[ 'key' ] = 'app') {
|
||||
unset($list[ $k ]);
|
||||
|
||||
@ -50,7 +50,7 @@ class DiyRouteService extends BaseAdminService
|
||||
if (!empty($cv[ 'url' ])) {
|
||||
$is_add = true;
|
||||
|
||||
if (!empty($where[ 'title' ]) && !str_contains($cv[ 'title' ], $where[ 'title' ])) {
|
||||
if (isset($where[ 'title' ]) && $where[ 'title' ] !='' && !str_contains($cv[ 'title' ], $where[ 'title' ])) {
|
||||
$is_add = false;
|
||||
}
|
||||
|
||||
|
||||
@ -11,7 +11,6 @@
|
||||
|
||||
namespace app\service\admin\generator;
|
||||
|
||||
use app\model\addon\Addon;
|
||||
use app\model\generator\GenerateColumn;
|
||||
use app\model\generator\GenerateTable;
|
||||
use core\base\BaseAdminService;
|
||||
@ -23,7 +22,6 @@ use think\db\exception\ModelNotFoundException;
|
||||
use think\facade\Db;
|
||||
use think\helper\Str;
|
||||
use think\Model;
|
||||
use think\model\relation\HasOne;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -11,9 +11,6 @@
|
||||
|
||||
namespace app\service\admin\generator\core;
|
||||
|
||||
use app\dict\sys\MenuDict;
|
||||
use app\model\sys\SysMenu;
|
||||
use think\facade\Cache;
|
||||
use think\helper\Str;
|
||||
|
||||
/**
|
||||
|
||||
@ -307,6 +307,7 @@ class ValidateGenerator extends BaseGenerator
|
||||
$dir .= $this->moduleName . '/';
|
||||
return $dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成的文件名
|
||||
* @return string
|
||||
@ -316,5 +317,4 @@ class ValidateGenerator extends BaseGenerator
|
||||
return $this->getUCaseClassName() . '.php';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -15,7 +15,6 @@ namespace app\service\admin\generator\core;
|
||||
|
||||
|
||||
|
||||
use app\service\core\menu\CoreMenuService;
|
||||
use think\helper\Str;
|
||||
|
||||
/**
|
||||
|
||||
@ -38,7 +38,7 @@ class {UCASE_NAME}Service extends BaseAdminService
|
||||
$field = '{FIELDS}';
|
||||
$order = '{ORDER}';
|
||||
|
||||
$search_model = {SEARCH_MODEL};
|
||||
$search_model = {SEARCH_MODEL}
|
||||
$list = $this->pageQuery($search_model);
|
||||
return $list;
|
||||
}
|
||||
@ -52,7 +52,7 @@ class {UCASE_NAME}Service extends BaseAdminService
|
||||
{
|
||||
$field = '{FIELDS}';
|
||||
|
||||
$info = {INFO_SEARCH_MODEL};
|
||||
$info = {INFO_SEARCH_MODEL}
|
||||
return $info;
|
||||
}
|
||||
|
||||
|
||||
@ -42,8 +42,8 @@ class MemberAccountService extends BaseAdminService
|
||||
|
||||
$field = 'member_account_log.id, member_account_log.member_id, member_account_log.account_type, member_account_log.account_data,member_account_log.account_sum, member_account_log.from_type, member_account_log.related_id, member_account_log.create_time, member_account_log.memo';
|
||||
$member_where = [];
|
||||
if (!empty($where[ 'keywords' ])) {
|
||||
$member_where[] = [ "member.member_no|member.nickname|member.mobile", 'like', '%' . $where[ 'keywords' ] . '%' ];
|
||||
if (isset($where[ 'keywords' ]) && $where[ 'keywords' ] != '') {
|
||||
$member_where[] = [ "member.member_no|member.nickname|member.mobile", 'like', '%' . $this->model->handelSpecialCharacter($where[ 'keywords' ]) . '%' ];
|
||||
}
|
||||
$search_model = $this->model->withSearch([ 'join_member_id' => 'member_id', 'account_type', 'from_type', 'join_create_time' => 'create_time' ], $where)
|
||||
->withJoin(
|
||||
|
||||
@ -16,7 +16,6 @@ use app\dict\member\MemberRegisterTypeDict;
|
||||
use app\model\member\Member;
|
||||
use app\service\admin\sys\ExportService;
|
||||
use app\service\core\member\CoreMemberService;
|
||||
use app\service\core\sys\CoreExportService;
|
||||
use core\base\BaseAdminService;
|
||||
use core\dict\DictLoader;
|
||||
use core\exception\AdminException;
|
||||
|
||||
@ -36,9 +36,9 @@ class MemberSignService extends BaseAdminService
|
||||
public function getPage(array $where = [])
|
||||
{
|
||||
$member_where = [];
|
||||
if(!empty($where['keywords']))
|
||||
if(isset($where['keywords']) && $where['keywords'] != '')
|
||||
{
|
||||
$member_where = [['member.member_no|member.nickname|member.mobile', 'like', '%'.$where['keywords'].'%']];
|
||||
$member_where = [['member.member_no|member.nickname|member.mobile', 'like', '%' . $this->model->handelSpecialCharacter($where['keywords']) . '%']];
|
||||
}
|
||||
$field = 'sign_id, member_sign.member_id, days, day_award, continue_award, continue_tag, member_sign.create_time, is_sign';
|
||||
$search_model = $this->model->withSearch(['create_time'],$where)->where($member_where)->withJoin(["member" => ['member_no', 'mobile', 'nickname', 'headimg']])->field($field)->append(['is_sign_name'])->order('member_sign.create_time desc');
|
||||
@ -111,4 +111,4 @@ class MemberSignService extends BaseAdminService
|
||||
}
|
||||
return $info[ 'value' ];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -115,7 +115,7 @@ class SmsService extends BaseAdminService
|
||||
{
|
||||
$config['default'] = $sms_type;
|
||||
}else{
|
||||
$config['default'] = '';
|
||||
$config['default'] = $config['default'] == $sms_type ? '' : $config['default'];
|
||||
}
|
||||
foreach ($sms_type_list[$sms_type]['params'] as $k_param => $v_param)
|
||||
{
|
||||
|
||||
@ -154,6 +154,8 @@ class PayChannelService extends BaseAdminService
|
||||
'collection_desc' => $data[ 'collection_desc' ] ?? '',// 必填-转账说明
|
||||
];
|
||||
break;
|
||||
default:
|
||||
$config = $data;
|
||||
}
|
||||
return $config;
|
||||
}
|
||||
|
||||
@ -12,10 +12,8 @@
|
||||
namespace app\service\admin\pay;
|
||||
|
||||
use app\dict\pay\PayDict;
|
||||
use app\model\pay\Pay;
|
||||
use app\model\pay\Refund;
|
||||
use app\service\core\pay\CoreRefundService;
|
||||
use app\service\core\paytype\CoreOfflineService;
|
||||
use core\base\BaseAdminService;
|
||||
|
||||
/**
|
||||
|
||||
@ -206,8 +206,7 @@ class AttachmentService extends BaseAdminService
|
||||
*/
|
||||
public function getCategoryPage(array $data)
|
||||
{
|
||||
$where = array (
|
||||
);
|
||||
$where = array ();
|
||||
if (!empty($data[ 'type' ])) {
|
||||
$where[] = [ 'type', '=', $data[ 'type' ] ];
|
||||
}
|
||||
@ -231,8 +230,8 @@ class AttachmentService extends BaseAdminService
|
||||
if (!empty($data[ 'type' ])) {
|
||||
$where[] = [ 'type', '=', $data[ 'type' ] ];
|
||||
}
|
||||
if (!empty($data[ 'name' ])) {
|
||||
$where[] = [ 'name', 'like', '%' . $data[ 'name' ] . '%' ];
|
||||
if (isset($data[ 'name' ]) && $data[ 'name' ] != '') {
|
||||
$where[] = [ 'name', 'like', '%' . $this->model->handelSpecialCharacter($data[ 'name' ]) . '%' ];
|
||||
}
|
||||
return SysAttachmentCategory::where($where)->field('id,name,type')->order('id desc')->select()->toArray();
|
||||
}
|
||||
@ -247,7 +246,7 @@ class AttachmentService extends BaseAdminService
|
||||
$icon_list = IconDict::getIcon();
|
||||
foreach ($icon_list as $k => $v) {
|
||||
unset($icon_list[ $k ][ 'glyphs' ]);
|
||||
if (!empty($data[ 'name' ]) && !str_contains($v['name'], $data['name'])) {
|
||||
if (isset($data[ 'name' ]) && $data[ 'name' ] !='' && !str_contains($v['name'], $data['name'])) {
|
||||
unset($icon_list[ $k ]);
|
||||
}
|
||||
}
|
||||
@ -310,4 +309,4 @@ class AttachmentService extends BaseAdminService
|
||||
return $res;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user