diff --git a/app/admin/controller/Index.php b/app/admin/controller/Index.php index 09147f5..9bce943 100644 --- a/app/admin/controller/Index.php +++ b/app/admin/controller/Index.php @@ -22,7 +22,6 @@ use app\admin\model\Article; use app\admin\model\Cunsult; use think\facade\Config; use taoler\com\Api; -use taoser\SetArr; use app\common\lib\facade\HttpHelper; class Index extends AdminController @@ -123,21 +122,22 @@ class Index extends AdminController } //版本检测 - public function getVersion() - { - $verCheck = Api::urlPost($this->sys['upcheck_url'],['pn'=>$this->pn,'ver'=>$this->sys_version]); - if($verCheck->code !== -1){ - return $verCheck->code ? "有{$verCheck->up_num}个版本需更新,当前可更新至{$verCheck->version}" : $verCheck->msg; - } else { - return lang('No new messages'); - } - } +// public function getVersion() +// { +// $verCheck = Api::urlPost($this->sys['upcheck_url'],['pn'=>$this->pn,'ver'=>$this->sys_version]); +// if($verCheck->code !== -1){ +// return $verCheck->code ? "有{$verCheck->up_num}个版本需更新,当前可更新至{$verCheck->version}" : $verCheck->msg; +// } else { +// return lang('No new messages'); +// } +// } public function checkVersion() { - $verCheck = Api::urlPost($this->sys['upcheck_url'],['pn'=>$this->pn,'ver'=>$this->sys_version]); - if($verCheck->code !== -1){ - return $verCheck->code ? "有{$verCheck->up_num}个版本需更新,当前可更新至{$verCheck->version}" : $verCheck->msg; + $data = ['pn'=>$this->pn,'ver'=>$this->sys_version]; + $response = HttpHelper::withHost()->get('/v1/upload/check', $data)->toJson(); + if($response->code !== -1){ + return $response->code ? "有{$response->up_num}个版本需更新,当前可更新至{$response->version}" : $response->msg; } else { return lang('No new messages'); } diff --git a/app/admin/controller/Login.php b/app/admin/controller/Login.php index 4a9b055..79faded 100644 --- a/app/admin/controller/Login.php +++ b/app/admin/controller/Login.php @@ -1,4 +1,13 @@ + * @Copyright (c) 2020~2023 https://www.aieok.com All rights reserved. + */ + namespace app\admin\controller; use think\facade\View; @@ -8,10 +17,9 @@ use app\admin\validate\Admin; use think\exception\ValidateException; use app\common\controller\AdminController; - class Login extends AdminController { - //登录 + // 登录 public function index() { if(Request::isAjax()){ @@ -37,7 +45,7 @@ class Login extends AdminController public function reg() { if(Session::has('admin_id')){ - return redirect('/admin/index/index'); + return redirect('index/index'); } return View::fetch('reg'); @@ -47,7 +55,7 @@ class Login extends AdminController public function forget() { if(Session::has('admin_id')){ - return redirect('/admin/index/index'); + return redirect('index/index'); } return View::fetch('forget'); diff --git a/app/admin/controller/addon/Addons.php b/app/admin/controller/addon/Addons.php index d6f1a5a..7e478ac 100644 --- a/app/admin/controller/addon/Addons.php +++ b/app/admin/controller/addon/Addons.php @@ -19,27 +19,89 @@ use app\common\lib\FileHelper; class Addons extends AdminController { /** + * 浏览插件 * */ public function index() { - if(Request::isAjax()) { - $data = Request::param(); - if(!isset($data['type'])) $data['type'] = 'onlineAddons'; - if(!isset($data['selector'])) $data['selector'] = 'all'; - return $this->getList($data); - } +// if(Request::isAjax()) { +// $data = Request::param(); +// if(!isset($data['type'])) $data['type'] = 'onlineAddons'; +// if(!isset($data['selector'])) $data['selector'] = 'all'; +// return $this->getList($data); +// } return View::fetch(); } + /** + * 插件动态列表 + * @param $data + * @return Json + */ + public function list() + { + $param = Request::param(); + $data = ['page' => $param['page'] ?? 1, 'limit' => $param['limit'] ?? 10, 'type' => $param['type'] ?? 'all']; + $res = []; + //本地插件列表 + $localAddons = Files::getDirName('../addons/'); + + if($data['type'] == 'installed') { + $count = count($localAddons); // 安装总数 + // 已安装 + if ($count) { + $res = ['code' => 0, 'msg' => 'ok', 'count' => $count]; + // 数组分组 + $arr = array_chunk($localAddons, $data['limit']); + // 选中的页码数组 + $arrAddon = $arr[$data['page'] - 1]; + // $data数据 + foreach ($arrAddon as $k => $v) { + $info_file = '../addons/' . $v . '/info.ini'; + $info = parse_ini_file($info_file); + $info['show'] = $info['status'] ? '启用' : '禁用'; + $info['install'] = $info['status'] ? '是' : '否'; + $res['data'][] = $info; + } + return json($res); + } + return json(['code' => -1, 'msg' => '没有安装任何插件']); + } + + // 在线插件 + $response = HttpHelper::withHost()->get('/v1/addonlist', $data); + $addons = $response->toJson(); + + if($response->ok()) { + $res = ['code' => 0, 'msg' => 'ok', 'count' => $addons->count]; + // $data数据 与本地文件对比 + foreach($addons->data as $v){ + if(in_array($v->name, $localAddons)) { + $info = get_addons_info($v->name); + //已安装 + $v->isInstall = 1; + //判断是否有新版本 + if($v->version > $info['version']) $v->have_newversion = 1; + $v->price = $v->price ? $v->price : '免费'; + } + $res['data'][] = $v; + }; + return json($res); + } + return json(['code' => -1, 'msg' => '未获取到服务器信息']); + } + /** * 插件动态列表 * @param $data * @return Json */ - public function getList($data) + public function getList() { + $data = Request::param(); + if(!isset($data['type'])) $data['type'] = 'onlineAddons'; + if(!isset($data['selector'])) $data['selector'] = 'all'; $res = []; //本地插件列表 $addonsList = Files::getDirName('../addons/'); diff --git a/app/admin/controller/addon/Template.php b/app/admin/controller/addon/Template.php index 2481cec..226e999 100644 --- a/app/admin/controller/addon/Template.php +++ b/app/admin/controller/addon/Template.php @@ -1,4 +1,13 @@ + * @Copyright (c) 2020~2023 https://www.aieok.com All rights reserved. + */ + namespace app\admin\controller\addon; use app\common\controller\AdminController; @@ -9,7 +18,6 @@ class Template extends AdminController public function index() { - // return View::fetch(); } } \ No newline at end of file diff --git a/app/admin/controller/content/Cate.php b/app/admin/controller/content/Cate.php index 3c97548..8d4bbe7 100644 --- a/app/admin/controller/content/Cate.php +++ b/app/admin/controller/content/Cate.php @@ -1,16 +1,26 @@ + * @Copyright (c) 2020~2023 https://www.aieok.com All rights reserved. + */ namespace app\admin\controller\content; use app\common\controller\AdminController; -use app\common\model\Cate as CateModel; -use app\common\model\Article; use think\facade\View; use think\facade\Request; use think\facade\Db; use think\facade\Cache; use taoler\com\Files; use app\common\lib\Msgres; +use app\common\model\Article; +use app\common\model\Cate as CateModel; + + class Cate extends AdminController { diff --git a/app/admin/controller/content/Comment.php b/app/admin/controller/content/Comment.php index ac5d949..d0cabf7 100644 --- a/app/admin/controller/content/Comment.php +++ b/app/admin/controller/content/Comment.php @@ -1,23 +1,29 @@ + * @Copyright (c) 2020~2023 https://www.aieok.com All rights reserved. + */ namespace app\admin\controller\content; use app\common\controller\AdminController; -use app\common\model\Cate; -use app\common\model\Comment as CommentModel; -use app\common\model\Article; use think\facade\View; use think\facade\Request; use think\facade\Db; -use think\facade\Cache; -use taoler\com\Files; -use app\common\lib\Msgres; -use think\response\Json; +use app\common\model\Comment as CommentModel; + + class Comment extends AdminController { - - + /** + * 浏览 + * @return string + */ public function index() { return View::fetch(); @@ -68,7 +74,16 @@ class Comment extends AdminController foreach($replys as $k => $v){ $url = $this->getRouteUrl($v['cid'],$v['ename'], $v['appname']); //$res['data'][] = ['id'=>$v['id'],'replyer'=>$v->user->name,'cardid'=>$v->article->title,'avatar'=>$v->user->user_img,'content'=>$v['content'],'replytime'=>$v['create_time']]; - $res['data'][] = ['id'=>$v['aid'],'replyer'=>$v['name'],'title'=>htmlspecialchars($v['title']),'avatar'=>$v['user_img'],'content'=>htmlspecialchars($v['content']),'replytime'=>date("Y-m-d",$v['create_time']),'check'=>$v['astatus'],'url'=>$url]; + $res['data'][] = [ + 'id'=>$v['aid'], + 'replyer'=>$v['name'], + 'title'=>htmlspecialchars($v['title']), + 'avatar'=>$v['user_img'], + 'content'=>htmlspecialchars($v['content']), + 'replytime'=>date("Y-m-d",$v['create_time']), + 'check'=>$v['astatus'], + 'url'=>$url + ]; } } else { $res = ['code'=>-1,'msg'=>'没有查询结果!']; diff --git a/app/admin/controller/content/Forum.php b/app/admin/controller/content/Forum.php index dca752b..813779e 100644 --- a/app/admin/controller/content/Forum.php +++ b/app/admin/controller/content/Forum.php @@ -1,10 +1,16 @@ + * @Copyright (c) 2020~2023 https://www.aieok.com All rights reserved. + */ namespace app\admin\controller\content; use app\common\controller\AdminController; -use app\common\model\Cate; -use app\common\model\Comment; use app\common\model\Article; use think\facade\View; use think\facade\Request; @@ -14,6 +20,7 @@ use taoler\com\Files; use app\common\lib\Msgres; use think\response\Json; + class Forum extends AdminController { /** @@ -86,7 +93,19 @@ class Forum extends AdminController $res['count'] = $count; foreach($forumList as $k=>$v){ $url = $this->getRouteUrl($v['aid'],$v['ename'],$v['appname']); - $res['data'][]= ['id'=>$v['aid'],'poster'=>$v['name'],'avatar'=>$v['user_img'],'title'=>htmlspecialchars($v['title']),'url'=>$url,'content'=>htmlspecialchars($v['content']),'posttime'=>date("Y-m-d",$v['update_time']),'top'=>$v['is_top'],'hot'=>$v['is_hot'],'reply'=>$v['is_reply'],'check'=>$v['status']]; + $res['data'][]= [ + 'id'=>$v['aid'], + 'poster'=>$v['name'], + 'avatar'=>$v['user_img'], + 'title'=>htmlspecialchars($v['title']), + 'url' => $url, + 'content' => strip_tags($v['content']), + 'posttime'=>date("Y-m-d",$v['update_time']), + 'top'=>$v['is_top'], + 'hot'=>$v['is_hot'], + 'reply'=>$v['is_reply'], + 'check'=>$v['status'] + ]; } } else { $res = ['code'=>-1,'msg'=>'没有查询结果!']; diff --git a/app/admin/controller/system/Admin.php b/app/admin/controller/system/Admin.php index 707e06a..95edcde 100644 --- a/app/admin/controller/system/Admin.php +++ b/app/admin/controller/system/Admin.php @@ -165,7 +165,6 @@ class Admin extends AdminController if(Request::isAjax()){ $user = $this->model->select($ids); $result = $user->delete(); - if($result){ return json(['code'=>0,'msg'=>'删除成功']); }else{ diff --git a/app/admin/controller/system/AuthGroup.php b/app/admin/controller/system/AuthGroup.php index c876663..e16dd8e 100644 --- a/app/admin/controller/system/AuthGroup.php +++ b/app/admin/controller/system/AuthGroup.php @@ -1,8 +1,16 @@ + * @Copyright (c) 2020~2023 https://www.aieok.com All rights reserved. + */ + namespace app\admin\controller\system; use app\common\controller\AdminController; -use app\admin\model\Admin as adminModel; use think\facade\View; use think\facade\Request; use think\facade\Db; @@ -10,9 +18,11 @@ use think\exception\ValidateException; use app\admin\model\AuthGroup as AuthGroupModel; use app\admin\model\AuthGroupAccess; use app\admin\model\AuthRule as AuthRuleModel; +use app\admin\model\Admin as adminModel; use LDAP\Result; use think\Response; + class AuthGroup extends AdminController { /** diff --git a/app/admin/controller/system/AuthRule.php b/app/admin/controller/system/AuthRule.php index 900f04f..1f52639 100644 --- a/app/admin/controller/system/AuthRule.php +++ b/app/admin/controller/system/AuthRule.php @@ -1,4 +1,13 @@ + * @Copyright (c) 2020~2023 https://www.aieok.com All rights reserved. + */ + namespace app\admin\controller\system; use app\common\controller\AdminController; diff --git a/app/admin/controller/system/Menu.php b/app/admin/controller/system/Menu.php index 68c2f4f..8c78b3d 100644 --- a/app/admin/controller/system/Menu.php +++ b/app/admin/controller/system/Menu.php @@ -1,4 +1,13 @@ + * @Copyright (c) 2020~2023 https://www.aieok.com All rights reserved. + */ + namespace app\admin\controller\system; use app\common\controller\AdminController; @@ -21,7 +30,7 @@ class Menu extends AdminController $auth = new Auth(); $menu = []; $rule = Session::has('ruleTable') ? Session::get('ruleTable') : 'auth_rule'; - $auth_rule_list = Db::name($rule)->field('id,pid,title,icon,name,sort,ismenu')->where(['status'=> 1, 'ismenu'=>1, 'delete_time'=> 0])->select(); + $auth_rule_list = Db::name($rule)->field('id,pid,title,icon,name,sort,ismenu')->where(['status'=> 1, 'delete_time'=> 0])->select(); foreach ($auth_rule_list as $v) { if ($auth->check($v['name'], $this->aid) || $this->aid == 1) { $menu[] = [ @@ -30,12 +39,14 @@ class Menu extends AdminController 'icon' => 'layui-icon ' . $v['icon'], 'href' => (string) url($v['name']), 'pid' => $v['pid'], - 'sort' => $v['sort'] + 'sort' => $v['sort'], + 'ismenu' => $v['ismenu'] ]; } } $nav = $this->getTrees($menu); + // 初始化控制台 $nav[] = [ 'id' => 500, @@ -106,7 +117,7 @@ class Menu extends AdminController // //$v['children'][$m]['type'] = 1; // //$v['children'][$m]['openType'] = '_iframe'; // } - $v['type'] = $v['pid'] == 0 ? 0 : $v['ismenu']; + $v['type'] = $v['ismenu']; $v['children'] = $child; } else { // 没有子菜单type=1 diff --git a/app/admin/controller/system/Set.php b/app/admin/controller/system/Set.php index c88c49f..a91f78e 100644 --- a/app/admin/controller/system/Set.php +++ b/app/admin/controller/system/Set.php @@ -4,10 +4,11 @@ * @Date: 2021-12-06 16:04:50 * @LastEditTime: 2022-07-24 11:06:14 * @LastEditors: TaoLer - * @Description: 搜索引擎SEO优化设置 + * @Description: 设置 * @FilePath: \TaoLer\app\admin\controller\Set.php * Copyright (c) 2020~2022 http://www.aieok.com All rights reserved. */ + namespace app\admin\controller\system; use app\common\controller\AdminController; diff --git a/app/admin/controller/system/Upgrade.php b/app/admin/controller/system/Upgrade.php index 1332561..2575c17 100644 --- a/app/admin/controller/system/Upgrade.php +++ b/app/admin/controller/system/Upgrade.php @@ -1,5 +1,11 @@ + * @Copyright (c) 2020~2023 https://www.aieok.com All rights reserved. * 升级包规定的目录结构 * xxx_版本号.zip(如:xxx_1.0.0.zip) * | @@ -27,6 +33,7 @@ use app\common\lib\SqlFile; use app\common\lib\Zip; use taoser\SetArr; + class Upgrade extends AdminController { protected $root_dir = "../"; //站点代码的根目录 diff --git a/app/admin/controller/user/User.php b/app/admin/controller/user/User.php index 9be48ab..1ca202c 100644 --- a/app/admin/controller/user/User.php +++ b/app/admin/controller/user/User.php @@ -1,15 +1,23 @@ + * @Copyright (c) 2020~2023 https://www.aieok.com All rights reserved. + */ namespace app\admin\controller\user; use app\common\controller\AdminController; -use app\admin\validate\Admin; use think\facade\View; use think\facade\Request; use think\facade\Db; use app\common\model\User as UserModel; use app\common\lib\Uploads; + class User extends AdminController { @@ -29,7 +37,10 @@ class User extends AdminController if(Request::isAjax()){ $datas = Request::only(['id','name','email','sex','status']); $map = array_filter($datas,[$this,'filtrArr']); - $user = Db::name('user')->where(['delete_time'=>0])->where($map)->order('id desc')->paginate(30); + $user = Db::name('user')->where(['delete_time'=>0])->where($map)->order('id desc')->paginate([ + 'list_rows' => input('limit'), + 'page' => input('page') + ]); $count = $user->total(); $res = []; if($count){ diff --git a/app/admin/controller/user/Vip.php b/app/admin/controller/user/Vip.php index 55cc67a..c45d2ee 100644 --- a/app/admin/controller/user/Vip.php +++ b/app/admin/controller/user/Vip.php @@ -1,4 +1,13 @@ + * @Copyright (c) 2020~2023 https://www.aieok.com All rights reserved. + */ + namespace app\admin\controller\user; use app\common\controller\AdminController; @@ -15,7 +24,7 @@ class Vip extends AdminController return View::fetch(); } - //显示VIP规则 + // VIP列表 public function list() { $keys = UserViprule::select(); diff --git a/app/admin/model/Admin.php b/app/admin/model/Admin.php index 50b17b5..8cdeee4 100644 --- a/app/admin/model/Admin.php +++ b/app/admin/model/Admin.php @@ -1,4 +1,12 @@ + * @Copyright (c) 2020~2023 https://www.aieok.com All rights reserved. + */ namespace app\admin\model; diff --git a/app/admin/model/AuthRule.php b/app/admin/model/AuthRule.php index 9b299c4..6e04fc8 100644 --- a/app/admin/model/AuthRule.php +++ b/app/admin/model/AuthRule.php @@ -1,4 +1,12 @@ + * @Copyright (c) 2020~2023 https://www.aieok.com All rights reserved. + */ namespace app\admin\model; diff --git a/app/admin/model/System.php b/app/admin/model/System.php index cb45d18..d6646c7 100644 --- a/app/admin/model/System.php +++ b/app/admin/model/System.php @@ -1,11 +1,18 @@ + * @Copyright (c) 2020~2023 https://www.aieok.com All rights reserved. + */ namespace app\admin\model; use think\Model; use think\facade\Cache; - class System extends Model { diff --git a/app/admin/view/addon/addons/config.html b/app/admin/view/addon/addons/config.html index 16a9ee9..ace9911 100644 --- a/app/admin/view/addon/addons/config.html +++ b/app/admin/view/addon/addons/config.html @@ -1,5 +1,11 @@ -{extend name="public/base" /} -{block name="body"} + + + + + 新增管理员 + + +
{foreach name="formData" item="vo" key="k"} @@ -54,32 +60,30 @@
-{/block} -{block name="js"} + + + -{/block} \ No newline at end of file + + \ No newline at end of file diff --git a/app/admin/view/addon/addons/index.html b/app/admin/view/addon/addons/index.html index d9d47ed..3f4d15a 100644 --- a/app/admin/view/addon/addons/index.html +++ b/app/admin/view/addon/addons/index.html @@ -2,107 +2,202 @@ - 用户管理 + 插件管理 - -
+
-
- - - - - -
-
- {include file="public/user_login" /} - - - - //事件 - var active = { - add: function(){ - layer.open({ - type: 2 - ,title: '添加插件' - ,content: 'add.html' - ,area: ['400px', '300px'] + + + + + + + + {include file="public/user_login" /} + + + + - + + \ No newline at end of file diff --git a/app/admin/view/addon/addons/pay.html b/app/admin/view/addon/addons/pay.html index ddd88cb..64316c4 100644 --- a/app/admin/view/addon/addons/pay.html +++ b/app/admin/view/addon/addons/pay.html @@ -1,69 +1,75 @@ -{extend name="public/base" /} - -{block name="body"} + + + + + 支付 + + - -
- -
-
- 授权 -
-
-
-
-

