pref: 增加服务类优化UI版面
This commit is contained in:
@@ -12,21 +12,19 @@ declare(strict_types=1);
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\common\service\notice\EmailService;
|
||||
use app\common\service\utils\FtpService;
|
||||
use Psr\SimpleCache\InvalidArgumentException;
|
||||
use support\Response;
|
||||
use think\db\exception\BindParamException;
|
||||
use think\facade\Cache;
|
||||
use support\Cache;
|
||||
use think\facade\Db;
|
||||
use Webman\Event\Event;
|
||||
use system\Random;
|
||||
use think\cache\driver\Memcached;
|
||||
use think\cache\driver\Redis;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
use think\db\exception\ModelNotFoundException;
|
||||
use app\AdminController;
|
||||
use app\common\library\Email;
|
||||
use app\common\library\Ftp;
|
||||
use app\common\model\system\AdminNotice;
|
||||
use app\common\model\system\Attachment;
|
||||
use app\common\model\system\Config;
|
||||
@@ -389,7 +387,6 @@ class Index extends AdminController
|
||||
(new Config())->saveAll($config);
|
||||
$env = base_path() . '/.env';
|
||||
$parse = parse_ini_file($env, true);
|
||||
$parse['CACHE_DRIVER'] = $post['cache_type'];
|
||||
$parse['CACHE_HOSTNAME'] = $post['cache_host'];
|
||||
$parse['CACHE_HOSTPORT'] = $post['cache_port'];
|
||||
$parse['CACHE_SELECT'] = $post['cache_select'];
|
||||
@@ -401,7 +398,6 @@ class Index extends AdminController
|
||||
}
|
||||
|
||||
// 清理系统核心缓存
|
||||
Cache::tag('core_system')->clear();
|
||||
$configList = Cache::get('config_list');
|
||||
foreach ($configList as $item) {
|
||||
Cache::delete($item);
|
||||
@@ -417,7 +413,7 @@ class Index extends AdminController
|
||||
public function testFtp(): Response
|
||||
{
|
||||
if (request()->isPost()) {
|
||||
if (Ftp::instance()->ftpTest(request()->post())) {
|
||||
if (FtpService::ftpTest(request()->post())) {
|
||||
return $this->success('上传测试成功!');
|
||||
}
|
||||
}
|
||||
@@ -427,51 +423,49 @@ class Index extends AdminController
|
||||
|
||||
/**
|
||||
* 邮件测试
|
||||
* @return Response
|
||||
*/
|
||||
public function testEmail()
|
||||
public function testEmail(): Response
|
||||
{
|
||||
if (request()->isPost()) {
|
||||
$info = Email::instance()->testEMail(request()->post());
|
||||
return $info === true ? $this->success('测试邮件发送成功!') : $this->error($info);
|
||||
try {
|
||||
EmailService::testEmail(request()->post());
|
||||
} catch (\Exception $e) {
|
||||
return $this->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
return $this->success('测试邮件发送成功!');
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存测试
|
||||
* @return Response
|
||||
*/
|
||||
public function testCache()
|
||||
public function testCache(): Response
|
||||
{
|
||||
if (request()->isPost()) {
|
||||
|
||||
$param = request()->post();
|
||||
if (!isset($param['type']) || empty($param['host']) || empty($param['port'])) {
|
||||
if (empty($param['host']) || empty($param['port'])) {
|
||||
return $this->error('参数错误!');
|
||||
}
|
||||
|
||||
$options = [
|
||||
'host' => $param['host'],
|
||||
'port' => (int)$param['port'],
|
||||
'username' => $param['user'],
|
||||
'password' => $param['pass']
|
||||
];
|
||||
if (!extension_loaded('redis')) {
|
||||
return $this->error('请先安装redis扩展!');
|
||||
}
|
||||
|
||||
try {
|
||||
if (strtolower($param['type']) == 'redis') {
|
||||
$drive = new Redis($options);
|
||||
} else {
|
||||
$drive = new Memcached($options);
|
||||
}
|
||||
$redis = new \Redis();
|
||||
$redis->connect($param['host'], (int)$param['port']);
|
||||
$redis->auth($param['pass']);
|
||||
$redis->select((int)$param['select']);
|
||||
$redis->set('key-test', time());
|
||||
$redis->close();
|
||||
} catch (\Throwable $th) {
|
||||
return $this->error($th->getMessage());
|
||||
}
|
||||
|
||||
if ($drive->set('test', 'cacheOK', 1000)) {
|
||||
return $this->success('缓存测试成功!');
|
||||
} else {
|
||||
return $this->error('缓存测试失败!');
|
||||
}
|
||||
}
|
||||
return $this->success('缓存测试成功!');
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
use think\db\exception\ModelNotFoundException;
|
||||
use think\Exception;
|
||||
use think\facade\Cache;
|
||||
use support\Cache;
|
||||
use Webman\Http\Request;
|
||||
|
||||
/**
|
||||
@@ -155,14 +155,13 @@ class Admin extends AdminController
|
||||
return $this->error('该用户名或邮箱已被注册!');
|
||||
}
|
||||
|
||||
|
||||
// 管理员加密
|
||||
$post['pwd'] = encryptPwd($post['pwd']);
|
||||
$post['create_ip'] = request()->getRealIp();
|
||||
$data = $this->model->create($post);
|
||||
if (!is_empty($data->id)) {
|
||||
$access['admin_id'] = $data->id;
|
||||
$access['group_id'] = $data->group_id;
|
||||
if (!is_empty($data['id'])) {
|
||||
$access['admin_id'] = $data['id'];
|
||||
$access['group_id'] = $data['group_id'];
|
||||
AdminAccessModel::insert($access);
|
||||
return $this->success('添加管理员成功!');
|
||||
} else {
|
||||
@@ -182,95 +181,84 @@ class Admin extends AdminController
|
||||
if (request()->isPost()) {
|
||||
|
||||
$id = request()->input('id');
|
||||
|
||||
if (!empty($id) && is_numeric($id)) {
|
||||
|
||||
// 验证数据
|
||||
$post = request()->all();
|
||||
$post = request_validate_rules($post, get_class($this->model), 'edit');
|
||||
if (!is_array($post)) {
|
||||
return $this->error($post);
|
||||
$retError = request_validate_rules($post, get_class($this->model), 'edit');
|
||||
if (!is_array($retError)) {
|
||||
return $this->error($retError);
|
||||
}
|
||||
|
||||
if (!empty($post['pwd'])) {
|
||||
if (isset($post['pwd']) && !empty($post['pwd'])) {
|
||||
$post['pwd'] = encryptPwd($post['pwd']);
|
||||
} else {
|
||||
// 清空避免被覆盖
|
||||
unset($post['pwd']);
|
||||
}
|
||||
|
||||
if ($this->model->update($post)) {
|
||||
$access['group_id'] = $post['group_id'];
|
||||
AdminAccessModel::where('admin_id', $id)->update($access);
|
||||
return $this->success('更新管理员成功!');
|
||||
} else {
|
||||
return $this->error('更新管理员失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->error('更新管理员失败');
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑权限
|
||||
* @return Response
|
||||
*/
|
||||
public function editRules()
|
||||
public function editRules(): Response
|
||||
{
|
||||
if (request()->isPost()) {
|
||||
return $this->_update_RuleCates();
|
||||
}
|
||||
return $this->updateRuleCates();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑栏目权限
|
||||
* @return Response
|
||||
*/
|
||||
public function editCates()
|
||||
public function editCates(): Response
|
||||
{
|
||||
return $this->_update_RuleCates(AUTH_CATE);
|
||||
return $this->updateRuleCates(AUTH_CATE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新权限函数
|
||||
* @access protected
|
||||
* @param string $type
|
||||
* @return \support\Response|void
|
||||
* @return Response
|
||||
*/
|
||||
protected function _update_RuleCates(string $type = AUTH_RULES)
|
||||
protected function updateRuleCates(string $type = AUTH_RULES): Response
|
||||
{
|
||||
if (request()->isPost()) {
|
||||
$admin_id = input('admin_id');
|
||||
$rules = request()->post($type) ?? [];
|
||||
$access = $this->auth->getRulesNode($admin_id, $type);
|
||||
$rules = array_diff($rules, $access[$this->auth->authGroup]);
|
||||
|
||||
$admin_id = input('admin_id');
|
||||
$rules = request()->post($type) ?? [];
|
||||
|
||||
if (!empty($admin_id) && $admin_id > 0) {
|
||||
|
||||
$access = $this->auth->getRulesNode($admin_id, $type);
|
||||
$rules = array_diff($rules, $access[$this->auth->authGroup]);
|
||||
|
||||
// 权限验证
|
||||
if (!$this->auth->checkRuleOrCateNodes($rules, $type, $this->auth->authPrivate)) {
|
||||
return $this->error('没有权限!');
|
||||
}
|
||||
|
||||
// 获取个人节点
|
||||
$differ = array_diff($access[$this->auth->authPrivate], $access[$this->auth->authGroup]);
|
||||
$current = [];
|
||||
if (!$this->auth->superAdmin()) {
|
||||
$current = $this->auth->getRulesNode();
|
||||
$current = array_diff($differ, $current[$this->auth->authPrivate]);
|
||||
}
|
||||
|
||||
$rules = array_unique(array_merge($rules, $current));
|
||||
$AdminAccessModel = new AdminAccessModel();
|
||||
$data = [
|
||||
"$type" => implode(',', $rules)
|
||||
];
|
||||
|
||||
if ($AdminAccessModel->where('admin_id', $admin_id)->save($data)) {
|
||||
return $this->success('更新权限成功!');
|
||||
}
|
||||
|
||||
return $this->error('更新权限失败!');
|
||||
}
|
||||
// 权限验证
|
||||
if (!$this->auth->checkRuleOrCateNodes($rules, $type, $this->auth->authPrivate)) {
|
||||
return $this->error('没有权限!');
|
||||
}
|
||||
|
||||
// 获取个人节点
|
||||
$differ = array_diff($access[$this->auth->authPrivate], $access[$this->auth->authGroup]);
|
||||
$current = [];
|
||||
if (!$this->auth->superAdmin()) {
|
||||
$current = $this->auth->getRulesNode();
|
||||
$current = array_diff($differ, $current[$this->auth->authPrivate]);
|
||||
}
|
||||
|
||||
$rules = array_unique(array_merge($rules, $current));
|
||||
$AdminAccessModel = new AdminAccessModel();
|
||||
$data = ["$type" => implode(',', $rules)];
|
||||
|
||||
if ($AdminAccessModel->update($data, ['admin_id' => $admin_id])) {
|
||||
return $this->success('更新权限成功!');
|
||||
}
|
||||
|
||||
return $this->error('更新权限失败!');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -278,7 +266,7 @@ class Admin extends AdminController
|
||||
* getAdminRules
|
||||
* @return mixed
|
||||
*/
|
||||
public function getPermissions()
|
||||
public function getPermissions(): mixed
|
||||
{
|
||||
$list = [];
|
||||
if (\request()->isAjax()) {
|
||||
@@ -666,7 +654,7 @@ class Admin extends AdminController
|
||||
// 清理内容
|
||||
if ($type == 'all' || $type == 'content') {
|
||||
$session = session(AdminSession);
|
||||
\think\facade\Cache::clear();
|
||||
\support\Cache::clear();
|
||||
request()->session()->set(AdminSession, $session);
|
||||
}
|
||||
|
||||
|
||||
@@ -50,34 +50,14 @@ class AdminRules extends AdminController
|
||||
}
|
||||
|
||||
// 获取总数
|
||||
$total = $this->model->count();
|
||||
$total = $this->model->where($where)->count();
|
||||
$list = $this->model->where($where)->order('sort asc')->select()->toArray();
|
||||
foreach ($list as $key => $value) {
|
||||
$list[$key]['title'] = __($value['title']);
|
||||
}
|
||||
|
||||
// 自定义查询
|
||||
if (count($list) < $total) {
|
||||
|
||||
$parentNode = []; // 查找父节点
|
||||
foreach ($list as $key => $value) {
|
||||
if ($value['pid'] !== 0 && !list_search($list,['id'=>$value['pid']])) {
|
||||
$parentNode[] = $this->parentNode($value['pid']);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($parentNode as $key => $value) {
|
||||
$list = array_merge($list,$value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$rules = $this->model->getListTree();
|
||||
return $this->success('获取成功', '',[
|
||||
'item'=> $list,
|
||||
'rules'=> $rules
|
||||
],
|
||||
count($list),0);
|
||||
$rules = list_to_tree($list,'id','pid','children',0);
|
||||
return $this->success('获取成功', '/',$rules, $total);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -73,11 +73,7 @@ class Department extends AdminController
|
||||
}
|
||||
|
||||
$depart = $this->model->getListTree();
|
||||
return $this->success('获取成功', '',[
|
||||
'item'=> $list,
|
||||
'depart'=> $depart
|
||||
],
|
||||
count($list));
|
||||
return $this->success('获取成功', '',$depart, $total);
|
||||
}
|
||||
|
||||
return view('system/department/index');
|
||||
|
||||
@@ -81,7 +81,7 @@ class Plugin extends AdminController
|
||||
return $this->error('请勿重复安装插件');
|
||||
}
|
||||
|
||||
// try {
|
||||
try {
|
||||
|
||||
$pluginZip = self::downLoad($name, ['name' => $name, 'token' => input('token')]);
|
||||
ZipArchives::unzip($pluginZip, plugin_path(), '', true);
|
||||
@@ -95,10 +95,10 @@ class Plugin extends AdminController
|
||||
self::pluginMenu($name);
|
||||
self::executeSql($name);
|
||||
self::enabled($name);
|
||||
// } catch (\Throwable $th) {
|
||||
// recursive_delete($pluginPath);
|
||||
// return $this->error($th->getMessage(), null, self::$ServerBody, $th->getCode());
|
||||
// }
|
||||
} catch (\Throwable $th) {
|
||||
recursive_delete($pluginPath);
|
||||
return $this->error($th->getMessage(), null, self::$ServerBody, $th->getCode());
|
||||
}
|
||||
|
||||
return $this->success('插件安装成功', null, get_plugin_config($name, true));
|
||||
}
|
||||
@@ -295,17 +295,15 @@ class Plugin extends AdminController
|
||||
if (request()->isPost()) {
|
||||
$post['extends'] = input('extends');
|
||||
$post['rewrite'] = input('rewrite');
|
||||
foreach ($post['rewrite'] as $kk=>$vv)
|
||||
{
|
||||
if($kk[0]!='/')return $this->error('伪静态变量名称“'.$kk.'" 必须以“/”开头');
|
||||
$post['rewrite'][$kk]=str_replace('\\','/',trim($vv,'/\\'));
|
||||
$value=explode('/',$post['rewrite'][$kk]);
|
||||
if(count($value)<2){
|
||||
return $this->error('伪静态规则变量值,不符合规则');
|
||||
foreach ($post['rewrite'] as $kk => $vv) {
|
||||
if ($kk[0] != '/') return $this->error('伪静态变量名称“' . $kk . '" 必须以“/”开头');
|
||||
$post['rewrite'][$kk] = str_replace('\\', '/', trim($vv, '/\\'));
|
||||
$value = explode('/', $post['rewrite'][$kk]);
|
||||
if (count($value) < 2) {
|
||||
return $this->error('伪静态不符合规则');
|
||||
}
|
||||
if(strtoupper($value[count($value)-2][0]) !== $value[count($value)-2][0])
|
||||
{
|
||||
return $this->error('伪静态规则变量值中,控制器首字母必须大写哦');
|
||||
if (strtoupper($value[count($value) - 2][0]) !== $value[count($value) - 2][0]) {
|
||||
return $this->error('控制器首字母必须大写');
|
||||
}
|
||||
}
|
||||
$config = array_merge($config, $post);
|
||||
|
||||
@@ -21,7 +21,6 @@ use system\Random;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
use think\db\exception\ModelNotFoundException;
|
||||
use Webman\Http\Request;
|
||||
|
||||
/**
|
||||
* 用户管理
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\middleware\system;
|
||||
use app\common\library\Auth;
|
||||
use think\facade\Cache;
|
||||
use Webman\Http\Request;
|
||||
use Webman\Http\Response;
|
||||
use Webman\MiddlewareInterface;
|
||||
|
||||
@@ -27,7 +27,7 @@ class AdminPermissions implements MiddlewareInterface
|
||||
* 不需要鉴权的方法
|
||||
* @var array
|
||||
*/
|
||||
protected array $noNeedAuth = [
|
||||
protected array $noNeedLogin = [
|
||||
'/Index/index',
|
||||
'/Login/index',
|
||||
'/Login/logout',
|
||||
@@ -56,12 +56,12 @@ class AdminPermissions implements MiddlewareInterface
|
||||
// 获取权限列表
|
||||
$class = new \ReflectionClass($request->controller);
|
||||
$properties = $class->getDefaultProperties();
|
||||
$this->noNeedAuth = $properties['noNeedAuth'] ?? $this->noNeedAuth;
|
||||
$this->noNeedLogin = $properties['noNeedLogin'] ?? $this->noNeedLogin;
|
||||
|
||||
// 控制器鉴权
|
||||
$method = '/' . $controller . '/' . $action;
|
||||
if (!in_array('*', $this->noNeedAuth)
|
||||
&& !in_array(strtolower($method), array_map('strtolower', $this->noNeedAuth))) {
|
||||
if (!in_array('*', $this->noNeedLogin)
|
||||
&& !in_array(strtolower($method), array_map('strtolower', $this->noNeedLogin))) {
|
||||
if (!Auth::instance()->SuperAdmin() && !Auth::instance()->check($method, get_admin_id())) {
|
||||
if (request()->isAjax()) {
|
||||
return json(['code' => 101, 'msg' => '没有权限']);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<!-- 正文开始 -->
|
||||
<div class="layui-fluid" id="LAY-component-grid-all">
|
||||
<div class="layui-row layui-col-space10">
|
||||
<div class="layui-col-xs6 layui-col-sm7 layui-col-md3">
|
||||
<div class=" layui-col-sm7 layui-col-md3">
|
||||
<!-- 填充内容 -->
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">总销售额<i class="layui-icon layui-icon-about layui-fr" lay-tips="指标说明" ></i></div>
|
||||
@@ -19,7 +19,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-xs6 layui-col-sm5 layui-col-md3">
|
||||
<div class=" layui-col-sm5 layui-col-md3">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">访问量 <span class="layui-badge layui-badge-green pull-right">日</span></div>
|
||||
<div class="layui-card-body">
|
||||
@@ -32,7 +32,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-xs6 layui-col-sm5 layui-col-md3">
|
||||
<div class=" layui-col-sm5 layui-col-md3">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">支付笔数 <span class="layui-badge layui-badge-blue pull-right">月</span></div>
|
||||
<div class="layui-card-body">
|
||||
@@ -45,7 +45,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-xs6 layui-col-sm7 layui-col-md3">
|
||||
<div class=" layui-col-sm7 layui-col-md3">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">活动运营效果 <span class="layui-badge layui-badge-red pull-right">周</span></div>
|
||||
<div class="layui-card-body">
|
||||
@@ -62,7 +62,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-xs6 layui-col-sm7 layui-col-md9">
|
||||
<div class=" layui-col-sm7 layui-col-md9">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">用户地域分布</div>
|
||||
<div class="layui-card-body">
|
||||
@@ -70,7 +70,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-xs6 layui-col-sm5 layui-col-md3">
|
||||
<div class=" layui-col-sm5 layui-col-md3">
|
||||
<div class="layui-card" >
|
||||
<div class="layui-card-header">在线人数</div>
|
||||
<div class="layui-card-body">
|
||||
@@ -78,7 +78,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-xs6 layui-col-sm5 layui-col-md3">
|
||||
<div class=" layui-col-sm5 layui-col-md3">
|
||||
<div class="layui-card" >
|
||||
<div class="layui-card-header">浏览器分布</div>
|
||||
<div class="layui-card-body">
|
||||
|
||||
@@ -162,8 +162,7 @@
|
||||
<div class="layui-form-mid layui-word-aux">* {:__('是否开启手机版模式')}</div>
|
||||
</div>
|
||||
|
||||
<div class="mobile" <eq name="$config['site_state']" value="0"> style="display:none;"
|
||||
</eq> >
|
||||
<div class="mobile" <eq name="$config['site_state']" value="0"> style="display:none;" </eq> >
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">{:__('手机版类型')}</label>
|
||||
@@ -328,88 +327,61 @@
|
||||
<label class="layui-form-label">{:__('缓存开关')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="radio" name="cache_status" data-display="cache_status"
|
||||
lay-filter="radioStatus" value="1" title="开启" <if
|
||||
lay-filter="radioStatus" value="1" title="开启" <if
|
||||
condition="$config['cache_status'] eq 1 "> checked </if> >
|
||||
<input type="radio" name="cache_status" data-display="cache_status"
|
||||
lay-filter="radioStatus" value="0" title="关闭" <if
|
||||
lay-filter="radioStatus" value="0" title="关闭" <if
|
||||
condition="$config['cache_status'] eq 0 "> checked </if>>
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">* {:__('开启数据库缓存会提高网站性能!')}</div>
|
||||
</div>
|
||||
|
||||
<div class="cache_status" <eq name="$config['cache_status']" value="0">
|
||||
style="display:none;" </eq> >
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">{:__('缓存方式')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<select name="cache_type" data-display="cache_type" data-disable="file"
|
||||
lay-filter="selectStatus" class="ctype">
|
||||
<option value="file" <if condition="$config['cache_type'] eq 'file'">
|
||||
selected</if> >file</option>
|
||||
<option value="redis" <if condition="$config['cache_type'] eq 'redis'">
|
||||
selected</if> >redis</option>
|
||||
<option value="memcached" <if
|
||||
condition="$config['cache_type'] eq 'memcached'">selected</if>
|
||||
>memcached</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">
|
||||
<i class="layui-icon layui-icon-about"
|
||||
lay-tips="{:__('使用Redis缓存方式,出错会抛出Connection refused!')}"></i>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">{:__('服务器IP')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="cache_host" placeholder="{:__('缓存服务器IP')}"
|
||||
value="{$config['cache_host']}" class="layui-input chost">
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">{:__('缓存时间')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="cache_time" autocomplete="off"
|
||||
value="{$config.cache_time}" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">* {:__('单位 /秒')}</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">{:__('端 口')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="cache_port" placeholder="{:__('缓存服务器端口')}"
|
||||
value="{$config['cache_port']}" class="layui-input cport">
|
||||
</div>
|
||||
|
||||
<div class="cache_type" <if
|
||||
condition="$config['cache_type'] eq 'file' or $config['cache_type'] eq ''">
|
||||
style="display:none;" </if> >
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">{:__('服务器IP')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="cache_host" placeholder="{:__('缓存服务器IP')}"
|
||||
value="{$config['cache_host']}" class="layui-input chost">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">{:__('端 口')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="cache_port" placeholder="{:__('缓存服务器端口')}"
|
||||
value="{$config['cache_port']}" class="layui-input cport">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">{:__('数据库')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="number" name="cache_select" min="1" max="16"
|
||||
placeholder="{:__('缓存服务redis库 1- 16')}"
|
||||
value="{$config['cache_select']}" class="layui-input cuser">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">{:__('账 号')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="cache_user" placeholder="{:__('缓存服务账号,没有请留空')}"
|
||||
value="{$config['cache_user']}" class="layui-input cuser">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">{:__('密 码')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="cache_pass" placeholder="{:__('缓存服务密码,没有请留空')}"
|
||||
value="{$config['cache_pass']}" class="layui-input cpass">
|
||||
</div>
|
||||
<button type="button" class="layui-btn layui-btn-primary" lay-ajax=""
|
||||
data-url="{:url('/Index/testCache')}"
|
||||
data-object="type:ctype,host:chost,port:cport,user:cuser,pass:cpass">{:__('测试连接')}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">{:__('缓存时间')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="cache_time" autocomplete="off"
|
||||
value="{$config.cache_time}" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">* {:__('单位 /秒')}</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">{:__('数据库')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="number" name="cache_select" min="1" max="16"
|
||||
placeholder="{:__('缓存服务redis库 1- 16')}"
|
||||
value="{$config['cache_select']}" class="layui-input cselect">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">{:__('账 号')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="cache_user" placeholder="{:__('缓存服务账号,没有请留空')}"
|
||||
value="{$config['cache_user']}" class="layui-input cuser">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">{:__('密 码')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="cache_pass" placeholder="{:__('缓存服务密码,没有请留空')}"
|
||||
value="{$config['cache_pass']}" class="layui-input cpass">
|
||||
</div>
|
||||
<button type="button" class="layui-btn layui-btn-primary" lay-ajax=""
|
||||
data-url="{:url('/index/testCache')}"
|
||||
data-object="host:chost,port:cport,user:cuser,select:cselect,pass:cpass">{:__('测试连接')}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -427,8 +399,7 @@
|
||||
<div class="layui-form-item layui-col-md5">
|
||||
<label class="layui-form-label">{:__('提示信息')}</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea id="site_notice" name="site_notice" lay-verify="siteClose"
|
||||
type="layui-textarea">{$config.site_notice}</textarea>
|
||||
<textarea name="site_notice" lay-verify="siteClose" class="layui-textarea">{$config.site_notice}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1835,21 +1806,11 @@
|
||||
<include file="/public/footer" />
|
||||
|
||||
<script>
|
||||
layui.use(['form', 'jquery', 'layedit', 'admin'], function () {
|
||||
layui.use(['form', 'jquery', 'admin'], function () {
|
||||
|
||||
var form = layui.form;
|
||||
var admin = layui.admin;
|
||||
var jquery = layui.jquery;
|
||||
// 渲染富文本编辑器
|
||||
var layedit = layui.layedit;
|
||||
var layindex = layedit.build('site_notice', { height: 110, color: '#ffffff' });
|
||||
|
||||
// 异步验证表单
|
||||
form.verify({
|
||||
siteClose: function (value) {
|
||||
return layedit.sync(layindex);
|
||||
}
|
||||
});
|
||||
|
||||
// 增加变量
|
||||
jquery('.layui-variable-add').on('click', function () {
|
||||
|
||||
@@ -290,6 +290,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table class="layui-hide" id="ID-treeTable-demo"></table>
|
||||
</div>
|
||||
<script src="__STATICADMIN__module/echarts/echarts.js"></script>
|
||||
<script src="__STATICADMIN__module/echarts/echarts-wordcloud.js"></script>
|
||||
@@ -298,10 +299,35 @@
|
||||
<include file="/public/footer"/>
|
||||
|
||||
<script>
|
||||
layui.use(['jquery','layer'], function () {
|
||||
layui.use(['jquery','layer','treeTable'], function () {
|
||||
|
||||
let $ = layui.jquery;
|
||||
let layer = layui.layer;
|
||||
let treeTable = layui.treeTable;
|
||||
|
||||
var inst = treeTable.render({
|
||||
elem: '#ID-treeTable-demo',
|
||||
url: '/static/demo-1.json?page=1&limit=10', // 此处为静态模拟数据,实际使用时需换成真实接口
|
||||
tree: {
|
||||
customName: {
|
||||
icon: 'icon2',
|
||||
name: 'title'
|
||||
},
|
||||
},
|
||||
maxHeight: '501px',
|
||||
toolbar: '#TPL-treeTable-demo',
|
||||
cols: [[
|
||||
{type: 'checkbox', fixed: 'left'},
|
||||
{field: 'id', title: 'ID', width: 80, sort: true, fixed: 'left'},
|
||||
{field: 'name', title: '用户名', width: 180, fixed: 'left'},
|
||||
{field: 'experience', title: '积分', width: 90, sort: true},
|
||||
{field: 'sex', title: '性别', width: 80, sort: true},
|
||||
{field: 'score', title: '评分', width: 80, sort: true},
|
||||
{field: 'city', title: '城市'},
|
||||
{ fixed: "right", title: "操作", width: 181, align: "center", toolbar: "#TPL-treeTable-demo-tools"}
|
||||
]],
|
||||
page: true
|
||||
});
|
||||
|
||||
/**
|
||||
* 用户统计报表
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<div class="layui-card-body">
|
||||
<div class="layui-panel">
|
||||
<div class="layui-card-header">
|
||||
<div class="title"><span class="titles"><img src="{$detail.face}" class="face" width="20"> </span>{$detail.nickname}</div>
|
||||
<div class="title"><span class="titles"><img src="{$detail.face|default=''}" class="face" width="20"> </span>{$detail.nickname|default='隐藏用户'}</div>
|
||||
<div class="time"><span class="times">时间:</span>{$detail.create_time}</div>
|
||||
</div>
|
||||
<div id="layui-info">{$detail.content|raw}</div>
|
||||
|
||||
@@ -122,31 +122,37 @@
|
||||
<include file="/public/footer" />
|
||||
|
||||
<script>
|
||||
layui.use(['admin','form','treetable','iconPicker'], function () {
|
||||
layui.use(['admin','form','treeTable','iconPicker'], function () {
|
||||
|
||||
var jquery = layui.jquery;
|
||||
var admin = layui.admin;
|
||||
var form = layui.form;
|
||||
var table = layui.table;
|
||||
var treetable = layui.treetable;
|
||||
var treeTable = layui.treeTable;
|
||||
var iconPicker = layui.iconPicker;
|
||||
var tableURL = "{:url('/system/AdminRules/index')}";
|
||||
|
||||
|
||||
// 渲染初始化表格
|
||||
var renderTable = function (tableURL) {
|
||||
treetable.render({
|
||||
treeTable.render({
|
||||
elem: '#lay-tableList',
|
||||
treeColIndex: 1,
|
||||
treeSpid: 0,
|
||||
treeIdName: 'id',
|
||||
treePidName: 'pid',
|
||||
url: tableURL,
|
||||
cellMinWidth: 100,
|
||||
treeDefaultClose: true,
|
||||
tree: {
|
||||
customName: {
|
||||
pid: 'pid',
|
||||
icon: 'icon1',
|
||||
},
|
||||
view: {
|
||||
iconClose: '', // 关闭时候的图标
|
||||
iconOpen: '', // 打开时候的图标
|
||||
iconLeaf: '', // 叶子节点的图标
|
||||
}
|
||||
},
|
||||
cols: [[
|
||||
{type: 'numbers'},
|
||||
{field: 'title', title: '{:__("菜单名称")}'},
|
||||
{field: 'name', title: '{:__("菜单名称")}',templet: function(d) {
|
||||
return '<i class="layui-icon '+d.icon+'"></i> '+d.title;
|
||||
},},
|
||||
{field: 'router', title: '{:__("路由地址")}'},
|
||||
{field: 'alias', title: '{:__("权限标识")}'},
|
||||
{field: 'auth', width: 80,title: '{:__("鉴权")}',templet: function(d) {
|
||||
@@ -246,7 +252,7 @@
|
||||
tips: '请选择上级菜单',
|
||||
name: 'pid',
|
||||
height: 'auto',
|
||||
data: table.cache['rules'],
|
||||
data: table.cache['lay-tableList'],
|
||||
radio: true,
|
||||
clickClose: true,
|
||||
initValue: checkedId,
|
||||
@@ -314,9 +320,10 @@
|
||||
var pageThat = jquery(this);
|
||||
pageThat.attr("disabled",true);
|
||||
// 获取提交地址
|
||||
if (typeof(tableThis) !== 'undefined') {
|
||||
var _pageUrl;
|
||||
if (typeof (tableThis) !== 'undefined') {
|
||||
_pageUrl = tableThis.event === 'edit' ? pageThat.attr('lay-edit') : pageThat.attr('lay-add');
|
||||
}else {
|
||||
} else {
|
||||
_pageUrl = pageThat.attr('lay-add');
|
||||
}
|
||||
|
||||
@@ -328,7 +335,7 @@
|
||||
// 开始POST提交数据
|
||||
jquery.post(_pageUrl,
|
||||
post.field, function(res){
|
||||
if (res.code == 200) {
|
||||
if (res.code === 200) {
|
||||
|
||||
layer.msg(res.msg);
|
||||
|
||||
@@ -356,12 +363,12 @@
|
||||
|
||||
// 展开所有
|
||||
jquery('#expandAll').click(function(){
|
||||
treetable.expandAll('#lay-tableList');
|
||||
treeTable.expandAll('lay-tableList', true);
|
||||
})
|
||||
|
||||
// 折叠所有
|
||||
jquery('#foldAll').click(function () {
|
||||
treetable.foldAll('#lay-tableList');
|
||||
treeTable.expandAll('lay-tableList',false);
|
||||
});
|
||||
|
||||
// 执行初始化
|
||||
|
||||
@@ -112,26 +112,35 @@
|
||||
<include file="/public/footer" />
|
||||
<script src="__STATICADMIN__module/xmselect/xmselect.js"></script>
|
||||
<script>
|
||||
layui.use(['admin','form','treetable'], function () {
|
||||
layui.use(['admin','form','treeTable'], function () {
|
||||
|
||||
var jquery = layui.jquery;
|
||||
var admin = layui.admin;
|
||||
var form = layui.form;
|
||||
var table = layui.table;
|
||||
var treetable = layui.treetable;
|
||||
var treeTable = layui.treeTable;
|
||||
var tableURL = "{:url('/system/Department/index')}";
|
||||
|
||||
// 渲染初始化表格
|
||||
var renderTable = function (tableURL) {
|
||||
|
||||
var ss = treetable.render({
|
||||
treeTable.render({
|
||||
elem: '#lay-tableList',
|
||||
treeColIndex: 1,
|
||||
treeSpid: 0,
|
||||
treeIdName: 'id',
|
||||
treePidName: 'pid',
|
||||
url: tableURL,
|
||||
cellMinWidth: 100,
|
||||
tree: {
|
||||
customName: {
|
||||
name: 'title',
|
||||
icon: 'icon1',
|
||||
},
|
||||
view: {
|
||||
iconClose: '', // 关闭时候的图标
|
||||
iconOpen: '', // 打开时候的图标
|
||||
iconLeaf: '', // 叶子节点的图标
|
||||
expandAllDefault: true,
|
||||
|
||||
}
|
||||
},
|
||||
// 默认展开
|
||||
cols: [[
|
||||
{type: 'numbers'},
|
||||
{field: 'title', title: '{:__("部门名称")}'},
|
||||
@@ -179,7 +188,7 @@
|
||||
tips: '请选择上级部门',
|
||||
name: 'pid',
|
||||
height: 'auto',
|
||||
data: table.cache.depart,
|
||||
data: table.cache['lay-tableList'],
|
||||
radio: true,
|
||||
clickClose: true,
|
||||
initValue: checkedId,
|
||||
@@ -210,10 +219,11 @@
|
||||
var pageThat = jquery(this);
|
||||
pageThat.attr("disabled",true);
|
||||
// 获取提交地址
|
||||
if (typeof(tableThis) !== 'undefined') {
|
||||
var _pageUrl;
|
||||
if (typeof (tableThis) !== 'undefined') {
|
||||
_pageUrl = tableThis.event === 'edit' ? pageThat.attr('lay-edit') : pageThat.attr('lay-add');
|
||||
}else {
|
||||
_pageUrl = pageThat.attr('lay-add');
|
||||
} else {
|
||||
_pageUrl = pageThat.attr('lay-add');
|
||||
}
|
||||
|
||||
|
||||
@@ -225,7 +235,7 @@
|
||||
// 开始POST提交数据
|
||||
jquery.post(_pageUrl,
|
||||
post.field, function(res){
|
||||
if (res.code == 200) {
|
||||
if (res.code === 200) {
|
||||
layer.msg(res.msg);
|
||||
// 更新列数据
|
||||
if (typeof(tableThis) !== 'undefined') {
|
||||
|
||||
@@ -108,6 +108,7 @@
|
||||
let $ = layui.jquery;
|
||||
let table = layui.table;
|
||||
let dropdown = layui.dropdown;
|
||||
window.framework = "{:config('app.version')}";
|
||||
window.plugins = {$plugin|raw};
|
||||
/*
|
||||
* 初始化表格
|
||||
|
||||
Reference in New Issue
Block a user