[更新]同步framework代码

This commit is contained in:
Anyon 2019-06-14 18:53:04 +08:00
parent 4fa3cea59d
commit 85f5f4e552
29 changed files with 238 additions and 884 deletions

View File

@ -58,7 +58,7 @@ class Auth extends Controller
$auth = $this->request->post('id', '0');
switch (strtolower($this->request->post('action'))) {
case 'get': // 获取权限配置
$nodes = \app\admin\service\Auth::get();
$nodes = \app\admin\service\AuthService::get();
$checked = Db::name('SystemAuthNode')->where(['auth' => $auth])->column('node');
foreach ($nodes as &$node) $node['checked'] = in_array($node['node'], $checked);
$data = $this->_apply_filter(\library\tools\Data::arr2tree($nodes, 'node', 'pnode', '_sub_'));
@ -131,7 +131,7 @@ class Auth extends Controller
/**
* 删除系统权限
*/
public function del()
public function remove()
{
$this->applyCsrfToken();
$this->_delete($this->table);
@ -143,7 +143,7 @@ class Auth extends Controller
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
protected function _del_delete_result($result)
protected function _remove_delete_result($result)
{
if ($result) {
$where = ['auth' => $this->request->post('id')];

View File

@ -14,6 +14,7 @@
namespace app\admin\controller;
use app\admin\service\AuthService;
use library\Controller;
use library\tools\Data;
use think\Console;
@ -37,7 +38,7 @@ class Index extends Controller
public function index()
{
$this->title = '系统管理后台';
$this->menus = \app\admin\service\Auth::getAuthMenu();
$this->menus = AuthService::getAuthMenu();
if (empty($this->menus) && !session('user.id')) {
$this->redirect('@admin/login');
} else {
@ -51,7 +52,6 @@ class Index extends Controller
*/
public function main()
{
$this->title = '后台首页';
$this->think_ver = \think\App::VERSION;
$this->mysql_ver = Db::query('select version() as ver')[0]['ver'];
$this->fetch();
@ -62,7 +62,7 @@ class Index extends Controller
*/
public function clearRuntime()
{
if (!\app\admin\service\Auth::isLogin()) {
if (!AuthService::isLogin()) {
$this->error('需要登录才能操作哦!');
}
$this->list = [
@ -82,7 +82,7 @@ class Index extends Controller
*/
public function buildOptimize()
{
if (!\app\admin\service\Auth::isLogin()) {
if (!AuthService::isLogin()) {
$this->error('需要登录才能操作哦!');
}
$this->list = [
@ -141,7 +141,7 @@ class Index extends Controller
if (md5($data['oldpassword']) !== $user['password']) {
$this->error('旧密码验证失败,请重新输入!');
}
$result = \app\admin\service\Auth::checkPassword($data['password']);
$result = AuthService::checkPassword($data['password']);
if (empty($result['code'])) $this->error($result['msg']);
if (Data::save('SystemUser', ['id' => $user['id'], 'password' => md5($data['password'])])) {
$this->success('密码修改成功,下次请使用新密码登录!', '');

View File

@ -1,86 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | framework
// +----------------------------------------------------------------------
// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://framework.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | github开源项目https://github.com/zoujingli/framework
// +----------------------------------------------------------------------
namespace app\admin\controller;
use library\Controller;
use think\Db;
/**
* 系统日志管理
* Class Log
* @package app\admin\controller
*/
class Log extends Controller
{
/**
* 指定当前数据表
* @var string
*/
public $table = 'SystemLog';
/**
* 系统操作日志
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function index()
{
$this->title = '系统操作日志';
$query = $this->_query($this->table)->like('action,node,content,username,geoip');
$query->dateBetween('create_at')->order('id desc')->page();
}
/**
* 列表数据处理
* @param array $data
* @throws \Exception
*/
protected function _index_page_filter(&$data)
{
$ip = new \Ip2Region();
foreach ($data as &$vo) {
$result = $ip->btreeSearch($vo['geoip']);
$vo['isp'] = isset($result['region']) ? $result['region'] : '';
$vo['isp'] = str_replace(['内网IP', '0', '|'], '', $vo['isp']);
}
}
/**
* 清理系统日志
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function clear()
{
if (Db::name($this->table)->whereRaw('1=1')->delete() !== false) {
$this->success('日志清理成功!');
} else {
$this->error('日志清理失败,请稍候再试!');
}
}
/**
* 删除系统日志
*/
public function del()
{
$this->applyCsrfToken();
$this->_delete($this->table);
}
}

View File

@ -14,6 +14,7 @@
namespace app\admin\controller;
use app\admin\service\AuthService;
use library\Controller;
use think\Db;
@ -38,7 +39,7 @@ class Login extends Controller
*/
protected function _index_get()
{
if (\app\admin\service\Auth::isLogin()) {
if (AuthService::isLogin()) {
$this->redirect('@admin');
} else {
$this->loginskey = session('loginskey');
@ -108,7 +109,7 @@ class Login extends Controller
session('user', $user);
session('loginskey', null);
_syslog('系统管理', '用户登录系统成功');
empty($user['authorize']) || \app\admin\service\Auth::applyNode();
empty($user['authorize']) || AuthService::applyNode();
$this->success('登录成功,正在进入系统...', url('@admin'));
}

View File

@ -95,7 +95,7 @@ class Menu extends Controller
// 选择自己的上级菜单
if (!isset($vo['pid']) && $this->request->get('pid', '0')) $vo['pid'] = $this->request->get('pid', '0');
// 读取系统功能节点
$nodes = \app\admin\service\Auth::get();
$nodes = \app\admin\service\AuthService::get();
foreach ($nodes as $key => $node) {
if (empty($node['is_menu'])) unset($nodes[$key]);
unset($nodes[$key]['pnode'], $nodes[$key]['is_login'], $nodes[$key]['is_menu'], $nodes[$key]['is_auth']);
@ -125,7 +125,7 @@ class Menu extends Controller
/**
* 删除系统菜单
*/
public function del()
public function remove()
{
$this->applyCsrfToken();
$this->_delete($this->table);

View File

@ -48,19 +48,11 @@ class Message extends Controller
/**
* 设置消息状态
*/
public function state()
public function read()
{
$this->_save($this->table, ['read_state' => '1', 'read_at' => date('Y-m-d H:i:s')]);
}
/**
* 删除系统消息
*/
public function del()
{
$this->_delete($this->table);
}
/**
* 清理所有消息
* @throws \think\Exception
@ -80,7 +72,7 @@ class Message extends Controller
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function onoff()
public function state()
{
sysconf('system_message_state', sysconf('system_message_state') ? 0 : 1);
if (sysconf('system_message_state')) {
@ -90,4 +82,12 @@ class Message extends Controller
}
}
/**
* 删除系统消息
*/
public function remove()
{
$this->_delete($this->table);
}
}

View File

@ -38,7 +38,7 @@ class Node extends Controller
public function index()
{
$this->title = '系统节点管理';
list($nodes, $groups) = [\app\admin\service\Auth::get(), []];
list($nodes, $groups) = [\app\admin\service\AuthService::get(), []];
$this->nodes = Data::arr2table($nodes, 'node', 'pnode');
foreach ($this->nodes as $node) {
$pnode = explode('/', $node['node'])[0];
@ -57,7 +57,7 @@ class Node extends Controller
*/
public function clear()
{
$nodes = array_unique(array_column(\app\admin\service\Auth::get(), 'node'));
$nodes = array_unique(array_column(\app\admin\service\AuthService::get(), 'node'));
if (false !== Db::name($this->table)->whereNotIn('node', $nodes)->delete()) {
$this->success('清理无效的节点配置成功!', '');
} else {

View File

@ -42,10 +42,11 @@ class Queue extends Controller
public function index()
{
$this->title = '消息任务管理';
$this->uris = Db::name($this->table)->distinct(true)->column('uri');
$this->cmd = 'php ' . env('root_path') . 'think xtask:start';
$this->message = Console::call('xtask:state')->fetch();
$this->_query($this->table)->equal('status,title,uri')->dateBetween('create_at,status_at')->order('id desc')->page();
$this->uris = Db::name($this->table)->distinct(true)->column('uri');
$query = $this->_query($this->table)->dateBetween('create_at,status_at');
$query->equal('status,title,uri')->order('id desc')->page();
}
/**
@ -58,7 +59,7 @@ class Queue extends Controller
$info = Db::name($this->table)->where($where)->find();
if (empty($info)) $this->error('需要重置的任务获取异常!');
$data = isset($info['data']) ? json_decode($info['data'], true) : '[]';
\app\admin\service\Queue::add($info['title'], $info['uri'], $info['later'], $data, $info['double'], $info['desc']);
\app\admin\service\QueueService::add($info['title'], $info['uri'], $info['later'], $data, $info['double'], $info['desc']);
$this->success('任务重置成功!', url('@admin') . '#' . url('@admin/queue/index'));
} catch (\think\exception\HttpResponseException $exception) {
throw $exception;
@ -70,12 +71,12 @@ class Queue extends Controller
/**
* 删除消息任务
*/
public function del()
public function remove()
{
try {
$isNot = false;
foreach (explode(',', $this->request->post('id', '0')) as $id) {
if (!\app\admin\service\Queue::del($id)) $isNot = true;
if (!\app\admin\service\QueueService::del($id)) $isNot = true;
}
if (empty($isNot)) $this->_delete($this->table);
$this->success($isNot ? '部分任务删除成功!' : '任务删除成功!');

View File

@ -96,7 +96,7 @@ class User extends Controller
if ($post['password'] !== $post['repassword']) {
$this->error('两次输入的密码不一致!');
}
$result = \app\admin\service\Auth::checkPassword($post['password']);
$result = \app\admin\service\AuthService::checkPassword($post['password']);
if (empty($result['code'])) $this->error($result['msg']);
$data = ['id' => $post['id'], 'password' => md5($post['password'])];
if (Data::save($this->table, $data, 'id')) {
@ -152,7 +152,7 @@ class User extends Controller
/**
* 删除系统用户
*/
public function del()
public function remove()
{
if (in_array('10000', explode(',', $this->request->post('id')))) {
$this->error('系统超级账号禁止删除!');

View File

@ -29,7 +29,7 @@ class Message extends Controller
public function __construct()
{
parent::__construct();
if (!\app\admin\service\Auth::isLogin()) {
if (!\app\admin\service\AuthService::isLogin()) {
$this->error('访问授权失败,请重新登录授权再试!');
}
}
@ -42,7 +42,7 @@ class Message extends Controller
*/
public function gets()
{
$list = \app\admin\service\Message::gets();
$list = \app\admin\service\MessageService::gets();
$this->success('获取系统消息成功!', $list);
}
@ -54,7 +54,7 @@ class Message extends Controller
public function set()
{
$code = $this->request->post('code');
if (\app\admin\service\Message::set($code)) {
if (\app\admin\service\MessageService::set($code)) {
$this->success('系统消息状态更新成功!');
} else {
$this->error('系统消息状态更新失败,请稍候再试!');

View File

@ -32,7 +32,7 @@ class Plugs extends Controller
public function __construct()
{
parent::__construct();
if (!\app\admin\service\Auth::isLogin()) {
if (!\app\admin\service\AuthService::isLogin()) {
$this->error('访问授权失败,请重新登录授权再试!');
}
}

View File

@ -1,122 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | framework
// +----------------------------------------------------------------------
// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://framework.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | github开源项目https://github.com/zoujingli/framework
// +----------------------------------------------------------------------
namespace app\admin\queue;
use app\admin\service\Queue;
/**
* 基础指令公共类
* Class QueueBase
* @package app\admin
*/
class JobsBase
{
/**
* 待处理
*/
const STATUS_PEND = 1;
/**
* 处理中
*/
const STATUS_PROC = 2;
/**
* 处理完成
*/
const STATUS_COMP = 3;
/**
* 处理失败
*/
const STATUS_FAIL = 4;
/**
* 任务ID
* @var integer
*/
protected $id;
/**
* 任务数据
* @var array
*/
protected $data;
/**
* 任务名称
* @var string
*/
protected $title;
/**
* 任务状态
* @var integer
*/
protected $status;
/**
* @var \think\console\Output
*/
protected $output;
/**
* 任务状态描述
* @var string
*/
protected $statusDesc = '';
/**
* 启动任务处理
* @param \think\queue\Job $job 当前任务对象
* @param array $data 任务执行对象
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function fire(\think\queue\Job $job, $data = [])
{
$this->data = $data;
$this->output = new \think\console\Output();
$this->id = isset($data['_job_id_']) ? $data['_job_id_'] : '';
$this->title = isset($data['_job_title_']) ? $data['_job_title_'] : '';
$this->output->newLine();
$this->output->writeln(" system task {$this->id} execution start");
$this->output->writeln('---------------------------------------------');
Queue::status($this->id, self::STATUS_PROC, $this->statusDesc);
if ($this->execute()) {
$this->output->writeln('---------------------------------------------');
$this->output->info(" successful");
$this->status = self::STATUS_COMP;
} else {
$this->output->writeln('---------------------------------------------');
$this->output->error(" failure");
$this->status = self::STATUS_FAIL;
}
$job->delete();
Queue::status($this->id, $this->status, $this->statusDesc);
$this->output->writeln('---------------------------------------------');
$this->output->newLine();
}
/**
* 执行任务
* @return boolean
*/
protected function execute()
{
return true;
}
}

View File

@ -1,176 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | framework
// +----------------------------------------------------------------------
// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://framework.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | github开源项目https://github.com/zoujingli/framework
// +----------------------------------------------------------------------
namespace app\admin\service;
use library\tools\Data;
use library\tools\Node;
use think\Db;
/**
* 权限访问及菜单管理
* Class Auth
* @package app\admin\service
*/
class Auth
{
/**
* 权限节点忽略规则
* @return array
*/
public static function getIgnore()
{
return ['index', 'admin/login', 'admin/index'];
}
/**
* 获取系统代码节点
* @param array $nodes
* @return array
* @throws \ReflectionException
*/
public static function get($nodes = [])
{
list($ignore, $map) = [self::getIgnore(), Node::getClassTreeNode(env('app_path'))];
$alias = Db::name('SystemNode')->column('node,is_menu,is_auth,is_login,title');
foreach (Node::getMethodTreeNode(env('app_path')) as $thr => $title) {
foreach ($ignore as $str) if (stripos($thr, $str) === 0) continue 2;
$tmp = explode('/', $thr);
list($one, $two) = ["{$tmp[0]}", "{$tmp[0]}/{$tmp[1]}"];
$nodes[$one] = array_merge(isset($alias[$one]) ? $alias[$one] : ['node' => $one, 'title' => '', 'is_menu' => 0, 'is_auth' => 0, 'is_login' => 0], ['pnode' => '']);
$nodes[$two] = array_merge(isset($alias[$two]) ? $alias[$two] : ['node' => $two, 'title' => isset($map[$two]) ? $map[$two] : '', 'is_menu' => 0, 'is_auth' => 0, 'is_login' => 0], ['pnode' => $one]);
$nodes[$thr] = array_merge(isset($alias[$thr]) ? $alias[$thr] : ['node' => $thr, 'title' => $title, 'is_menu' => 0, 'is_auth' => 0, 'is_login' => 0], ['pnode' => $two]);
}
foreach ($nodes as &$node) list($node['is_auth'], $node['is_menu'], $node['is_login']) = [intval($node['is_auth']), intval($node['is_menu']), empty($node['is_auth']) ? intval($node['is_login']) : 1];
return $nodes;
}
/**
* 检查用户节点权限
* @param string $node 节点
* @return boolean
*/
public static function checkAuthNode($node)
{
list($module, $controller, $action) = explode('/', str_replace(['?', '=', '&'], '/', "{$node}///"));
$current = Node::parseString("{$module}/{$controller}") . strtolower("/{$action}");
// 后台入口无需要验证权限
if (stripos($node, 'admin/index') === 0) return true;
// 超级管理员无需要验证权限
if (session('user.username') === 'admin') return true;
// 未配置权限的节点默认放行
if (!in_array($current, self::getAuthNode())) return true;
// 用户指定角色授权放行
return in_array($current, (array)session('user.nodes'));
}
/**
* 获取授权节点
* @return array
*/
public static function getAuthNode()
{
$nodes = cache('need_access_node');
if (empty($nodes)) {
$nodes = Db::name('SystemNode')->where(['is_auth' => '1'])->column('node');
cache('need_access_node', $nodes);
}
return $nodes;
}
/**
* 应用用户权限节点
* @return boolean
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public static function applyNode()
{
cache('need_access_node', null);
if (($uid = session('user.id'))) session('user', Db::name('SystemUser')->where('id', $uid)->find());
if (session('user.authorize') && ($ids = explode(',', session('user.authorize')))) {
$auths = Db::name('SystemAuth')->whereIn('id', $ids)->where('status', '1')->column('id');
if (empty($auths)) return session('user.nodes', []);
return session('user.nodes', Db::name('SystemAuthNode')->whereIn('auth', $auths)->column('node'));
}
return false;
}
/**
* 判断用户登录状态
* @return boolean
*/
public static function isLogin()
{
return !!session('user');
}
/**
* 获取授权后的菜单
* @return array
* @throws \ReflectionException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public static function getAuthMenu()
{
self::applyNode();
$list = Db::name('SystemMenu')->where('status', '1')->order('sort asc,id asc')->select();
return self::buildMenuData(Data::arr2tree($list), self::get(), self::isLogin());
}
/**
* 后台主菜单权限过滤
* @param array $menus 当前菜单列表
* @param array $nodes 系统权限节点数据
* @param bool $isLogin 是否已经登录
* @return array
*/
private static function buildMenuData($menus, $nodes, $isLogin)
{
foreach ($menus as $key => &$menu) {
if (!empty($menu['sub'])) $menu['sub'] = self::buildMenuData($menu['sub'], $nodes, $isLogin);
if (!empty($menu['sub'])) $menu['url'] = '#';
elseif (preg_match('/^https?\:/i', $menu['url'])) continue;
elseif ($menu['url'] !== '#') {
$node = join('/', array_slice(explode('/', preg_replace('/[\W]/', '/', $menu['url'])), 0, 3));
$menu['url'] = url($menu['url']) . (empty($menu['params']) ? '' : "?{$menu['params']}");
if (isset($nodes[$node]) && $nodes[$node]['is_login'] && empty($isLogin)) unset($menus[$key]);
elseif (isset($nodes[$node]) && $nodes[$node]['is_auth'] && $isLogin && !self::checkAuthNode($node)) unset($menus[$key]);
} else unset($menus[$key]);
}
return $menus;
}
/**
* 检查密码是否合法
* @param string $password
* @return array
*/
public static function checkPassword($password)
{
$password = trim($password);
if (!strlen($password) >= 6) {
return ['code' => 0, 'msg' => '密码必须大于6字符'];
}
if (!preg_match("/^(?![\d]+$)(?![a-zA-Z]+$)(?![^\da-zA-Z]+$).{6,32}$/", $password)) {
return ['code' => 0, 'msg' => '密码必需包含大小写字母、数字、符号任意两者组合!'];
}
return ['code' => 1, 'msg' => '密码复杂度通过验证!'];
}
}

View File

@ -1,55 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | framework
// +----------------------------------------------------------------------
// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://framework.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | github开源项目https://github.com/zoujingli/framework
// +----------------------------------------------------------------------
namespace app\admin\service;
use library\tools\Node;
use think\Db;
/**
* 系统日志服务管理
* Class Log
* @package app\admin\service
*/
class Log
{
/**
* 写入操作日志
* @param string $action
* @param string $content
* @return bool
*/
public static function write($action = '行为', $content = "内容描述")
{
$data = [
'node' => Node::current(),
'geoip' => PHP_SAPI === 'cli' ? '127.0.0.1' : request()->ip(),
'action' => $action,
'content' => $content,
'username' => PHP_SAPI === 'cli' ? 'cli' : (string)session('user.username'),
];
return Db::name('SystemLog')->insert($data) !== false;
}
/**
* 清理系统日志数据
* @return boolean
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public static function clear()
{
return Db::name('SystemLog')->where('1=1')->delete() !== false;
}
}

View File

@ -1,72 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | framework
// +----------------------------------------------------------------------
// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://framework.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | github开源项目https://github.com/zoujingli/framework
// +----------------------------------------------------------------------
namespace app\admin\service;
use library\tools\Data;
use think\Db;
/**
* 系统消息管理
* Class Message
* @package app\admin\service
*/
class Message
{
/**
* 增加系统消息
* @param string $title 消息标题
* @param string $desc 消息描述
* @param string $url 访问链接
* @param string $node 权限节点
* @return boolean
*/
public static function add($title, $desc, $url, $node)
{
$code = Data::uniqidNumberCode(12);
$data = ['title' => $title, 'desc' => $desc, 'url' => $url, 'code' => $code, 'node' => $node];
return Db::name('SystemMessage')->insert($data) !== false;
}
/**
* 系统消息状态更新
* @param integer $code
* @return boolean
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public static function set($code)
{
$result = Db::name('SystemMessage')->where(['code' => $code, 'read_state' => '0'])->update([
'read_state' => '1', 'read_at' => date('Y-m-d H:i:s'), 'read_uid' => session('user.id'),
]);
return $result !== false;
}
/**
* 获取消息列表成功
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public static function gets()
{
$where = ['read_state' => '0'];
$list = Db::name('SystemMessage')->where($where)->order('id desc')->select();
foreach ($list as $key => $vo) if (!empty($vo['node']) && !auth($vo['node'])) unset($list[$key]);
return $list;
}
}

View File

@ -1,128 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | framework
// +----------------------------------------------------------------------
// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://framework.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | github开源项目https://github.com/zoujingli/framework
// +----------------------------------------------------------------------
namespace app\admin\service;
use think\Db;
/**
* 任务管理器
* Class Queue
* @package app\admin\service
*/
class Queue
{
/**
* 待处理
*/
const STATUS_PEND = 1;
/**
* 处理中
*/
const STATUS_PROC = 2;
/**
* 处理完成
*/
const STATUS_COMP = 3;
/**
* 处理失败
*/
const STATUS_FAIL = 4;
/**
* 创建任务并记录日志
* @param string $title 任务名称
* @param string $uri 任务命令
* @param integer $later 延时时间
* @param array $data 任务附加数据
* @param integer $double 任务多开
* @param string $desc 任务描述
* @throws \think\Exception
*/
public static function add($title, $uri, $later, array $data, $double = 1, $desc = '')
{
if (empty($double) && self::exists($title)) {
throw new \think\Exception('该任务已经创建,请耐心等待处理完成!');
}
$jobId = Db::name('SystemJobsLog')->insertGetId([
'title' => $title, 'later' => $later, 'uri' => $uri, 'double' => intval($double),
'data' => json_encode($data, 256), 'desc' => $desc, 'status_at' => date('Y-m-d H:i:s'),
]);
$data['_job_id_'] = $jobId;
$data['_job_title_'] = $title;
\think\Queue::later($later, $uri, $data);
}
/**
* 更新任务状态
* @param integer $jobId
* @param integer $status
* @param string $statusDesc
* @return boolean
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public static function status($jobId, $status = self::STATUS_PEND, $statusDesc = '')
{
$result = Db::name('SystemJobsLog')->where(['id' => $jobId])->update([
'status' => $status, 'status_desc' => $statusDesc, 'status_at' => date('Y-m-d H:i:s'),
]);
return $result !== false;
}
/**
* 检查任务是否存在
* @param string $title
* @return boolean
*/
public static function exists($title)
{
$where = [['title', 'eq', $title], ['status', 'in', [1, 2]]];
return Db::name('SystemJobsLog')->where($where)->count() > 0;
}
/**
* 获取任务数据
* @param integer $jobId
* @return array|null
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public static function get($jobId)
{
return Db::name('SystemJobsLog')->where(['id' => $jobId])->find();
}
/**
* 删除任务数据
* @param integer $jobId
* @return boolean
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public static function del($jobId)
{
$where = [['id', 'eq', $jobId], ['status', 'in', [1, 3, 4]]];
if (Db::name('SystemJobsLog')->where($where)->delete() > 0) {
Db::name('SystemJobs')->whereLike('payload', '%"_job_id_":"' . $jobId . '"%')->delete();
return true;
}
return false;
}
}

View File

@ -20,10 +20,8 @@ if (!function_exists('auth')) {
*/
function auth($node)
{
list($req, $num) = [request(), count(explode('/', $node))];
if ($num === 1) $node = "{$req->module()}/{$req->controller()}/{$node}";
if ($num === 2) $node = "{$req->module()}/{$node}";
return \app\admin\service\Auth::checkAuthNode($node);
$real = \library\tools\Node::get($node);
return \app\admin\service\AuthService::checkAuthNode($real);
}
}
@ -39,11 +37,12 @@ if (!function_exists('sysdata')) {
function sysdata($name, array $value = null)
{
if (is_null($value)) {
$data = json_decode(\think\Db::name('SystemData')->where('name', $name)->value('value'), true);
$data = json_decode(\think\Db::name('SystemData')->where(['name' => $name])->value('value'), true);
return empty($data) ? [] : $data;
}
} else {
return data_save('SystemData', ['name' => $name, 'value' => json_encode($value, JSON_UNESCAPED_UNICODE)], 'name');
}
}
}
if (!function_exists('_sysmsg')) {
@ -57,7 +56,7 @@ if (!function_exists('_sysmsg')) {
*/
function _sysmsg($title, $desc, $url, $node)
{
return \app\admin\service\Message::add($title, $desc, $url, $node);
return \app\admin\service\MessageService::add($title, $desc, $url, $node);
}
}
@ -70,7 +69,7 @@ if (!function_exists('_syslog')) {
*/
function _syslog($action, $content)
{
return \app\admin\service\Log::write($action, $content);
return \app\admin\service\OplogService::write($action, $content);
}
}
@ -83,9 +82,12 @@ if (!function_exists('local_image')) {
function local_image($url)
{
$result = \library\File::down($url);
if (isset($result['url'])) return $result['url'];
if (isset($result['url'])) {
return $result['url'];
} else {
return $url;
}
}
}
if (!function_exists('base64_image')) {
@ -102,8 +104,9 @@ if (!function_exists('base64_image')) {
list($ext, $base) = explode('|||', preg_replace('|^data:image/(.*?);base64,|i', '$1|||', $content));
$info = \library\File::save($predir . md5($base) . '.' . (empty($ext) ? 'tmp' : $ext), base64_decode($base));
return $info['url'];
}
} else {
return $content;
}
} catch (\Exception $e) {
return $content;
}
@ -113,21 +116,22 @@ if (!function_exists('base64_image')) {
// 系统权限检查中间键
\think\facade\Middleware::add(function (\think\Request $request, \Closure $next) {
// 系统消息处理
if (($code = $request->get('messagecode')) > 0) \app\admin\service\Message::set($code);
if (($code = $request->get('messagecode')) > 0) \app\admin\service\MessageService::set($code);
// 节点忽略跳过
$node = \library\tools\Node::current();
foreach (\app\admin\service\Auth::getIgnore() as $str) if (stripos($node, $str) === 0) return $next($request);
foreach (\app\admin\service\AuthService::getIgnore() as $str) if (stripos($node, $str) === 0) return $next($request);
// 节点权限查询
$auth = \think\Db::name('SystemNode')->cache(true, 60)->field('is_auth,is_login')->where(['node' => $node])->find();
$info = ['is_auth' => $auth['is_auth'], 'is_login' => $auth['is_auth'] ? 1 : $auth['is_login']];
// 登录状态检查
if (!empty($info['is_login']) && !\app\admin\service\Auth::isLogin()) {
if (!empty($info['is_login']) && !\app\admin\service\AuthService::isLogin()) {
$message = ['code' => 0, 'msg' => '抱歉,您还没有登录获取访问权限!', 'url' => url('@admin/login')];
return $request->isAjax() ? json($message) : redirect($message['url']);
}
// 访问权限检查
if (!empty($info['is_auth']) && !\app\admin\service\Auth::checkAuthNode($node)) {
if (!empty($info['is_auth']) && !\app\admin\service\AuthService::checkAuthNode($node)) {
return json(['code' => 0, 'msg' => '抱歉,您没有访问该模块的权限!']);
}
} else {
return $next($request);
}
});

View File

@ -5,8 +5,8 @@
<button data-modal='{:url("add")}' data-title="添加权限" class='layui-btn layui-btn-sm layui-btn-primary'>添加权限</button>
<!--{/if}-->
<!--{if auth("admin/auth/del")}-->
<button data-action='{:url("del")}' data-rule="id#{key}" data-csrf="{:systoken('admin/auth/del')}" data-confirm="确定要删除这些权限吗?" class='layui-btn layui-btn-sm layui-btn-primary'>删除权限</button>
<!--{if auth("admin/auth/remove")}-->
<button data-action='{:url("remove")}' data-rule="id#{key}" data-csrf="{:systoken('admin/auth/remove')}" data-confirm="确定要删除这些权限吗?" class='layui-btn layui-btn-sm layui-btn-primary'>删除权限</button>
<!--{/if}-->
{/block}
@ -16,7 +16,7 @@
<table class="layui-table" lay-skin="line">
<caption class="margin-bottom-10 text-left">{include file='auth/index_search'}</caption>
<!--{notempty name='list'}-->
{notempty name='list'}
<thead>
<tr>
<th class='list-table-check-td think-checkbox'>
@ -28,9 +28,9 @@
<th></th>
</tr>
</thead>
<!--{/notempty}-->
{/notempty}
<tbody>
<!--{foreach $list as $key=>$vo}-->
{foreach $list as $key=>$vo}
<tr data-dbclick>
<td class='list-table-check-td think-checkbox'><input class="list-check-box" value='{$vo.id}' type='checkbox'></td>
<td class='text-left'>
@ -60,13 +60,13 @@
<a class="layui-btn layui-btn-warm layui-btn-sm" data-action="{:url('resume')}" data-value="id#{$vo.id};status#1" data-csrf="{:systoken('admin/auth/resume')}">启 用</a>
{/if}
{if auth("admin/auth/del")}
<a class="layui-btn layui-btn-danger layui-btn-sm" data-confirm="确定要删除数据吗?" data-action="{:url('del')}" data-value="id#{$vo.id}" data-csrf="{:systoken('admin/auth/del')}">删 除</a>
{if auth("admin/auth/remove")}
<a class="layui-btn layui-btn-danger layui-btn-sm" data-confirm="确定要删除数据吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}" data-csrf="{:systoken('admin/auth/remove')}">删 除</a>
{/if}
</td>
</tr>
<!--{/foreach}-->
{/foreach}
</tbody>
</table>

View File

@ -4,11 +4,11 @@
<div style="max-width:1000px">
<form class="layui-card layui-form">
<div class="layui-card-body padding-bottom-5 think-box-shadow">
<div class="layui-form-item">
<div class="layui-card-body think-box-shadow">
<div class="layui-form-item margin-bottom-0">
<label class="layui-form-label">Storage<br><span class="nowrap color-desc">存储类型</span></label>
<div class="layui-input-block">
{foreach ['local'=>'本地服务器存储','oss'=>'阿里云OSS存储','qiniu'=>'七牛云存储'] as $k=>$v}
{foreach ['local'=>'本地服务器存储','qiniu'=>'七牛云对象存储','oss'=>'阿里云OSS存储'] as $k=>$v}
<input type="radio" data-storagetype="{$k}" name="storage_type" value="{$k}" title="{$v}" lay-filter="storage_type">
{/foreach}
<p class="help-block">请选择文件存储类型,其它云储存需要配置正确的参数才可以上传文件哦!</p>
@ -17,9 +17,9 @@
</div>
</form>
<div class="padding-top-15 padding-bottom-10 think-box-shadow">
<div data-type="oss">{include file='config/file_oss'}</div>
<div data-type="local">{include file='config/file_local'}</div>
<div data-type="qiniu">{include file='config/file_qiniu'}</div>
<div class="layui-anim layui-anim-upbit" data-type="oss">{include file='config/file_oss'}</div>
<div class="layui-anim layui-anim-upbit" data-type="local">{include file='config/file_local'}</div>
<div class="layui-anim layui-anim-upbit" data-type="qiniu">{include file='config/file_qiniu'}</div>
</div>
</div>
@ -30,14 +30,13 @@
$(function () {
apply('{:sysconf("storage_type")}');
window.form.render();
window.form.on('radio(storage_type)', function (data) {
apply(data.value);
});
function apply(value) {
var $active = $("[data-storagetype='" + value + "']").trigger('click');
if ($active.size() < 1) $("[data-storagetype]:first").trigger('click');
this.$active = $("[data-storagetype='" + value + "']").trigger('click');
if (this.$active.size() < 1) $("[data-storagetype]:first").trigger('click');
$('[data-type="' + value + '"]').show().siblings('[data-type]').hide();
}
});

View File

@ -3,26 +3,26 @@
{block name="content"}
<form onsubmit="return false;" data-auto="true" method="post" class='layui-form layui-card' autocomplete="off" style="max-width:1000px">
<div class="layui-card-body padding-bottom-10 think-box-shadow" style="padding-right:80px!important">
<div class="layui-card-body padding-bottom-10 think-box-shadow" style="padding-right:60px!important">
<div class="layui-form-item margin-top-20">
<label class="layui-form-label">Name<br><span class="nowrap color-desc">程序名称</span></label>
<div class="layui-input-block">
<input name="app_name" required placeholder="请输入程序名称" value="{:sysconf('app_name')}" class="layui-input">
<p class="help-block">当前程序名称,在后台主标题上显示</p>
<p class="help-block">当前程序名称,在后台主标题上显示 {:sysconf('app_name')}</p>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">Version<br><span class="nowrap color-desc">程序版本</span></label>
<div class="layui-input-block">
<input name="app_version" placeholder="请输入程序版本" value="{:sysconf('app_version')}" class="layui-input">
<p class="help-block">当前程序版本号,在后台主标题上标显示</p>
<p class="help-block">当前程序版本号,在后台主标题上标显示版本 {:sysconf('app_version')}</p>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">Website<br><span class="nowrap color-desc">网站名称</span></label>
<div class="layui-input-block">
<input name="site_name" required placeholder="请输入网站名称" value="{:sysconf('site_name')}" class="layui-input">
<p class="help-block">网站名称,显示在浏览器标签上</p>
<p class="help-block">网站名称,将在浏览器的标签上显示 {:sysconf('site_name')}</p>
</div>
</div>
<div class="layui-form-item">
@ -38,14 +38,14 @@
<label class="layui-form-label">Copyright<br><span class="nowrap color-desc">版权信息</span></label>
<div class="layui-input-block">
<input name="site_copy" required placeholder="请输入版权信息" value="{:sysconf('site_copy')}" class="layui-input">
<p class="help-block">程序的版权信息设置,在后台登录页面显示</p>
<p class="help-block">程序的版权信息设置,在后台登录页面显示版本信息</p>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">Miitbeian<br><span class="nowrap color-desc">网站备案</span></label>
<label class="layui-form-label">Miitbeian<br><span class="nowrap color-desc">网站备案</span></label>
<div class="layui-input-block">
<input name="miitbeian" placeholder="请输入网站备案号" value="{:sysconf('miitbeian')}" class="layui-input">
<p class="help-block">网站备案号,可以在<a target="_blank" href="http://www.miitbeian.gov.cn">备案管理中心</a>查询获取</p>
<p class="help-block">网站备案号,可以在<a target="_blank" href="http://www.miitbeian.gov.cn">备案管理中心</a>查询获取,将在登录页面下面显示</p>
</div>
</div>
<div class="hr-line-dashed margin-left-40"></div>

View File

@ -1,11 +1,120 @@
{extend name='main'}
{block name='content'}
<div class="layui-row layui-col-space10">
<style>
.store-total-container {
font-size: 14px;
margin-bottom: 20px;
letter-spacing: 1px;
}
.store-total-container .store-total-icon {
top: 45%;
right: 8%;
font-size: 65px;
position: absolute;
color: rgba(255, 255, 255, 0.4);
}
.store-total-container .store-total-item {
color: #fff;
line-height: 4em;
padding: 15px 25px;
position: relative;
}
.store-total-container .store-total-item > div:nth-child(2) {
font-size: 46px;
line-height: 46px;
}
</style>
<div class="think-box-shadow store-total-container notselect">
<div class="margin-bottom-15">商城统计</div>
<div class="layui-row layui-col-space15">
<div class="layui-col-sm6 layui-col-md3">
<div class="store-total-item nowrap" style="background:linear-gradient(-125deg,#57bdbf,#2f9de2)">
<div>商品总量</div>
<div>63</div>
<div>当前商品总数量</div>
</div>
<i class="store-total-icon layui-icon layui-icon-template-1"></i>
</div>
<div class="layui-col-sm6 layui-col-md3">
<div class="store-total-item nowrap" style="background:linear-gradient(-125deg,#ff7d7d,#fb2c95)">
<div>用户总量</div>
<div>1,634</div>
<div>当前用户总数量</div>
</div>
<i class="store-total-icon layui-icon layui-icon-user"></i>
</div>
<div class="layui-col-sm6 layui-col-md3">
<div class="store-total-item nowrap" style="background:linear-gradient(-113deg,#c543d8,#925cc3)">
<div>订单总量</div>
<div>148</div>
<div>已付款订单总数量</div>
</div>
<i class="store-total-icon layui-icon layui-icon-read"></i>
</div>
<div class="layui-col-sm6 layui-col-md3">
<div class="store-total-item nowrap" style="background:linear-gradient(-141deg,#ecca1b,#f39526)">
<div>评价总量</div>
<div>0</div>
<div>订单评价总数量</div>
</div>
<i class="store-total-icon layui-icon layui-icon-survey"></i>
</div>
</div>
</div>
<div class="think-box-shadow store-total-container">
<div class="margin-bottom-15">实时概况</div>
<div class="layui-row layui-col-space15">
<div class="layui-col-md6 margin-bottom-15">
<div class="layui-row">
<div class="layui-col-xs3 text-center">
<i class="layui-icon color-blue" style="font-size:60px;line-height:72px">&#xe65e;</i>
</div>
<div class="layui-col-xs4">
<div class="font-s14">销售额(元)</div>
<div class="font-s16">1351.00</div>
<div class="font-s12 color-desc">昨日974.00</div>
</div>
<div class="layui-col-xs5">
<div class="font-s14">支付订单数</div>
<div class="font-s16">106</div>
<div class="font-s12 color-desc">昨日76</div>
</div>
</div>
</div>
<div class="layui-col-md6 margin-bottom-15">
<div class="layui-row">
<div class="layui-col-xs3 text-center">
<i class="layui-icon color-blue" style="font-size:60px;line-height:72px">&#xe663;</i>
</div>
<div class="layui-col-xs4">
<div class="font-s14">新增用户数</div>
<div class="font-s16">327</div>
<div class="font-s12 color-desc">昨日238</div>
</div>
<div class="layui-col-xs5">
<div class="font-s14">下单用户数</div>
<div class="font-s16">69</div>
<div class="font-s12 color-desc">昨日34</div>
</div>
</div>
</div>
</div>
</div>
<div class="layui-row layui-col-space15">
<div class="layui-col-md6">
<fieldset class="think-box-shadow">
<legend class="layui-bg-cyan">系统信息</legend>
<div class="think-box-shadow">
<table class="layui-table" lay-skin="line" lay-even>
<caption class="text-left margin-bottom-15 font-s14">系统信息</caption>
<colgroup>
<col width="30%">
</colgroup>
@ -44,12 +153,12 @@
</tr>
</tbody>
</table>
</fieldset>
</div>
</div>
<div class="layui-col-md6">
<fieldset class="think-box-shadow">
<legend class="layui-bg-cyan">产品团队</legend>
<div class="think-box-shadow">
<table class="layui-table" lay-skin="line" lay-even>
<caption class="text-left margin-bottom-15 font-s14">产品团队</caption>
<colgroup>
<col width="30%">
</colgroup>
@ -92,7 +201,7 @@
</tr>
</tbody>
</table>
</fieldset>
</div>
</div>
</div>
{/block}

View File

@ -1,68 +0,0 @@
{extend name='main'}
{block name="button"}
{if auth("admin/log/clear")}
<button data-load='{:url("clear")}' data-confirm="确定要消除所有日志吗?" class='layui-btn layui-btn-sm layui-btn-primary'>清理日志</button>
{/if}
{if auth("admin/log/del")}
<button data-action='{:url("del")}' data-rule="id#{key}" data-csrf="{:systoken('admin/log/del')}" data-confirm="确定要删除日志吗?" class='layui-btn layui-btn-sm layui-btn-primary'>删除日志</button>
{/if}
{/block}
{block name="content"}
<div class="think-box-shadow">
<table class="layui-table" lay-skin="line">
<caption class="margin-bottom-10 text-left">{include file='log/index_search'}</caption>
{notempty name='list'}
<thead>
<tr>
<th class='list-table-check-td think-checkbox'>
<input data-auto-none data-check-target='.list-check-box' type='checkbox'>
</th>
<th class='text-left nowrap' width="20%">操作</th>
<th class='text-left nowrap' width="20%">权限</th>
<th class='text-left nowrap' width="20%">位置</th>
<th class='text-left nowrap' width="20%">操作时间</th>
<th></th>
</tr>
</thead>
<tbody>
<!--{foreach $list as $key=>$vo}-->
<tr data-dbclick>
<td class='list-table-check-td think-checkbox'>
<input class="list-check-box" value='{$vo.id}' type='checkbox'>
</td>
<td class='text-left nowrap'>
行为:<strong>{$vo.action|default='--'}</strong><br>
描述:{$vo.content|default='--'}
</td>
<td class='text-left nowrap'>
账号:{$vo.username|default='--'}<br>
节点:{$vo.node|default='--'}
</td>
<td class='text-left nowrap'>
地址:{$vo.geoip|default='--'}<br>
位置:{$vo.isp|default='--'}
</td>
<td class='text-left nowrap'>
日期:{$vo.create_at|format_datetime|str_replace=' ','<br>时间:',###|raw}
</td>
<td class='text-left nowrap'>
{if auth("admin/log/del")}
<a data-dbclick class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除该日志吗?" data-action="{:url('del')}" data-value="id#{$vo.id}" data-csrf="{:systoken('admin/log/del')}">删 除</a>
{/if}
</td>
</tr>
<!--{/foreach}-->
</tbody>
{/notempty}
</table>
{empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
</div>
{/block}

View File

@ -1,56 +0,0 @@
<fieldset>
<legend class="layui-bg-cyan">条件搜索</legend>
<form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
<div class="layui-form-item layui-inline">
<label class="layui-form-label">操作账号</label>
<div class="layui-input-inline">
<input name="username" value="{$Think.get.username|default=''}" placeholder="请输入操作账号" class="layui-input">
</div>
</div>
<div class="layui-form-item layui-inline">
<label class="layui-form-label">操作节点</label>
<div class="layui-input-inline">
<input name="node" value="{$Think.get.node|default=''}" placeholder="请输入操作节点" class="layui-input">
</div>
</div>
<div class="layui-form-item layui-inline">
<label class="layui-form-label">操作行为</label>
<div class="layui-input-inline">
<input name="action" value="{$Think.get.action|default=''}" placeholder="请输入操作行为" class="layui-input">
</div>
</div>
<div class="layui-form-item layui-inline">
<label class="layui-form-label">操作描述</label>
<div class="layui-input-inline">
<input name="content" value="{$Think.get.content|default=''}" placeholder="请输入操作内容" class="layui-input">
</div>
</div>
<div class="layui-form-item layui-inline">
<label class="layui-form-label">位置地址</label>
<div class="layui-input-inline">
<input name="geoip" value="{$Think.get.geoip|default=''}" placeholder="请输入位置地址" class="layui-input">
</div>
</div>
<div class="layui-form-item layui-inline">
<label class="layui-form-label">操作时间</label>
<div class="layui-input-inline">
<input data-date-range name="create_at" value="{$Think.get.create_at|default=''}" placeholder="请选择操作时间" class="layui-input">
</div>
</div>
<div class="layui-form-item layui-inline">
<button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
</div>
</form>
</fieldset>
<script>form.render()</script>

View File

@ -6,17 +6,17 @@
<button data-modal='{:url("add")}' data-title="添加菜单" class='layui-btn layui-btn-sm layui-btn-primary'>添加菜单</button>
<!--{/if}-->
<!--{if auth("admin/menu/del")}-->
<button data-action='{:url("del")}' data-csrf="{:systoken('admin/menu/del')}" data-rule="id#{key}" class='layui-btn layui-btn-sm layui-btn-primary'>删除菜单</button>
<!--{if auth("admin/menu/remove")}-->
<button data-action='{:url("remove")}' data-csrf="{:systoken('admin/menu/remove')}" data-rule="id#{key}" class='layui-btn layui-btn-sm layui-btn-primary'>删除菜单</button>
<!--{/if}-->
{/block}
{block name="content"}
<div style="background:#fff">
<!--{empty name='list'}-->
{empty name='list'}
<blockquote class="layui-elem-quote">没 有 记 录 哦!</blockquote>
<!--{else}-->
{else}
<table class="layui-table" lay-skin="line">
<thead>
<tr>
@ -33,7 +33,7 @@
</tr>
</thead>
<tbody>
<!--{foreach $list as $key=>$vo}-->
{foreach $list as $key=>$vo}
<tr data-dbclick>
<td class='list-table-check-td think-checkbox'>
<input class="list-check-box" value='{$vo.ids}' type='checkbox'>
@ -66,15 +66,15 @@
<a class="layui-btn layui-btn-warm layui-btn-xs" data-action="{:url('resume')}" data-value="id#{$vo.ids};status#1" data-csrf="{:systoken('admin/menu/resume')}">启 用</a>
{/if}
{if auth("admin/menu/del")}
<a class="layui-btn layui-btn-danger layui-btn-xs" data-confirm="确定要删除数据吗?" data-action="{:url('del')}" data-value="id#{$vo.ids}" data-csrf="{:systoken('admin/menu/del')}">删 除</a>
{if auth("admin/menu/remove")}
<a class="layui-btn layui-btn-danger layui-btn-xs" data-confirm="确定要删除数据吗?" data-action="{:url('remove')}" data-value="id#{$vo.ids}" data-csrf="{:systoken('admin/menu/remove')}">删 除</a>
{/if}
</td>
</tr>
<!--{/foreach}-->
{/foreach}
</tbody>
</table>
<!--{/empty}-->
{/empty}
</div>
{/block}

View File

@ -2,7 +2,7 @@
{block name="button"}
{if auth("admin/message/onoff")}
{if auth("admin/message/state")}
<form class="layui-form inline-block StatusSwitch" action="">
{if sysconf('system_message_state')}
<input type="checkbox" checked lay-skin="switch" lay-filter="StatusSwitch" lay-text="开 启|关 闭">
@ -11,7 +11,7 @@
{/if}
<script>
form.on('switch(StatusSwitch)', function () {
$.form.load('{:url("onoff")}', {}, 'get', function () {
$.form.load('{:url("state")}', {}, 'get', function () {
return false;
});
});
@ -35,8 +35,8 @@
<button data-load='{:url("clear")}' data-confirm="确定要清理所有消息记录吗?" class='layui-btn layui-btn-sm layui-btn-primary'>清理消息</button>
{/if}
{if auth("admin/message/del")}
<button data-action='{:url("del")}' data-rule="id#{key}" data-confirm="确定要删除这些消息吗?" class='layui-btn layui-btn-sm layui-btn-primary'>批量删除</button>
{if auth("admin/message/remove")}
<button data-action='{:url("remove")}' data-rule="id#{key}" data-confirm="确定要删除这些消息吗?" class='layui-btn layui-btn-sm layui-btn-primary'>批量删除</button>
{/if}
{/block}
@ -75,14 +75,14 @@
<td class='text-left nowrap'>日期:{$vo.create_at|format_datetime|str_replace=' ','<br>时间:',###|raw}</td>
<td class='text-left nowrap'>
{if $vo.read_state eq 1 and auth("admin/message/state")}
{if $vo.read_state eq 1 and auth("admin/message/read")}
<a class="layui-btn layui-btn-sm layui-btn-disabled">已 读</a>
{elseif auth("admin/message/state")}
<a class="layui-btn layui-btn-sm" data-action="{:url('state')}" data-value="id#{$vo.id};read_state#1">已 读</a>
{elseif auth("admin/message/read")}
<a class="layui-btn layui-btn-sm" data-action="{:url('read')}" data-value="id#{$vo.id};read_state#1">已 读</a>
{/if}
{if auth("admin/message/del")}
<a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除该消息吗?" data-action="{:url('del')}" data-value="id#{$vo.id}">删 除</a>
{if auth("admin/message/remove")}
<a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除该消息吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}">删 除</a>
{/if}
</td>

View File

@ -34,7 +34,7 @@
</ul>
<div class="layui-tab-content padding-0">
{foreach $groups as $key=>$group}
<div class="layui-tab-item">
<div class="layui-tab-item layui-anim layui-anim-upbit">
<table class="layui-table border-0 margin-0" lay-skin="line">
<!--{empty name='nodes'}-->
<p class="help-block text-center well">没 有 记 录 哦!</p>

View File

@ -2,8 +2,8 @@
{block name="button"}
<!--{if auth("admin/queue/del")}-->
<button data-action='{:url("del")}' data-confirm="确定要删除这些任务吗?" data-rule="id#{key}" class='layui-btn layui-btn-sm layui-btn-primary'>删除任务</button>
<!--{if auth("admin/queue/remove")}-->
<button data-action='{:url("remove")}' data-confirm="确定要删除这些任务吗?" data-rule="id#{key}" class='layui-btn layui-btn-sm layui-btn-primary'>删除任务</button>
<!--{/if}-->
{/block}
@ -14,7 +14,7 @@
<table class="layui-table" lay-skin="line">
<caption class="margin-bottom-10 text-left">{include file='queue/index_search'}</caption>
<!--{notempty name='list'}-->
{notempty name='list'}
<thead>
<tr>
<th class='list-table-check-td think-checkbox'>
@ -25,9 +25,9 @@
<th class='text-left nowrap'>任务状态</th>
</tr>
</thead>
<!--{/notempty}-->
{/notempty}
<tbody>
<!--{foreach $list as $key=>$vo}-->
{foreach $list as $key=>$vo}
<tr>
<td class='list-table-check-td think-checkbox'>
<input class="list-check-box" value='{$vo.id}' type='checkbox'>
@ -62,8 +62,8 @@
<i class="layui-icon font-s12">&#xe669;</i>
</a>
{/eq}
<!--{if auth("admin/queue/del") and in_array($vo.status,[1,3,4])}-->
<a data-action='{:url("del")}' data-confirm="确定要删除该任务吗?" data-value="id#{$vo.id}" data-tips-text="删除该任务" class='layui-badge layui-bg-red margin-left-5'>
<!--{if auth("admin/queue/remove") and in_array($vo.status,[1,3,4])}-->
<a data-action='{:url("remove")}' data-confirm="确定要删除该任务吗?" data-value="id#{$vo.id}" data-tips-text="删除该任务" class='layui-badge layui-bg-red margin-left-5'>
<i class="layui-icon">&#xe640;</i>
</a>
<!--{/if}-->
@ -72,7 +72,7 @@
<span class="layui-badge layui-bg-gray">{$vo.status_desc|raw|default="<span class='color-desc'>没有获取到状态描述</span>"}</span>
</td>
</tr>
<!--{/foreach}-->
{/foreach}
</tbody>
</table>

View File

@ -6,8 +6,8 @@
<button data-modal='{:url("add")}' data-title="添加用户" class='layui-btn layui-btn-sm layui-btn-primary'>添加用户</button>
{/if}
{if auth("admin/user/del")}
<button data-action='{:url("del")}' data-rule="id#{key}" data-csrf="{:systoken('admin/user/del')}" data-confirm="确定要删除这些用户吗?" class='layui-btn layui-btn-sm layui-btn-primary'>删除用户</button>
{if auth("admin/user/remove")}
<button data-action='{:url("remove")}' data-rule="id#{key}" data-csrf="{:systoken('admin/user/remove')}" data-confirm="确定要删除这些用户吗?" class='layui-btn layui-btn-sm layui-btn-primary'>删除用户</button>
{/if}
{/block}
@ -65,8 +65,8 @@
<a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('resume')}" data-value="id#{$vo.id};status#1" data-csrf="{:systoken('admin/user/resume')}">启 用</a>
{/if}
{if auth("admin/user/del")}
<a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除该用户吗?" data-action="{:url('del')}" data-value="id#{$vo.id}" data-csrf="{:systoken('admin/user/del')}">删 除</a>
{if auth("admin/user/remove")}
<a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除该用户吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}" data-csrf="{:systoken('admin/user/remove')}">删 除</a>
{/if}
</td>

View File

@ -11,7 +11,6 @@
// +----------------------------------------------------------------------
// | github开源项目https://github.com/zoujingli/framework
// +--------------------------------------------------------------------*/
::-webkit-input-placeholder{color:#aaa}
::-webkit-scrollbar{width:3px;height:3px}
::-webkit-scrollbar-track{background:#ccc!important}
@ -68,16 +67,16 @@ a{color:#06C;cursor:pointer}a:hover{color:#039}input::-ms-clear{display:none}.mo
.text-top{vertical-align:top!important}.text-left{text-align:left!important}.text-right{text-align:right!important}.text-center{text-align:center!important}.text-middle{vertical-align:middle!important}.text-bottom{vertical-align:bottom!important}
.nowrap{white-space:nowrap!important}.help-block{color:#999;font-size:12px}.inline-block{display:inline-block!important}.block{display:block!important}.pointer{cursor:pointer!important}
.full-width{width:100%!important}.full-height{height:100%!important}.color-red{color:#ec494e!important}.color-blue{color:#2494f2!important}.color-desc{color:#999!important}.color-text{color:#333!important}.color-green{color:#090!important}
.notdata{display:block;margin-bottom:10px;padding:15px;border:1px solid #e6e6e6;border-radius:0 2px 2px 0;background-color:#f2f2f2;text-align:center;letter-spacing:8px;font-size:13px;line-height:22px}
.notdata{display:block;padding:15px;border:1px solid #e6e6e6;border-radius:0 2px 2px 0;background-color:#f2f2f2;text-align:center;letter-spacing:8px;font-size:13px;line-height:22px}
[data-tips-image]{cursor:zoom-in!important}.notselect{user-select:none;-ms-user-select:none;-moz-user-select:none;-webkit-user-select:none}.transition{-webkit-transition:all .2s linear;-moz-transition:all .2s linear;-o-transition:all .2s linear;transition:all .2s linear}
/* 文字大小 */
.font-s10{font-size:10px!important}.font-s11{font-size:11px!important}.font-s12{font-size:12px!important}.font-s13{font-size:13px!important}.font-s14{font-size:14px!important}.font-s16{font-size:16px!important}.font-s18{font-size:18px!important}.font-s20{font-size:20px!important}
.font-s10{font-size:10px!important}.font-s11{font-size:11px!important}.font-s12{font-size:12px!important}.font-s13{font-size:13px!important}.font-s14{font-size:14px!important}.font-s16{font-size:16px!important}.font-s18{font-size:18px!important}.font-s20{font-size:20px!important}.font-s30{font-size:30px!important}
.border-0{border:0!important}.border-radius-0{border-radius:0!important}
.padding-0{padding:0!important}.padding-5{padding:5px!important}.padding-10{padding:10px!important}.padding-15{padding:15px!important}.padding-20{padding:20px!important}.padding-25{padding:25px!important}.padding-30{padding:30px!important}
.padding-top-0{padding-top:0!important}.padding-top-5{padding-top:5px!important}.padding-top-10{padding-top:10px!important}.padding-top-15{padding-top:15px!important}.padding-top-20{padding-top:20px!important}
.padding-top-0{padding-top:0!important}.padding-top-5{padding-top:5px!important}.padding-top-10{padding-top:10px!important}.padding-top-15{padding-top:15px!important}.padding-top-20{padding-top:20px!important}.padding-top-30{padding-top:30px!important}
.padding-left-0{padding-left:0!important}.padding-left-5{padding-left:5px!important}.padding-left-10{padding-left:10px!important}.padding-left-15{padding-left:15px!important}.padding-left-20{padding-left:20px!important}.padding-left-40{padding-left:40px!important}
.padding-right-0{padding-right:0!important}.padding-right-5{padding-right:5px!important}.padding-right-10{padding-right:10px!important}.padding-right-15{padding-right:15px!important}.padding-right-20{padding-right:20px!important}
.padding-bottom-0{padding-bottom:0!important}.padding-bottom-5{padding-bottom:5px!important}.padding-bottom-10{padding-bottom:10px!important}.padding-bottom-15{padding-bottom:15px!important}.padding-bottom-20{padding-bottom:20px!important}
.padding-right-0{padding-right:0!important}.padding-right-5{padding-right:5px!important}.padding-right-10{padding-right:10px!important}.padding-right-15{padding-right:15px!important}.padding-right-20{padding-right:20px!important}.padding-right-30{padding-right:30px!important}
.padding-bottom-0{padding-bottom:0!important}.padding-bottom-5{padding-bottom:5px!important}.padding-bottom-10{padding-bottom:10px!important}.padding-bottom-15{padding-bottom:15px!important}.padding-bottom-20{padding-bottom:20px!important}.padding-bottom-30{padding-bottom:30px!important}
.margin-0{margin:0!important}.margin-5{margin:5px!important}.margin-10{margin:10px!important}.margin-15{margin:15px!important}.margin-20{margin:20px!important}.margin-25{margin:25px!important}.margin-30{margin:30px!important}
.margin-top-0{margin-top:0!important}.margin-top-5{margin-top:5px!important}.margin-top-10{margin-top:10px!important}.margin-top-15{margin-top:15px!important}.margin-top-20{margin-top:20px!important}
.margin-left-0{margin-left:0!important}.margin-left-5{margin-left:5px!important}.margin-left-10{margin-left:10px!important}.margin-left-15{margin-left:15px!important}.margin-left-20{margin-left:20px!important}.margin-left-40{margin-left:40px!important}
@ -134,7 +133,11 @@ fieldset{margin:0;border:1px solid #e6e6e6;padding:10px 20px 5px 20px}
.layui-table .list-table-sort-td input{width:50px;color:#666;padding:2px;border:1px solid #e6e6e6;text-align:center;font-size:9pt;line-height:18px}
.layui-table .list-table-check-td{width:10px!important;text-align:center;padding-left:15px!important;padding-right:15px!important}
.layui-table .list-table-check-td input{margin:0!important;vertical-align:middle}
.think-box-shadow{box-shadow:0 2px 3px 0 rgba(0,0,0,.1);background:#fff;padding:20px!important}
/** 自定义表单样式 */
.think-form-label{padding:9px 15px;font-weight:400;line-height:20px;text-align:right}
.think-form-group-right{border-top-left-radius:0;border-bottom-left-radius:0;border-left:none}
.think-form-group-left input{border-top-right-radius:0;border-bottom-right-radius:0;border-right:none}
.think-box-shadow{box-shadow:0 2px 3px 0 rgba(0,0,0,.1);background:#fff;padding:20px 30px!important}
/** checkbox & radio */
label.think-checkbox,label.think-radio{display:inline-block;margin-right:10px}
.think-checkbox,.think-radio{margin-top:10px;font-weight:400;line-height:17px;cursor:pointer}