订单标题:{$orderData.subject}

-

订单编号:{$orderData.out_trade_no}

-

订单价格:¥{$orderData.total_amount}

-
-
-
-
-
-
+ +
+
+
+ 授权 +
-
-
不支持退款
-
-
软件协议:本软件为原作者拥有版权权限,购买软件可以商用,禁止第三方出售行为。
+
+
+

订单标题:{$orderData.subject}

+

订单编号:{$orderData.out_trade_no}

+

订单价格:¥{$orderData.total_amount}

+
+
+
+
+
+
+
+
+
不支持退款
+
+
软件协议:本软件为原作者拥有版权权限,购买软件可以商用,禁止出售第三方行为。
+
+
+
+
+ +
+
+

请使用支付宝扫一扫
扫描二维码进行支付

+
+
-
-
- -
-
-

请使用支付宝扫一扫
扫描二维码进行支付

-
-
-
-
-{/block} -{block name="js"} - -{/block} \ No newline at end of file + + + + + \ No newline at end of file diff --git a/app/admin/view/system/admin/index.html b/app/admin/view/system/admin/index.html index 8820401..2d7daf1 100644 --- a/app/admin/view/system/admin/index.html +++ b/app/admin/view/system/admin/index.html @@ -262,7 +262,6 @@ } window.remove = function(obj) { - layer.confirm('确定要删除该用户', { icon: 3, title: '提示' diff --git a/app/admin/view/system/auth_rule/index.html b/app/admin/view/system/auth_rule/index.html index c44eec3..bea3c5a 100644 --- a/app/admin/view/system/auth_rule/index.html +++ b/app/admin/view/system/auth_rule/index.html @@ -5,241 +5,241 @@ 权限管理 - -
-
-
-
-
+ +
+
+
+
+
- + - + - + - + - + - - - + + - + + + table.on('toolbar(power-table)', function(obj){ + if(obj.event === 'add'){ + window.add(); + } else if(obj.event === 'refresh'){ + window.refresh(); + } else if(obj.event === 'batchRemove'){ + window.batchRemove(obj); + } else if(obj.event === 'expandAll'){ + treetable.expandAll("#power-table"); + } else if(obj.event === 'foldAll'){ + treetable.foldAll("#power-table"); + } + }); + + form.on('switch(rule-enable)', function(obj) { + layer.tips(this.value + ' ' + this.name + ':' + obj.elem.checked, obj.othis); + var status = obj.elem.checked ? 1 : -1; + //执行用户审核 + $.ajax({ + type:'post', + url: RULES_ENABLE, + data:{"id":this.value,"status":status}, + dataType:'json', + success:function(res){ + if(res.code === 0){ + layer.msg(res.msg,{ + icon:res.icon, + time:2000 + } + //,function(){location.reload();} + ); + } else { + layer.open({ + title:'审核失败', + content:res.msg, + icon:5, + adim:6 + }) + } + } + }); + return false; + }); + + window.add = function(){ + layer.open({ + type: 2, + title: '新增', + shade: 0.1, + area: ['450px', '500px'], + content: 'add.html' + }); + } + + window.edit = function(obj){ + console.log(obj.data.powerId) + layer.open({ + type: 2, + title: '修改', + shade: 0.1, + area: ['450px', '500px'], + content: 'edit.html?id=' + obj.data.powerId + }); + } + window.remove = function(obj){ + layer.confirm('确定要删除该权限', {icon: 3, title:'提示'}, function(index){ + layer.close(index); + let loading = layer.load(); + $.ajax({ + url: RULES_DELETE+"?id="+obj.data['powerId'], + dataType:'json', + type:'delete', + success:function(result){ + layer.close(loading); + if(result.code === 0){ + layer.msg(result.msg,{icon:1,time:1000},function(){ + obj.del(); + }); + }else{ + layer.msg(result.msg,{icon:2,time:1000}); + } + } + }) + }); + } + + window.batchRemove = function(obj) { + let data = table.checkStatus(obj.config.id).data; + if (data.length === 0) { + layer.msg("未选中数据", { + icon: 3, + time: 1000 + }); + return false; + } + let ids = ""; + for (let i = 0; i < data.length; i++) { + ids += data[i].powerId + ","; + } + ids = ids.substr(0, ids.length - 1); + layer.confirm('确定要删除这些权限', { + icon: 3, + title: '提示' + }, function(index) { + layer.close(index); + let loading = layer.load(); + $.ajax({ + url: MODULE_PATH + "batchRemove/" + ids, + dataType: 'json', + type: 'delete', + success: function(result) { + layer.close(loading); + if (result.success) { + layer.msg(result.msg, { + icon: 1, + time: 1000 + }, function() { + table.reload('user-table'); + }); + } else { + layer.msg(result.msg, { + icon: 2, + time: 1000 + }); + } + } + }) + }); + } + }) + + \ No newline at end of file diff --git a/app/admin/view/system/upgrade/index.html b/app/admin/view/system/upgrade/index.html index 3fc97d6..747853b 100644 --- a/app/admin/view/system/upgrade/index.html +++ b/app/admin/view/system/upgrade/index.html @@ -23,7 +23,7 @@
{else /}
- +
diff --git a/app/admin/view/user/user/index.html b/app/admin/view/user/user/index.html index dfadef0..f0bcc0c 100644 --- a/app/admin/view/user/user/index.html +++ b/app/admin/view/user/user/index.html @@ -235,7 +235,8 @@ title: '刷新', layEvent: 'refresh', icon: 'layui-icon-refresh', - }, 'filter', 'print', 'exports'] + }, 'filter', 'print', 'exports'], + limit: 10 }); table.on('tool(user-table)', function(obj) { @@ -303,7 +304,7 @@ data:{"id":data.id,"auth":auth}, dataType:'json', success:function(data){ - if(data.code == 0){ + if(data.code === 0){ layer.msg(data.msg,{ icon:6, time:2000 diff --git a/public/static/component/pear/module/addons.js b/public/static/component/pear/module/addons.js index d19b3f8..913eca3 100644 --- a/public/static/component/pear/module/addons.js +++ b/public/static/component/pear/module/addons.js @@ -1,78 +1,73 @@ //网站app版本发布 -layui.define(["table", "form", "upload","notify",'toast'], function (exports) { - var $ = layui.jquery, - table = layui.table, - form = layui.form, - upload = layui.upload; - var notify = layui.notify; - var toast = layui.toast; - var layer = layui.layer; +layui.define(["table", "form",'toast','common'], function (exports) { + var $ = layui.jquery, table = layui.table, form = layui.form; + let toast = layui.toast; + let layer = layui.layer; + let common = layui.common; - //渲染表格 - table.render({ - elem: "#addons-list", - toolbar: "#toolbar", - defaultToolbar: [], - url: addonList, - cols: [[ - {type: 'checkbox'}, - {title: '序号', type: 'numbers'}, - {field: 'title', title: '插件', width: 200}, - {field: 'description', title: '简介', minWidth: 200}, - {field: 'author', title: '作者', width: 100}, - {field: 'price', title: '价格(元)', width: 85}, - {field: 'downloads', title: '下载', width: 70}, - {field: 'version', title: '版本', templet: '
{{d.version}} {{# if(d.have_newversion == 1){ }}{{# } }}
', width: 75}, - {field: 'status', title: '在线', width: 70}, - {title: '操作', width: 165, align: 'center', toolbar: '#addons-tool'} - ]], - page: true, - limit: 15, - height: "full-220", - text: "对不起,加载出现异常!", - }); - - // 重载数据 - var addonReload = function (type,selector) { - $.ajax({ - type: "post", - url: addonList, - data: { type: type, selector: selector }, - dataType: "json", - success: function (res) { - //渲染表格 - table.reload('addons-list',{ - url: addonList, - where: { - type: type, selector: selector - }, - cols: [res["col"]], - }); - }, - }); - } - - //头工具栏事件 - table.on("toolbar(addons-list)", function (obj) { - var checkStatus = table.checkStatus(obj.config.id); - var url = $(this).data(url); - - switch (obj.event) { - case "installed": - addonReload("installed","all"); - break; - case "allAddons": - addonReload("onlineAddons","all"); - break; - case "freeAddons": - addonReload("onlineAddons","free"); - break; - case "payAddons": - addonReload("onlineAddons","pay"); - break; - } - }); + // 渲染表格 + // table.render({ + // elem: "#addons-list", + // toolbar: "#toolbar", + // defaultToolbar: [], + // url: addonList, + // cols: [[ + // {type: 'checkbox'}, + // {title: '序号', type: 'numbers'}, + // {field: 'title', title: '插件', width: 200}, + // {field: 'description', title: '简介', minWidth: 200}, + // {field: 'author', title: '作者', width: 100}, + // {field: 'price', title: '价格(元)', width: 85}, + // {field: 'downloads', title: '下载', width: 70}, + // {field: 'version', title: '版本', templet: '
{{d.version}} {{# if(d.have_newversion == 1){ }}{{# } }}
', width: 75}, + // {field: 'status', title: '在线', width: 70}, + // {title: '操作', width: 165, align: 'center', toolbar: '#addons-bar'} + // ]], + // page: true, + // limit: 15, + // text: "对不起,加载出现异常!", + // }); + // + // // 重载数据 + // var addonReload = function (type,selector) { + // $.ajax({ + // type: "post", + // url: addonList, + // data: { type: type, selector: selector }, + // dataType: "json", + // success: function (res) { + // //渲染表格 + // table.reload('addons-list',{ + // url: addonList, + // where: { + // type: type, selector: selector + // }, + // cols: [res["col"]], + // }); + // }, + // }); + // } + // + // //头工具栏事件 + // table.on("toolbar(addons-list)", function (obj) { + // var checkStatus = table.checkStatus(obj.config.id); + // + // switch (obj.event) { + // case "installed": + // addonReload("installed","all"); + // break; + // case "allAddons": + // addonReload("onlineAddons","all"); + // break; + // case "freeAddons": + // addonReload("onlineAddons","free"); + // break; + // case "payAddons": + // addonReload("onlineAddons","pay"); + // break; + // } + // }); var api = { userinfo: { @@ -92,6 +87,7 @@ layui.define(["table", "form", "upload","notify",'toast'], function (exports) { //监听工具条 table.on("tool(addons-list)", function (obj) { + var data = obj.data; var event = obj.event; var url = $(this).data('url') @@ -100,15 +96,14 @@ layui.define(["table", "form", "upload","notify",'toast'], function (exports) { var install = function (data,url,userLoginUrl,userIsPayUrl){ var userinfo = api.userinfo.get(); // 检测权限 if(userinfo) { - layer.confirm("确认安装吗?", "vcenter",function(){ - var index = layer.load(1); + layer.confirm("确认安装吗?", "vcenter",function(index){ $.post(url, { name: data.name, version: data.version, uid: userinfo.uid, token: userinfo.token }, function (res) { // 需要支付 if (res.code === -2) { layer.close(index); layer.open({ type: 2, - area: ['55%', '75%'], + area: [common.isModile()?'100%':'800px', common.isModile()?'100%':'600px'], fixed: false, //不固定 maxmin: true, content: 'pay.html'+ "?id=" + data.id+ "&name=" + data.name + "&version=" + data.version + "&uid=" + userinfo.uid + "&price=" + data.price, @@ -130,13 +125,11 @@ layui.define(["table", "form", "upload","notify",'toast'], function (exports) { if (res.code === 0) { layer.close(index); toast.success({title:"安装成功",message:res.msg,position: 'topRight'}); - //notify.success(res.msg, "topRight"); } // 安装失败 if (res.code === -1) { layer.close(index); toast.error({title:"安装失败",message:res.msg,position: 'topRight'}); - //notify.error(res.msg, "topRight"); } // 重载 table.reloadData("addons-list",{},'deep'); @@ -166,7 +159,6 @@ layui.define(["table", "form", "upload","notify",'toast'], function (exports) { }; if (!data.name || !data.password) { toast.error({title:"安装失败",message:'Account Or Password Cannot Empty',position: 'topRight'}); - //notify.error('Account Or Password Cannot Empty'); return false; } $.ajax({ @@ -177,16 +169,12 @@ layui.define(["table", "form", "upload","notify",'toast'], function (exports) { toast.success({title:"登录成功",message:res.msg,position: 'topRight'}, function (){ location.reload(); }); - // notify.success("登录成功", function (){ - // location.reload(); - // }); } else { toast.warning({title:"警告消息",message:res.msg}); - //notify.alert(res.msg); + } }, error: function (res) { toast.error({title:"登录失败",message:res.msg,position: 'topRight'}); - //notify.error(res.msg); } }) }, @@ -210,19 +198,17 @@ layui.define(["table", "form", "upload","notify",'toast'], function (exports) { // 卸载插件 if (event === "uninstall") { - notify.confirm("确认框", "vcenter",function() { - var index = layer.load(1); + layer.confirm("是否卸载?", "vcenter",function(index) { $.post(url, { name: data.name }, function (res) { if (res.code === 0) { toast.success({title:"卸载成功",message:res.msg,position: 'topRight'}); - //notify.success(res.msg, "topRight"); } else { toast.error({title:"卸载失败",message:res.msg,position: 'topRight'}); - //notify.error(res.msg, "topRight"); } }); - table.reload("addons-list"); layer.close(index); + table.reload("addons-list"); + }); } @@ -232,7 +218,6 @@ layui.define(["table", "form", "upload","notify",'toast'], function (exports) { // 无配置项拦截 if (res.code === -1) { toast.warning({title:"警告消息",message:res.msg,position: 'topRight'}) - //notify.alert(res.msg); return false; } layer.open({ @@ -256,10 +241,8 @@ layui.define(["table", "form", "upload","notify",'toast'], function (exports) { success: function (res) { if (res.code === 0) { toast.success({title:"成功消息",message:res.msg,position: 'topRight'}); - //notify.success(res.msg, "topRight"); } else { toast.error({title:"失败消息",message:res.msg,position: 'topRight'}); - //notify.error(res.msg, "topRight"); } }, });