[更新]系统模块代码同步

This commit is contained in:
Anyon 2017-10-13 15:12:10 +08:00
parent d7679d723f
commit c012bf0f60
12 changed files with 120 additions and 183 deletions

View File

@ -68,7 +68,7 @@ class Auth extends BasicAdmin
{ {
$nodes = NodeService::get(); $nodes = NodeService::get();
$checked = Db::name('SystemAuthNode')->where(['auth' => $auth_id])->column('node'); $checked = Db::name('SystemAuthNode')->where(['auth' => $auth_id])->column('node');
foreach ($nodes as $key => &$node) { foreach ($nodes as &$node) {
$node['checked'] = in_array($node['node'], $checked); $node['checked'] = in_array($node['node'], $checked);
} }
$all = $this->_apply_filter(ToolsService::arr2tree($nodes, 'node', 'pnode', '_sub_')); $all = $this->_apply_filter(ToolsService::arr2tree($nodes, 'node', 'pnode', '_sub_'));

View File

@ -14,7 +14,6 @@
namespace app\admin\controller; namespace app\admin\controller;
use app\store\OrderService;
use controller\BasicAdmin; use controller\BasicAdmin;
use service\ExtendService; use service\ExtendService;
use service\LogService; use service\LogService;
@ -61,23 +60,13 @@ class Config extends BasicAdmin
*/ */
public function file() public function file()
{ {
$this->title = '文件存储配置';
$alert = [ $alert = [
'type' => 'success', 'title' => '操作提示', 'type' => 'danger',
'content' => '文件引擎参数影响全局文件上传功能,请勿随意修改!' 'title' => '操作安全警告(默认使用本地服务存储)',
'content' => '请根据实际情况配置存储引擎,合理做好站点下载分流。建议尽量使用云存储服务,同时保证文件访问协议与网站访问协议一致!'
]; ];
$this->title = '文件存储配置';
$this->assign('alert', $alert); $this->assign('alert', $alert);
return $this->index(); return $this->index();
} }
/**
* 短信参数配置
*/
public function sms()
{
$this->title = '短信服务配置';
$this->assign('result', ExtendService::querySmsBalance());
return $this->index();
}
} }

View File

@ -38,7 +38,7 @@ class Index extends BasicAdmin
public function index() public function index()
{ {
NodeService::applyAuthNode(); NodeService::applyAuthNode();
$list = (array)Db::name('SystemMenu')->where(['status' => '1'])->order('sort asc,id asc')->select(); $list = (array) Db::name('SystemMenu')->where(['status' => '1'])->order('sort asc,id asc')->select();
$menus = $this->_filterMenuData(ToolsService::arr2tree($list), NodeService::get(), !!session('user')); $menus = $this->_filterMenuData(ToolsService::arr2tree($list), NodeService::get(), !!session('user'));
return view('', ['title' => '系统管理', 'menus' => $menus]); return view('', ['title' => '系统管理', 'menus' => $menus]);
} }

View File

@ -40,17 +40,14 @@ class Log extends BasicAdmin
*/ */
public function index() public function index()
{ {
$this->title = '系统操作日志';
$get = $this->request->get();
// 日志行为类别 // 日志行为类别
$actions = Db::name($this->table)->group('action')->column('action'); $actions = Db::name($this->table)->group('action')->column('action');
$this->assign('actions', $actions); $this->assign('actions', $actions);
// 日志数据库对象 // 日志数据库对象
list($this->title, $get) = ['系统操作日志', $this->request->get()];
$db = Db::name($this->table)->order('id desc'); $db = Db::name($this->table)->order('id desc');
foreach (['action', 'content', 'username'] as $key) { foreach (['action', 'content', 'username'] as $key) {
if (isset($get[$key]) && $get[$key] !== '') { (isset($get[$key]) && $get[$key] !== '') && $db->whereLike($key, "%{$get[$key]}%");
$db->where($key, 'like', "%{$get[$key]}%");
}
} }
if (isset($get['date']) && $get['date'] !== '') { if (isset($get['date']) && $get['date'] !== '') {
list($start, $end) = explode('-', str_replace(' ', '', $get['date'])); list($start, $end) = explode('-', str_replace(' ', '', $get['date']));

View File

@ -95,13 +95,14 @@ class Menu extends BasicAdmin
$current_path = "-{$vo['pid']}-{$vo['id']}"; $current_path = "-{$vo['pid']}-{$vo['id']}";
if ($vo['pid'] !== '' && (stripos("{$menu['path']}-", "{$current_path}-") !== false || $menu['path'] === $current_path)) { if ($vo['pid'] !== '' && (stripos("{$menu['path']}-", "{$current_path}-") !== false || $menu['path'] === $current_path)) {
unset($menus[$key]); unset($menus[$key]);
continue;
} }
} }
} }
// 读取系统功能节点 // 读取系统功能节点
$nodes = NodeService::get(); $nodes = NodeService::get();
foreach ($nodes as $key => $_vo) { foreach ($nodes as $key => $node) {
if (empty($_vo['is_menu'])) { if (empty($node['is_menu'])) {
unset($nodes[$key]); unset($nodes[$key]);
} }
} }

View File

@ -40,8 +40,12 @@ class Node extends BasicAdmin
*/ */
public function index() public function index()
{ {
$alert = [
'type' => 'danger',
'title' => '操作安全警告(默认新节点所有人可以访问,请勾选登录控制)',
'content' => '结构为系统自动生成,其权限各选项直接影响到不同权限用户的访问及操作,请勿随意修改数据!'
];
$nodes = ToolsService::arr2table(NodeService::get(), 'node', 'pnode'); $nodes = ToolsService::arr2table(NodeService::get(), 'node', 'pnode');
$alert = ['type' => 'danger', 'title' => '安全警告', 'content' => '结构为系统自动生成, 状态数据请勿随意修改!'];
return view('', ['title' => '系统节点管理', 'nodes' => $nodes, 'alert' => $alert]); return view('', ['title' => '系统节点管理', 'nodes' => $nodes, 'alert' => $alert]);
} }
@ -51,9 +55,8 @@ class Node extends BasicAdmin
public function save() public function save()
{ {
if ($this->request->isPost()) { if ($this->request->isPost()) {
$post = $this->request->post(); list($data, $post) = [[], $this->request->post()];
if (isset($post['list'])) { if (isset($post['list'])) {
$data = [];
foreach ($post['list'] as $vo) { foreach ($post['list'] as $vo) {
$data['node'] = $vo['node']; $data['node'] = $vo['node'];
$data[$vo['name']] = $vo['value']; $data[$vo['name']] = $vo['value'];

View File

@ -43,9 +43,7 @@ class User extends BasicAdmin
$get = $this->request->get(); $get = $this->request->get();
$db = Db::name($this->table)->where(['is_deleted' => '0']); $db = Db::name($this->table)->where(['is_deleted' => '0']);
foreach (['username', 'phone', 'mail'] as $key) { foreach (['username', 'phone', 'mail'] as $key) {
if (isset($get[$key]) && $get[$key] !== '') { (isset($get[$key]) && $get[$key] !== '') && $db->whereLike($key, "%{$get[$key]}%");
$db->where($key, 'like', "%{$get[$key]}%");
}
} }
if (isset($get['date']) && $get['date'] !== '') { if (isset($get['date']) && $get['date'] !== '') {
list($start, $end) = explode('-', str_replace(' ', '', $get['date'])); list($start, $end) = explode('-', str_replace(' ', '', $get['date']));
@ -88,11 +86,12 @@ class User extends BasicAdmin
$this->assign('verify', false); $this->assign('verify', false);
return $this->_form($this->table, 'pass'); return $this->_form($this->table, 'pass');
} }
$data = $this->request->post(); $post = $this->request->post();
if ($data['password'] !== $data['repassword']) { if ($post['password'] !== $post['repassword']) {
$this->error('两次输入的密码不一致!'); $this->error('两次输入的密码不一致!');
} }
if (DataService::save($this->table, ['id' => $data['id'], 'password' => md5($data['password'])], 'id')) { $data = ['id' => $post['id'], 'password' => md5($post['password'])];
if (DataService::save($this->table, $data, 'id')) {
$this->success('密码修改成功,下次请使用新密码登录!', ''); $this->success('密码修改成功,下次请使用新密码登录!', '');
} }
$this->error('密码修改失败,请稍候再试!'); $this->error('密码修改失败,请稍候再试!');
@ -110,7 +109,7 @@ class User extends BasicAdmin
} }
if (isset($data['id'])) { if (isset($data['id'])) {
unset($data['username']); unset($data['username']);
} elseif (Db::name($this->table)->where(['username' => $data['username']])->find()) { } elseif (Db::name($this->table)->where(['username' => $data['username']])->count() > 0) {
$this->error('用户账号已经存在,请使用其它账号!'); $this->error('用户账号已经存在,请使用其它账号!');
} }
} else { } else {

View File

@ -1,11 +1,10 @@
{extend name="extra@admin/content"} {extend name="extra@admin/content"}
{block name="content"} {block name="content"}
<form onsubmit="return false;" action="__SELF__" data-auto="true" method="post" <form onsubmit="return false;" action="__SELF__" data-auto="true" method="post" class='form-horizontal layui-form' style='padding-top:20px'>
class='form-horizontal layui-form' style='padding-top:20px'>
<div class="form-group"> <div class="form-group">
<label class="col-sm-2 control-label">Storage <span class="nowrap">(存储引擎)</span></label> <label class="col-sm-2 control-label label-required">Storage <span class="nowrap">(存储引擎)</span></label>
<div class='col-sm-8'> <div class='col-sm-8'>
<label class="think-radio"> <label class="think-radio">
<!--{if sysconf('storage_type') eq 'local'}--> <!--{if sysconf('storage_type') eq 'local'}-->
@ -111,11 +110,10 @@
</div> </div>
<div class="form-group" data-storage-type="local"> <div class="form-group" data-storage-type="local">
<label class="col-sm-2 control-label">Allow <span class="nowrap">(允许类型)</span></label> <label class="col-sm-2 control-label">AllowExts <span class="nowrap">(允许类型)</span></label>
<div class='col-sm-8'> <div class='col-sm-8'>
<input type="text" name="storage_local_exts" required="required" <input type="text" name="storage_local_exts" required="required" value="{:sysconf('storage_local_exts')}"
title="请输入系统文件上传后缀" placeholder="请输入系统文件上传后缀" title="请输入系统文件上传后缀" placeholder="请输入系统文件上传后缀" class="layui-input">
value="{:sysconf('storage_local_exts')}" class="layui-input">
<p class="help-block">设置系统允许上传文件的后缀多个以英文逗号隔开。如png,jpg,rar,doc</p> <p class="help-block">设置系统允许上传文件的后缀多个以英文逗号隔开。如png,jpg,rar,doc</p>
</div> </div>
</div> </div>
@ -123,9 +121,8 @@
<div class="form-group" data-storage-type="qiniu"> <div class="form-group" data-storage-type="qiniu">
<label class="col-sm-2 control-label">Bucket <span class="nowrap">(空间名称)</span></label> <label class="col-sm-2 control-label">Bucket <span class="nowrap">(空间名称)</span></label>
<div class='col-sm-8'> <div class='col-sm-8'>
<input type="text" name="storage_qiniu_bucket" required="required" <input type="text" name="storage_qiniu_bucket" required="required" value="{:sysconf('storage_qiniu_bucket')}"
title="请输入七牛云存储 Bucket (空间名称)" placeholder="请输入七牛云存储 Bucket (空间名称)" title="请输入七牛云存储 Bucket (空间名称)" placeholder="请输入七牛云存储 Bucket (空间名称)" class="layui-input">
value="{:sysconf('storage_qiniu_bucket')}" class="layui-input">
<p class="help-block">填写七牛云存储空间名称static</p> <p class="help-block">填写七牛云存储空间名称static</p>
</div> </div>
</div> </div>
@ -133,9 +130,8 @@
<div class="form-group" data-storage-type="qiniu"> <div class="form-group" data-storage-type="qiniu">
<label class="col-sm-2 control-label">Domain <span class="nowrap">(访问域名)</span></label> <label class="col-sm-2 control-label">Domain <span class="nowrap">(访问域名)</span></label>
<div class='col-sm-8'> <div class='col-sm-8'>
<input type="text" name="storage_qiniu_domain" required="required" <input type="text" name="storage_qiniu_domain" required="required" value="{:sysconf('storage_qiniu_domain')}"
title="请输入七牛云存储 Domain (访问域名)" placeholder="请输入七牛云存储 Domain (访问域名)" title="请输入七牛云存储 Domain (访问域名)" placeholder="请输入七牛云存储 Domain (访问域名)" class="layui-input">
value="{:sysconf('storage_qiniu_domain')}" class="layui-input">
<p class="help-block">填写七牛云存储访问域名static.ctolog.cc</p> <p class="help-block">填写七牛云存储访问域名static.ctolog.cc</p>
</div> </div>
</div> </div>
@ -143,9 +139,8 @@
<div class="form-group" data-storage-type="qiniu"> <div class="form-group" data-storage-type="qiniu">
<label class="col-sm-2 control-label">AccessKey <span class="nowrap">(访问密钥)</span></label> <label class="col-sm-2 control-label">AccessKey <span class="nowrap">(访问密钥)</span></label>
<div class='col-sm-8'> <div class='col-sm-8'>
<input type="text" name="storage_qiniu_access_key" required="required" <input type="text" name="storage_qiniu_access_key" required="required" value="{:sysconf('storage_qiniu_access_key')}"
title="请输入七牛云 AccessKey (访问密钥)" placeholder="请输入七牛云 AccessKey (访问密钥)" title="请输入七牛云 AccessKey (访问密钥)" placeholder="请输入七牛云 AccessKey (访问密钥)" class="layui-input">
value="{:sysconf('storage_qiniu_access_key')}" class="layui-input">
<p class="help-block">可以在 [ 七牛云 > 个人中心 ] 设置并获取到访问密钥</p> <p class="help-block">可以在 [ 七牛云 > 个人中心 ] 设置并获取到访问密钥</p>
</div> </div>
</div> </div>
@ -154,9 +149,8 @@
<div class="form-group" data-storage-type="qiniu"> <div class="form-group" data-storage-type="qiniu">
<label class="col-sm-2 control-label">SecretKey <span class="nowrap">(安全密钥)</span></label> <label class="col-sm-2 control-label">SecretKey <span class="nowrap">(安全密钥)</span></label>
<div class='col-sm-8'> <div class='col-sm-8'>
<input type="password" name="storage_qiniu_secret_key" required="required" <input type="password" name="storage_qiniu_secret_key" required="required" value="{:sysconf('storage_qiniu_secret_key')}" maxlength="43"
title="请输入七牛云 SecretKey (安全密钥)" placeholder="请输入七牛云 SecretKey (安全密钥)" title="请输入七牛云 SecretKey (安全密钥)" placeholder="请输入七牛云 SecretKey (安全密钥)" class="layui-input">
value="{:sysconf('storage_qiniu_secret_key')}" maxlength="43" class="layui-input">
<p class="help-block">可以在 [ 七牛云 > 个人中心 ] 设置并获取到安全密钥</p> <p class="help-block">可以在 [ 七牛云 > 个人中心 ] 设置并获取到安全密钥</p>
</div> </div>
</div> </div>
@ -186,9 +180,8 @@
<div class="form-group" data-storage-type="oss"> <div class="form-group" data-storage-type="oss">
<label class="col-sm-2 control-label">Bucket <span class="nowrap">(空间名称)</span></label> <label class="col-sm-2 control-label">Bucket <span class="nowrap">(空间名称)</span></label>
<div class='col-sm-8'> <div class='col-sm-8'>
<input type="text" name="storage_oss_bucket" required="required" <input type="text" name="storage_oss_bucket" required="required" value="{:sysconf('storage_oss_bucket')}"
title="请输入AliOSS Bucket (空间名称)" placeholder="请输入AliOSS Bucket (空间名称)" title="请输入AliOSS Bucket (空间名称)" placeholder="请输入AliOSS Bucket (空间名称)" class="layui-input">
value="{:sysconf('storage_oss_bucket')}" class="layui-input">
<p class="help-block">填写OSS存储空间名称static</p> <p class="help-block">填写OSS存储空间名称static</p>
</div> </div>
</div> </div>
@ -196,9 +189,8 @@
<div class="form-group" data-storage-type="oss"> <div class="form-group" data-storage-type="oss">
<label class="col-sm-2 control-label">Domain <span class="nowrap">(访问域名)</span></label> <label class="col-sm-2 control-label">Domain <span class="nowrap">(访问域名)</span></label>
<div class='col-sm-8'> <div class='col-sm-8'>
<input type="text" name="storage_oss_domain" required="required" <input type="text" name="storage_oss_domain" required="required" value="{:sysconf('storage_oss_domain')}"
title="请输入AliOSS存储 Domain (访问域名)" placeholder="请输入AliOSS存储 Domain (访问域名)" title="请输入AliOSS存储 Domain (访问域名)" placeholder="请输入AliOSS存储 Domain (访问域名)" class="layui-input">
value="{:sysconf('storage_oss_domain')}" class="layui-input">
<p class="help-block">填写OSS存储外部访问域名static.ctolog.cc</p> <p class="help-block">填写OSS存储外部访问域名static.ctolog.cc</p>
</div> </div>
</div> </div>
@ -206,9 +198,8 @@
<div class="form-group" data-storage-type="oss"> <div class="form-group" data-storage-type="oss">
<label class="col-sm-2 control-label">AccessKey <span class="nowrap">(访问密钥)</span></label> <label class="col-sm-2 control-label">AccessKey <span class="nowrap">(访问密钥)</span></label>
<div class='col-sm-8'> <div class='col-sm-8'>
<input type="text" name="storage_oss_keyid" required="required" <input type="text" name="storage_oss_keyid" required="required" value="{:sysconf('storage_oss_keyid')}" maxlength="16"
title="请输入16位AliOSS AccessKey (访问密钥)" placeholder="请输入AliOSS AccessKey (访问密钥)" title="请输入16位AliOSS AccessKey (访问密钥)" placeholder="请输入AliOSS AccessKey (访问密钥)" class="layui-input">
value="{:sysconf('storage_oss_keyid')}" maxlength="16" class="layui-input">
<p class="help-block">可以在 [ 阿里云 > 个人中心 ] 设置并获取到访问密钥</p> <p class="help-block">可以在 [ 阿里云 > 个人中心 ] 设置并获取到访问密钥</p>
</div> </div>
</div> </div>
@ -217,9 +208,8 @@
<div class="form-group" data-storage-type="oss"> <div class="form-group" data-storage-type="oss">
<label class="col-sm-2 control-label">SecretKey <span class="nowrap">(安全密钥)</span></label> <label class="col-sm-2 control-label">SecretKey <span class="nowrap">(安全密钥)</span></label>
<div class='col-sm-8'> <div class='col-sm-8'>
<input type="password" name="storage_oss_secret" required="required" <input type="password" name="storage_oss_secret" required="required" value="{:sysconf('storage_oss_secret')}" maxlength="30"
title="请输入30位AliOSS SecretKey (安全密钥)" placeholder="请输入AliOSS SecretKey (安全密钥)" title="请输入30位AliOSS SecretKey (安全密钥)" placeholder="请输入AliOSS SecretKey (安全密钥)" class="layui-input">
value="{:sysconf('storage_oss_secret')}" maxlength="30" class="layui-input">
<p class="help-block">可以在 [ 阿里云 > 个人中心 ] 设置并获取到安全密钥</p> <p class="help-block">可以在 [ 阿里云 > 个人中心 ] 设置并获取到安全密钥</p>
</div> </div>
</div> </div>
@ -239,7 +229,6 @@
<script> <script>
(function () { (function () {
window.form.render(); window.form.render();
buildForm('{:sysconf("storage_type")}'); buildForm('{:sysconf("storage_type")}');
$('[name=storage_type]').on('click', function () { $('[name=storage_type]').on('click', function () {
buildForm($('[name=storage_type]:checked').val()) buildForm($('[name=storage_type]:checked').val())

View File

@ -1,41 +0,0 @@
{extend name="extra@admin/content"}
{block name="content"}
<form onsubmit="return false;" action="__SELF__" data-auto="true" method="post" class='form-horizontal layui-form' style='padding-top:20px'>
<div class="form-group">
<label class="col-sm-2 control-label">State <span class="nowrap">(账号状态)</span></label>
<div class='col-sm-8'>
<input disabled class="layui-input layui-bg-gray" value="{if $result.code}短信剩余 {$result.num}{else}{$result.msg}{/if}">
<p class="help-block">肋通SMS接口状态若短信剩余条数不足时请提前充值。</p>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Username <span class="nowrap">(平台账号)</span></label>
<div class='col-sm-8'>
<input type="text" name="sms_username" required="required" value="{:sysconf('sms_username')}"
title="请输入助通SMS接口平台账号" placeholder="请输入助通SMS接口平台账号" class="layui-input">
<p class="help-block">助通SMS接口平台账号平台管理 <a target="_blank" href="http://client.ztsms.cn">登录平台</a></p>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Password <span class="nowrap">(平台密码)</span></label>
<div class='col-sm-8'>
<input type="password" name="sms_password" required="required" value="{:sysconf('sms_password')}"
title="请输入助通SMS接口平台密码" placeholder="请输入助通SMS接口平台密码" class="layui-input">
<p class="help-block">助通SMS接口平台密码需要在助通平台修改。</p>
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="col-sm-4 col-sm-offset-2">
<div class="layui-form-item text-center">
<button class="layui-btn" type="submit">保存配置</button>
</div>
</div>
</form>
{/block}

View File

@ -66,5 +66,5 @@
<button class="layui-btn" type='submit'>保存数据</button> <button class="layui-btn" type='submit'>保存数据</button>
<button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗?" data-close>取消编辑</button> <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗?" data-close>取消编辑</button>
</div> </div>
<script>window.form.render();</script>
</form> </form>

View File

@ -2,11 +2,11 @@
{block name="button"} {block name="button"}
<div class="nowrap pull-right" style="margin-top:10px"> <div class="nowrap pull-right" style="margin-top:10px">
<button data-modal='{:url("$classuri/add")}' data-title="添加用户" class='layui-btn layui-btn-small'><i <button data-modal='{:url("$classuri/add")}' data-title="添加用户" class='layui-btn layui-btn-small'>
class='fa fa-plus'></i> 添加用户 <i class='fa fa-plus'></i> 添加用户
</button> </button>
<button data-update data-field='delete' data-action='{:url("$classuri/del")}' <button data-update data-field='delete' data-action='{:url("$classuri/del")}' class='layui-btn layui-btn-small layui-btn-danger'>
class='layui-btn layui-btn-small layui-btn-danger'><i class='fa fa-remove'></i> 删除用户 <i class='fa fa-remove'></i> 删除用户
</button> </button>
</div> </div>
{/block} {/block}
@ -61,13 +61,13 @@
<th class='list-table-check-td'> <th class='list-table-check-td'>
<input data-none-auto="" data-check-target='.list-check-box' type='checkbox'/> <input data-none-auto="" data-check-target='.list-check-box' type='checkbox'/>
</th> </th>
<th class='text-left'>用户账号</th> <th class='text-left nowrap'>用户名</th>
<th class='text-left'>手机号</th> <th class='text-left nowrap'>手机号</th>
<th class='text-left'>电子邮箱</th> <th class='text-left nowrap'>电子邮箱</th>
<th class='text-left'>登录次数</th> <th class='text-left nowrap'>登录次数</th>
<th class='text-left'>最后登录</th> <th class='text-left nowrap'>最后登录</th>
<th class='text-left'>状态</th> <th class='text-left nowrap'>状态</th>
<th class='text-left'>操作</th> <th class='text-left nowrap'>操作</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>