规划插件目录

This commit is contained in:
taoser 2023-03-16 22:54:11 +08:00
parent e2096d3c22
commit 8546f94d3c
291 changed files with 1395 additions and 33202 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
/.idea
/.vscode
pay_order.php
*.log
.env

View File

@ -1,8 +1,10 @@
KeyAuth.php
Version.php
TimeLine.php
Plugins.php
App.php
AddonsMarket.php
ViewsMarket.php
/addonfactory
/addons
/apps
/server
/taocai
Apps.php

View File

@ -1,585 +0,0 @@
<?php
namespace app\admin\controller;
use app\common\controller\AdminController;
use app\common\lib\SqlFile;
use app\common\lib\Zip;
use think\Exception;
use think\facade\View;
use think\facade\Request;
use think\facade\Config;
use app\admin\model\AuthRule;
use app\admin\model\Addons as AddonsModel;
use think\response\Json;
use Symfony\Component\VarExporter\VarExporter;
use taoler\com\Files;
use app\common\lib\facade\HttpHelper;
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);
}
return View::fetch();
}
/**
* 插件动态列表
* @param $data
* @return Json
*/
public function getList($data)
{
$res = [];
//本地插件列表
$addonsList = Files::getDirName('../addons/');
$response = HttpHelper::withHost()->get('/v1/addons');
$addons = $response->toJson();
switch($data['type']){
//已安装
case 'installed':
if($addonsList){
$res = ['code'=>0,'msg'=>'','count'=>5];
$res['col'] = [
['type' => 'numbers'],
['field' => 'name','title'=> '插件', 'width'=> 120],
['field'=> 'title','title'=> '标题', 'width'=> 100],
['field'=> 'version','title'=> '版本', 'templet' => '<div>{{d.version}}</div>', 'width'=> 60],
['field' => 'author','title'=> '作者', 'width'=> 80],
['field' => 'description','title'=> '简介', 'minWidth'=> 200],
['field' => 'install','title'=> '安装', 'width'=> 100],
['field' => 'ctime','title'=> '到期时间', 'width'=> 100],
['field' => 'status','title'=> '状态', 'width'=> 95, 'templet' => '#buttonStatus'],
['title' => '操作', 'width'=> 150, 'align'=>'center', 'toolbar'=> '#addons-installed-tool']
];
// $data数据
foreach($addonsList as $v){
$info_file = '../addons/'.$v.'/info.ini';
$info = parse_ini_file($info_file);
$info['show'] = $info['status'] ? '启用' : '禁用';
$info['install'] = $info['status'] ? '是' : '否';
$res['data'][] = $info;
}
} else {
$res = ['code'=>-1,'msg'=>'没有安装任何插件'];
}
break;
//在线全部
case 'onlineAddons':
if($response->ok()) {
$res['code'] = 0;
$res['msg'] = '';
$res['count'] = count($addons->data);
$res['col'] = [
['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' => '<div>{{d.version}} {{# if(d.have_newversion == 1){ }}<span class="layui-badge-dot"></span>{{# } }}</div>','width'=> 75],
['field' => 'status','title'=> '在线', 'width'=> 70],
['title' => '操作', 'width'=> 150, 'align'=>'center', 'toolbar'=> '#addons-tool']
];
// $data数据 与本地文件对比
foreach($addons->data as $v){
switch ($data['selector']) {
case 'free':
if($v->price == 0) {
if(in_array($v->name,$addonsList)) {
$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;
}
break;
case 'pay':
if($v->price > 0) {
if(in_array($v->name,$addonsList)) {
$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;
}
break;
case 'all':
if(in_array($v->name,$addonsList)) {
$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;
break;
}
};
} else {
$res = ['code' => -1, 'msg' => '未获取到服务器信息'];
}
break;
}
return json($res);
}
/**
* 显示创建资源表单页.
*
* @return \think\Response
*/
public function add()
{
//添加版本
if(Request::isAjax()){
$data = Request::param();
$result = AddonsModel::create($data);
if($result){
$res = ['code'=>0,'msg'=>'添加成功'];
}else{
$res = ['code'=>-1,'msg'=>'添加失败'];
}
return json($res);
}
return View::fetch();
}
/**
* 上传插件文件zip
* @return Json
*/
public function uploadZip()
{
$id = Request::param();
$file = request()->file('file');
try {
validate(['file'=>'filesize:2048|fileExt:zip,rar,7z'])
->check(array($file));
$saveName = \think\facade\Filesystem::disk('public')->putFile('addons',$file);
} catch (\think\exception\ValidateException $e) {
return json(['code' => -1,'msg' => $e->getMessage()]);
}
$upload = Config::get('filesystem.disks.public.url');
if($saveName){
$name_path =str_replace('\\',"/",$upload.'/'.$saveName);
$res = ['code'=>0,'msg'=>'插件上传成功','src'=>$name_path];
} else {
$res = ['code'=>-1,'msg'=>'上传错误'];
}
return json($res);
}
/**
* 上传接口
*
* @return void
*/
public function uploads()
{
$type = Request::param('type');
return $this->uploadFiles($type);
}
/**
* 安装&升级,
* @param array $data
* @param bool $type true执行sql,false升级不执行sql
* @return Json
*/
public function install(array $data = [], bool $type = true)
{
$data = Request::only(['name','version','uid','token']) ?? $data;
// 接口
$response = HttpHelper::withHost()->post('/v1/getaddons',$data)->toJson();
if($response->code < 0) return json($response);
//版本判断,是否能够安装?
$addInstalledVersion = get_addons_info($data['name']);
if(!empty($addInstalledVersion)){
$verRes = version_compare($data['version'],$addInstalledVersion['version'],'>');
if(!$verRes){
return json(['code'=>-1,'msg'=>'不能降级,请选择正确版本']);
}
//$tpl_ver_res = version_compare($addInstalledVersion['template_version'], config('taoler.template_version'),'<');
}
$file_url = $response->addons_src;
//判断远程文件是否可用存在
$header = get_headers($file_url, true);
if(!isset($header[0]) && (strpos($header[0], '200') || strpos($header[0], '304'))){
return json(['code'=>-1,'msg'=>'获取远程文件失败']);
}
//把远程文件放入本地
//拼接路径
$addons_dir = FileHelper::getDirPath(root_path() . 'runtime' . DS . 'addons');
if(!is_dir($addons_dir)) Files::mkdirs($addons_dir);
$package_file = $addons_dir . $data['name'] . '.zip'; //升级的压缩包文件路径
$cpfile = copy($file_url, $package_file);
if(!$cpfile) return json(['code'=>-1,'msg'=>'下载升级文件失败']);
$uzip = new Zip();
$zipDir = strstr($package_file, '.zip',true); //返回文件名后缀前的字符串
$zipPath = FileHelper::getDirPath($zipDir); //转换为带/的路径 压缩文件解压到的路径
$unzip_res = $uzip->unzip($package_file, $zipPath, true);
if(!$unzip_res) return json(['code'=>-1,'msg'=>'解压失败']);
unlink($package_file);
//升级插件
//升级前的写入文件权限检查
$allUpdateFiles = Files::getAllFile($zipPath);
if (empty($allUpdateFiles)) return json(['code' => -1, 'msg' => '无可更新文件。']);
$checkString = '';
foreach ($allUpdateFiles as $updateFile) {
$coverFile = ltrim(str_replace($zipPath, '', $updateFile), DIRECTORY_SEPARATOR);
$dirPath = dirname('../'.$coverFile);
if (file_exists('../'.$coverFile)) {
if (!is_writable('../'.$coverFile)) $checkString .= $coverFile . '&nbsp;[<span class="text-red">' . '无写入权限' . '</span>]<br>';
} else {
if (!is_dir($dirPath)) @mkdir($dirPath, 0777, true);
if (!is_writable($dirPath)) $checkString .= $dirPath . '&nbsp;[<span class="text-red">' . '无写入权限' . '</span>]<br>';
}
}
if (!empty($checkString)) return json(['code' => -1, 'msg' => $checkString]);
try {
// 拷贝文件
FileHelper::copyDir(root_path() . 'runtime' . DS . 'addons' . DS . $data['name'] . DS, root_path());
// $type判断是安装还是升级
if($type) {
// 执行数据库
$sqlInstallFile = root_path(). 'addons' . DS . $data['name'] . DS . 'install.sql';
if(file_exists($sqlInstallFile)) {
SqlFile::dbExecute($sqlInstallFile);
}
}
//安装菜单
//$menu = get_addons_menu($data['name']);
$menuFile = app()->getRootPath() . 'addons' . DS . $data['name'] . DS . 'menu.php';
if(file_exists($menuFile)){
$menu = include $menuFile;
} else {
$menu = [];
}
if(!empty($menu)){
if(isset($menu['is_nav']) && $menu['is_nav'] == 1){
$pid = 0;
}else{
$pid = AuthRule::where('name','addons')->value('id');
}
$menu_arr[] = $menu['menu'];
$this->addAddonMenu($menu_arr, (int)$pid,1);
}
$class = get_addons_instance($data['name']);
//执行插件安装
$class->install();
set_addons_info($data['name'],['status' => 1,'install' => 1]);
} catch (\Exception $e) {
return json(['code'=>-1,'msg'=> $e->getMessage()]);
}
Files::delDirAndFile('../runtime/addons/'.$data['name'] . DS);
$msg = $type ? '插件安装成功!' : '插件升级成功!';
return json(['code' => 0, 'msg' => $msg]);
}
/**
* 卸载插件
* @param string $name
* @return Json
* @throws \Exception
*/
public function uninstall(string $name = '')
{
$name = input('name') ?? $name;
// 执行插件卸载
$class = get_addons_instance($name);
$class->uninstall();
// 卸载菜单
$menu = get_addons_menu($name);
if(!empty($menu)){
$menu_arr[] = $menu['menu'];
$this->delAddonMenu($menu_arr);
}
try {
//卸载插件数据库
$sqlUninstallFile = root_path().'addons/'.$name.'/uninstall.sql';
if(file_exists($sqlUninstallFile)) {
SqlFile::dbExecute($sqlUninstallFile);
}
// 插件addons下目录
$addonsDir = root_path() . 'addons' . DS . $name . DS;
// 插件管理后台目录
$admin_controller = app_path() . 'controller' . DS . $name . DS;
$admin_model = app_path() . 'model' . DS . $name . DS;
$admin_view = app_path() . 'view' . DS . $name . DS;
$admin_validate = app_path() . 'validate' . DS . $name . DS;
// 插件静态资源目录
$addon_public = public_path() . 'addons' . DS . $name . DS;
if(file_exists($addonsDir)) Files::delDir($addonsDir);
if(file_exists($admin_controller)) Files::delDir($admin_controller);
if(file_exists($admin_model)) Files::delDir($admin_model);
if(file_exists($admin_view)) Files::delDir($admin_view);
if(file_exists($admin_validate)) Files::delDir($admin_validate);
if(file_exists($addon_public)) Files::delDir($addon_public);
} catch (\Exception $e) {
return json(['code' => -1, 'msg' => $e->getMessage()]);
}
return json(['code' => 0, 'msg' => '插件卸载成功']);
}
/**
* 升级插件
* @return Json
* @throws \Exception
*/
public function upgrade()
{
$data = Request::only(['name','version','uid','token']);
// 获取配置信息
$config = get_addons_config($data['name']);
// 卸载插件
$class = get_addons_instance($data['name']);
$class->uninstall();
//$this->uninstall($data['name']);
// 卸载菜单
$menu = get_addons_menu($data['name']);
if(!empty($menu)){
$menu_arr[] = $menu['menu'];
$this->delAddonMenu($menu_arr);
}
try {
// 升级安装第二个type参数false为升级true安装
$res = $this->install($data,false);
// 升级sql
$sqlUpdateFile = root_path().'addons/'.$data['name'].'/update.sql';
if(file_exists($sqlUpdateFile)) {
SqlFile::dbExecute($sqlUpdateFile);
}
// 恢复配置
if(!empty($config)) {
set_addons_config($data['name'], $config);
}
// 写入版本号
set_addons_info($data['name'],['version' =>$data['version']]);
} catch (\Exception $e) {
return json(['code' => -1, 'msg' => $e->getMessage()]);
}
return $res;
}
/**
* 启用禁用插件
* @return Json
* @throws Exception
*/
public function status(){
$name = input('name');
$info = get_addons_info($name);
try{
$arr = ['status' => $info['status'] ? 0 :1];
set_addons_info($name,$arr);
$class = get_addons_instance($name);
if($arr['status']) {
$res = ['code'=>0,'msg'=>'启用成功'];
} else {
$res = ['code'=>0,'msg'=>'已被禁用'];
}
$info['status']==1 ?$class->enabled():$class->disabled();
} catch (\Exception $e) {
throw new Exception($e->getMessage());
}
return json($res);
}
/**
* 配置插件
* @param $name
* @return string|Json
* @throws \Exception
*/
public function config($name)
{
$name = input('name');
$config = get_addons_config($name);
if(empty($config)) return json(['code'=>-1,'msg'=>'无配置项!无需操作']);
if(Request::isAjax()){
$params = Request::param('params/a',[],'trim');
if ($params) {
foreach ($config as $k => &$v) {
if (isset($params[$k])) {
if ($v['type'] == 'array') {
$arr = [];
$params[$k] = is_array($params[$k]) ? $params[$k] :[];
foreach ($params[$k]['key'] as $kk=>$vv){
$arr[$vv] = $params[$k]['value'][$kk];
}
$params[$k] = $arr;
$value = $params[$k];
$v['content'] = $value;
$v['value'] = $value;
} else {
$value = $params[$k];
}
$v['value'] = $value;
}
}
unset($v);
set_addons_config($name,$config);
}
return json(['code'=>0,'msg'=>'配置成功!']);
}
//模板引擎初始化
$view = ['formData'=>$config,'title'=>'title'];
View::assign($view);
$configFile = root_path() . 'addons' . DS . $name . DS . 'config.html';
$viewFile = is_file($configFile) ? $configFile : '';
return View::fetch($viewFile);
}
/**
* 添加菜单
* @param array $menu
* @param int $pid
* @param int $type
* @return void
* @throws \Exception
*/
public function addAddonMenu(array $menu,int $pid = 0, int $type = 1)
{
foreach ($menu as $v){
$hasChild = isset($v['sublist']) && $v['sublist'] ? true : false;
try {
$v['pid'] = $pid;
$v['name'] = trim($v['name'],'/');
$v['type'] = $type;
$menu = AuthRule::withTrashed()->where('name',$v['name'])->find();
if($menu){
$menu->restore();
} else {
$menu = AuthRule::create($v);
}
if ($hasChild) {
$this->addAddonMenu($v['sublist'], $menu->id,$type);
}
} catch (\Exception $e) {
throw new \Exception($e->getMessage());
}
}
}
/**
* 循环删除菜单
* @param array $menu
* @param string $module
* @return void
* @throws \Exception
*/
public function delAddonMenu(array $menu,string $module = 'addon')
{
foreach ($menu as $k=>$v){
$hasChild = isset($v['sublist']) && $v['sublist'] ? true : false;
try {
$v['name'] = trim($v['name'],'/');
$menu_rule = AuthRule::withTrashed()->where('name',$v['name'])->find();
if(!is_null($menu_rule)){
$menu_rule->delete(true);
if ($hasChild) {
$this->delAddonMenu($v['sublist']);
}
}
} catch (\Exception $e) {
throw new \Exception($e->getMessage());
}
}
}
/**
* 用户登录
* @return mixed|Json
*/
public function userLogin()
{
$response = HttpHelper::withHost()->post('/v1/user/login', Request::param())->toJson();
return json($response);
}
/**
* 订单
* @return string|Json
*/
public function pay()
{
$data = Request::only(['id','name','version','uid','price']);
// $url = $this->getSystem()['api_url'].'/v1/createOrder';
// $order = Api::urlPost($url,$data);
$response = HttpHelper::withHost()->post('/v1/createOrder', $data);
if ($response->ok()) {
// $orderData = json_decode(json_encode($response->toJson()->data),TRUE);
View::assign('orderData',$response->toArray()['data']);
return View::fetch();
} else {
return json($response->toJson());
}
}
/**
* 支付查询
* @return Json
*/
public function isPay()
{
$param = Request::only(['name','userinfo']);
$data = [
'name'=>$param['name'],
'uid'=> $param['userinfo']['uid'],
];
$response = HttpHelper::withHost()->post('/v1/ispay', $data)->toJson();
return json($response);
}
}

View File

@ -1,211 +0,0 @@
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2019-10-15
* Time: 15:40
*/
namespace app\admin\controller;
use app\common\controller\AdminController;
use app\admin\validate\Admin as AdminValidate;
use app\admin\model\Admin as AdminModel;
use think\facade\View;
use think\facade\Request;
use think\facade\Db;
use think\facade\Session;
use think\facade\Cookie;
use think\exception\ValidateException;
use app\common\model\User as UserModel;
use taoler\com\Files;
class Admin extends AdminController
{
//管理员
public function index()
{
if(Request::isAjax()){
$data = Request::only(['id','username','mobile','email']);
$map = array_filter($data);
$admins = Db::name('admin')
->field('id,username,mobile,email,last_login_ip,status,last_login_time')
->where('delete_time',0)
->where($map)
->select();
$count = $admins->count();
if($count){
$res = ['code'=>0,'msg'=>'','count'=>$count];
foreach($admins as $k => $v){
$data = ['id'=>$v['id'],'loginname'=>$v['username'],'telphone'=>$v['mobile'],'email'=>$v['email'],'ip'=>$v['last_login_ip'],'check'=>$v['status'],'logintime'=>date("Y-m-d",$v['last_login_time'])];
$res['data'][] = $data;
}
} else {
$res = ['code'=>-1,'msg'=>'没有查询结果!'];
}
return json($res);
}
return View::fetch();
}
//管理员审核
public function check()
{
$data = Request::param();
//获取状态
$res = Db::name('admin')->where('id',$data['id'])->save(['status' => $data['status']]);
if($res){
if($data['status'] == 1){
return json(['code'=>0,'msg'=>'设置管理员通过','icon'=>6]);
} else {
return json(['code'=>0,'msg'=>'管理员已取消','icon'=>5]);
}
}else {
return json(['code'=>-1,'msg'=>'审核出错']);
}
}
//添加管理员
public function add()
{
if(Request::isAjax()){
$data = Request::param();
$data['create_time'] = time();
$salt = substr(md5($data['create_time']),-6);
$data['password'] = md5(substr_replace(md5($data['password']),$salt,0,6));
$data['status'] = 1;
//$adminId = Db::name('admin')->insertGetId($data);
$admin = Db::name('admin')->save($data);
//Db::name('auth_group_access')->insert(['uid'=>$adminId,'group_id'=>$data['auth_group_id']]);
if($admin){
$res = ['code'=>0,'msg'=>'添加成功'];
}else{
$res = ['code'=>-1,'msg'=>'添加失败'];
}
return json($res);
}
//$auth_group = Db::name('auth_group')->select();
//View::assign(['auth_group'=>$auth_group]);
return View::fetch();
}
//管理员编辑
public function edit($id)
{
$admin = AdminModel::find($id);
if(Request::isAjax()){
$data = Request::param();
if(empty($data['password'])){
unset($data['password']);
} else {
$t = strtotime($admin['create_time']);
$salt = substr(md5($t),-6);
$data['password'] = md5(substr_replace(md5($data['password']),$salt,0,6));
}
$data['update_time'] = time();
$result = $admin->update($data);
//Db::name('auth_group_access')->where('uid',$data['id'])->update(['group_id'=>$data['auth_group_id']]);
if($result){
$res = ['code'=>0,'msg'=>'编辑成功'];
}else{
$res = ['code'=>-1,'msg'=>'编辑失败'];
}
return json($res);
}
//$auth_group = Db::name('auth_group')->select();,'auth_group'=>$auth_group
View::assign(['admin'=>$admin]);
return View::fetch();
}
//删除管理员
public function delete($id)
{
if(Request::isAjax()){
$user =AdminModel::find($id);
$result = $user->delete();
if($result){
return json(['code'=>0,'msg'=>'删除成功']);
}else{
return json(['code'=>-1,'msg'=>'删除失败']);
}
}
}
//基本资料显示
public function info()
{
$admin = AdminModel::find(Session::get('admin_id'));
$auths = $admin->adminGroup;
$authname = [];
foreach($auths as $v){
$authname[] = $v->title;
}
$authGroupTitle = implode('|', $authname);
View::assign(['admin'=>$admin,'authGroupTitle'=>$authGroupTitle]);
return View::fetch('set/user/info');
}
//管理员资料更新
public function infoSet()
{
$admin = AdminModel::find(Session::get('admin_id'));
if(Request::isAjax()){
$data = Request::only(['nickname','sex','mobile','email','remarks']);
$result = $admin->save($data);
if($result){
$res = ['code'=>0,'msg'=>'更新成功'];
} else {
$res = ['code'=>-1,'msg'=>'更新失败'];
}
return json($res);
}
}
//显示改密码页面
public function repass()
{
$admin = AdminModel::find(Session::get('admin_id'));
View::assign('admin',$admin);
return View::fetch('set/user/repass');
}
//修改密码
public function repassSet()
{
if(Request::isAjax()){
$data = Request::only(['oldPassword','password','repassword']);
$data['admin_id'] = $this->aid;
$admin = new AdminModel;
$res = $admin->setpass($data);
return $res;
}
}
//清除缓存Cache
public function clearCache(){
$res = $this->clearSysCache();
if($res){
return json(['code'=>0,'msg'=>'清除缓存成功']);
} else {
return json(['code'=>-1,'msg'=>'清除缓存失败']);
}
}
//退出登陆
public function logout()
{
//清空缓存
Cookie::delete('adminAuth');
Session::clear();
return json(['code'=>0,'msg'=>'退出成功' ]);
}
}

View File

@ -1,147 +0,0 @@
<?php
namespace app\admin\controller;
use app\common\controller\AdminController;
use think\facade\View;
use think\facade\Request;
use think\facade\Db;
use think\exception\ValidateException;
use app\admin\model\AuthGroupAccess;
class AuthAccess extends AdminController
{
/**
protected function initialize()
{
parent::initialize();
}
*/
//用户组明细
public function index()
{
if(Request::isAjax()){
$data = Request::only(['uid']);
$map = array_filter($data);
//var_dump($map);
$groups = Db::name('auth_group_access')
->alias('c')
->join('admin a','c.uid = a.id')
->join('auth_group g','c.group_id = g.id')
->field('c.id as id,username,title,c.status as status')
->where(['c.status'=>1,'c.delete_time'=>0])
->where($map)
->select();
$count = $groups->count();
$res = [];
if($count){
$res = ['code'=>0,'msg'=>'','count'=>$count];
foreach($groups as $k => $v){
$data = ['id'=>$v['id'],'username'=>$v['username'],'title'=>$v['title'],'check'=>$v['status']];
$res['data'][] = $data;
}
} else {
$res = ['code'=>-1,'msg'=>'没有查询结果!'];
}
return json($res);
}
$admins = Db::name('admin')->field('id,username')->select();
View::assign('admins',$admins);
return View::fetch();
}
//角色添加
public function add()
{
if(Request::isAjax()){
$data = Request::only(['uid','group_id']);
//检测重复权限
$groups = Db::name('auth_group_access')->where('uid',$data['uid'])->column('group_id');
if(in_array($data['group_id'],$groups)){
$res = ['code'=>-1,'msg'=>'不能重复添加已存在权限'];
} else {
$result = AuthGroupAccess::create($data);
if($result) {
$res = ['code'=>0,'msg'=>'添加权限成功'];
} else {
$res = ['code'=>-1,'msg'=>'添加权限失败'];
}
}
return json($res);
}
$admins = Db::name('admin')->field('id,username')->where('delete_time',0)->select();
$auth_groups = Db::name('auth_group')->field('id,title')->select();
View::assign(['admins'=>$admins,'auth_groups'=>$auth_groups]);
return View::fetch();
}
//管理员权限编辑
public function edit()
{
$id = input('id');
if(Request::isAjax()){
$data = Request::only(['id','uid','group_id']);
//检测重复权限
$groups = Db::name('auth_group_access')->where('uid',$data['uid'])->column('group_id');
if(in_array($data['group_id'],$groups)){
$res = ['code'=>-1,'msg'=>'不能重复添加已存在权限'];
} else {
$result = AuthGroupAccess::where('id',$data['id'])->update(['uid'=>$data['uid'],'group_id'=>$data['group_id']]);
if($result){
$res = ['code'=>0,'msg'=>'编辑成功'];
} else {
$res = ['code'=>-1,'msg'=>'编辑失败'];
}
}
return json($res);
}
$access = Db::name('auth_group_access')->find($id);
$admins = Db::name('admin')->field('id,username')->where('delete_time',0)->select();
$auth_groups = Db::name('auth_group')->field('id,title')->select();
View::assign(['admins'=>$admins,'auth_groups'=>$auth_groups,'access'=>$access]);
return View::fetch();
}
//角色删除
public function delete($id)
{
if(Request::isAjax()){
$access = AuthGroupAccess::find($id);
$result = $access->delete();
if($result){
$res = ['code'=>0,'msg'=>'删除成功'];
}else{
$res = ['code'=>-1,'msg'=>'删除失败'];
}
return json($res);
}
}
//角色审核
public function check()
{
$data = Request::only(['id','status']);
//获取状态
$result = AuthGroupAccess::update($data);
if($result){
if($data['status'] == 1){
return json(['code'=>0,'msg'=>'开启权限','icon'=>6]);
} else {
return json(['code'=>0,'msg'=>'禁用权限','icon'=>5]);
}
}else {
return json(['code'=>-1,'msg'=>'权限执行出错']);
}
}
}

View File

@ -1,140 +0,0 @@
<?php
namespace app\admin\controller;
use app\common\controller\AdminController;
use app\admin\validate\Admin;
use app\admin\model\Admin as adminModel;
use think\facade\View;
use think\facade\Request;
use think\facade\Db;
use think\exception\ValidateException;
use app\admin\model\AuthGroup as AuthGroupModel;
use app\admin\model\AuthRule as AuthRuleModel;
class AuthGroup extends AdminController
{
/**
protected function initialize()
{
parent::initialize();
}
*/
//角色
public function list()
{
if(Request::isAjax()){
$data = Request::only(['id']);
$map = array_filter($data);
$role = Db::name('auth_group')->field('id,title,limits,descr,status')->where($map)->select();
$count = $role->count();
$res = [];
if($count){
$res = ['code'=>0,'msg'=>'','count'=>$count];
foreach($role as $k => $v){
$data = ['id'=>$v['id'],'rolename'=>$v['title'],'limits'=>$v['limits'],'descr'=>$v['descr'],'check'=>$v['status']];
$res['data'][] = $data;
}
} else {
$res = ['code'=>-1,'msg'=>'没有查询结果!'];
}
return json($res);
}
$roles = Db::name('auth_group')->field('id,title')->where('status',1)->select();
View::assign('roles',$roles);
return View::fetch('role');
}
//角色添加
public function roleAdd()
{
if(Request::isAjax()){
$data = Request::param();
$result = AuthGroupModel::create($data);
if($result) {
$res = ['code'=>0,'msg'=>'添加成功'];
} else {
$res = ['code'=>-1,'msg'=>'添加失败'];
}
return json($res);
}
$menus = $this->getMenus(1);
View::assign('menus',$menus);
return View::fetch('roleadd');
}
//角色编辑
public function roleEdit()
{
if(Request::isAjax()){
$data = Request::param();
/*
if(!strpos($data['rules'],'1,2,3,4,5'))
{
$data['rules'] = substr_replace($data['rules'],"1,2,3,4,5,",0,0);
}
*/
$rule = AuthGroupModel::update($data);
if($rule){
$res = ['code'=>0,'msg'=>'保存成功'];
} else {
$res = ['code'=>-1,'msg'=>'保存失败'];
}
return json($res);
}
$menus = $this->getMenus(1);
View::assign('menus',$menus);
$authGroup = AuthGroupModel::select();
$auth = AuthGroupModel::find(input('id'));
$ru = $auth->rules;
$rus = explode(',',$ru);
View::assign(['authGroup'=>$authGroup,'auth'=>$auth,'ru'=>$ru,'rus'=>$rus]);
return View::fetch('roleedit');
}
//角色删除
public function roleDel($id)
{
if(Request::isAjax()){
$role =AuthGroupModel::find($id);
$result = $role->delete();
if($result){
$res = ['code'=>0,'msg'=>'删除成功'];
}else{
$res = ['code'=>-1,'msg'=>'删除失败'];
}
return json($res);
}
}
//角色审核
public function check()
{
$data = Request::param();
//获取状态
$res = Db::name('auth_group')->where('id',$data['id'])->save(['status' => $data['status']]);
if($res){
if($data['status'] == 1){
return json(['code'=>0,'msg'=>'角色审核通过','icon'=>6]);
} else {
return json(['code'=>0,'msg'=>'禁用此角色','icon'=>5]);
}
}else {
return json(['code'=>-1,'msg'=>'审核出错']);
}
}
}

View File

@ -1,202 +0,0 @@
<?php
namespace app\admin\controller;
use app\common\controller\AdminController;
use think\App;
use think\facade\Request;
use think\facade\Db;
use think\facade\View;
use app\admin\model\AuthRule as AuthRuleModel;
class AuthRule extends AdminController
{
//
public function __construct(App $app)
{
parent::__construct($app);
$this->model = new AuthRuleModel();
}
/**
* 菜单列表
*/
public function index()
{
if(Request::isAjax()){
return $this->model->getAuthRuleTree();
}
return View::fetch();
}
/**
*权限树
* 支持获取三级菜单
*/
public function tree()
{
//$res = $this->treeTr($this->getMenus());
//var_dump($res);
$result = $this->getMenus(1);
$count = count($result);
$tree = [];
if($result){
$tree = ['code'=>0,'msg'=>'','count'=>$count];
$res = []; //auth_rule储存数据表中的表结构
foreach($result as $k => $v){
//第一层子权限
$children = [];
if(isset($v['children'])){
foreach($v['children'] as $m => $j){
//第二层子权限
$chichi = [];
if(isset($j['children'])){
//第三层子权限
foreach($j as $s){
if(isset($s['children'])){
$chichi[] = ['id'=>$s['id'],'title'=>$s['title'],'pid'=>$s['pid']]; //子数据的子数据
}
}
}
//if($j['level'] < 3){}
$children[] = ['id'=>$j['id'],'title'=>$j['title'],'pid'=>$j['pid'],'children'=>$chichi]; //子数据
}
}
$data[] = ['id'=>$v['id'],'title'=>$v['title'],'pid'=>$v['pid'],'children'=>$children];
}
//构造一个顶级菜单pid=0的数组。把权限放入顶级菜单下子权限中
$tree['data'][] = ['id'=>0,'title'=>'顶级','pid'=>0,'children'=>$data];
}
return json($tree);
}
//添加权限
public function add()
{
if(Request::isAjax()){
$data = Request::param();
//层级level
$plevel = Db::name('auth_rule')->field('level')->find($data['pid']);
if($plevel){
$data['level'] = $plevel['level']+1;
} else {
$data['level'] = 0;
}
return $this->model->saveRule($data);
}
$auth_rules = $this->model->getAuthRuleTree();
View::assign('AuthRule',$auth_rules);
return View::fetch();
}
//权限编辑
public function edit()
{
$rule = new AuthRuleModel();
if(Request::isAjax()){
$data = Request::param(['id','pid','title','name','icon','sort','ismenu']);
//层级level
$ruId = $rule->find($data['pid']); //查询出上级ID
if($ruId){
$plevel = $ruId->level; //上级level等级
$data['level'] = $plevel+1;
} else {
$data['level'] = 0;
}
$zi = $this->model->where('pid',$data['id'])->select();//查询出下级
if(!empty($zi)){
$zi->update(['level'=>$data['level']+1]);
}
$rule = $this->model->find($data['id']);
return $rule->saveRule($data);
}
$auth_rules = $this->model->getAuthRuleTree();
$rules = $this->model->find(input('id'));
View::assign(['AuthRule'=>$auth_rules,'rules'=>$rules]);
return View::fetch();
}
//权限开关
public function check()
{
$data = Request::param();
//获取状态
$res = Db::name('auth_rule')->where('id',$data['id'])->save(['status' => $data['status']]);
if($res){
if($data['status'] == 1){
return json(['code'=>0,'msg'=>'权限开启','icon'=>6]);
} else {
return json(['code'=>0,'msg'=>'权限禁用','icon'=>5]);
}
}else {
return json(['code'=>-1,'msg'=>'审核出错']);
}
}
//菜单显示控制
public function menuShow()
{
$data = Request::param();
$rules = Db::name('auth_rule')->save($data);
if($rules){
if($data['ismenu'] == 1){
return json(['code'=>0,'msg'=>'设置菜单显示','icon'=>6]);
} else {
return json(['code'=>0,'msg'=>'取消菜单显示','icon'=>5]);
}
}else{
$res = ['code'=>-1,'msg'=>'设置失败'];
}
return json($res);
}
//排序
public function sort()
{
$data = Request::param();
$rules = Db::name('auth_rule')->save($data);
if($rules){
$res = ['code'=>0,'msg'=>'排序成功'];
}else{
$res = ['code'=>-1,'msg'=>'排序失败'];
}
return json($res);
}
public function delete($id)
{
$pids = AuthRuleModel::where('pid',$id)->select();
if($pids)
{
$result = $pids->delete();
}
$rule = AuthRuleModel::find($id);
$result = $rule->delete();
if($result){
$res = ['code'=>0,'msg'=>'删除成功'];
} else {
$res = ['code'=>-1,'msg'=>'删除失败'];
}
return json($res);
}
}

View File

@ -1,102 +0,0 @@
<?php
namespace app\admin\controller;
use app\common\controller\AdminController;
use think\facade\Request;
use think\facade\View;
use think\facade\Config;
use phpspirit\databackup\BackupFactory;
use taoler\com\Files;
class Database extends AdminController
{
public function __construct()
{
parent::initialize();
$this->hostname = Config::get('database.connections.mysql.hostname');
$this->hostport = Config::get('database.connections.mysql.hostport');
$this->database = Config::get('database.connections.mysql.database');
$this->username = Config::get('database.connections.mysql.username');
$this->password = Config::get('database.connections.mysql.password');
$this->backdir = Config::get('taoler.databasebackdir');
}
public function index()
{
if(Request::isAjax()){
$backName = Files::getDirName($this->backdir);
if(empty($backName)){
return json(['code'=>-1,'msg'=>'还没有数据']);
}
$res['count'] = count($backName);
if($res['count']){
$res['code'] = 0;
$res['msg'] = '';
$res['data'] = [];
foreach($backName as $k=>$v){
$res['data'][] = ['id' => $k,
'time' => $v,
'name' => $v,
];
}
}
return json($res);
}
return View::fetch();
}
public function backup()
{
//自行判断文件夹
if (isset($_POST['backdir']) && $_POST['backdir'] != '') {
$backupdir = $_POST['backdir'];
} else {
$backupdir = $this->backdir . date('Ymdhis');
}
if (!is_dir($backupdir)) {
mkdir($backupdir, 0777, true);
}
$backup = BackupFactory::instance('mysql', "$this->hostname:$this->hostport", $this->database, $this->username, $this->password);
$result = $backup->setbackdir($backupdir)
->setvolsize(0.2)
->setonlystructure(false) //设置是否只备份目录结构
->settablelist() //设置要备份的表, 默认全部表
->setstructuretable()
->ajaxbackup($_POST);
echo json_encode($result);
}
//下载
public function down()
{
$id = input('id');
var_dump($id);
}
//删除备份文件夹
public function delete()
{
$name = input('name');
//var_dump($name);
$dir = $this->backdir . $name;
$res = Files::delDir($dir);
if($res){
return json(['code'=>0,'msg'=>'删除成功']);
} else {
return json(['code'=>-1,'msg'=>'删除失败']);
}
}
}

View File

@ -1,124 +0,0 @@
<?php
namespace app\admin\controller;
header('Content-Type:application/json; charset=utf-8');
use app\common\controller\AdminController;
use think\facade\View;
use AngularFilemanager\LocalBridge\FileManagerApi;
use AngularFilemanager\LocalBridge\Rest;
use taoler\com\Api;
include '../extend/AngularFilemanager/LocalBridge/Response.php';
include '../extend/AngularFilemanager/LocalBridge/Rest.php';
include '../extend/AngularFilemanager/LocalBridge/Translate.php';
include '../extend/AngularFilemanager/LocalBridge/FileManagerApi.php';
class FileManager extends AdminController
{
public function index()
{
return View::fetch();
}
public function handler()
{
$fileManagerApi = new FileManagerApi();
$rest = new Rest();
$rest->post([$fileManagerApi, 'postHandler'])
->get([$fileManagerApi, 'getHandler'])
->handle();
}
public function data()
{
$url = 'http://api.aieok.com/v1/handler';
/*
$data = json([
'action'=>'list',
'path'=> '/'
])->header([
'Cache-control' => 'no-cache,must-revalidate',
'Content-Type' => 'application/json'
]);
*/
$datas = [
'action'=>'list',
'path'=> '/'
];
$jsonStr = json_encode($datas);
list($returnCode, $returnContent) = $this->http_post_json($url, $jsonStr);
if($returnCode == 200){
$res = trim($returnContent,'"');
return json_decode($res);
}
//var_dump($data);
//$apiRes = Api::urlPost($url,$data);
//var_dump($apiRes);
//return $apiRes;
//$path = app()->getRootPath();
// var_dump($path);
//Listing (URL: fileManagerConfig.listUrl, Method: POST)
/*
$fileManagerApi = new FileManagerApi();
$file = $fileManagerApi->listActionData('/');
$data['result'] = $file;
*/
//$rest = new Rest('post');
//$rest->post([$fileManagerApi, 'postHandler'])
// ->get([$fileManagerApi, 'getHandler'])
// ->handle();
//$res = $fileManagerApi->postHandler([],['action'=>'list', 'path'=>'../'],'');
//$rest = new Rest();
//$rest->post([$fileManagerApi, 'postHandler'])
//->handle();
}
public function http_post_json($url, $jsonStr)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT, 20);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json; charset=utf-8',
)
);
curl_setopt($ch, CURLOPT_HEADER, 0); // ÏÔʾ·µ»ØµÄHeaderÇøÓòÄÚÈÝ
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonStr);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
return array($httpCode,$response);
}
}

View File

@ -1,588 +0,0 @@
<?php
namespace app\admin\controller;
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;
use think\facade\Db;
use think\facade\Cache;
use taoler\com\Files;
use app\common\lib\Msgres;
use think\response\Json;
class Forum extends AdminController
{
//帖子列表
public function list()
{
if(Request::isAjax()){
$data = Request::only(['id','name','title','sec']);
$where =array();
if (!empty($data['sec'])) {
switch ($data['sec']) {
case '1':
$data['a.status'] = 1;
break;
case '2':
$data['is_top'] = 1;
break;
case '3':
$data['is_hot'] = 1;
break;
case '4':
$data['is_reply'] = 0;
break;
case '5':
$data['a.status'] = -1;
break;
case '6':
$data['a.status'] = 0;
break;
}
}
unset($data['sec']);
unset($data['status']);
if(!empty($data['id'])){
$data['a.id'] = $data['id'];
unset($data['id']);
}
if(!empty($data['title'])){
$where[] = ['title', 'like', '%'.$data['title'].'%'];
unset($data['title']);
}
$map = array_filter($data,[$this,"filtr"]);
$forumList = Db::name('article')
->alias('a')
->join('user u','a.user_id = u.id')
->join('cate c','a.cate_id = c.id')
->field('a.id as aid,ename,appname,name,user_img,title,content,a.update_time as update_time,is_top,a.is_hot as is_hot,is_reply,a.status as status')
->where('a.delete_time',0)
->where($map)
->where($where)
->order('a.create_time', 'desc')
->paginate(15);
$res = [];
$count = $forumList->total();
if($count){
$res['code'] = 0;
$res['msg'] = '';
$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']];
}
} else {
$res = ['code'=>-1,'msg'=>'没有查询结果!'];
}
return json($res);
}
return View::fetch();
}
//删除帖子
public function listdel($id)
{
if(Request::isAjax()){
$arr = explode(",",$id);
foreach($arr as $v){
$article = Article::find($v);
$result = $article->together(['comments'])->delete();
}
if($result){
return json(['code'=>0,'msg'=>'删除成功']);
}else{
return json(['code'=>-1,'msg'=>'删除失败']);
}
}
}
/**
* 置顶、加精、评论开关,审核等状态管理
*
* @return Json
*/
public function check()
{
$param = Request::only(['id','name','value']);
$data = ['id'=>$param['id'],$param['name']=>$param['value']];
//获取状态
$res = Db::name('article')->save($data);
Cache::delete('article_'.$data['id']);
if($res){
return json(['code'=>0,'msg'=>'设置成功','icon'=>6]);
}else {
return json(['code'=>-1,'msg'=>'失败啦','icon'=>6]);
}
}
//帖子分类
public function tags()
{
$cate = new Cate();
if(Request::isAjax()){
return $cate->getList();
}
//详情模板
$sys = $this->getSystem();
$template = Files::getDirName('../view/'.$sys['template'].'/index/article/');
View::assign(['template'=>$template]);
return View::fetch();
}
// 应用下article/view模板
public function getAppNameView()
{
$appName = input('appname') ?: 'index';
$sys = $this->getSystem();
if(is_dir(root_path() . 'app' . DS . $appName . DS . 'view' . DS)){
$viewPath = root_path() . 'app' . DS . $appName . DS . 'view' . DS . 'article' . DS;
} elseif(is_dir(root_path() . 'view' . DS . $sys['template'] . DS)) {
$viewPath = root_path() . 'view' . DS . $sys['template'] . DS . 'index' . DS . 'article' . DS;
} else {
$viewPath = '';
}
$template = Files::getDirName($viewPath);
return json(['data' => $template]);
}
//添加和编辑帖子分类
public function tagsform()
{
$addOrEdit = !is_null(input('id'));//true是编辑false新增
$msg = $addOrEdit ? lang('edit') : lang('add');
if(Request::isAjax()) {
$data = Request::param();
if(isset($data['id']) && $data['pid'] == $data['id']) return json(['code'=>-1,'msg'=> $msg.'不能作为自己的子类']);
$list = Db::name('cate')->cache('catename')->save($data);
if($list){
return json(['code'=>0,'msg'=> $msg.'分类成功']);
}else{
return json(['code'=>-1,'msg'=> $msg.'分类失败']);
}
}
//详情模板
$sys = $this->getSystem();
$template = Files::getDirName('../view/'.$sys['template'].'/index/article/');
// 如果是新增pid=0,detpl默认第一个子模块如果是编辑查询出cate
$cate = $addOrEdit ? Db::name('cate')->field('detpl,pid,appname')->where(['delete_time' =>0])->find((int) input('id')) : ['pid'=>0,'detpl'=>$template[0],'appname'=>'index'];
// app下前台带模板的应用
$appArr = [];
if(is_dir(root_path() . 'app' . DS . 'home')) {
$appArr = ['index','home'];
} else {
$appArr = ['index'];
}
View::assign(['template'=>$template,'cate'=>$cate, 'appname' => $appArr]);
return View::fetch();
}
//删除帖子分类
public function tagsdelete()
{
if(Request::isAjax()){
$id = Request::param('id');
$cate = new Cate;
$result = $cate->del($id);
if($result == 1){
Cache::tag('catename')->clear();
return json(['code'=>0,'msg'=>'删除分类成功']);
}else{
return json(['code'=>-1,'msg'=>$result]);
}
}
}
//帖子评论
public function replys()
{
if(Request::isAjax()) {
$data = Request::only(['name','content','status']);
$map = array_filter($data);
$where = array();
if(!empty($map['content'])){
$where[] = ['a.content','like','%'.$map['content'].'%'];
unset($map['content']);
}
if(isset($data['status']) && $data['status'] !== '' ){
$where[] = ['a.status','=',(int)$data['status']];
unset($map['status']);
}
/*
$replys = Comment::field('id,article_id,user_id,content,create_time')->with([
'user' => function($query){
$query->field('id,name,user_img');
},
'article' => function($query){
$query->field('id,title');
}
])->paginate(15);
*/
$replys = Db::name('comment')
->alias('a')
->join('user u','a.user_id = u.id')
->join('article c','a.article_id = c.id')
->join('cate ca','c.cate_id = ca.id')
->field('a.id as aid,name,ename,appname,title,user_img,a.content as content,a.create_time as create_time,a.status as astatus,c.id as cid')
->where('a.delete_time',0)
->where($map)
->where($where)
->order('a.create_time', 'desc')
->paginate(15);
$count = $replys->total();
$res = [];
if ($count) {
$res = ['code'=>0,'msg'=>'','count'=>$count];
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];
}
} else {
$res = ['code'=>-1,'msg'=>'没有查询结果!'];
}
return json($res);
}
return View::fetch();
}
//评论编辑
public function replysform()
{
return View::fetch();
}
//评论删除
public function redel($id)
{
if(Request::isAjax()){
$comm =Comment::find($id);
$result = $comm->delete();
if($result){
return json(['code'=>0,'msg'=>'删除成功']);
}else{
return json(['code'=>-1,'msg'=>'删除失败']);
}
}
}
//评论审核
public function recheck()
{
$data = Request::param();
//获取状态
$res = Db::name('comment')->where('id',$data['id'])->save(['status' => $data['status']]);
if($res){
if($data['status'] == 1){
return json(['code'=>0,'msg'=>'评论审核通过','icon'=>6]);
} else {
return json(['code'=>0,'msg'=>'评论被禁止','icon'=>5]);
}
}else {
return json(['code'=>-1,'msg'=>'审核出错']);
}
}
//帖子分类开启热点
//评论审核
public function tagshot()
{
$data = Request::only(['id','is_hot']);
$cate = Db::name('cate')->save($data);
if($cate){
if($data['is_hot'] == 1){
return json(['code'=>0,'msg'=>'设置热点成功','icon'=>6]);
} else {
return json(['code'=>0,'msg'=>'取消热点显示','icon'=>5]);
}
}else{
$res = ['code'=>-1,'msg'=>'热点设置失败'];
}
return json($res);
}
//array_filter过滤函数
public function filtr($arr){
if($arr === '' || $arr === null){
return false;
}
return true;
}
/**
* 添加帖子文章
* @return string|\think\Response|\think\response\Json|void
*/
public function add()
{
if (Request::isAjax()) {
$data = Request::only(['cate_id', 'title', 'title_color', 'tiny_content', 'content', 'upzip', 'keywords', 'description', 'captcha']);
$tagId = input('tagid');
$data['user_id'] = 1; //管理员ID
// 调用验证器
$validate = new \app\common\validate\Article;
$result = $validate->scene('Artadd')->check($data);
if (true !== $result) {
return Msgres::error($validate->getError());
}
// 获取内容图片音视频标识
$iva= $this->hasIva($data['content']);
$data = array_merge($data,$iva);
// 处理内容
$data['content'] = $this->downUrlPicsReaplace($data['content']);
// 把,转换为,并去空格->转为数组->去掉空数组->再转化为带,号的字符串
$data['keywords'] = implode(',',array_filter(explode(',',trim(str_replace('',',',$data['keywords'])))));
// 获取分类ename,appname
$cateName = Db::name('cate')->field('ename,appname')->find($data['cate_id']);
$article = new Article();
$result = $article->add($data);
if ($result['code'] == 1) {
// 获取到的最新ID
$aid = $result['data']['id'];
//写入taglist表
$tagArr = [];
if(isset($tagId)) {
$tagIdArr = explode(',',$tagId);
foreach($tagIdArr as $tid) {
$tagArr[] = ['article_id'=>$aid,'tag_id'=>$tid,'create_time'=>time()];
}
}
Db::name('taglist')->insertAll($tagArr);
// 清除文章tag缓存
Cache::tag('tagArtDetail')->clear();
$link = $this->getRouteUrl((int)$aid, $cateName['ename'],$cateName['appname']);
// 推送给百度收录接口
$this->baiduPushUrl($link);
$url = $result['data']['status'] ? $link : (string)url('index/');
$res = Msgres::success($result['msg'], $url);
} else {
$res = Msgres::error('add_error');
}
return $res;
}
//1.查询分类表获取所有分类
$cateList = Db::name('cate')->where(['status'=>1,'delete_time'=>0])->order('sort','asc')->cache('catename',3600)->select();
//2.将catelist变量赋给模板 公共模板nav.html
View::assign('cateList',$cateList);
return View::fetch('add');
}
/**
* 编辑文章
* @param $id
* @return string|\think\Response|\think\response\Json|void
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function edit($id)
{
$article = Article::find($id);
if(Request::isAjax()){
$data = Request::only(['id','cate_id','title','title_color','content','upzip','keywords','description','captcha']);
$tagId = input('tagid');
//调用验证器
$validate = new \app\common\validate\Article();
$res = $validate->scene('Artadd')->check($data);
if(true !== $res){
return Msgres::error($validate->getError());
} else {
//获取内容图片音视频标识
$iva= $this->hasIva($data['content']);
$data = array_merge($data,$iva);
// 处理内容
$data['content'] = $this->downUrlPicsReaplace($data['content']);
// 把,转换为,并去空格->转为数组->去掉空数组->再转化为带,号的字符串
$data['keywords'] = implode(',',array_filter(explode(',',trim(str_replace('',',',$data['keywords'])))));
$result = $article->edit($data);
if($result == 1) {
//处理标签
$artTags = Db::name('taglist')->where('article_id',$id)->column('tag_id','id');
if(isset($tagId)) {
$tagIdArr = explode(',',$tagId);
foreach($artTags as $aid => $tid) {
if(!in_array($tid,$tagIdArr)){
//删除被取消的tag
Db::name('taglist')->delete($aid);
}
}
//查询保留的标签
$artTags = Db::name('taglist')->where('article_id',$id)->column('tag_id');
$tagArr = [];
foreach($tagIdArr as $tid) {
if(!in_array($tid, $artTags)){
//新标签
$tagArr[] = ['article_id'=>$data['id'],'tag_id'=>$tid,'create_time'=>time()];
}
}
//更新新标签
Db::name('taglist')->insertAll($tagArr);
}
//删除原有缓存显示编辑后内容
Cache::delete('article_'.$id);
$link = $this->getRouteUrl((int) $id, $article->cate->ename, $article->cate->appname);
// 推送给百度收录接口
$this->baiduPushUrl($link);
$editRes = Msgres::success('edit_success',$link);
} else {
$editRes = Msgres::error($result);
}
return $editRes;
}
}
View::assign(['article'=>$article]);
//1.查询分类表获取所有分类
$cateList = Db::name('cate')->where(['status'=>1,'delete_time'=>0])->order('sort','asc')->cache('catename',3600)->select();
//2.将catelist变量赋给模板 公共模板nav.html
View::assign('cateList',$cateList);
return View::fetch();
}
/**
* 调用百度关键词
*
* @return json
*/
public function getKeywords()
{
$data = Request::only(['flag','keywords','content']);
$keywords = $this->setKeywords($data);
return json(['code'=>0, 'msg' => 'ok', 'data'=> $keywords]);
}
/**
* 标题调用百度关键词词条
* @return Json
*/
public function getWordList()
{
$title = input('title');
return $this->getBdiduSearchWordList($title);
}
/**
* 内容中是否有图片视频音频插入
*
* @param [type] $content
* @return array
*
*/
public function hasIva($content)
{
//判断是否插入图片
$isHasImg = strpos($content,'img[');
$data['has_img'] = is_int($isHasImg) ? 1 : 0;
//判断是否插入视频
$isHasVideo = strpos($content,'video(');
$data['has_video'] = is_int($isHasVideo) ? 1 : 0;
//判断是否插入音频
$isHasAudio = strpos($content,'audio[');
$data['has_audio'] = is_int($isHasAudio) ? 1 : 0;
return $data;
}
/**
* 获取描述过滤html
*
* @return void
*/
public function getDescription()
{
$data = Request::only(['content']);
$description = getArtContent($data['content']);
return json(['code'=>0,'data'=>$description]);
}
/**
* 上传接口
*
* @return void
*/
public function uploads()
{
$type = Request::param('type');
return $this->uploadFiles($type);
}
public function getCateTree()
{
//
$cate = Db::name('cate')->order(['id' => 'ASC','sort' => 'ASC'])->where(['delete_time'=>0])->select()->toArray();
$cateTree = array2tree($cate);
$count = count($cateTree);
$tree = [];
if($cateTree){
$tree = ['code'=>0,'msg'=>'','count'=>$count];
$res = []; //auth_rule储存数据表中的表结构
foreach($cateTree as $k => $v){
//第一层子权限
$children = [];
if(isset($v['children'])){
foreach($v['children'] as $m => $j){
//第二层子权限
$chichi = [];
if(isset($j['children'])){
//第三层子权限
foreach($j as $s){
if(isset($s['children'])){
$chichi[] = ['id'=>$s['id'],'catename'=>$s['catename'],'pid'=>$s['pid']]; //子数据的子数据
}
}
}
//if($j['level'] < 3){}
$children[] = ['id'=>$j['id'],'catename'=>$j['catename'],'pid'=>$j['pid'],'children'=>$chichi]; //子数据
}
}
$data[] = ['id'=>$v['id'],'catename'=>$v['catename'],'pid'=>$v['pid'],'children'=>$children];
}
//构造一个顶级菜单pid=0的数组。把权限放入顶级菜单下子权限中
$tree['data'][] = ['id'=>0,'catename'=>'顶级','pid'=>0,'children'=>$data];
}
return json($tree);
}
}

View File

@ -17,8 +17,6 @@ use think\facade\Session;
use think\facade\Request;
use think\facade\Cache;
use think\facade\Lang;
use app\admin\model\Admin;
use app\admin\model\Article;
use app\admin\model\Cunsult;
use think\facade\Config;
use taoler\com\Api;
@ -121,18 +119,11 @@ class Index extends AdminController
return View::fetch();
}
//版本检测
// public function getVersion()
// {
// $verCheck = Api::urlPost($this->sys['upcheck_url'],['pn'=>$this->pn,'ver'=>$this->sys_version]);
// if($verCheck->code !== -1){
// return $verCheck->code ? "<span style='color:red'>有{$verCheck->up_num}个版本需更新,当前可更新至{$verCheck->version}</span>" : $verCheck->msg;
// } else {
// return lang('No new messages');
// }
// }
public function checkVersion()
/**
* 系统升级检测
* @return mixed|string
*/
public function sysUpgradeCheck()
{
$data = ['pn'=>$this->pn,'ver'=>$this->sys_version];
$response = HttpHelper::withHost()->get('/v1/upload/check', $data)->toJson();

View File

@ -1,67 +0,0 @@
<?php
namespace app\admin\controller;
use app\common\controller\AdminController;
use think\facade\Db;
use taoser\think\Auth;
class Menu extends AdminController
{
public function index(){
return view();
}
/**
* 动态菜单并排序
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getMenuNavbar()
{
// 用户菜单权限
$auth = new Auth();
$pid = empty(input('id')) ? 0 : input('id');
$data = Db::name('auth_rule')->field('id,title,icon,name,sort')->where(['pid'=>$pid,'status'=> 1, 'ismenu'=>1, 'delete_time'=> 0])->select();
$tree = [];
foreach ($data as $k => $v) {
$hasChild = $this->hasChildren($v['id']);
if($hasChild) {
$v['hasChildren'] = 1;
} else {
$v['hasChildren'] = 0;
}
if ($auth->check($v['name'], session('admin_id')) || session('admin_id') == 1) {
$tree[] = ['id'=>$v['id'],'text'=>$v['title'],'icon'=>$v['icon'],'hasChildren'=>$v['hasChildren'],'href'=>(string) url($v['name']),'sort'=>$v['sort']];
}
}
// 排序
$cmf_arr = array_column($tree, 'sort');
array_multisort($cmf_arr, SORT_ASC, $tree);
return json($tree);
}
/**
* 是否有子菜单
* @param $pid
* @return bool
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function hasChildren($pid)
{
$data = Db::name('auth_rule')->field('pid')->where(['delete_time'=> 0,'status'=> 1,'ismenu'=>1,'pid'=>$pid])->select()->toArray();
if(count($data)) {
return true;
} else {
return false;
}
}
}

View File

@ -1,96 +0,0 @@
<?php
namespace app\admin\controller;
use app\common\controller\AdminController;
use think\facade\View;
use think\facade\Request;
use think\facade\Session;
use think\facade\Db;
use app\common\model\Message as MessageModel;
use taoler\com\Message;
class Notice extends AdminController
{
//显示消息
public function index()
{
if(Request::isAjax()){
$notices = MessageModel::where(['type'=>0,'delete_time'=>0])->paginate(15);
$count = $notices->total();
$res = [];
if($count){
$res = ['code'=>0,'msg'=>'','count'=>$count];
foreach($notices as $msg){
$res['data'][] = ['id'=>$msg['id'],'type'=>$msg['type'] == 0 ? '系统消息': '个人消息','title'=>$msg['title'],'user_id'=>$msg['user_id'],'content'=>$msg['content'],'ctime'=>$msg['create_time']];
}
} else {
$res = ['code'=>-1,'msg'=>'还没有发布任何通知'];
}
return json($res);
}
return View::fetch();
}
//添加消息
public function add()
{
$sendId = Session::get('admin_id');
$data = Request::only(['type','title','receve_id','content']);
if($data['type'] == 1){
$receveId = $data['receve_id']; //个人通知
} else {
$receveId = 0; //系统通知
}
unset($data['receve_id']); //收信人移除
$data['user_id'] = $sendId; //发信人入信息库
//写入信息库
$result = Message::sendMsg($sendId,$receveId,$data);
if($result){
$res = ['code'=>0,'msg'=>'发布成功'];
} else {
$res = ['code'=>-1,'msg'=>'发布失败'];
}
return json($res);
}
//编辑VIP积分规则
public function edit()
{
$id = input('id');
if(Request::isAjax()){
$data = Request::only(['id','title','type','content']);
$result = MessageModel::update($data);
if($result){
$res = ['code'=>0,'msg'=>'编辑成功'];
}else{
$res = ['code'=>-1,'msg'=>'编辑失败'];
}
return json($res);
}
$msg = Db::name('message')->find($id);
View::assign(['msg'=>$msg]);
return View::fetch();
}
//删除消息
public function delete($id)
{
if(Request::isAjax()){
$msg = MessageModel::with('messageto')->find($id);
$result = $msg->together(['messageto'])->delete();
if($result){
return json(['code'=>0,'msg'=>'删除成功']);
}else{
return json(['code'=>-1,'msg'=>'删除失败']);
}
}
}
}

View File

@ -1,505 +0,0 @@
<?php
/*
* @Author: TaoLer <alipey_tao@qq.com>
* @Date: 2022-04-13 09:54:31
* @LastEditTime: 2022-08-14 09:23:13
* @LastEditors: TaoLer
* @Description: 搜索引擎SEO优化设置
* @FilePath: \github\TaoLer\app\admin\controller\Seo.php
* Copyright (c) 2020~2022 https://www.aieok.com All rights reserved.
*/
declare(strict_types=1);
namespace app\admin\controller;
use app\common\controller\AdminController;
use think\facade\View;
use think\facade\Request;
use think\facade\Db;
use taoser\SetArr;
use app\common\model\PushJscode;
class Seo extends AdminController
{
// 写ID
protected $w_id = 0;
public function index()
{
// 站点地图
$xml = '';
$xmlArr = $this->getXmlFile(public_path());
foreach($xmlArr as $v) {
$map = $this->getIndexUrl().'/'.$v;
$xml .= $map."\n";
}
// robots
if(is_file($rob = public_path().'robots.txt')){
$robots = file_get_contents($rob);
} else {
$robots = '';
}
// push_js
$pushjs = new PushJscode();
$jscode = $pushjs->getAllCodes(1);
View::assign(['xml'=>$xml,'jscode'=>$jscode,'robots'=>$robots]);
return View::fetch();
}
/**
* 百度推送
*
* @return void
*/
public function push()
{
$data = Request::only(['start_id','end_id','time']);
// 动态路由配置
$article_as = config('taoler.url_rewrite.article_as');
$api = config('taoler.baidu.push_api');
if(empty($api)) return json(['code'=>-1,'msg'=>'请先配置接口push_api']);
$urls = [];
if(empty($data['start_id']) || empty($data['end_id'])) {
if($article_as == '<ename>/'){ //变量路由
$artAllId = Db::name('article')
->alias('a')
->join('cate c','a.cate_id = c.id')
->field('a.id as aid,ename')
->where(['a.delete_time'=>0,'a.status'=>1])
->whereTime('a.create_time', $data['time'])
->select()->toArray();
} else { //常量路由
$artAllId = Db::name('article')->where(['delete_time'=>0,'status'=>1])->whereTime('create_time', $data['time'])->column('id');
}
} else {
if($article_as == '<ename>/') {
$artAllId = Db::name('article')
->alias('a')
->join('cate c','a.cate_id = c.id')
->field('a.id as aid,ename')
->where(['a.delete_time'=>0,'a.status'=>1])
->where('a.id','between',[$data['start_id'],$data['end_id']])
->whereTime('a.create_time', $data['time'])
->select()->toArray();
} else {
$artAllId = Db::name('article')->where(['delete_time'=>0,'status'=>1])->where('id','between',[$data['start_id'],$data['end_id']])->whereTime('create_time', $data['time'])->column('id');
}
}
if(empty($artAllId)) return json(['code'=>-1,'msg'=>'没有查询到结果,无需推送']);
// 组装链接数组
if($article_as == '<ename>/') {
foreach($artAllId as $art) {
$urls[] = $this->getRouteUrl($art['aid'], $art['ename']);
}
} else {
foreach($artAllId as $aid) {
$urls[] = $this->getRouteUrl($aid);
}
}
// 百度接口单次最大提交200进行分组
$urls = array_chunk($urls,2000);
$ch = curl_init();
foreach($urls as $url) {
$options = array(
CURLOPT_URL => $api,
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => implode("\n", $url),
CURLOPT_HTTPHEADER => array('Content-Type: text/plain'),
);
curl_setopt_array($ch, $options);
$result = curl_exec($ch);
if($result == false) {
return json(['code'=>-1,'msg'=>'接口失败']);
}
}
curl_close($ch);
$res = stripos($result,'error');
$data = json_decode($result);
if($res !== false) {
return json(['code'=>-1,'msg'=>$data->message]);
};
return json(['code'=>0,'msg'=>'成功推送'.$data->success.'条,今天剩余'.$data->remain]);
}
/**
* 百度接口配置
*
* @return void
*/
public function config()
{
$baidu = [];
$data = Request::only(['client_id','client_secret','push_api']);
foreach($data as $k => $v) {
if($v !== ''){
if($k == 'push_api') {
$baidu[$k] = "'$v'";
} else {
$baidu[$k] = $v;
}
}
}
// 获取Access Token分词的必选参数设置时写入
$baidu['grant_type'] = 'client_credentials';
$res = SetArr::name('taoler')->edit([
'baidu' => $baidu,
]);
if($res == true){
return json(['code'=>0,'msg'=>'设置成功']);
}
}
/**
* 百度谷歌sitemap生成xml文件
*
* @return void
*/
public function map()
{
$data = Request::only(['map_num','map_time','map_level']);
// 写文件字符串
$str = '';
// 标记每次调用首次调用写ID
$flag= true;
// 写ID
$w_id = '';
// 生成新文件编号,防止重复写入,
$i = 1;
// 获取public下所有xml文件
$newFile = $this->getXmlFile(public_path());
// 路由配置
$article_as = config('taoler.url_rewrite.article_as');
// 没有xml文件时不存在重写
if(empty($newFile)) {
$rewrite = false;
} else {
$xmlFile = end($newFile);
$strFile = file_get_contents(public_path().$xmlFile);
$num = substr_count($strFile, '<url>');
// 是否有需要追加在文件,判断最新文件是否未写满
$rewrite = $num < $data['map_num'] ? true : false;
}
if($rewrite){
// 需要追加的数量
$limit = (int) $data['map_num'] - $num;
$name = pathinfo($xmlFile,PATHINFO_FILENAME);
$arr = explode('_', $name);
// 检验当天,避免重复生成
if($arr[0] == date('Y-d-m'))
{
$i = $arr[1] + 1;
}
} else {
$limit = (int) $data['map_num'];
}
// 最新ID
$maxId = Db::name('article')->where(['delete_time'=>0,'status'=>1])->max('id');
do
{
$this->wr_id = $flag ? config('taoler.sitemap.write_id') : $this->w_id;
if($article_as == '<ename>/') {
// 分类名
$artAllId = Db::name('article')
->alias('a')
->join('cate c','a.cate_id = c.id')
->field('a.id as aid,a.update_time as uptime,ename')
->where(['a.delete_time'=>0,'a.status'=>1])
->where('a.id', '>', (int) $this->wr_id)
->order('a.id','asc')->limit($limit)
->select()->toArray();
} else {
$artAllId = Db::name('article')
->where(['delete_time'=>0,'status'=>1])
->where('id', '>', (int) $this->wr_id)
->order('id','asc')->limit($limit)->column('update_time','id');
}
if(empty($artAllId)) {
return json(['code'=>-1,'msg'=>'本次无需生成']);
} else {
// 本次最新文件ID
if($article_as == '<ename>/') {
// 循环拼接文件字符串
foreach($artAllId as $art) {
//url生成
$url = $this->getRouteUrl($art['aid'], $art['ename']);
$time = date('Y-m-d', $art['uptime']);
// 组装字符串
$str .= <<<STR
<url>
<loc>$url</loc>
<lastmod>$time</lastmod>
<changefreq>daily</changefreq>
<priority>0.5</priority>
</url>\n
STR;
}
$last_arr = end($artAllId);
$last_id = $last_arr['aid'];
} else {
// 循环拼接文件字符串
foreach($artAllId as $aid => $uptime) {
// url生成
$url = $this->getRouteUrl($aid);
$time = date('Y-m-d', $uptime);
// 组装字符串
$str .= <<<STR
<url>
<loc>$url</loc>
<lastmod>$time</lastmod>
<changefreq>daily</changefreq>
<priority>0.5</priority>
</url>\n
STR;
}
$last_id = array_key_last($artAllId);
}
// 写文件
if($rewrite){
// 写入旧xml文件
$reps = $str.'</urlset>';
$xml = preg_replace('/<\/urlset>/', $reps, $strFile);
$res = file_put_contents(public_path().$xmlFile, $xml);
if($res == false){
return json(['code'=>-1,'msg'=>$xmlFile.'写入失败']);
}
$limit = $data['map_num'];
$rewrite = false;
} else {
// 生成新xml
$xml = <<<XML
<?xml version="1.0" encoding="utf-8"?> <!-- XML文件需以utf-8编码-->
<urlset>\n$str</urlset>
XML;
$res = file_put_contents(public_path().date('Y-m-d').'_'.$i.'.xml', $xml);
if($res == false){
return json(['code'=>-1,'msg'=>date('Y-m-d').'_'.$i.'.xml写入失败']);
}
}
// 重置标记内容
$str = '';
$i++;
$this->w_id = $last_id;
$flag = false;
}
}
while($last_id < (int) $maxId);
// 写配置标记最后写入ID
$res = SetArr::name('taoler')->edit([
'sitemap' => [
'map_num' => $data['map_num'],
'write_id' => $last_id,
],
]);
if($res == false){
return json(['code'=>-1,'msg'=>'写xml配置失败']);
}
return json(['code'=>0,'msg'=>'本次成功生成' . count($artAllId) . '条xml']);
}
/**
* 返回public目录下xml名称数组
*
* @param string $dir
* @return array
*/
public function getXmlFile(string $dir) : array
{
$arr = [];
$files = array_diff(scandir($dir), array('.', '..'));
foreach ($files as $file) {
if(is_file("$dir/$file") && !is_link($dir) && (pathinfo("$dir/$file", PATHINFO_EXTENSION)) == 'xml')
{
$arr[] = "$file";
}
}
return $arr;
}
/**
* 生成robots
*
* @return void
*/
public function robots()
{
if(Request::isPost()){
$txt = input('robots');
$xmlArr = $this->getXmlFile(public_path());
foreach($xmlArr as $v) {
$res = stripos($txt, $v);
if($res == false){
$map = $this->getIndexUrl().'/'.$v;
$txt .= "\nsitemap:".$map;
}
}
$res = file_put_contents(public_path().'robots.txt',$txt);
if($res == false){
return json(['code'=>-1,'msg'=>$v.'写入失败']);
}
return json(['code'=>0,'msg'=>'设置成功']);
}
}
/**
* 保存搜索平台js代码
*
* @return void
*/
public function savePushJs()
{
$data = Request::only(['name','jscode','type']);
if(empty($data['name'])) {
return json(['code'=>-1,'msg'=>'请术输入名称']);
}
if(empty($data['jscode'])){
return json(['code'=>-1,'msg'=>'请术输入代码']);
}
$push = new PushJscode();
$res = $push->saveCode($data);
if(!$res) {
return json(['code'=>-1,'msg'=>'保存失败']);
}
return json(['code'=>0,'msg'=>'保存成功']);
}
/**
* 删除平台js代码
*
* @return void
*/
public function delPushJs()
{
$id = (int) input('id');
$push = new PushJscode();
$res = $push->delCode($id);
if(!$res) {
return json(['code'=>-1,'msg'=>'删除失败']);
}
return json(['code'=>0,'msg'=>'删除成功']);
}
/**
* 搜索引擎日志分析
*
* @return void
*/
public function searchLog()
{
$time = input('search_time');
$name = input('spider_name');
$page = input('page') ? input('page') : 1;
$limit = input('limit') ? input('limit') : 20;
$logPath = app()->getRootPath().'runtime/log/browse/'.$time.'.log';
$logPath = str_replace('\\','/',$logPath);
if(!file_exists($logPath)) {
return json(['code'=>-1,'msg'=>'还没有要分析的日志哦!']);
}
$log = file_get_contents($logPath);
$log = preg_replace('/\[info\][^\n]*compatible;/', '', $log);
$log = preg_replace('/\[info\][^\n]*(?=YisouSpider)/', ' ', $log);
switch($name) {
case 'Baiduspider':
preg_match_all('/(.*?)(?:Baiduspider)+[^\n]*\r?\n/',$log,$arr);
break;
case 'Bytespider':
preg_match_all('/(.*?)(?:Bytespider)+[^\n]*\r?\n/',$log,$arr);
break;
case 'Googlebot':
preg_match_all('/(.*?)(?:Googlebot)+[^\n]*\r?\n/',$log,$arr);
break;
case 'bingbot':
preg_match_all('/(.*?)(?:bingbot)+[^\n]*\r?\n/',$log,$arr);
break;
default:
// 正则全部蜘蛛
preg_match_all('/(.*?)(?:bingbot|Googlebot|Baiduspider|Bytespider|360Spider|YisouSpider|Sosospider|Sogou News Spider|SemrushBot|AhrefsBot|MJ12bot)+[^\n]*\r?\n/',$log,$arr);
}
// $string = '';
// foreach($arr[0] as $str) {
// $str = preg_replace('/\[(.*?)T/', '', $str);
// $str = preg_replace('/\+08:00\]/', '', $str);
// $string .= preg_replace('/\/(.*?)\)/', '', $str);
// }
// if(strlen($string)) {
// return json(['code'=>0,'msg'=>'分析成功','data'=>$string]);
// } else {
// return json(['code'=>-1,'msg'=>'还没有蜘蛛来哦']);
// }
$data = [];
$list = [];
if(count($arr[0])) {
$list['code']= 0;
$list['msg'] = '分析成功';
$list['count'] = count($arr[0]);
foreach($arr[0] as $k =>$str) {
// $str = preg_replace('/\[(.*?)T/', '', $str);
// $str = preg_replace('/\+08:00\]/', '', $str);
$str = preg_replace('/\/(.*?)\)/', '', $str);
// 时间
$ptime = "/([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})/";
preg_match($ptime, $str,$at);
$time = str_replace('T',' ',$at[0]);
//$list[$k]['time'] = $time;
// ip
$pip = '/((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}/';
preg_match($pip, $str,$aip);
$ip = $aip[0];
// url
$pattern="/(http|https):\/\/.*$/i";
preg_match($pattern, $str,$url);
// name
preg_match('/(?:bingbot|Googlebot|Baiduspider|Bytespider|360Spider|YisouSpider|Sosospider|Sogou News Spider|SemrushBot|AhrefsBot|MJ12bot)/', $str, $n);
$name = $n[0];
//$list['data'][] = ['id'=>$k + 1, 'time'=>$time, 'name'=>$name, 'ip'=>$ip, 'url'=>$url[0]];
$data[] = ['id'=>$k + 1, 'time'=>$time, 'name'=>$name, 'ip'=>$ip, 'url'=>$url[0]];
}
$datas = array_chunk($data,(int)$limit);
//$pages = count($datas);
foreach($datas as $k=>$v) {
if($page-1 == $k) {
$list['data'] = $v;
}
}
return json($list);
} else {
return json(['code'=>-1,'msg'=> '没有需要分析的数据']);
}
}
public function tagLinkList()
{
$arr = [];
$pushjs = new PushJscode();
$tags = $pushjs->getAllCodes(2);
if(count($tags)) {
$arr = ['code'=>0, 'msg'=>'', 'count' => count($tags)];
foreach($tags as $k=>$v) {
$arr['data'][] = ['id'=>$v['id'],'tag'=>$v['name'], 'link'=>$v['jscode'],'time'=>$v['create_time']];
}
} else {
$arr = ['code'=>-1, 'msg'=>'没有数据'];
}
return json($arr);
}
}

View File

@ -1,317 +0,0 @@
<?php
/*
* @Author: TaoLer <alipey_tao@qq.com>
* @Date: 2021-12-06 16:04:50
* @LastEditTime: 2022-07-24 11:06:14
* @LastEditors: TaoLer
* @Description: 搜索引擎SEO优化设置
* @FilePath: \TaoLer\app\admin\controller\Set.php
* Copyright (c) 2020~2022 http://www.aieok.com All rights reserved.
*/
namespace app\admin\controller;
use app\common\controller\AdminController;
use think\facade\View;
use think\facade\Request;
use think\facade\Db;
use think\facade\Cache;
use think\facade\Config;
use app\admin\model\System;
use app\admin\model\MailServer;
use taoler\com\Files;
use think\facade\Session;
use think\facade\Cookie;
use taoser\SetArr;
use app\common\lib\SetArr as SetArrConf;
use think\response\Json;
class Set extends AdminController
{
protected function initialize()
{
parent::initialize();
$this->sysInfo = $this->getSystem();
}
//网站设置显示
public function index()
{
$template = Files::getDirName('../view');
$email = Db::name('admin')->where('id',1)->value('email');
// 应用映射
$index_map = array_search('index',config('app.app_map'));
$admin_map = array_search('admin',config('app.app_map'));
$index_map = $index_map ? $index_map : '';
$admin_map = $admin_map ? $admin_map : '';
View::assign(['sysInfo'=>$this->sysInfo,'template'=>$template,'email'=>$email,'index_map'=>$index_map,'admin_map'=>$admin_map]);
// 域名绑定
if(!empty(config('app.domain_bind'))){
$data = array_flip(config('app.domain_bind'));
$domain_bind = [
'index' => isset($data['index']) ? $data['index'] : '',
'admin' => isset($data['admin']) ? $data['admin'] : '',
];
} else {
$domain_bind = [
'index' => '',
'admin' => '',
];
}
View::assign($domain_bind);
// url美化
$urlArr = config('taoler.url_rewrite');
$urlRe = [];
foreach($urlArr as $k => $v) {
if(!empty($v)) {
$urlRe[$k] = substr($v, 0, strrpos($v, '/'));
} else {
$urlRe[$k] = '';
}
}
View::assign('url_re',$urlRe);
return View::fetch('set/system/website');
}
//网站设置
public function website()
{
if(Request::isPost()){
$data = Request::only(['webname','domain','template','cache','upsize','uptype','blackname','webtitle','keywords','descript','state','icp','showlist','copyright']);
$system = new System();
$result = $system->sets($data,$this->sysInfo['clevel']);
if($result == 1){
return json(['code'=>0,'msg'=>'更新成功']);
} else {
return json(['code'=>-1,'msg'=>$result]);
}
}
}
//综合设置
public function server()
{
return View::fetch('set/system/server');
}
/**基础服务配置
* parem $id
*/
public function config()
{
$conf = Config::get('taoler.config');
if(Request::isPost()){
$data = Request::param();
if(!isset($data['regist_check'])) $data['regist_check'] =1;
if(!isset($data['posts_check'])) $data['posts_check'] =1;
if(!isset($data['commnets_check'])) $data['commnets_check'] =1;
foreach($conf as $c=>$f){
if(array_key_exists($c,$data)){
$conf[$c] = (int) $data[$c];
}else{
$conf[$c] = 0;
}
}
$value = [
'config'=>$conf
];
$result = SetArr::name('taoler')->edit($value);
if($result){
$res = ['code'=>0,'msg'=>'配置成功'];
} else {
$res = ['code'=>-1,'msg'=>'配置出错!'];
}
return json($res);
}
}
// 域名绑定
public function setDomain()
{
$str = file_get_contents(str_replace('\\', '/', app()->getConfigPath() . 'app.php'));
if(Request::isPost()){
$data = Request::only(['index','admin','domain_check']);
//$data = Request::param();
//dump($data);
if($data['domain_check'] == 'on') {
// 过滤空项目
$domain_bind = [];
if(!empty($data['index'])){
$domain_bind[$data['index']] ='index';
if(config('app.default_app') == $domain_bind[$data['index']]) {
if(empty($data['admin'])) {
return json(['code'=>-1, 'msg'=>'默认应用和Index一致时必须绑定Admin域名,否则无法进入后台']);
}
}
}
if(!empty($data['admin'])){
$domain_bind[$data['admin']] ='admin';
}
// 匹配整个domain_map数组
$pats_domain_bind = '/\'(domain_bind)\'[^\]]*\],/';
// 空数组
$rep_domain_null = "'domain_bind'\t=> [\n\t],";
$str = preg_replace($pats_domain_bind, $rep_domain_null, $str);
// 匹配'domain_bind' => [
$pats = '/\'(domain_bind)\'\s*=>\s*\[\r?\n/';
preg_match($pats,$str,$arr);
// 拼接数组内字符串
$domainArr = '';
foreach($domain_bind as $k => $v){
$domainArr .= "\t\t'". $k. "' => '" . $v . "',\n";
}
// 追加组成新数组写入文件
$reps = $arr[0].$domainArr;
$str = preg_replace($pats, $reps, $str);
$res = file_put_contents(app()->getConfigPath() . 'app.php', $str);
// 如果编辑了后台 ,需要清理退出缓存
if(!empty($domain_bind[$data['admin']])) {
//清空缓存
Cookie::delete('adminAuth');
Session::clear();
}
} else {
$res = SetArr::name('app')->delete([
'domain_bind'=> config('app.domain_bind'),
]);
}
if($res == true){
return json(['code'=>0,'msg'=>'成功']);
} else{
return json(['code'=>-1,'msg'=>'失败']);
}
}
}
/**
* 绑定应用映射
*
* @return void
*/
public function bindMap()
{
$data = Request::only(['index_map','admin_map']);
$str = file_get_contents(str_replace('\\', '/', app()->getConfigPath() . 'app.php'));
// 过滤空项目
$app_map = [];
if(!empty($data['index_map'])){
$app_map[$data['index_map']]='index';
}
if(!empty($data['admin_map'])){
$app_map[$data['admin_map']] ='admin';
}
//halt($app_map);
// $set = new SetArrConf('app');
// $res = $set->delete(['app_map' => config('app.app_map')])->add([
// 'app_map' => $app_map,
// ])->put();
// halt($res);
// 匹配整个app_map数组
$pats_app_map = '/\'(app_map)\'[^\]]*\],/';
preg_match($pats_app_map,$str,$arr_map);
// 空数组
$rep_map_null = "'app_map'\t=> [\n\t],";
$str = preg_replace($pats_app_map, $rep_map_null, $str);
// 匹配'app_map' => [
$pats = '/\'(app_map)\'\s*=>\s*\[\r?\n/';
preg_match($pats,$str,$arr);
// 拼接数组内字符串
$appArr = '';
foreach($app_map as $k => $v){
$appArr .= "\t\t'". $k. "' => '" . $v . "',\n";
}
// 追加组成新数组写入文件
$reps = $arr[0].$appArr;
$str = preg_replace($pats, $reps, $str);
$res = file_put_contents(app()->getConfigPath() . 'app.php', $str);
if(!$res) {
return json(['code'=>-1,'msg'=>'绑定失败']);
}
return json(['code'=>0,'msg'=>'绑定成功']);
}
/**
* URL美化设置访问链接
* @return Json
*/
public function setUrl()
{
$data = Request::only(['article_as','cate_as']);
$arr = [];
foreach($data as $k => $v) {
if(!empty($v)) {
$arr['url_rewrite'][$k] = $v . '/';
} else {
$arr['url_rewrite'][$k] = '';
}
}
// if(empty($arr['url_rewrite']['cate_as'])) return json(['code'=>-1,'msg'=>'分类不能为空']);
if(!array_key_exists('url_rewrite',config('taoler'))){
$result = SetArr::name('taoler')->add($arr);
} else {
$result = SetArr::name('taoler')->edit($arr);
}
if($result){
$res = ['code'=>0,'msg'=>'配置成功'];
} else {
$res = ['code'=>-1,'msg'=>'配置出错!'];
}
return json($res);
}
//上传logo
public function upload()
{
$param = Request::param('field');
$uploads = new \app\common\lib\Uploads();
$upRes = $uploads->put('file','SYS_logo',2000,'image');
$logoJson = $upRes->getData();
if($logoJson['status'] == 0){
if($param == 'logo'){
$result = Db::name('system')->where('id', 1)->cache('system')->update(['logo'=>$logoJson['url']]);
} else {
//移动端logo
$result = Db::name('system')->where('id', 1)->cache('system')->update(['m_logo'=>$logoJson['url']]);
}
if($result){
$res = ['code'=>0,'msg'=>'更新logo成功'];
} else {
$res = ['code'=>-1,'msg'=>'上传成功,数据无须更新'];
}
} else {
$res = ['code'=>-1, 'msg'=>$logoJson['msg']];
}
return json($res);
}
}

View File

@ -1,83 +0,0 @@
<?php
namespace app\admin\controller;
use app\common\controller\AdminController;
use think\facade\View;
use think\facade\Request;
use think\facade\Db;
use app\common\model\UserSignrule;
class Sign extends AdminController
{
//添加签到积分规则
public function add()
{
if(Request::isPost()){
$data = Request::only(['days','score']);
$day = UserSignrule::where('days',(int)$data['days'])->find();
//$day = Db::name('user_signrule')->where('days',$data['days'])->find();
if(!is_null($day)){
$res = ['code'=>-1,'msg'=>'不能重复设置'];
} else {
$result = UserSignrule::create($data);
if($result){
$res = ['code'=>0,'msg'=>'设置积分成功'];
} else {
$res = ['code'=>-1,'msg'=>'保存失败'];
}
}
return json($res);
}
}
//删除签到积分规则
public function delete($id)
{
if(Request::isAjax()){
$user =UserSignrule::find($id);
$result = $user->delete();
if($result){
return json(['code'=>0,'msg'=>'删除成功']);
}else{
return json(['code'=>-1,'msg'=>'删除失败']);
}
}
}
//编辑签到积分规则
public function signEdit()
{
if(Request::isAjax()){
$data = Request::param();
$result = UserSignrule::update($data);
if($result){
$res = ['code'=>0,'msg'=>'编辑成功'];
}else{
$res = ['code'=>-1,'msg'=>'编辑失败'];
}
return json($res);
}
$sign = Db::name('user_signrule')->find(input('id'));
View::assign('sign',$sign);
return View::fetch('set/system/signedit');
}
//显示签到积分规则
public function signRule()
{
$keys = UserSignrule::select();
$count = $keys->count();
$res = [];
if($count){
$res = ['code'=>0,'msg'=>'','count'=>$count];
foreach($keys as $k=>$v){
$res['data'][] = ['id'=>$v['id'],'days'=>$v['days'],'score'=>$v['score'],'ctime'=>$v['create_time']];
}
} else {
$res = ['code'=>-1,'msg'=>'还没有任何积分设置!'];
}
return json($res);
}
}

View File

@ -1,158 +0,0 @@
<?php
namespace app\admin\controller;
use app\common\controller\AdminController;
use think\facade\View;
use think\facade\Db;
use think\facade\Request;
use app\common\model\Slider as SliderModel;
class Slider extends AdminController
{
/**
* @return string
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function index()
{
return View::fetch();
}
/**
* 链接列表
*
* @return void
*/
public function list()
{
$list = [];
$type = input('slid_type');
$limit = input('limit');
$page = input('page');
if($type) {
$datas = SliderModel::where('slid_type',$type)->paginate([
'list_rows'=> $limit,
'page'=>$page
]);
} else {
$datas = SliderModel::paginate([
'list_rows'=> $limit,
'page'=>$page
]);
}
if(count($datas)) {
$list = ['code'=>0, 'count'=> count($datas), 'msg'=>'获取数据成功'];
foreach($datas as $k=>$v) {
$list['data'][] = [
'id'=>$v['id'],
'slid_name'=>$v['slid_name'],
'slid_img' =>$v['slid_img'],
'slid_type'=>$v['slid_type'],
'slid_href'=>$v['slid_href'],
'slid_color'=>$v['slid_color'],
'slid_start'=> time() < $v['slid_start'] ? '<span style="color:#1c97f5;">未开始</span>' : date('Y-m-d H:i',$v['slid_start']),
'slid_over'=> time() > $v['slid_over'] ? '<span style="color:#F00;">已结束</span>' : date('Y-m-d H:i',$v['slid_over']),
'slid_status'=> $v['slid_status'] ? '正常' : '禁止'
];
}
return json($list);
} else {
return json(['code'=>-1,'msg'=>'还没有数据']);
}
}
/**
* 显示创建资源表单页.
*
* @return \think\Response
*/
public function add()
{
//添加幻灯
if(Request::isAjax()){
$data = Request::param();
$data['slid_start'] = strtotime($data['slid_start']);
$data['slid_over'] = strtotime($data['slid_over']);
$slid = new SliderModel();
$result = $slid->add($data);
if($result == 1){
$res = ['code'=>0,'msg'=>'添加成功'];
}else{
$res = ['code'=>-1,'msg'=>'添加失败'];
}
return json($res);
}
return View::fetch();
}
/**
* @param $id
* @return string|\think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function edit()
{
$id = (int)input('id');
$slider = Db::name('slider')->find($id);
if(Request::isAjax()){
$data = Request::param();
$data['slid_start'] = strtotime($data['slid_start']);
$data['slid_over'] = strtotime($data['slid_over']);
$slid = new SliderModel();
$result = $slid->edit($data);
if($result == 1){
$res = ['code'=>0,'msg'=>'编辑成功'];
}else{
$res = ['code'=>-1,'msg'=>'编辑失败'];
}
return json($res);
}
View::assign('slider',$slider);
return View::fetch();
}
/**
* @return \think\response\Json
*/
public function uploadImg()
{
$uploads = new \app\common\lib\Uploads();
$upRes = $uploads->put('file','SYS_slider',1024,'image');
$slires = $upRes->getData();
if($slires['status'] == 0){
$name_path = $slires['url'];
$res = ['code'=>0,'msg'=>'上传flash成功','src'=>$name_path];
} else {
$res = ['code'=>1,'msg'=>'上传错误'];
}
return json($res);
}
/**
* @param $id
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function delete($id)
{
$slider = SliderModel::find($id);
$res = $slider->delete();
if($res){
return json(['code'=>0,'msg'=>'删除成功']);
} else {
return json(['code'=>-1,'msg'=>'删除失败']);
}
}
}

View File

@ -1,130 +0,0 @@
<?php
/*
* @Author: TaoLer <317927823@qq.com>
* @Date: 2022-08-14 09:39:01
* @LastEditTime: 2022-08-15 16:12:13
* @LastEditors: TaoLer
* @Description: 优化版
* @FilePath: \TaoLer\app\admin\controller\Tag.php
* Copyright (c) 2020~2022 https://www.aieok.com All rights reserved.
*/
declare(strict_types=1);
namespace app\admin\controller;
use app\common\controller\AdminController;
use think\facade\View;
use think\facade\Request;
use think\facade\Db;
use app\common\model\Tag as TagModel;
class Tag extends AdminController
{
// public function __construct(TagModel $tagModel)
// {
// $this->tagModel = new TagModel;
// }
public function index()
{
return View::fetch('index');
}
public function list()
{
$arr = [];
$tag = new TagModel;
$tags = $tag->getTagList();
// dump($tags);
if(count($tags)) {
$arr = ['code'=>0, 'msg'=>'', 'count' => count($tags)];
foreach($tags as $k=>$v) {
$arr['data'][] = ['id'=>$v['id'],'name'=>$v['name'], 'ename'=>$v['ename'], 'keywords'=>$v['keywords'], 'description'=>$v['description'], 'title'=>$v['title'],'time'=>$v['create_time']];
}
} else {
$arr = ['code'=>-1, 'msg'=>'没有数据'];
}
return json($arr);
}
public function add()
{
if(Request::isAjax()) {
$data = Request::only(['name','ename','keywords','description','title']);
// 把,转换为,并去空格->转为数组->去掉空数组->再转化为带,号的字符串
$data['keywords'] = implode(',',array_filter(explode(',',trim(str_replace('',',',$data['keywords'])))));
$tagModel = new TagModel;
$res = $tagModel->saveTag($data);
if($res == true){
return json(['code'=>0,'msg'=>'设置成功']);
}
}
return view();
}
public function edit()
{
$tagModel = new TagModel;
if(Request::isAjax()) {
$data = Request::only(['name','ename','id','keywords','description','title']);
// 把,转换为,并去空格->转为数组->去掉空数组->再转化为带,号的字符串
$data['keywords'] = implode(',',array_filter(explode(',',trim(str_replace('',',',$data['keywords'])))));
$res =$tagModel::update($data);
if($res == true){
return json(['code'=>0,'msg'=>'设置成功']);
}
}
$tag = $tagModel->getTag(input('id'));
View::assign('tag',$tag);
return view();
}
public function delete()
{
if(Request::isPost()) {
$tagModel = new TagModel;
$res = $tagModel->delTag(input('id'));
if($res == true){
return json(['code'=>0,'msg'=>'删除成功']);
}
}
}
/**
* 所有tag标签
*
* @return void
*/
public function getAllTag()
{
$data = [];
$tagModel = new TagModel;
$tags = $tagModel->getTagList();
foreach($tags as $tag) {
$data[] = ['name'=> $tag['name'], 'value'=> $tag['id']];
}
return json(['code'=>0,'data'=>$data]);
}
public function getArticleTag($id)
{
//
$data = [];
$artTags = Db::name('taglist')->where('article_id',$id)->select();
// halt($artTags);
foreach($artTags as $v) {
$tag = Db::name('tag')->find($v['tag_id']);
if(!is_null($tag))
$data[] = ['name'=>$tag['name'],'value'=>$tag['id']];
}
return json(['code'=>0,'data'=>$data]);
}
}

View File

@ -1,80 +0,0 @@
<?php
declare(strict_types=1);
namespace app\admin\controller;
use app\common\controller\AdminController;
use think\facade\View;
use think\facade\Request;
use think\facade\Config;
use think\facade\Db;
use taoser\SetArr;
class TagLink extends AdminController
{
public function index()
{
return View::fetch();
}
public function list()
{
$arr = [];
$tag = input('tag');
$tags = Config::get('taglink');
if(count($tags)) {
$arr = ['code'=>0, 'msg'=>'', 'count' => count($tags)];
foreach($tags as $k=>$v) {
$arr['data'][] = ['tag'=>$k, 'link'=>$v];
}
} else {
$arr = ['code'=>-1, 'msg'=>'没有数据'];
}
return json($arr);
}
public function add()
{
if(Request::isAjax()) {
$data = Request::only(['tag','link']);
$link = '\''.$data['link'].'\'';
$arr = [$data['tag'] => $link];
$res = SetArr::name('taglink')->add($arr);
if($res == true){
return json(['code'=>0,'msg'=>'设置成功']);
}
}
return View::fetch();
}
public function edit()
{
$tag = input('tag');
if(Request::isAjax()) {
$data = Request::only(['tag','link']);
$link = '\''.$data['link'].'\'';
$arr = [$data['tag'] => $link];
$res = SetArr::name('taglink')->edit($arr);
if($res == true){
return json(['code'=>0,'msg'=>'设置成功']);
}
}
$link = config('taglink.'.$tag);
View::assign(['tag'=>$tag, 'link'=>$link]);
return View::fetch();
}
public function delete()
{
if(Request::isPost()) {
$tag = input('tag');
$arr = [$tag => null];
$res = SetArr::name('taglink')->delete($arr);
if($res == true){
return json(['code'=>0,'msg'=>'删除成功']);
}
}
}
}

View File

@ -1,363 +0,0 @@
<?php
/**
* 升级包规定的目录结构
* xxx_版本号.zip(xxx_1.0.0.zip)
* |
* |————runtime
* | |
* | |___update.sql(更新脚本) //create table test(id init(11)); create table test2(id init(11));
* | |___rockback.sql回滚脚本 //drop table test; //drop table test2;
* | |___remove.txt // clear清除目录和文件
* |
* |____php
*
*/
namespace app\admin\controller;
use app\common\controller\AdminController;
use think\facade\View;
use think\facade\Request;
use think\facade\Db;
use taoler\com\Api;
use taoler\com\Str;
use taoler\com\Files;
use think\facade\Config;
use think\facade\Log;
use app\common\lib\SqlFile;
use app\common\lib\Zip;
use taoser\SetArr;
class Upgrade extends AdminController
{
protected $root_dir = "../"; //站点代码的根目录
protected $backup_dir = "../runtime/update/backup_dir/"; //备份目录
protected $upload_dir = "../runtime/update/upload_dir/"; //升级包目录
protected $sys_version_num; //当前系统的版本
public function __construct()
{
parent::initialize();
$this->sys_version = Config::get('taoler.version');
$this->pn = Config::get('taoler.appname');
$this->sys = $this->getSystem();
}
/** 升级界面 */
public function index()
{ //字符隐藏
$key = Str::func_substr_replace($this->sys['key']);
$sys_base = [
'key' => $key,
'upcheck_url' => $this->sys['upcheck_url'],
'upgrade_url' => $this->sys['upgrade_url'],
];
View::assign('ver_num',$sys_base);
return View::fetch();
}
//设置key
public function key()
{
$data = Request::only(['key']);
if(empty($data['key'])){
return json(['code'=>0,'msg'=>'请填写正确的key']);
}
$res = Db::name('system')->cache('system')->update(['key'=>$data['key'],'id'=>1]);
if($res){
$res = ['code'=>0,'msg'=>'保存成功'];
} else {
$res = ['code'=>-1,'msg'=>'保存失败'];
}
return json($res);
}
//修改key
public function keyedit()
{
$key = Db::name('system')->field('key,upcheck_url,upgrade_url')->find(1);
if(Request::isAjax()){
$data = Request::only(['key','upcheck_url','upgrade_url']);
if(empty($data['key'])){
return json(['code'=>-1,'msg'=>'请正确填写申请到的key']);
}
$res = Db::name('system')->cache('system')->update(['key'=>$data['key'],'upcheck_url'=>$data['upcheck_url'],'upgrade_url'=>$data['upgrade_url'],'id'=>1]);
if($res){
$res = ['code'=>0,'msg'=>'修改成功'];
} else {
$res = ['code'=>-1,'msg'=>'修改失败'];
}
return json($res);
}
View::assign('key',$key);
return View::fetch();
}
//升级前的版本检测
public function check()
{
$cy = Api::urlPost($this->sys['base_url'],['u'=>$this->sys['domain']]);
if($cy->code == 0 && $cy->level !== $this->sys['clevel']){
Db::name('system')->cache('system')->update(['clevel'=>$cy->level,'id'=>1]);
}
$versions = Api::urlPost($this->sys['upcheck_url'],['pn'=>$this->pn,'ver'=>$this->sys_version]);
// 判断服务器状态
$version_code = $versions->code;
if($version_code == -1){
$res = json(['code'=>$version_code,'msg'=>$versions->msg]);
}
if($version_code == 1){
$res = json(['code'=>$version_code,'msg'=>$versions->msg,'data'=>['version'=>$versions->version,'upnum'=>$versions->up_num,'info'=>$versions->info]]);
}
if($version_code == 0){
$res = json(['code'=>$version_code,'msg'=>$versions->msg]);
}
return $res;
}
/**
* 在线更新
* 1.提交接口2.下载数据包3.备份4升级
*/
public function upload()
{
$versions = Api::urlPost($this->sys['upgrade_url'],['url'=>$this->sys['domain'],'key'=>$this->sys['key'],'pn'=>$this->pn,'ver'=>$this->sys_version]);
Log::channel('update')->info('update:{type} {progress} {msg}',['type'=>'check','progress'=>'0%','msg'=>'===>升级检测开始===>']);
//判断服务器状态
$version_code = $versions->code;
if($version_code == -1){
Log::channel('update')->info('update:{type} {progress} {msg}',['type'=>'check eroor','progress'=>'5%','msg'=>'===>服务器链接失败===>']);
return json(['code'=>$version_code,'msg'=>$versions->msg]);
}
$version_num = $versions->version;
$file_url = $versions->src;
//判断远程文件是否可用存在
$header = get_headers($file_url, true);
if(!isset($header[0]) && (strpos($header[0], '200') || strpos($header[0], '304'))){
return json(['code'=>-1,'msg'=>'获取远程文件失败']);
}
$upload_dir = Files::getDirPath($this->upload_dir); //拼接升级文件暂存路径
Files::mkdirs($upload_dir);
$package_file = $upload_dir.'taoler_'.$version_num.'.zip'; //本地zip文件
$cpfile = copy($file_url,$package_file); //把远程文件放入本地
if(!$cpfile) {
return json(['code'=>-1,'msg'=>'下载升级文件失败']);
}
//记录下日志
Log::channel('update')->info('update:{type} {progress} {msg}',['type'=>'success','progress'=>'20%','msg'=>'上传升级包'.$version_num.'成功!']);
//升级前备份代码
$ex = array('.git','.idea','runtime','data','addons','config','extend','mysql','public','vendor','view'); // 排除备份目录
$this->backFile($this->root_dir,$this->backup_dir,$ex);
//执行升级
$updateRes = $this->execute_update($package_file);
$upDate = $updateRes->getData();
if($upDate['code'] == -1){
return json(['code'=>-1,'msg'=>$upDate['msg']]);
}
//清除
Files::delDirAndFile($this->upload_dir);
Files::delDirAndFile($this->backup_dir);
//清除废弃目录和文件
$delFiles = '../runtime/remove.txt';
if(file_exists($delFiles)){
$str = file_get_contents($delFiles); //将整个文件内容读入到一个字符串中
$str = str_replace("\r\n",",",$str);
$delArr = explode(',',$str);
foreach($delArr as $v){
if(is_dir($v)){
//删除文件夹
Files::delDirAndFile($v.'/',true);
} else {
//删除文件
if(file_exists($v)){
unlink($v);
}
}
}
unlink($delFiles);
}
//更新系统的版本号了
//更新php的版本号了(应该跟svngit的版本号一致)
//更新数据库的版本号了(应该跟svngit的版本号一致)
$value = [
'version' => $version_num
];
$res = SetArr::name('taoler')->edit($value);
if(!$res){
return json(['code'=>-1,'msg'=>'代码更新成功,但版本写入失败']);
}
Log::channel('update')->info('update:{type} {progress} {msg}',['type'=>'success','progress'=>'100%','msg'=>'升级成功!']);
//清理缓存
$this->clearSysCache();
return json(['code'=>0,'msg'=>'升级成功']);
}
/**
* 升级执行
* @param string $package_file
* @return \think\response\Json
* @throws \Exception
*/
private function execute_update(string $package_file)
{
// 1.解压 zip文件有密码的话需要解密
$zip = new Zip;
$zipDir = strstr($package_file, '.zip',true); //返回文件名后缀前的字符串
$zipPath = Files::getDirPath($zipDir); //转换为带/的路径 压缩文件解压到的路径
$unzip_res = $zip->unzip($package_file,$zipPath);
if(!$unzip_res) {
return json(['code'=>-1,'msg'=>'解压失败']);
}
//解压成功,得到文件夹
//$package_name = str_replace('.zip','',$package_file);
Log::channel('update')->info('update:{type} {progress} {msg}',['type'=>'success','progress'=>'50%','msg'=>'升级文件解压成功!']);
// 2.升级sql操作
$upSql = $zipPath.'runtime/update.sql';
if(file_exists($upSql)) {
try{
SqlFile::dbExecute($upSql);
} catch (\Exception $e){
return json(['code'=>-1,'msg'=>$e->getMessage()]);
}
//删除sql语句
unlink($upSql);
}
// 3.升级PHP
if(is_dir($zipPath)) {
//升级前的写入文件权限检查
$allUpdateFiles = Files::getAllFile($zipPath);
if (empty($allUpdateFiles)) return json(['code' => -1, 'msg' => '无可更新文件。']);
$checkString = '';
foreach ($allUpdateFiles as $updateFile) {
$coverFile = ltrim(str_replace($zipPath, '', $updateFile), DIRECTORY_SEPARATOR);
$dirPath = dirname('../'.$coverFile);
if (file_exists('../'.$coverFile)) {
if (!is_writable('../'.$coverFile)) $checkString .= $coverFile . '&nbsp;[<span class="text-red">' . '无写入权限' . '</span>]<br>';
} else {
if (!is_dir($dirPath)) @mkdir($dirPath, 0777, true);
if (!is_writable($dirPath)) $checkString .= $dirPath . '&nbsp;[<span class="text-red">' . '无写入权限' . '</span>]<br>';
}
}
if (!empty($checkString)) return json(['code' => -1, 'msg' => $checkString]);
$cpRes = Files::copyDirs($zipPath,$this->root_dir);
$cpData = $cpRes->getData();
//更新失败
if($cpData['code'] == -1) {
//数据库回滚
/*
if(file_exists($this->upload_dir.'/'.$package_file.'/mysql/mysql_rockback.sql'))
{
$this->database_operation($this->upload_dir.'/'.$package_file.'/mysql/mysql_rockback.sql');
}
*/
//php代码回滚 升级前备份的代码
Files::copydirs($this->backup_dir, $this->root_dir);
return json(['code'=>-1,'msg'=>$cpData['msg']]);
}
Log::channel('update')->info('update:{type} {progress} {msg}',['type'=>'success','progress'=>'70%','msg'=>'升级文件执行成功!']);
}
return json(['code'=>0,'msg'=>'升级文件执行成功']);
}
/**
* 手动处理升级包上传
*/
public function uploadZip()
{
$files = request()->file('file');
$mime = $files->getMime();
if($mime !== 'application/zip'){
return json(['code'=>-1,'msg'=>'文件类型不对']);
}
$name = $files->getOriginalName();
//校验后缀
$ext = pathinfo($name,PATHINFO_EXTENSION); //文件后缀
if($ext != 'zip')
{
return json(['code'=>-1,'msg'=>'上传文件格式不对']);
}
//对比版本号
$fname = pathinfo($name,PATHINFO_FILENAME); //无后缀文件名
$version_num = array_pop(explode('_',$fname));
$verRes = version_compare($version_num,$this->sys_version,'>');
if(!$verRes){
return json(['code'=>-1,'msg'=>'不能降级,请选择正确版本']);
}
$upDir = $this->upload_dir.$fname;
//$mv = $files->move('/../tmp/web/upload_dir',$version_num);
$mfile = move_uploaded_file($files,$upDir);
if(!$mfile)
{
return json(['code'=>0,'msg'=>'上传文件失败']);
}
//升级前备份代码
$ex = array('.git','.idea','runtime','data','addons','config','extend'); // 排除备份文件夹
$this->backFile($this->root_dir,$this->backup_dir,$ex);
//执行升级
$upres = $this->execute_update($mfile);
//更新版本
//Db::name('system')->update(['sys_version_num'=>$version_num,'id'=>1]);
$value = [
'version' => $version_num
];
$res = SetArr::name('taoler')->edit($value);
if($res == false){
return json(['code'=>-1,'msg'=>'代码更新成功,但版本写入失败']);
}
return json(['code'=>0,'msg'=>'升级成功']);
}
/**
* 备份
* @param string $dir
* @param string $backDir
* @param array $ex
* @return \think\response\Json
*/
public function backFile(string $dir,string $backDir,array $ex)
{
$backRes = Files::copydirs($dir, $backDir, $ex);
$backData = $backRes->getData();
if($backData['code'] == -1){
Log::channel('update')->info('update:{type} {progress} {msg}',['type'=>'error','progress'=>'25%','msg'=>'备份失败!']);
return json(['code'=>-1,'msg'=>$backRes['msg']]);
}
Log::channel('update')->info('update:{type} {progress} {msg}',['type'=>'success','progress'=>'30%','msg'=>'执行文件备份成功!']);
}
}

View File

@ -1,158 +0,0 @@
<?php
namespace app\admin\controller;
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
{
//用户表
public function list()
{
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);
$count = $user->total();
$res = [];
if($count){
$res = ['code'=>0,'msg'=>'','count'=>$count];
foreach($user as $k => $v){
$data = ['id'=>$v['id'],'username'=>$v['name'],'nick'=>$v['nickname'],'avatar'=>$v['user_img'],'phone'=>$v['phone'],'email'=>$v['email'],'sex'=>$v['sex'],'ip'=>$v['last_login_ip'],'city'=>$v['city'],'logintime'=>date("Y-m-d H:i",$v['last_login_time']),'jointime'=>date("Y-m-d",$v['create_time']),'check'=>$v['status'],'auth'=>$v['auth']];
$res['data'][] = $data;
}
} else {
$res = ['code'=>-1,'msg'=>'没有查询结果!'];
}
return json($res);
}
return View::fetch();
}
//添加用户
public function userForm()
{
//
if(Request::isAjax()){
$data = Request::param();
$data['create_time'] = time();
$salt = substr(md5($data['create_time']),-6);
// 默认手机号为密码
$data['password'] = md5(substr_replace(md5($data['phone']),$salt,0,6));
try {
Db::name('user')->save($data);
$res = ['code'=>0,'msg'=>'添加成功'];
} catch (\Exception $e) {
$res = ['code'=>-1, 'msg'=>$e->getMessage()];
}
return json($res);
}
return View::fetch('userform');
}
//编辑用户
public function userEdit()
{
if(Request::isAjax()){
$data = Request::param();
$user = Db::name('user')->field('create_time')->find($data['id']);
$salt = substr(md5($user['create_time']),-6);
// 默认手机号为密码
$data['password'] = md5(substr_replace(md5($data['phone']),$salt,0,6));
$result = Db::name('user')->update($data);
if($result){
$res = ['code'=>0,'msg'=>'编辑成功'];
}else{
$res = ['code'=>-1,'msg'=>'编辑失败'];
}
return json($res);
}
$user = Db::name('user')->find(input('id'));
View::assign('user',$user);
return View::fetch('useredit');
}
//删除用户
public function delete($id)
{
if(Request::isAjax()){
$user =UserModel::find($id);
$result = $user->delete();
if($result){
return json(['code'=>0,'msg'=>'删除成功']);
}else{
return json(['code'=>-1,'msg'=>'删除失败']);
}
}
}
//上传头像
public function uploadImg()
{
$uploads = new Uploads();
$upRes = $uploads->put('file','head_pic',2000,'image');
$userJson = $upRes->getData();
if($userJson['status'] == 0){
$res = ['code'=>0,'msg'=>'上传头像成功','src'=>$userJson['url']];
} else {
$res = ['code'=>1,'msg'=>'上传错误'];
}
return json($res);
}
//审核用户
public function check()
{
$data = Request::only(['id','status']);
//获取状态
$res = Db::name('user')->where('id',$data['id'])->save(['status' => $data['status']]);
if($res){
if($data['status'] == 1){
return json(['code'=>0,'msg'=>'用户审核通过','icon'=>6]);
} else {
return json(['code'=>0,'msg'=>'禁用用户','icon'=>5]);
}
}else {
return json(['code'=>-1,'msg'=>'审核出错']);
}
}
//超级管理员
public function auth()
{
$data = Request::param();
$user = Db::name('user')->save($data);
if($user){
if($data['auth'] == 1){
return json(['code'=>0,'msg'=>'设置为超级管理员','icon'=>6]);
} else {
return json(['code'=>0,'msg'=>'取消超级管理员','icon'=>5]);
}
}else{
$res = ['code'=>-1,'msg'=>'前台管理员设置失败'];
}
return json($res);
}
//过滤数组中为空和null的值
public function filtrArr($arr)
{
if($arr === '' || $arr === null){
return false;
}
return true;
}
}

View File

@ -1,96 +0,0 @@
<?php
namespace app\admin\controller;
//use app\common\controller\AdminController;
class Uzip
{
/**
*header('Content-type:text/html;charset=utf-8');
*@param $filename 解压文件
*@param $dir 解压到路径
*@param $overwrite 是否覆盖文件 true false
*/
public function uzip($filename, $dir ,$overwrite=true)
{
if(!is_dir($dir)) {
//mkdir($dir, 0777, true);//创建目录保存解压内容
$this->create_dirs($dir);
}
if(file_exists($filename)) {
$resource = zip_open($filename);
while($zip = zip_read($resource)) {
if(zip_entry_open($resource, $zip)) {
//获得文件名mac压缩成zip解压需要过滤资源库隐藏文件
$file_content = zip_entry_name($zip);
// 如果文件不在根目录中
$pos_last_slash = strrpos($file_content, "/");
$file_name = substr($file_content, $pos_last_slash+1);
if(empty($file_name)){
$pt = $this->create_dirs($dir.$file_content);
}
if($file_name) {
$save_path = $dir.$file_content;
if(file_exists($save_path)) {
if($overwrite === true){
echo $file_name . '<pre />';
$file_size = zip_entry_filesize($zip);
$file = zip_entry_read($zip, $file_size);
$fpc = file_put_contents($save_path, $file);
//zip_entry_close($zip);
}else{
//echo '文件夹内已存在文件 "' . $file_name . '" <pre />';
return json(['code'=>0,'msg'=>'文件夹内已存在文件']);
}
}else {
//echo $file_name . '<pre />';
$file_size = zip_entry_filesize($zip);
$file = zip_entry_read($zip, $file_size);
$fpc = file_put_contents($save_path, $file);
//zip_entry_close($zip);
}
}
zip_entry_close($zip);
}
}
zip_close($resource);
}else{
return false;
}
return true;
}
public function create_dirs($path)
{
if (!is_dir($path))
{
$directory_path = "";
$directories = explode("/",$path);
array_pop($directories);
foreach($directories as $directory)
{
$directory_path .= $directory."/";
if (!is_dir($directory_path))
{
mkdir($directory_path);
chmod($directory_path, 0777);
}
}
}
}
}

View File

@ -1,81 +0,0 @@
<?php
namespace app\admin\controller;
use app\common\controller\AdminController;
use think\facade\View;
use think\facade\Request;
use think\facade\Db;
use app\common\model\UserViprule;
class Vip extends AdminController
{
//添加VIP积分规则
public function add()
{
$data = Request::only(['score','vip']);
$vip = UserViprule::where('vip',$data['vip'])->find();
if($vip){
$res = ['code'=>-1,'msg'=>'vip等级不能重复设置'];
} else {
$result = UserViprule::create($data);
if($result){
$res = ['code'=>0,'msg'=>'设置vip等级成功'];
} else {
$res = ['code'=>-1,'msg'=>'vip保存失败'];
}
}
return json($res);
}
//删除VIP积分规则
public function delete($id)
{
if(Request::isAjax()){
$user =UserViprule::find($id);
$result = $user->delete();
if($result){
return json(['code'=>0,'msg'=>'删除成功']);
}else{
return json(['code'=>-1,'msg'=>'删除失败']);
}
}
}
//编辑VIP积分规则
public function vipEdit($id)
{
if(Request::isAjax()){
$data = Request::param();
$result = UserViprule::update($data);
if($result){
$res = ['code'=>0,'msg'=>'编辑成功'];
}else{
$res = ['code'=>-1,'msg'=>'编辑失败'];
}
return json($res);
}
$vip = Db::name('user_viprule')->find($id);
$level = UserViprule::column('vip');
View::assign(['vip'=>$vip,'level'=>$level]);
return View::fetch('set/system/vipedit');
}
//显示VIP规则
public function vipRule()
{
$keys = UserViprule::select();
$count = $keys->count();
$res = [];
if($count){
$res = ['code'=>0,'msg'=>'','count'=>$count];
foreach($keys as $k=>$v){
$res['data'][] = ['id'=>$v['id'],'score'=>$v['score'],'nick'=>$v['nick'],'vip'=>$v['vip'],'ctime'=>$v['create_time']];
}
} else {
$res = ['code'=>-1,'msg'=>'还没有任何vip等级设置'];
}
return json($res);
}
}

View File

@ -1,4 +1,13 @@
<?php
/**
* @Program: TaoLer 2023/3/15
* @FilePath: app\admin\controller\addon\Addons.php
* @Description: Addons
* @LastEditTime: 2023-03-15 22:40:04
* @Author: Taoker <317927823@qq.com>
* @Copyright (c) 2020~2023 https://www.aieok.com All rights reserved.
*/
namespace app\admin\controller\addon;
use app\common\controller\AdminController;
@ -16,6 +25,7 @@ use taoler\com\Files;
use app\common\lib\facade\HttpHelper;
use app\common\lib\FileHelper;
class Addons extends AdminController
{
/**
@ -293,10 +303,11 @@ class Addons extends AdminController
$menu = [];
}
if(!empty($menu)){
if(isset($menu['is_nav']) && $menu['is_nav'] == 1){
$pid = 0;
if(isset($menu['is_nav']) && $menu['is_nav'] < 8){
$pid = $menu['is_nav'];
} else {
$pid = AuthRule::where('name','addons')->value('id');
//$pid = AuthRule::where('name','addons')->value('id');
return json(['code'=>-1,'msg'=> 'is_nav菜单项目设置错误']);
}
$menu_arr[] = $menu['menu'];
$this->addAddonMenu($menu_arr, (int)$pid,1);

View File

@ -37,7 +37,7 @@ class Comment extends AdminController
$map = array_filter($data);
$where = array();
if(!empty($map['content'])){
$where[] = ['a.content','like','%'.$map['content'].'%'];
$where[] = ['a.content','like', $map['content'].'%'];
unset($map['content']);
}
if(isset($data['status']) && $data['status'] !== '' ){
@ -79,7 +79,7 @@ class Comment extends AdminController
'replyer' => $v['name'],
'title' => htmlspecialchars($v['title']),
'avatar' => $v['user_img'],
'content'=>htmlspecialchars($v['content']),
'content' => strip_tags($v['content']),
'replytime' => date("Y-m-d",$v['create_time']),
'check' => $v['astatus'],
'url' => $url
@ -116,6 +116,7 @@ class Comment extends AdminController
}
}
//评论审核
public function check()
{
@ -124,24 +125,19 @@ class Comment extends AdminController
//获取状态
$res = Db::name('comment')->where('id',$data['id'])->save(['status' => $data['status']]);
if($res){
if($data['status'] == 1){
return json(['code'=>0,'msg'=>'评论审核通过','icon'=>6]);
} else {
if($data['status'] == 1) return json(['code'=>0,'msg'=>'评论审核通过','icon'=>6]);
return json(['code'=>0,'msg'=>'评论被禁止','icon'=>5]);
}
}else {
return json(['code'=>-1,'msg'=>'审核出错']);
}
}
//array_filter过滤函数
public function filtr($arr){
if($arr === '' || $arr === null){
return false;
}
public function filtr($arr)
{
if($arr === '' || $arr === null) return false;
return true;
}

View File

@ -1,2 +0,0 @@
*
!.gitignore

View File

@ -1,3 +1 @@
App.php
Version.php
Plugins.php
/addons

View File

@ -1,2 +0,0 @@
*
!.gitignore

View File

@ -1,2 +0,0 @@
*
!.gitignore

View File

@ -1,7 +1,5 @@
/key_auth
/time_line
/version
/plugins
/addons_market
/views_market
/app
/addons
/apps
/server

View File

@ -1,48 +0,0 @@
{extend name="public:base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-admin" id="layuiadmin-form-admin" style="padding: 20px 30px 0 0;">
<div class="layui-form-item">
<label class="layui-form-label">登录名</label>
<div class="layui-input-inline">
<input type="text" name="username" lay-verify="required" placeholder="请输入用户名" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">密码</label>
<div class="layui-input-inline">
<input type="text" name="password" lay-verify="password" placeholder="请输入密码" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">手机</label>
<div class="layui-input-inline">
<input type="text" name="mobile" lay-verify="phone" placeholder="请输入号码" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">邮箱</label>
<div class="layui-input-inline">
<input type="text" name="email" lay-verify="email" placeholder="请输入邮箱" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="LAY-user-back-submit" id="LAY-user-back-submit" value="确认">
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form'], function(){
var $ = layui.$
,form = layui.form ;
})
</script>
{/block}

View File

@ -1,51 +0,0 @@
{extend name="public:base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-admin" id="layuiadmin-form-admin" style="padding: 20px 30px 0 0;">
<div class="layui-form-item layui-hide">
<input type="text" name="id" class="layui-input" value="{$admin.id}">
</div>
<div class="layui-form-item">
<label class="layui-form-label">登录名</label>
<div class="layui-input-inline">
<input type="text" name="username" disabled lay-verify="required" placeholder="请输入用户名" autocomplete="off" class="layui-input layui-disabled" value="{$admin.username}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">密码</label>
<div class="layui-input-inline">
<input type="text" name="password" lay-verify="password" placeholder="请输入密码" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">手机</label>
<div class="layui-input-inline">
<input type="text" name="mobile" lay-verify="phone" placeholder="请输入号码" autocomplete="off" class="layui-input" value="{$admin.mobile}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">邮箱</label>
<div class="layui-input-inline">
<input type="text" name="email" lay-verify="email" placeholder="请输入邮箱" autocomplete="off" class="layui-input" value="{$admin.email}">
</div>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="LAY-user-back-submit" id="LAY-user-back-submit" value="确认">
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form'], function(){
var $ = layui.$
,form = layui.form ;
})
</script>
{/block}

View File

@ -1,198 +0,0 @@
{extend name="public:base" /}
{block name="body"}
<div class="layui-fluid">
<div class="layui-card">
<div class="layui-form layui-card-header layuiadmin-card-header-auto">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">登录名</label>
<div class="layui-input-block">
<input type="text" name="username" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">手机</label>
<div class="layui-input-block">
<input type="text" name="mobile" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">邮箱</label>
<div class="layui-input-block">
<input type="text" name="email" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="LAY-user-back-search">
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
</button>
</div>
</div>
</div>
<div class="layui-card-body">
<div style="padding-bottom: 10px;">
<button class="layui-btn layuiadmin-btn-admin" data-type="batchdel">删除</button>
<button class="layui-btn layuiadmin-btn-admin" data-type="add">添加</button>
</div>
<table id="LAY-user-back-manage" lay-filter="LAY-user-back-manage"></table>
<!-- <script type="text/html" id="buttonTpl">
{{# if(d.check == 1){ }}
<button class="layui-btn layui-btn-xs">已审核</button>
{{# } else { }}
<button class="layui-btn layui-btn-primary layui-btn-xs">未审核</button>
{{# } }}
</script>
-->
<script type="text/html" id="buttonTpl">
{{# if(d.id == '1'){ }}
<input type="checkbox" name="check" lay-skin="switch" disabled lay-text="通过|禁用" value="1" checked id="{{d.id}}">
{{# } else { }}
{if condition="checkRuleButton('admin/check')"}<input type="checkbox" name="check" lay-skin="switch" lay-filter="admincheck" lay-text="通过|禁用" {{# if(d.check == 1){ }} checked {{# } }} id="{{d.id}}" >{else}<button class="layui-btn layui-btn-xs layui-btn-radius layui-btn-disabled">无权限</button>{/if}
{{# } }}
</script>
<script type="text/html" id="table-useradmin-admin">
{if condition="checkRuleButton('admin/edit')"}
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>
{else /}<a class="layui-btn layui-btn-normal layui-btn-xs layui-btn-disabled"><i class="layui-icon layui-icon-edit"></i>编辑</a>{/if}
{{# if(d.id == '1'){ }}
<a class="layui-btn layui-btn-disabled layui-btn-xs"><i class="layui-icon layui-icon-delete"></i>删除</a>
{{# } else { }}
{if condition="checkRuleButton('admin/delete')"}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
{else /}<a class="layui-btn layui-btn-danger layui-btn-xs layui-btn-disabled"><i class="layui-icon layui-icon-delete"></i>删除</a>{/if}
{{# } }}
</script>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
var userList = "{:url('User/list')}";
var userDelete = "{:url('User/delete')}";
var userEdit = "{:url('User/userEdit')}";
var adminIndex = "{:url('Admin/index')}";
var adminDelete = "{:url('Admin/delete')}";
var adminEdit = "{:url('Admin/edit')}";
var authGroupList = "{:url('AuthGroup/list')}";
var authGroupRoledel = "{:url('AuthGroup/roleDel')}";
var authGroupRoleEdit = "{:url('AuthGroup/roleEdit')}";
var authAccessIndex = "{:url('AuthAccess/index')}";
var authAccessDelete = "{:url('AuthAccess/delete')}";
var authAccessEdit = "{:url('AuthAccess/edit')}";
var authRuleIndex = "{:url('AuthRule/index')}";
var authRuleDelete = "{:url('AuthRule/delete')}";
var authRuleEdit = "{:url('AuthRule/edit')}";
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'useradmin', 'table'], function(){
var $ = layui.$
,form = layui.form
,table = layui.table;
//监听搜索
form.on('submit(LAY-user-back-search)', function(data){
var field = data.field;
$.post("{:url('admin/index')}",field);
//执行重载
table.reload('LAY-user-back-manage', {
where: field
});
});
//监听管理员审核
form.on('switch(admincheck)', function(data){
var data= data.elem;
//执行管理员审核
var status = data.checked ? 1 : 0;
$.post("{:url('admin/check')}",{"id":data.id,"status":status},function(res){
if(res.code == 0){
layer.msg(res.msg,{icon:res.icon,time:2000})
} else {
layer.open({title:'审核失败',content:res.msg,icon:5,adim:6})
}
});
return false;
});
//事件
var active = {
batchdel: function(){
var checkStatus = table.checkStatus('LAY-user-back-manage')
,checkData = checkStatus.data; //得到选中的数据
if(checkData.length === 0){
return layer.msg('请选择数据');
}
layer.prompt({
formType: 1
,title: '敏感操作,请验证口令'
}, function(value, index){
layer.close(index);
layer.confirm('确定删除吗?', function(index) {
//执行 Ajax 后重载
/*
admin.req({
url: 'xxx'
//,……
});
*/
table.reload('LAY-user-back-manage');
layer.msg('已删除');
});
});
}
,add: function(){
layer.open({
type: 2
,title: '添加管理员'
,content: 'add.html'
,area: ['400px', '380px']
,btn: ['确定', '取消']
,yes: function(index, layero){
var iframeWindow = window['layui-layer-iframe'+ index]
,submitID = 'LAY-user-back-submit'
,submit = layero.find('iframe').contents().find('#'+ submitID);
//监听提交
iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
var field = data.field; //获取提交的字段
//提交 Ajax 成功后,静态更新表格中的数据
$.post("{:url('admin/add')}",field,function(res){
if(res.code == 0){
layer.msg(res.msg,{icon:res.icon,time:2000})
} else {
layer.open({title:'添加失败',content:res.msg,icon:5,adim:6})
}
});
table.reload('LAY-user-back-manage'); //数据刷新
layer.close(index); //关闭弹层
});
submit.trigger('click');
}
});
}
}
$('.layui-btn.layuiadmin-btn-admin').on('click', function(){
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
});
</script>
{/block}

View File

@ -1,43 +0,0 @@
{extend name="public:base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-admin" id="layuiadmin-form-admin" style="padding: 20px 30px 0 0;">
<div class="layui-form-item">
<label class="layui-form-label">管理员</label>
<div class="layui-input-block">
<select name="uid" lay-verify="required">
{volist name="admins" id="vo"}
<option value="{$vo.id}">{$vo.username}</option>
{/volist}
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">角色</label>
<div class="layui-input-block">
<select name="group_id" lay-verify="required">
{volist name="auth_groups" id="vo"}
<option value="{$vo.id}">{$vo.title}</option>
{/volist}
</select>
</div>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="LAY-admin-group-submit" id="LAY-admin-group-submit" value="确认">
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form'], function(){
var $ = layui.$
,form = layui.form ;
})
</script>
{/block}

View File

@ -1,47 +0,0 @@
{extend name="public:base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-admin" id="layuiadmin-form-admin" style="padding: 20px 30px 0 0;">
<div class="layui-form-item layui-hide">
<input type="text" name="id" class="layui-input" value="{$access.id}">
</div>
<div class="layui-form-item">
<label class="layui-form-label">管理员</label>
<div class="layui-input-block">
<select name="uid" lay-verify="required">
{volist name="admins" id="vo"}
<option {if condition="$access.uid eq $vo.id"} selected {/if} value="{$vo.id}">{$vo.username}</option>
{/volist}
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">角色</label>
<div class="layui-input-block">
<select name="group_id" lay-verify="required">
{volist name="auth_groups" id="vo"}
<option {if condition="$access.group_id eq $vo.id"} selected {/if} value="{$vo.id}">{$vo.title}</option>
{/volist}
</select>
</div>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="LAY-admin-group-submit" id="LAY-admin-group-submit" value="确认">
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form'], function(){
var $ = layui.$
,form = layui.form ;
})
</script>
{/block}

View File

@ -1,205 +0,0 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-fluid">
<div class="layui-card">
<div class="layui-form layui-card-header layuiadmin-card-header-auto">
<div class="layui-form-item">
<div class="layui-inline">管理员筛选</div>
<div class="layui-inline">
<select name="uid" lay-filter="LAY-admin-group-type">
<option value="">全部用户</option>
{volist name="admins" id="vo"}
<option value="{$vo.id}">{$vo.username}</option>
{/volist}
</select>
</div>
</div>
</div>
<div class="layui-card-body">
<div style="padding-bottom: 10px;">
<button class="layui-btn layuiadmin-btn-role" data-type="batchdel">删除</button>
<button class="layui-btn layuiadmin-btn-role" data-type="add">添加</button>
</div>
<table id="LAY-user-back-group" lay-filter="LAY-user-back-group"></table>
<script type="text/html" id="buttonCheck">
{if condition="checkRuleButton('AuthAccess/check')"}<input type="checkbox" name="check" lay-skin="switch" lay-filter="groupcheck" lay-text="开启|禁用" {{# if(d.check == 1){ }} checked {{# } }} id="{{d.id}}" >{else /}<button class="layui-btn layui-btn-xs layui-btn-radius layui-btn-disabled">无权限</button>{/if}
</script>
<script type="text/html" id="table-useradmin-admin">
{if condition="checkRuleButton('AuthAccess/edit')"}
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>
{else /}<a class="layui-btn layui-btn-normal layui-btn-xs layui-btn-disabled"><i class="layui-icon layui-icon-edit"></i>编辑</a>{/if}
{if condition="checkRuleButton('AuthAccess/delete')"}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
{else /}<a class="layui-btn layui-btn-danger layui-btn-xs layui-btn-disabled"><i class="layui-icon layui-icon-delete"></i>删除</a>{/if}
</script>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
var userList = "{:url('User/list')}";
var userDelete = "{:url('User/delete')}";
var userEdit = "{:url('User/userEdit')}";
var adminIndex = "{:url('Admin/index')}";
var adminDelete = "{:url('Admin/delete')}";
var adminEdit = "{:url('Admin/edit')}";
var authGroupList = "{:url('AuthGroup/list')}";
var authGroupRoledel = "{:url('AuthGroup/roleDel')}";
var authGroupRoleEdit = "{:url('AuthGroup/roleEdit')}";
var authAccessIndex = "{:url('AuthAccess/index')}";
var authAccessDelete = "{:url('AuthAccess/delete')}";
var authAccessEdit = "{:url('AuthAccess/edit')}";
var authRuleIndex = "{:url('AuthRule/index')}";
var authRuleDelete = "{:url('AuthRule/delete')}";
var authRuleEdit = "{:url('AuthRule/edit')}";
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'useradmin', 'table'], function(){
var $ = layui.$
,form = layui.form
,table = layui.table;
//搜索角色
form.on('select(LAY-admin-group-type)', function(data){
$.ajax({
type:"post",
url:"{:url('AuthAccess/index')}",
data:{"uid":data.value},
daType:"json",
success:function (data){
if (data.code == -1){
layer.open({
content:data.msg,
icon:5,
anim:6
});
}
}
});
//执行重载
table.reload('LAY-user-back-group', {
where: {
uid: data.value
}
});
});
//监听角色审核
form.on('switch(groupcheck)', function(data){
var data= data.elem;
//console.log(data);
if(data.checked == true){
data.value = 1;
}else{
data.value = 0;
}
//执行角色审核
$.ajax({
type:'post',
url:"{:url('admin/AuthAccess/check')}",
data:{id:data.id,status:data.value,},
dataType:'json',
success:function(res){
if(res.code == 0){
layer.msg(res.msg,{
icon:res.icon,
time:2000
});
} else {
layer.open({
title:'审核失败',
content:res.msg,
icon:5,
adim:6
})
}
}
});
return false;
});
//事件
var active = {
batchdel: function(){
var checkStatus = table.checkStatus('LAY-user-back-group')
,checkData = checkStatus.data; //得到选中的数据
if(checkData.length === 0){
return layer.msg('请选择数据');
}
layer.confirm('确定删除吗?', function(index) {
//执行 Ajax 后重载
/*
admin.req({
url: 'xxx'
//,……
});
*/
table.reload('LAY-user-back-group');
layer.msg('已删除');
});
},
add: function(){
layer.open({
type: 2
,title: '添加权限'
,content: 'add.html'
,area: ['450px', '400px']
,btn: ['确定', '取消']
,yes: function(index, layero){
var iframeWindow = window['layui-layer-iframe'+ index]
,submit = layero.find('iframe').contents().find("#LAY-admin-group-submit");
//监听提交
iframeWindow.layui.form.on('submit(LAY-admin-group-submit)', function(data){
var field = data.field;
//提交 Ajax 成功后,静态更新表格中的数据
$.ajax({
type:"post",
url:"{:url('AuthAccess/add')}",
data:field,
daType:"json",
success:function (data){
if (data.code == 0) {
layer.msg(data.msg,{
icon:6,
time:2000
});
} else {
layer.open({
title:'添加失败',
content:data.msg,
icon:5,
anim:6
});
}
}
});
//刷新数据
table.reload('LAY-user-back-group');
layer.close(index); //关闭弹层
});
submit.trigger('click');
}
});
}
}
$('.layui-btn.layuiadmin-btn-role').on('click', function(){
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
});
</script>
{/block}

View File

@ -1,231 +0,0 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-fluid">
<div class="layui-card">
<div class="layui-form layui-card-header layuiadmin-card-header-auto">
<div class="layui-form-item">
<div class="layui-inline">
角色筛选
</div>
<div class="layui-inline">
<select name="id" lay-filter="LAY-user-adminrole-type">
<option value="">全部角色</option>
{volist name="roles" id="vo"}
<option value="{$vo.id}">{$vo.title}</option>
{/volist}
</select>
</div>
</div>
</div>
<div class="layui-card-body">
<div style="padding-bottom: 10px;">
<button class="layui-btn layuiadmin-btn-role" data-type="batchdel">删除</button>
<button class="layui-btn layuiadmin-btn-role" data-type="add">添加</button>
</div>
<table id="LAY-user-back-role" lay-filter="LAY-user-back-role"></table>
<script type="text/html" id="buttonCheck">
{if condition="checkRuleButton('AuthGroup/check')"}<input type="checkbox" name="check" lay-skin="switch" lay-filter="rolecheck" lay-text="打开|关闭" {{# if(d.check == 1){ }} checked {{# } }} id="{{d.id}}" >
{else /}<button class="layui-btn layui-btn-xs layui-btn-radius layui-btn-disabled">无权限</button>{/if}
</script>
<script type="text/html" id="table-useradmin-admin">
{if condition="checkRuleButton('AuthGroup/roleedit')"}
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>
{else /} <a class="layui-btn layui-btn-normal layui-btn-xs layui-btn-disabled"><i class="layui-icon layui-icon-edit"></i>编辑</a>{/if}
{if condition="checkRuleButton('AuthGroup/roledel')"}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
{else /} <a class="layui-btn layui-btn-danger layui-btn-xs layui-btn-disabled"><i class="layui-icon layui-icon-delete"></i>删除</a>{/if}
</script>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
var userList = "{:url('User/list')}";
var userDelete = "{:url('User/delete')}";
var userEdit = "{:url('User/userEdit')}";
var adminIndex = "{:url('Admin/index')}";
var adminDelete = "{:url('Admin/delete')}";
var adminEdit = "{:url('Admin/edit')}";
var authGroupList = "{:url('AuthGroup/list')}";
var authGroupRoledel = "{:url('AuthGroup/roleDel')}";
var authGroupRoleEdit = "{:url('AuthGroup/roleEdit')}";
var authAccessIndex = "{:url('AuthAccess/index')}";
var authAccessDelete = "{:url('AuthAccess/delete')}";
var authAccessEdit = "{:url('AuthAccess/edit')}";
var authRuleIndex = "{:url('AuthRule/index')}";
var authRuleDelete = "{:url('AuthRule/delete')}";
var authRuleEdit = "{:url('AuthRule/edit')}";
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'useradmin', 'table'], function(){
var $ = layui.$
,form = layui.form
,table = layui.table;
//搜索角色
form.on('select(LAY-user-adminrole-type)', function(data){
$.ajax({
type:"post",
url:"{:url('AuthGroup/list')}",
data:{"id":data.value},
daType:"json",
success:function (data){
if (data.code == 0) {
} else {
layer.open({
content:data.msg,
icon:5,
anim:6
});
}
}
});
//执行重载
table.reload('LAY-user-back-role', {
where: {
id: data.value
}
});
});
//监听角色审核
form.on('switch(rolecheck)', function(data){
var data= data.elem;
//console.log(data);
if(data.checked == true){
data.value = 1;
}else{
data.value = 0;
}
//执行角色审核
$.ajax({
type:'post',
url:"{:url('AuthGroup/check')}",
data:{id:data.id,status:data.value,},
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;
});
//事件
var active = {
batchdel: function(){
var checkStatus = table.checkStatus('LAY-user-back-role')
,checkData = checkStatus.data; //得到选中的数据
if(checkData.length === 0){
return layer.msg('请选择数据');
}
layer.confirm('确定删除吗?', function(index) {
//执行 Ajax 后重载
/*
admin.req({
url: 'xxx'
//,……
});
*/
table.reload('LAY-user-back-role');
layer.msg('已删除');
});
},
add: function(){
layer.open({
type: 2
,title: '添加新角色'
,content: 'roleadd.html'
,area: ['500px', '480px']
,btn: ['确定', '取消']
,yes: function(index, layero){
var iframeWindow = window['layui-layer-iframe'+ index]
,submit = layero.find('iframe').contents().find("#LAY-user-role-submit");
//监听提交
iframeWindow.layui.form.on('submit(LAY-user-role-submit)', function(data){
var field = data.field;
//checkbox 父子级级联或取id
var mId = "";
var e =iframeWindow.$(":checkbox");
e.each(function () {
if($(this).next().hasClass("layui-form-checked")){
mId+=$(this).val()+",";
};
})
rules = mId.substring(0,mId.length-1);
/*
var arr = new Array(); //获取提交的字段
$(iframeWindow.document).find('input[name=rules]:checked').each(function(){
arr.push($(this).val());
});
var rules = arr.join(',');//将数组元素连接起来以构建一个字符串
*/
//提交 Ajax 成功后,静态更新表格中的数据
$.ajax({
type:"post",
url:"{:url('AuthGroup/roleAdd')}",
data:{"rules":rules,"title":field.title,"descr":field.descr},
daType:"json",
success:function (data){
if (data.code == 0) {
layer.msg(data.msg,{
icon:6,
time:2000
});
} else {
layer.open({
title:'添加失败',
content:data.msg,
icon:5,
anim:6
});
}
}
});
table.reload('LAY-user-back-role');
layer.close(index); //关闭弹层
});
submit.trigger('click');
}
});
}
}
$('.layui-btn.layuiadmin-btn-role').on('click', function(){
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
});
</script>
{/block}

View File

@ -1,144 +0,0 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-role" id="layuiadmin-form-role" style="padding: 20px 30px 0 0;">
<div class="layui-form-item">
<label class="layui-form-label">角色</label>
<div class="layui-input-inline">
<input type="text" name="title" lay-verify="required" placeholder="请输入角色名" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item" id="test">
<label class="layui-form-label">权限范围</label>
{volist name="menus" id="vo1"}
<ul class="layui-input-block" style="margin-top: 10px ;">
<li>
<input type="checkbox" name="rules" class="parent" lay-skin="primary" data-level="{$vo1.level}" value="{$vo1.id}" title="{$vo1.title}------|">
<ul>
{if condition="isset($vo1['children'])"}
{volist name="vo1['children']" id="vo2"}
<li>
{if condition="isset($vo2['children'])"}
<input type="checkbox" name="rules" class="parent" lay-skin="primary" data-level="{$vo2.level}" value="{$vo2.id}" title="{$vo2.title}">
{volist name="vo2['children']" id="vo3"}
<input type="checkbox" name="rules" lay-skin="primary" id="{$vo3.id}" data-level="{$vo3.level}" value="{$vo3.id}" title="{$vo3.title}">
{/volist}
{else /}
<input type="checkbox" name="rules" lay-skin="primary" id="{$vo2.id}" data-level="{$vo2.level}" value="{$vo2.id}" title="{$vo2.title}">
{/if}
</li>
{/volist}
{/if}
</ul>
</li>
</ul>
{/volist}
</div>
<div class="layui-form-item">
<label class="layui-form-label">具体描述</label>
<div class="layui-input-block">
<textarea type="text" name="descr" lay-verify="required" autocomplete="off" class="layui-textarea"></textarea>
</div>
</div>
<div class="layui-form-item layui-hide">
<button class="layui-btn" lay-submit lay-filter="LAY-user-role-submit" id="LAY-user-role-submit">提交</button>
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form'], function(){
var $ = layui.$
,form = layui.form ;
form.on('checkbox()', function(data){
//var pc = data.elem.classList; //获取选中的checkbox的class属性
var othis = $(data.elem);
var level = $(data.elem).attr('data-level');
//选择
if(data.elem.checked==true){
//主菜单
if(level === '0'){
var c =$(data.elem).siblings().find("input[type='checkbox']");
c.each(function(){
var e = $(this);
e.next().addClass("layui-form-checked");
});
}
//子菜单及子项
if(level === '1'){
var c = $(data.elem).siblings("input[type='checkbox']");
c.each(function(){
var e = $(this);
e.next().addClass("layui-form-checked");
});
$(data.elem).parent().parent().prev().addClass("layui-form-checked");
}
//子项
if(level === '2'){
$(data.elem).siblings('div:first').addClass("layui-form-checked");
$(data.elem).parent().parent().prev().addClass("layui-form-checked");
}
}else{
//取消
if(level === '0'){
var c =$(data.elem).siblings().find("input[type='checkbox']");
c.each(function(){
var e = $(this);
e.next().removeClass("layui-form-checked");
});
}
if(level === '1'){
var c = $(data.elem).siblings("input[type='checkbox']");
c.each(function(){
var e = $(this);
e.next().removeClass("layui-form-checked");
});
//子项为0菜单取消选择
var s = $(data.elem).parent().parent().children('li').children('div:first-of-type .layui-form-checked');
if(s.length === 0){
$(data.elem).parent().parent().prev().removeClass("layui-form-checked");
}
}
//子项
if(level === '2'){
var t = othis.siblings('div .layui-form-checked');
if(t.length == 1){
$(data.elem).siblings('div:first').removeClass("layui-form-checked");
}
//子项为0菜单取消选择
var s = $(data.elem).parent().parent().children('li').children('div:first-of-type .layui-form-checked');
if(s.length === 0){
$(data.elem).parent().parent().prev().removeClass("layui-form-checked");
}
}
}
});
})
</script>
{/block}

View File

@ -1,169 +0,0 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-role" id="layuiadmin-form-role" style="padding: 20px 30px 0 0;">
<div class="layui-form-item layui-hide">
<input type="text" name="id" class="layui-input" value="{$auth.id}">
</div>
<div class="layui-form-item">
<label class="layui-form-label">角色</label>
<div class="layui-input-block">
<select name="title">
{volist name="authGroup" id="vo"}
<option {if condition="$vo.id eq $Request.param.id"} selected {/if} id="{$vo.id}" value="{$vo.title}">{$vo.title}</option>
{/volist}
</select>
</div>
</div>
<div class="layui-form-item" id="test">
<label class="layui-form-label">权限范围</label>
{volist name="menus" id="vo1"}
<ul class="layui-input-block" style="margin-top: 10px ;">
<li>
<input type="checkbox" name="rules" class="parent" lay-skin="primary" data-level="{$vo1.level}" value="{$vo1.id}" title="{$vo1.title}------|" {if (in_array($vo1.id,$rus))} checked {/if}>
<ul>
{if condition="isset($vo1['children'])"}
{volist name="vo1['children']" id="vo2"}
<li>
{if condition="isset($vo2['children'])"}
<input type="checkbox" name="rules" class="parent" lay-skin="primary" data-level="{$vo2.level}" value="{$vo2.id}" title="{$vo2.title}" {if (in_array($vo2.id,$rus))} checked {/if}>
{volist name="vo2['children']" id="vo3"}
<input type="checkbox" name="rules" lay-skin="primary" id="{$vo3.id}" data-level="{$vo3.level}" value="{$vo3.id}" title="{$vo3.title}" {if (in_array($vo3.id,$rus))} checked {/if}>
{/volist}
{else /}
<input type="checkbox" name="rules" lay-skin="primary" id="{$vo2.id}" data-level="{$vo2.level}" value="{$vo2.id}" title="{$vo2.title}" {if (in_array($vo2.id,$rus))} checked {/if}>
{/if}
</li>
{/volist}
{/if}
</ul>
</li>
</ul>
{/volist}
</div>
<div class="layui-form-item">
<label class="layui-form-label">具体描述</label>
<div class="layui-input-block">
<textarea type="text" name="descr" lay-verify="required" autocomplete="off" class="layui-textarea" value="{$auth.descr}">{$auth.descr}</textarea>
</div>
</div>
<div class="layui-form-item layui-hide">
<button class="layui-btn" lay-submit lay-filter="LAY-user-role-submit" id="LAY-user-role-submit">提交</button>
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'table','form'], function(){
var $ = layui.$
,form = layui.form
,table = layui.table;
// var name = "{$ru}";
// var names = name.split(",");
// var inputs = $('input[name=rules]');
// for (var i =0;i<inputs.length;i++) {
// for (var n =0;n<names.length;n++) {
// if (names[n]===inputs[i].value) {
// inputs[i].checked = true;
// }
// }
// }
form.on('checkbox()', function(data){
//var pc = data.elem.classList; //获取选中的checkbox的class属性
var othis = $(data.elem);
var level = $(data.elem).attr('data-level');
//选择
if(data.elem.checked==true){
//主菜单
if(level === '0'){
var c =$(data.elem).siblings().find("input[type='checkbox']");
c.each(function(){
var e = $(this);
e.next().addClass("layui-form-checked");
});
}
//子菜单及子项
if(level === '1'){
var c = $(data.elem).siblings("input[type='checkbox']");
c.each(function(){
var e = $(this);
e.next().addClass("layui-form-checked");
});
$(data.elem).parent().parent().prev().addClass("layui-form-checked");
}
//子项
if(level === '2'){
$(data.elem).siblings('div:first').addClass("layui-form-checked");
$(data.elem).parent().parent().prev().addClass("layui-form-checked");
}
}else{
//取消
if(level === '0'){
var c =$(data.elem).siblings().find("input[type='checkbox']");
c.each(function(){
var e = $(this);
e.next().removeClass("layui-form-checked");
});
}
if(level === '1'){
var c = $(data.elem).siblings("input[type='checkbox']");
c.each(function(){
var e = $(this);
e.next().removeClass("layui-form-checked");
});
//子项为0菜单取消选择
var s = $(data.elem).parent().parent().children('li').children('div:first-of-type .layui-form-checked');
if(s.length === 0){
$(data.elem).parent().parent().prev().removeClass("layui-form-checked");
}
}
//子项
if(level === '2'){
var t = othis.siblings('div .layui-form-checked');
if(t.length == 1){
$(data.elem).siblings('div:first').removeClass("layui-form-checked");
}
//子项为0菜单取消选择
var s = $(data.elem).parent().parent().children('li').children('div:first-of-type .layui-form-checked');
if(s.length === 0){
$(data.elem).parent().parent().prev().removeClass("layui-form-checked");
}
}
}
});
})
</script>
{/block}

View File

@ -1,117 +0,0 @@
{extend name="public:base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-admin" id="layuiadmin-rule-add" style="padding: 20px 30px 0 0;">
<div class="layui-form-item">
<label class="layui-form-label">上级菜单</label>
<div class="layui-input-block">
<div id="menuSelectBox" class="ew-xmselect-tree"></div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">菜单名称</label>
<div class="layui-input-inline">
<input type="text" name="title" lay-verify="required" placeholder="请输入菜单名" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">权限地址</label>
<div class="layui-input-inline">
<input type="text" name="name" lay-verify="required" placeholder="请输入权限地址" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">图标</label>
<div class="layui-input-inline">
<input type="text" name="icon" id="iconPicker" lay-filter="iconPicker" style="display:none;">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">排序</label>
<div class="layui-input-inline">
<input type="text" name="sort" lay-verify="" placeholder="排序序号" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">类型</label>
<div class="layui-input-block">
<input type="radio" name="ismenu" lay-skin="primary" title="目录" value="0">
<input type="radio" name="ismenu" lay-skin="primary" title="菜单" value="1" checked>
<input type="radio" name="ismenu" lay-skin="primary" title="按钮" value="2">
</div>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="LAY-user-rule-submit" id="LAY-user-rule-submit" value="确认">
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form','admin', 'xmSelect', 'iconPicker'], function(){
var $ = layui.$
,form = layui.form ;
var admin = layui.admin;
var xmSelect = layui.xmSelect;
var iconPicker = layui.iconPicker;
//初始化图标选择
iconPicker.render({
elem: '#iconPicker',
type: 'fontClass',
search: false,
page: true,
limit: 12,
click: function (data) {
//console.log(data);
}
});
//权限菜单结构
admin.req({
type: "post",
url: "{:url('AuthRule/tree')}",
data:{},
done:function(res){
var data = res.data;
// 渲染下拉树
xmSelect.render({
el: '#menuSelectBox',
name: 'pid',
height: '250px',
layVerify: 'required',
layVerType: 'tips',
data: data,
initValue: [],
model: {label: {type: 'text'}},
prop: {
name: 'title',
value: 'id'
},
radio: true,
clickClose: true,
tree: {
show: true,
indent: 15,
strict: false,
expandedKeys: true
},
tips: '请选择上级菜单'
});
}
});
});
</script>
{/block}

View File

@ -1,118 +0,0 @@
{extend name="public:base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-admin" id="layuiadmin-rule-edit" style="padding: 20px 30px 0 0;">
<div class="layui-form-item layui-hide">
<input type="text" name="id" class="layui-input" value="{$rules.id}">
</div>
<div class="layui-form-item">
<label class="layui-form-label">上级菜单</label>
<div class="layui-input-block">
<div id="menuSelectBox" class="ew-xmselect-tree"></div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">菜单名称</label>
<div class="layui-input-inline">
<input type="text" name="title" lay-verify="required" placeholder="请输入权限名" autocomplete="off" class="layui-input" value="{$rules.title}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">权限地址</label>
<div class="layui-input-inline">
<input type="text" name="name" lay-verify="required" placeholder="请输入权限地址" autocomplete="off" class="layui-input" value="{$rules.name}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">图标</label>
<div class="layui-input-inline">
<input type="text" name="icon" id="iconPicker" lay-filter="iconPicker" value="{$rules.icon}" style="display:none;">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">排序</label>
<div class="layui-input-inline">
<input type="text" name="sort" lay-verify="required" placeholder="排序序号" autocomplete="off" class="layui-input" value="{$rules.sort}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">类型</label>
<div class="layui-input-block">
<input type="radio" name="ismenu" lay-skin="primary" title="目录" value="0" {if condition="$rules.ismenu == 0"} checked {/if}>
<input type="radio" name="ismenu" lay-skin="primary" title="菜单" value="1" {if condition="$rules.ismenu == 1"} checked {/if}>
<input type="radio" name="ismenu" lay-skin="primary" title="按钮" value="2" {if condition="$rules.ismenu == 2"} checked {/if}>
</div>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="LAY-user-rule-submit" id="LAY-user-rule-submit" value="确认">
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form','admin', 'xmSelect', 'iconPicker'], function(){
var $ = layui.$
,form = layui.form ;
var admin = layui.admin;
var xmSelect = layui.xmSelect;
var iconPicker = layui.iconPicker;
var initPid = "{$rules['pid']}";
//初始化图标选择
iconPicker.render({
elem: '#iconPicker',
type: 'fontClass',
search: false,
page: true,
limit: 12,
click: function (data) {
//console.log(data);
}
});
//权限菜单结构
admin.req({
type: "post",
url: "{:url('AuthRule/tree')}",
data:{},
done:function(res){
var data = res.data;
// 渲染下拉树
xmSelect.render({
el: '#menuSelectBox',
name: 'pid',
height: '250px',
layVerify: 'required',
layVerType: 'tips',
data: data,
initValue: [initPid],
model: {label: {type: 'text'}},
prop: {
name: 'title',
value: 'id'
},
radio: true,
clickClose: true,
tree: {
show: true,
indent: 15,
strict: false,
expandedKeys: true
},
tips: '请选择上级菜单'
});
}
});
})
</script>
{/block}

View File

@ -1,318 +0,0 @@
{extend name="public:base" /}
{block name="css"}<link rel="stylesheet" href="/static/admin/tree/css/treeTable.css">{/block}
{block name="body"}
<body class="layui-hide">
<div class="page-wrapper">
<div class="demo-side">
<table id="LAY-user-auth-rule"></table>
</div>
</div>
<!-- 表格操作列 -->
<script type="text/html" id="tbBar">
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="edit">修改</a>
<!--a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a-->
{{# if(d.id == '1' | d.id == '2' | d.id == '9' | d.id == '10' ){ }}<a class="layui-btn layui-btn-disabled layui-btn-xs">删除</a>
{{# } else { }}
{if condition="checkRuleButton('authrule/delete')"}<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
{else /}<a class="layui-btn layui-btn-danger layui-btn-xs layui-btn-disabled">删除</a>{/if}
{{# } }}
</script>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/modules/'
}).use(['layer', 'util', 'treeTable'], function () {
var $ = layui.jquery;
var layer = layui.layer;
var util = layui.util;
var treeTable = layui.treeTable;
$('body').removeClass('layui-hide');
// 渲染表格
var insTb = treeTable.render({
elem: '#LAY-user-auth-rule',
url: "{:url('AuthRule/index')}",
toolbar: 'default',
//height: 'full-200',
tree: {
iconIndex: 2,
isPidData: true,
idName: 'id',
pidName: 'pid'
},
defaultToolbar: ['filter', 'print', 'exports'],
cols: [
[
{type: 'checkbox'},
{field: 'id', title: 'ID',width: 40},
{field: 'title', title: '菜单名称', minWidth: 165},
{field: 'url', title: '菜单地址', rowspan: 2},
{
title: '菜单图标', align: 'center',
templet: '<p><i class="layui-icon {{d.icon}}"></i></p>'
},
{field: 'authority', title: '权限标识'},
{field: 'ismenu', title: '类型', templet: type, align: 'center', width: 60},
// {title: '类型', templet: '<p>{{d.ismenu ? "菜单" : "按钮"}}</p>', align: 'center', width: 60},
{field: 'sort', title: '排序', align: 'center', width: 60},
{field: 'create_time',title: '创建时间'},
{align: 'center', toolbar: '#tbBar', title: '操作', width: 120}
]
],
style: 'margin-top:0;'
});
//自定义“状态”列
function type(data) {
var isMenu = data.ismenu;
var btns = "";
if (isMenu == -1) {
return "目录";
}
if (isMenu == 1) {
btns += '<span class="layui-btn layui-btn-sm">菜单</span>';
//return "菜单";
}
if (isMenu == 0) {
btns += '<span class="layui-btn layui-btn-normal layui-btn-sm">按钮</span>';
//return "按钮";
}
return btns;
}
// 工具列点击事件
treeTable.on('tool(LAY-user-auth-rule)', function (obj) {
var event = obj.event;
var data = obj.data;
if (event === 'del') {
layer.prompt({
formType: 1
,title: '敏感操作,请验证口令'
}, function(value, index){
layer.close(index);
layer.confirm('确定删除此权限?', function(index){
$.ajax({
type:'post',
url:"{:url('AuthRule/delete')}",
data:{id:data.id},
dataType:'json',
success:function(data){
if(data.code == 0){
layer.msg(data.msg,{
icon:6,
time:2000
},function(){
location.reload();
});
} else {
layer.open({
title:'删除失败',
content:data.msg,
icon:5,
adim:6
})
}
}
});
layer.close(index);
});
});
} else if (event === 'edit') {
layer.open({
type: 2
,title: '编辑权限'
,content: "{:url('AuthRule/edit')}" +'?id='+ data.id
,area: ['420px', '550px']
,btn: ['确定', '取消']
,yes: function(index, layero){
var iframeWindow = window['layui-layer-iframe'+ index]
,submitID = 'LAY-user-rule-submit'
,submit = layero.find('iframe').contents().find('#'+ submitID);
//监听提交
iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
var field = data.field; //获取提交的字段
//提交 Ajax 成功后,静态更新表格中的数据
$.ajax({
type:"post",
url:"{:url('AuthRule/edit')}",
data: field,
daType:"json",
success:function (res){
if (res.code == 0) {
layer.msg(res.msg,{
icon:6,
time:2000
}, function(){
location.reload();
});
} else {
layer.open({
tiele:'修改失败',
content:res.msg,
icon:5,
anim:6
});
}
}
});
//treeTable.reload('LAY-user-auth-rule'); //数据刷新
layer.close(index); //关闭弹层
});
submit.trigger('click');
}
,success: function(layero, index){
}
});
}
});
// 头部工具栏点击事件
treeTable.on('toolbar(LAY-user-auth-rule)', function (obj) {
switch (obj.event) {
case 'add':
layer.msg('添加');
layer.open({
type: 2
,title: '添加权限'
,content: 'add.html'
,area: ['420px', '550px']
,btn: ['确定', '取消']
,yes: function(index, layero){
var iframeWindow = window['layui-layer-iframe'+ index]
,submitID = 'LAY-user-rule-submit'
,submit = layero.find('iframe').contents().find('#'+ submitID);
//监听提交
iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
var field = data.field; //获取提交的字段
//提交 Ajax 成功后,静态更新表格中的数据
$.ajax({
type:"post",
url:"{:url('AuthRule/add')}",
data: field,
daType:"json",
success:function (data){
if (data.code == 0) {
layer.msg(data.msg,{
icon:6,
time:2000
}, function(){
location.reload();
});
} else {
layer.open({
title:'添加失败',
content:data.msg,
icon:5,
anim:6
});
}
}
});
treeTable.reload('LAY-user-auth-rule'); //数据刷新
layer.close(index); //关闭弹层
});
submit.trigger('click');
}
});
break;
case 'delete':
layer.msg('删除');
break;
case 'update':
layer.msg('编辑');
break;
case 'LAYTABLE_TIPS':
layer.msg('提示');
break;
}
});
// 全部展开
$('#btnExpandAll').click(function () {
insTb.expandAll();
});
// 全部折叠
$('#btnFoldAll').click(function () {
insTb.foldAll();
});
// 展开指定
$('#btnExpand').click(function () {
insTb.expand(2);
});
// 折叠指定
$('#btnFold').click(function () {
insTb.fold(2);
});
// 设置选中
$('#btnChecked').click(function () {
insTb.expand(4);
insTb.setChecked([4]);
});
// 搜索
$('#btnSearch').click(function () {
var keywords = $('#edtSearch').val();
if (keywords) {
insTb.filterData(keywords);
} else {
insTb.clearFilter();
}
});
// 清除搜索
$('#btnClearSearch').click(function () {
insTb.clearFilter();
});
// 重载
$('#btnReload').click(function () {
insTb.reload();
});
$('#btnRefresh').click(function () {
insTb.refresh();
});
// 获取选中
$('#btnGetChecked').click(function () {
layer.alert('<pre>' + JSON.stringify(insTb.checkStatus().map(function (d) {
return {
authorityName: d.authorityName,
authorityId: d.authorityId,
LAY_INDETERMINATE: d.LAY_INDETERMINATE
};
}), null, 3) + '</pre>');
});
// 演示侧边栏
$('#btnToggleSide').click(function () {
$('.demo-side').toggleClass('show');
});
});
</script>
{/block}

View File

@ -96,9 +96,9 @@
,cols: [[
{type: 'checkbox'}
,{field: 'id', width: 80, title: 'ID', sort: true}
,{field: 'title', title: '标题',minWidth: 150, templet: '<div><a href="{{d.url}}" target="_blank">{{d.title}}</a></div>'}
,{field: 'replyer', title: '账号', width: 80}
,{field: 'avatar', title: '头像', width: 60, templet: '#imgTpl'}
,{field: 'replyer', title: '账号', width: 80}
,{field: 'title', title: '标题',minWidth: 150, templet: '<div><a href="{{d.url}}" target="_blank">{{d.title}}</a></div>'}
,{field: 'content', title: '评论', minWidth: 200}
,{field: 'replytime', title: '回复时间', width: 120, sort: true}
,{field: 'check', title: '审核', templet: '#buttonCheck', width: 100}

View File

@ -121,8 +121,8 @@
[
{type: 'checkbox'}
,{field: 'id', width: 60, title: 'ID', sort: true}
,{field: 'poster', title: '账号',width: 80}
,{field: 'avatar', title: '头像', width: 60, templet: '#avatarTpl'}
,{field: 'poster', title: '账号',width: 80}
,{field: 'title', title: '标题', minWidth: 180,templet: '<div><a href="{{- d.url }}" target="_blank">{{- d.title }}</a></div>'}
,{field: 'content', title: '内容', 'escape':false, minWidth: 200}
,{field: 'posttime', title: '时间',width: 120, sort: true}

View File

@ -1,130 +0,0 @@
{extend name="public:base" /}
{block name="body"}
<div class="layui-fluid">
<div class="layui-card">
<div class="layui-card-header layuiadmin-card-header-auto">
<button class="layui-btn layuiadmin-btn-ledger" data-type="back">备份</button>
</div>
<div class="layui-progress layui-progress-big" lay-showpercent="true" lay-filter="demo">
<div class="layui-progress-bar layui-bg-red" lay-percent="0%"></div>
</div>
<div class="layui-card-body">
<table id="LAY-app-content-ledger" lay-filter="LAY-app-content-ledger"></table>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-sm" lay-event="getCheckData">获取选中行数据</button>
<button class="layui-btn layui-btn-sm" lay-event="getCheckLength">获取选中数目</button>
<button class="layui-btn layui-btn-sm" lay-event="isAll">验证是否全选</button>
</div>
</script>
<script type="text/html" id="tao-ledger">
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>备份</a>
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="down"><i class="layui-icon layui-icon-edit"></i>下载</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-edit"></i>删除</a>
</script>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index','table','layer','element'], function(){
var table = layui.table,
layer = layui.layer,
element = layui.element;
var $ = layui.$;
var active = {
back: function backup(predate)
{
//var index = layer.load();
$.ajax({
url: "{:url('Databackup/backup')}",
type: 'POST', //POST
async: true, //或false,是否异步
dataType: 'json',
data:predate,
success: function (data) {
if (data.totalpercentage >= 100)
{
//关闭
//layer.close(index);
layer.alert('备份完成', {icon: 1});
}
element.progress('demo', data.totalpercentage+'%');
//循环备份
if (data.totalpercentage < 100)
{
backup(data);
}
}
});
}
};
//总帐信息
table.render({
elem: '#LAY-app-content-ledger'
,url: "{:url('Database/index')}" //进列表接口
,toolbar: '#toolbarDemo' //开启头部工具栏,并为其绑定左侧模板
,defaultToolbar: ['filter', 'exports', 'print']
,cols: [[
{type: 'checkbox', fixed: 'left'}
,{field:'id', title:'ID', width:80, fixed: 'left', unresize: true, sort: true}
,{field: 'time', title: '备份时间',width: 180}
,{field: 'name', title: '备份名', minWidth: 200}
,{title: '操作', width: 150, align: 'center', toolbar: '#tao-ledger'}
]]
,page: true
,limit: 15
,limits: [10, 15, 20, 25, 30]
,text: '对不起,加载出现异常!'
});
$('#back1').on('click',function(){
//询问框
layer.confirm('确定备份?', {
btn: ['确定','取消'] //按钮
}, function(){
console.log(123);
backup({});
//layer.msg('的确很重要', {icon: 1});
}
);
});
$('.layui-btn.layuiadmin-btn-ledger').on('click', function(){
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
});
</script>
{/block}

View File

@ -1,218 +0,0 @@
{extend name="public:base" /}
{block name="body"}
<div class="layui-fluid">
<div class="layui-card">
<div class="layui-card-header layuiadmin-card-header-auto">
<button class="layui-btn layuiadmin-btn-database" data-type="back">备份</button>
</div>
<div class="layui-progress layui-progress-big" lay-showpercent="true" lay-filter="demo">
<div class="layui-progress-bar layui-bg-red" lay-percent="0%"></div>
</div>
<div class="layui-card-body">
<table id="LAY-app-content-database" lay-filter="LAY-app-content-database"></table>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-sm" lay-event="getCheckData">获取选中行数据</button>
<button class="layui-btn layui-btn-sm" lay-event="getCheckLength">获取选中数目</button>
<button class="layui-btn layui-btn-sm" lay-event="isAll">验证是否全选</button>
</div>
</script>
<script type="text/html" id="tao-database">
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="down"><i class="layui-icon layui-icon-download-circle"></i></a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i></a>
</script>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index','table','layer','element'], function(){
var table = layui.table,
layer = layui.layer,
element = layui.element;
var $ = layui.$;
var active = {
back: function backup(predate)
{
var index = layer.load();
$.ajax({
url: "{:url('Database/backup')}",
type: 'POST', //POST
async: true, //或false,是否异步
dataType: 'json',
data:predate,
success: function (data, textStatus, jqXHR) {
if (data.totalpercentage >= 100)
{
//关闭
layer.close(index);
layer.alert('备份完成', {icon: 1});
table.reload('LAY-app-content-database'); //数据刷新
}
element.progress('demo', data.totalpercentage+'%');
//循环备份
if (data.totalpercentage < 100)
{
backup(data);
}
}
});
}
};
//信息
table.render({
elem: '#LAY-app-content-database'
,url: "{:url('Database/index')}" //进列表接口
,toolbar: '#toolbarDemo' //开启头部工具栏,并为其绑定左侧模板
,cols: [[
{type: 'checkbox', fixed: 'left'}
,{field:'id', title:'ID', width:80, fixed: 'left', unresize: true, sort: true}
,{field: 'time', title: '备份时间',width: 180}
,{field: 'name', title: '备份名', minWidth: 200}
,{title: '操作', width: 100, align: 'center', toolbar: '#tao-database'}
]]
,page: true
,limit: 15
,limits: [10, 15, 20, 25, 30]
,text: '对不起,加载出现异常!'
});
//监听工具条
table.on('tool(LAY-app-content-database)', function(obj){
var data = obj.data;
if(obj.event === 'del'){
layer.confirm('确定删除此站点?', function(index){
$.ajax({
type:'post',
url:"{:url('Database/delete')}",
data:{name:data.name},
dataType:'json',
success:function(data){
if(data.code == 0){
layer.msg(data.msg,{
icon:6,
time:2000
},function(){
location.reload();
});
} else {
layer.open({
title:'删除失败',
content:data.msg,
icon:5,
adim:6
})
}
}
});
//obj.del();
layer.close(index);
});
} else if(obj.event === 'down'){
var tr = $(obj.tr);
layer.open({
type: 2
,title: '下载'
,content: "{:url('Database/down')}" + '?id='+ data.id
,area: ['420px', '460px']
,btn: ['确定', '取消']
,yes: function(index, layero){
//获取iframe元素的值
var iframeWindow = window['layui-layer-iframe'+ index]
,submit = layero.find('iframe').contents().find("#LAY-admin-pay-submit");
//监听提交
iframeWindow.layui.form.on('submit(LAY-admin-pay-submit)', function(data){
var field = data.field; //获取提交的字段
//提交 Ajax 成功后,静态更新表格中的数据
$.ajax({
type:"post",
url:payEdit,
data:field,
daType:"json",
success:function (res){
if (res.code == 0) {
layer.msg(res.msg,{
icon:6,
time:2000
});
} else {
layer.open({
title:'修改失败',
content:res.msg,
icon:5,
anim:6
});
}
}
});
table.reload('LAY-app-content-pay'); //数据刷新
layer.close(index); //关闭弹层
});
submit.trigger('click');
}
,success: function(layero, index){
//给iframe元素赋值
var othis = layero.find('iframe').contents().find("#layuiadmin-app-form-pay").click();
othis.find('input[name="pay_value"]').val(Math.abs(data.pay_value))
,othis.find('input[name="pay_name"]').val(data.pay_name);
}
});
}
});
$('#back1').on('click',function(){
//询问框
layer.confirm('确定备份?', {
btn: ['确定','取消'] //按钮
}, function(){
console.log(123);
backup({});
//layer.msg('的确很重要', {icon: 1});
}
);
});
$('.layui-btn.layuiadmin-btn-database').on('click', function(){
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
});
</script>
{/block}

View File

@ -1,80 +0,0 @@
<!doctype html>
<html lang="en" data-ng-app="FileManagerApp">
<head>
<!--
* Angular FileManager v1.5.1 (https://github.com/joni2back/angular-filemanager)
* Jonas Sciangula Street <joni2back@gmail.com>
* Licensed under MIT (https://github.com/joni2back/angular-filemanager/blob/master/LICENSE)
-->
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>angular-filemanager</title>
<!-- third party -->
<script src="/file/node_modules/jquery/dist/jquery.min.js"></script>
<script src="/file/node_modules/angular/angular.min.js"></script>
<script src="/file/node_modules/angular-translate/dist/angular-translate.min.js"></script>
<script src="/file/node_modules/ng-file-upload/dist/ng-file-upload.min.js"></script>
<script src="/file/node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="/file/node_modules/bootswatch/paper/bootstrap.min.css" />
<!-- /third party -->
<!-- Uncomment if you need to use raw source code-->
<script src="/file/src/js/app.js"></script>
<script src="/file/src/js/directives/directives.js"></script>
<script src="/file/src/js/filters/filters.js"></script>
<script src="/file/src/js/providers/config.js"></script>
<script src="/file/src/js/entities/chmod.js"></script>
<script src="/file/src/js/entities/item.js"></script>
<script src="/file/src/js/services/apihandler.js"></script>
<script src="/file/src/js/services/apimiddleware.js"></script>
<script src="/file/src/js/services/filenavigator.js"></script>
<script src="/file/src/js/providers/translations.js"></script>
<script src="/file/src/js/controllers/main.js"></script>
<script src="/file/src/js/controllers/selector-controller.js"></script>
<link href="/file/src/css/animations.css" rel="stylesheet">
<link href="/file/src/css/dialogs.css" rel="stylesheet">
<link href="/file/src/css/main.css" rel="stylesheet">
<!-- Comment if you need to use raw source code
<link href="/file/dist/angular-filemanager.min.css" rel="stylesheet">
<script src="/file/dist/angular-filemanager.min.js"></script>
/Comment if you need to use raw source code -->
<script type="text/javascript">
//example to override angular-filemanager default config
angular.module('FileManagerApp').config(['fileManagerConfigProvider', function (config) {
var defaults = config.$get();
config.set({
appName: 'angular-filemanager',
listUrl: '/FileManager/data',
pickCallback: function(item) {
var msg = 'Picked %s "%s" for external use'
.replace('%s', item.type)
.replace('%s', item.fullPath());
window.alert(msg);
},
allowedActions: angular.extend(defaults.allowedActions, {
pickFiles: false,
pickFolders: false,
}),
});
}]);
</script>
</head>
<body class="ng-cloak">
<angular-filemanager></angular-filemanager>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-35182652-1', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>

View File

@ -1,249 +0,0 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-form layui-form-pane" lay-filter="layuiadmin-form-addforum" id="layuiadmin-form-addforum">
<div class="layui-tab layui-tab-brief" lay-filter="user">
<div class="layui-tab-content" id="LAY_ucm" style="padding: 20px 0">
<div class="layui-tab-item layui-show">
<div class="layui-row layui-col-space15 layui-form-item">
<div class="layui-col-md3">
<label class="layui-form-label">{:lang('special column')}</label>
<div class="layui-input-block">
<select lay-verify="required" name="cate_id" lay-filter="column">
<option></option>
{volist name="cateList" id="cate"}
<option value="{$cate.id}" {if($Request.param.cate == $cate.ename)} selected {/if}>{:cookie('think_lang') == 'en-us' ? $cate.ename : $cate.catename}</option>
{/volist}
</select>
</div>
</div>
<div class="layui-col-md8">
<label for="L_title" class="layui-form-label">{:lang('title')}</label>
<div class="layui-input-block">
<input type="text" id="L_title" name="title" required lay-verify="required" autocomplete="off" class="layui-input" style="position:relative;" value=""/>
<input type="hidden" id="L_title_color" name="title_color" autocomplete="off" class="layui-input" />
<div class="layui-input bdsug layui-hide">
<ul class="wordlist">
</ul>
</div>
</div>
</div>
<div class="layui-col-md1">
<div id="color"></div>
</div>
</div>
<div class="layui-form-item layui-form-text">
<div class="layui-input-block">
<textarea id="L_content" name="content" required lay-verify="required" placeholder="{:lang('please input the content')}" class="layui-textarea fly-editor" style="height: 260px"> </textarea>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">{:lang('enclosure')}</label>
<div class="layui-input-inline" style="width: 190px">
<input type="text" class="layui-input" name="upzip" value="" placeholder="zip,image文件" title="上传附件" />
</div>
<button type="button" class="layui-btn" id="zip-button"><i class="layui-icon"></i>{:lang('uploads')}</button>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">{:lang('描述')}</label>
<div class="layui-input-block">
<textarea name="description" class="layui-textarea" placeholder="SEO描述"></textarea>
</div>
</div>
{//关键词}
<div class="layui-form-item">
<label class="layui-form-label">{:lang('添加关键词')}</label>
<div class="layui-input-block">
<!-- <input type="text" class="layui-input" name="" id="inputTags" value="" placeholder="多个回车添加" title="添加关键词" /> -->
<input type="text" class="layui-input" name="keywords" value="" placeholder="多个用逗号隔开" title="添加关键词" />
</div>
</div>
{//tag}
<div class="layui-form-item">
<label class="layui-form-label">{:lang('add tags')}</label>
<div class="layui-input-block">
<div id="tag"></div>
</div>
</div>
<div class="layui-form-item layui-hide">
<button type="submit" class="layui-btn" lay-filter="article-add" lay-submit id="article-add">{:lang('post now')}</button>
</div>
</div>
</div>
</div>
</div>
{/block}
{block name="js"}
<script src="/static/jquery-3.6.0.min.js"></script>
<script src="/addons/taonyeditor/tinymce/tinymce.min.js"></script>
<script src="/addons/taonyeditor/tinymce/tinymce-jquery.min.js"></script>
<script>
//定义选择器
var mytextareaid = 'textarea#L_content';
var imagePrependUrl = "{$domain}";
//定义文件上传接口接口
var taonyUploadUrl = "{:url('forum/uploads')}",
taonyUploadImgage = "{:url('forum/uploads')}?type=image",
taonyUploadVideo = "{:url('forum/uploads')}?type=video";
taonyUploadZip = "{:url('forum/uploads')}?type=zip";
taonyUploadAudio = "{:url('forum/uploads')}?type=audio";
$(mytextareaid).removeClass();
</script>
<script src="/static/xm-select.js"></script>
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
,editor: '{/}/static/admin/modules/taonyeditor/js/taonyeditor'
}).use(["form", "colorpicker", "upload","editor"], function () {
var $ = layui.jquery,
form = layui.form,
colorpicker = layui.colorpicker,
upload = layui.upload;
var editor = layui.editor;
//获取百度标签标志tag或者word;
var flag = 'word';
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
var taonystatus = "{:hook('taonystatus')}";
// 编辑器插件启用状态
var isShow = taonystatus ? false : true;
if(isShow) {
$('.layui-textarea').each(function(){
var othis = $(this), html = othis.html();
othis.attr(fly.content(html));
})
}
// 从详情页自动调用端口过滤,获取描述信息
tinymce.get('L_content').on('mouseleave', function() {
var content = tinymce.get('L_content').getContent({format: 'text'});
content = content.replace(/[\r\n]/g,"").replace(/\n/g, '').replace(/\s/g, '').replace(/\t/g, '');
if(content.length >200) {
content = content.substring(0,200);
}
// var test = tinymce.activeEditor.getContent({format: 'text'});
$('[name="description"]').val(content);
});
// tag标签
$(function(){
//1.渲染标签
var addTags = xmSelect.render({
el: '#tag',
name: 'tagid',
layVerify: 'required',
layVerType: 'msg',
paging: true,
pageSize: 5,
data: []
});
//2.动态标签赋值
$.get("{:url('tag/getAllTag')}",function(res){
if(res.code == 0){
addTags.update({
data: res.data,
autoRow: true,
})
}
});
})
// 通过接口自动获取tag的内容
var conf = "{:empty(config('taoler.baidu.client_id'))}";
if (conf !== "1") {
$("#L_title").on("blur", function () {
var title = $(this).val();
var content = $("#L_content").val();
$.ajax({
type: "post",
url: "{:url('Forum/getKeywords')}",
data: { keywords: title, content:content, flag: flag },
daType: "json",
success: function (data) {
if (data.code == 0) {
$("input[name='keywords']").val(data.data.join(','));
}
},
});
});
}
// 百度词条
var baidu_title_switch = "{:config('taoler.config.baidu_title_switch')}";
if(baidu_title_switch == 1) {
$("#L_title").bind('input propertychange',function () {
var title = $(this).val();
var str = '';
if(title.length > 0 ) {
$.post("{:url('forum/getWordList')}",{title:title},function(res){
// 动态生成ur>li内容
if (res.code == 0) {
// 显示动态框
$(".bdsug").removeClass('layui-hide');
for (var i = 0; i < res.data.length; i++) {
//str += '<li data-key=' + res.data[i].q + '><b>' + res.data[i].q.replace(title,'') + '</b></li>';
str += '<li data-key=' + res.data[i].q + '><b>' + res.data[i].q + '</b></li>';
}
// 清空ul并追加li
$('.wordlist').empty().append(str);
// 点击李获取li值并复制给#L_title input的value
$(".bdsug li").on('click',function(){
var word = $(this).attr('data-key');
var words = title + '(' + word + ')';
$("#L_title").val(words);
// 关闭动态框
$(".bdsug").addClass('layui-hide');
});
} else {
$(".bdsug").addClass('layui-hide');
}
});
} else {
$(".bdsug").addClass('layui-hide');
}
});
}
//上传附件
upload.render({
elem: "#zip-button",
url: "{:url('forum/uploads')}", //改成您自己的上传接口
data: { type: "zip" },
accept: "file", //普通文件
done: function (res) {
if (res.status == 0) {
$('input[name="upzip"]').val(res.url);
layer.msg("上传成功");
} else {
layer.msg(res.msg);
}
},
});
// 改变标题颜色
colorpicker.render({
elem: "#color",
color: "#393d49",
predefine: true, // 开启预定义颜色
done: function (color) {
//譬如你可以在回调中把得到的 color 赋值给表单
$("#L_title_color").val(color);
$("#L_title").css("color", color);
},
});
});
</script>
{/block}

View File

@ -1,221 +0,0 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-form layui-form-pane">
<div class="layui-tab layui-tab-brief" lay-filter="user">
<div class="layui-form layui-tab-content" id="LAY_ucm" style="padding: 20px 0;">
<div class="layui-tab-item layui-show">
<input type="hidden" name="id" value="{$article.id}">
<div class="layui-row layui-col-space15 layui-form-item">
<div class="layui-col-md3">
<label class="layui-form-label">{:lang('special column')}</label>
<div class="layui-input-block">
<select lay-verify="required" name="cate_id" lay-filter="column">
<option></option>
{volist name="cateList" id="cate"}
<option value="{$cate.id}" {if $article.cate_id == $cate.id}selected{/if}>{:cookie('think_lang') == 'en-us' ? $cate.ename : $cate.catename}</option>
{/volist}
</select>
</div>
</div>
<div class="layui-col-md8">
<label for="L_title" class="layui-form-label">{:lang('title')}</label>
<div class="layui-input-block">
<input type="text" id="L_title" name="title" required lay-verify="required" autocomplete="off" class="layui-input" value="{$article.title}">
<input type="hidden" id="L_title_color" name="title_color" autocomplete="off" class="layui-input" value="{$article.title_color ?? '#333'}">
<input type="hidden" name="user_id" value="{$article.user_id}">
</div>
</div>
<div class="layui-col-md1">
<div id="color"></div>
<div id="test9" style="margin-left: 30px;"></div>
</div>
</div>
<div class="layui-form-item layui-form-text">
<div class="layui-input-block">
<textarea id="L_content" name="content" required lay-verify="required" placeholder="详细内容" class="layui-textarea fly-editor" style="height: 260px;">{$article.content}</textarea>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">{:lang('enclosure')}</label>
<div class="layui-input-inline" style="width: 190px;">
<input type="text" class="layui-input" name="upzip" value="{$article.upzip ?? ''}" placeholder="zip,jpg格式" title="上传附件"/>
</div>
<button type="button" class="layui-btn" id="zip-button"><i class="layui-icon"></i>上传文件</button>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">{:lang('描述')}</label>
<div class="layui-input-block">
<textarea name="description" class="layui-textarea" placeholder="SEO描述">{$article.description}</textarea>
</div>
</div>
{//关键词}
<div class="layui-form-item">
<label class="layui-form-label">{:lang('添加关键词')}</label>
<div class="layui-input-block">
<input type="text" class="layui-input" name="keywords" value="{$article.keywords}" placeholder="多个英文逗号隔开" title="添加关键词" />
</div>
</div>
{//tag}
<div class="layui-form-item">
<label class="layui-form-label">{:lang('add tags')}</label>
<div class="layui-input-block">
<div id="tag"></div>
</div>
</div>
<div class="layui-form-item layui-hide">
<button type="submit" class="layui-btn" lay-filter="article-edit" lay-submit id="article-edit">{:lang('post now')}</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{/block}
{block name="js"}
<script src="/static/jquery-3.6.0.min.js"></script>
<script src="/addons/taonyeditor/tinymce/tinymce.min.js"></script>
<script src="/addons/taonyeditor/tinymce/tinymce-jquery.min.js"></script>
<script>
//定义选择器
var mytextareaid = 'textarea#L_content';
var imagePrependUrl = "{$domain}";
//定义文件上传接口接口
var taonyUploadUrl = "{:url('forum/uploads')}",
taonyUploadImgage = "{:url('forum/uploads')}?type=image",
taonyUploadVideo = "{:url('forum/uploads')}?type=video";
taonyUploadZip = "{:url('forum/uploads')}?type=zip";
taonyUploadAudio = "{:url('forum/uploads')}?type=audio";
$(mytextareaid).removeClass();
</script>
<script src="/static/xm-select.js"></script>
<script>
layui.extend({
index: 'lib/index' //主入口模块
,editor: '{/}/static/admin/modules/taonyeditor/js/taonyeditor'
}).use(['colorpicker','form','upload', 'editor'], function(){
var $ = layui.jquery
,colorpicker = layui.colorpicker
,form = layui.form
,upload = layui.upload;
var artId = "{$article.id}";
var editor = layui.editor;
$(function(){
//1.渲染标签
var addTags = xmSelect.render({
el: '#tag',
name: 'tagid',
layVerify: '',
layVerType: 'msg',
paging: true,
pageSize: 5,
data: []
});
//2.动态赋值
$.get("{:url('tag/getArticleTag')}",{id:artId},function(res){
if(res.code == 0){
addTags.setValue(
res.data
)
}
});
//3.动态标签赋值
$.get("{:url('tag/getAllTag')}",function(res){
if(res.code == 0){
addTags.update({
data: res.data,
autoRow: true,
})
}
});
})
// 从详情页自动调用端口过滤,获取描述信息
tinymce.get('L_content').on('mouseleave', function() {
var content = tinymce.get('L_content').getContent({format: 'text'});
content = content.replace(/[\r\n]/g,"").replace(/\n/g, '').replace(/\s/g, '').replace(/\t/g, '');
if(content.length >200) {
content = content.substring(0,200);
}
// var test = tinymce.activeEditor.getContent({format: 'text'});
$('[name="description"]').val(content);
});
// 获取描述的内容
$("#L_content").bind('input propertychange', function(){
var content = $(this).val()
$.ajax({
type:"post",
url:"{:url('Forum/getDescription')}",
data:{"content":content},
daType:"json",
success:function (data){
if (data.code == 0) {
$('[name="description"]').val(data.data);
}
}
});
return false;
})
// 获取tag的内容
var conf = "{:empty(config('taoler.baidu.client_id'))}";
if(conf !== '1'){
$("#L_title").on('blur', function(){
var title = $(this).val();
var flag = 'on';
$.ajax({
type:"post",
url:"{:url('Forum/getKeywords')}",
data:{"keywords":keywords,"flag":flag},
daType:"json",
success:function (data){
if (data.code == 0) {
$("input[name='keywords']").val("");
}
}
});
return false;
})
}
//预定义颜色项
colorpicker.render({
elem: '#color'
,color: "{$article.title_color ?? '#333'}"
,predefine: true // 开启预定义颜色
,done: function(color){
//譬如你可以在回调中把得到的 color 赋值给表单
$('#L_title_color').val(color);
//改变标题颜色
$('#L_title').css("color", color);
}
});
//指定允许上传的文件类型
upload.render({
elem: '#zip-button'
,url: "{:url('forum/uploads')}" //改成您自己的上传接口
,data: {type:'zip'}
,accept: 'file' //普通文件
,done: function(res){
if(res.status == 0){
$('input[name="upzip"]').val(res.url);
layer.msg('上传成功');
} else {
layer.msg(res.msg);
}
}
});
});
</script>
{/block}

View File

@ -1,241 +0,0 @@
{extend name="public:base" /}
{block name="body"}
<div class="layui-fluid">
<div class="layui-card">
<div class="layui-form layui-card-header layuiadmin-card-header-auto">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">帖子ID</label>
<div class="layui-input-block">
<input type="text" name="id" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">发帖人</label>
<div class="layui-input-block">
<input type="text" name="name" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">标题</label>
<div class="layui-input-block">
<input type="text" name="title" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">状态</label>
<div class="layui-input-block">
<select name="sec">
<option value="">选择状态</option>
<option value="1">正常</option>
<option value="5">禁止</option>
<option value="6">待审</option>
<option value="2">置顶</option>
<option value="3">加精</option>
<option value="4">禁评</option>
</select>
</div>
</div>
<div class="layui-inline">
<button class="layui-btn layuiadmin-btn-forum-list" lay-submit lay-filter="LAY-app-forumlist-search">
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
</button>
</div>
</div>
</div>
<div class="layui-card-body">
<div style="padding-bottom: 10px;">
<button class="layui-btn layuiadmin-btn-forum-list" data-type="add">添加</button>
<button class="layui-btn layuiadmin-btn-forum-list" data-type="batchdel">删除</button>
</div>
<table id="LAY-app-forum-list" lay-filter="LAY-app-forum-list" ></table>
<script type="text/html" id="avatarTpl">
<div><img style="width: 25px; height: 25px;" src= "{{ d.avatar }}"></div>
</script>
<script type="text/html" id="buttonTpl">
<input type="checkbox" name="is_top" value="{{d.id}}" lay-skin="switch" lay-text="是|否" lay-filter="isTop" {{ d.top == 1 ? 'checked' : '' }}>
</script>
<script type="text/html" id="buttonHot">
<input type="checkbox" name="is_hot" value="{{d.id}}" lay-skin="switch" lay-text="是|否" lay-filter="isHot" {{ d.hot == 1 ? 'checked' : '' }}>
</script>
<script type="text/html" id="buttonReply">
<input type="checkbox" name="is_reply" value="{{d.id}}" lay-skin="switch" lay-text="是|否" lay-filter="isReply" {{ d.reply == 0 ? 'checked' : '' }}>
</script>
<script type="text/html" id="buttonCheck">
<input type="checkbox" name="status" value="{{d.id}}" lay-skin="switch" lay-filter="artStatus" lay-text="通过|{{ d.check == 0 ? '待审' : '禁止' }}" {{ d.check == 1 ? 'checked' : '' }}>
</script>
<script type="text/html" id="table-forum-list">
<a class="layui-btn layui-btn-xs" lay-event="edit" data-url="{:url('Forum/edit')}"><i class="layui-icon layui-icon-edit"></i></a>
{if condition="checkRuleButton('forum/listdel')"}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del" data-url="{:url('Forum/listdel')}"><i class="layui-icon layui-icon-delete"></i></a>
{else /}<a class="layui-btn layui-btn-danger layui-btn-xs layui-btn-disabled"><i class="layui-icon layui-icon-delete"></i></a>{/if}
</script>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
var forumList = "{:url('Forum/list')}",
forumReplys = "{:url('Forum/replys')}",
forumRedel = "{:url('Forum/redel')}",
forumReplysform = "{:url('Forum/replysform')}",
forumTags = "{:url('Forum/tags')}",
forumTagsDelete = "{:url('Forum/tagsdelete')}",
forumTagsForm = "{:url('Forum/tagsform')}";
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'forum', 'table'], function(){
var $ = layui.$
,form = layui.form
,table = layui.table;
// 监听搜索
form.on('submit(LAY-app-forumlist-search)', function(data){
var field = data.field;
$.post("{:url('Forum/list')}",field);
//执行重载
table.reload('LAY-app-forum-list', {
where: field
});
});
// 监听置顶
form.on('switch(isTop)', function(obj){
$.post("{:url('Forum/check')}",{id:obj.value, name:obj.elem.name,value:obj.elem.checked ? 1 : 0},function(res){
layer.tips(obj.value + ' ' + obj.elem.name + ''+ obj.elem.checked, obj.othis);
});
});
// 监听加精
form.on('switch(isHot)', function(obj){
$.post("{:url('Forum/check')}",{id:obj.value, name:obj.elem.name,value: obj.elem.checked ? 1 : 0},function(res){
layer.tips(obj.value + ' ' + obj.elem.name + ''+ obj.elem.checked, obj.othis);
});
});
// 监听回复
form.on('switch(isReply)', function(obj){
$.post("{:url('Forum/check')}",{id:obj.value, name:obj.elem.name,value: obj.elem.checked ? 0 : 1},function(res){
layer.tips(obj.value + ' ' + obj.elem.name + ''+ obj.elem.checked, obj.othis);
});
});
// 监听审贴
form.on('switch(artStatus)', function(obj){
//layer.tips(obj.value + ' ' + obj.elem.name + ''+ obj.elem.checked, obj.othis);
$.post("{:url('Forum/check')}",{id:obj.value, name:obj.elem.name,value: obj.elem.checked ? 1 : -1},function(res){
if(res.code == 0){
layer.msg(res.msg,{icon:res.icon,time:2000})
} else {
layer.open({title:'审核失败',content:res.msg,icon:5,adim:6})
}
});
});
//事件
var active = {
batchdel: function(){
var checkStatus = table.checkStatus('LAY-app-forum-list')
,checkData = checkStatus.data; //得到选中的数据
if(checkData.length === 0){
return layer.msg('请选择数据');
}
layer.confirm('确定删除吗?', function(index) {
//获取所选id
var idsArray = [];
for (var i = 0; i < checkData.length; i++) {
idsArray.push(checkData[i].id);
}
var ids = idsArray.toString();
//执行 Ajax 后重载
$.post("{:url('Forum/listdel')}",{"id": ids},function(res){
if(res.code == 0){
layer.msg('删除成功', {icon: 1,shade: 0});
}
});
table.reload('LAY-app-forum-list');
layer.msg('已删除');
});
}
,add: function(){
layer.open({
type: 2
,title: '添加'
,content: 'add.html'
,maxmin: true
,area: ['100%', '100%']
,btn: ['确定', '取消']
,yes: function(index, layero){
var iframeWindow = window['layui-layer-iframe'+ index]
,submitID = 'article-add'
,submit = layero.find('iframe').contents().find('#'+ submitID);
//监听提交
iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
var field = data.field; //获取提交的字段
// tag
var numArr = new Array();
layero.find('iframe').contents().find(".layui-btn-container").children("button").each(function () {
numArr.push($(this).val()); //添加至数组
});
field.tags = numArr.lenth ? "" : numArr.join(",");
//提交 Ajax 成功后,静态更新表格中的数据
$.ajax({
type:"post",
url:"{:url('Forum/add')}",
data: field,
daType:"json",
success:function (data){
if (data.code == 0) {
layer.msg(data.msg,{
icon:6,
time:2000
});
} else {
layer.open({
tiele:'添加失败',
content:data.msg,
icon:5,
anim:6
});
}
}
});
table.reload('LAY-app-forum-list'); //数据刷新
layer.close(index); //关闭弹层
});
submit.trigger('click');
}
});
}
}
$('.layui-btn.layuiadmin-btn-forum-list').on('click', function(){
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
// $(document).on('focusin', function(e) {
// if ($(e.target).closest(".tox-tinymce, .tox-tinymce-aux, .moxman-window, .tam-assetmanager-root").length) {
// e.stopImmediatePropagation();
// }
// });
});
</script>
{/block}

View File

@ -1,61 +0,0 @@
{extend name="public:base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-list" id="layuiadmin-form-list" style="padding: 20px 30px 0 0;">
<div class="layui-form-item">
<label class="layui-form-label">用户名</label>
<div class="layui-input-block">
<input type="text" name="poster" lay-verify="required" placeholder="请输入用户名" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">发帖内容</label>
<div class="layui-input-block">
<textarea name="content" lay-verify="required" autocomplete="off" class="layui-textarea"></textarea>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">置顶</label>
<div class="layui-input-block">
<input type="checkbox" lay-filter="switch" lay-verify="required" name="switch" lay-skin="switch" lay-text="ON|OFF">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">头像</label>
<div class="layui-input-inline">
<input type="text" name="avatar" placeholder="请上传图片" autocomplete="off" class="layui-input" >
</div>
<button style="float: left;" type="button" class="layui-btn" id="layuiadmin-upload-list">上传图片</button>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="LAY-app-forum-submit" id="LAY-app-forum-submit" value="确认">
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form', 'upload'], function(){
var $ = layui.$
,form = layui.form
,upload = layui.upload;
upload.render({
elem: '#layuiadmin-upload-list'
,url: layui.setter.base + 'json/upload/demo.js'
,accept: 'images'
,method: 'get'
,acceptMime: 'image/*'
,done: function(res){
$(this.item).prev("div").children("input").val(res.data.src)
}
});
})
</script>
{/block}

View File

@ -1,163 +0,0 @@
{extend name="public:base" /}
{block name="body"}
<div class="layui-fluid">
<div class="layui-card">
<div class="layui-form layui-card-header layuiadmin-card-header-auto">
<div class="layui-form-item">
<div class="layui-inline layuiadmin-input-useradmin">
<label class="layui-form-label">回帖人</label>
<div class="layui-input-block">
<input type="text" name="name" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">内容</label>
<div class="layui-input-block">
<input type="text" name="content" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">状态</label>
<div class="layui-input-block">
<select name="status" lay-filter="fourm-check">
<option value="">全部</option>
<option value="0">待审</option>
<option value="-1">禁止</option>
<option value="1">通过</option>
</select>
</div>
</div>
<div class="layui-inline">
<button class="layui-btn layuiadmin-btn-replys" data-type="reload" lay-submit lay-filter="LAY-app-forumreply-search">
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
</button>
</div>
</div>
</div>
<div class="layui-card-body">
<div style="padding-bottom: 10px;">
<button class="layui-btn layuiadmin-btn-replys" data-type="batchdel">删除</button>
</div>
<table id="LAY-app-forumreply-list" lay-filter="LAY-app-forumreply-list"></table>
<script type="text/html" id="imgTpl">
<img style="width: 25px; height: 25px;" src= {{ d.avatar }}>
</script>
<script type="text/html" id="buttonCheck">
{if condition="checkRuleButton('forum/recheck')"}<input type="checkbox" name="check" lay-skin="switch" lay-filter="recheck" lay-text="通过|{{ d.check == 0 ? '待审' : '禁止' }}" {{ d.check == 1 ? 'checked' : '' }} id="{{d.id}}" >
{else /}<button class="layui-btn layui-btn-xs layui-btn-radius layui-btn-disabled">无权限</button>{/if}
</script>
<script type="text/html" id="table-forum-replys">
{if condition="checkRuleButton('forum/redel')"}
<!--a class="layui-btn layui-btn-disabled layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a-->
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
{else / }<a class="layui-btn layui-btn-danger layui-btn-xs layui-btn-disabled"><i class="layui-icon layui-icon-delete"></i>删除</a>{/if}
</script>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
var forumList = "{:url('Forum/list')}",
forumListdel = "{:url('Forum/listdel')}",
forumListform = "{:url('Forum/listform')}",
forumReplys = "{:url('Forum/replys')}",
forumRedel = "{:url('Forum/redel')}",
forumReplysform = "{:url('Forum/replysform')}",
forumTags = "{:url('Forum/tags')}",
forumTagsDelete = "{:url('Forum/tagsdelete')}",
forumTagsForm = "{:url('Forum/tagsform')}";
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'forum', 'table'], function(){
var $ = layui.$
,form = layui.form
,table = layui.table;
//监听搜索
form.on('submit(LAY-app-forumreply-search)', function(data){
var field = data.field;
$.post("{:url('Forum/replys')}",field);
//执行重载
table.reload('LAY-app-forumreply-list', {
where: field
});
});
//状态选择
form.on('select(fourm-check)',function(data){
$.post("{:url('Forum/replys')}",{"status":data.value});
//执行重载
table.reload('LAY-app-forumreply-list', {
where: {
status: data.value
}
});
});
var active = {
batchdel: function(){
var checkStatus = table.checkStatus('LAY-app-forumreply-list')
,checkData = checkStatus.data; //得到选中的数据
if(checkData.length === 0){
return layer.msg('请选择数据');
}
layer.confirm('确定删除吗?', function(index) {
//执行 Ajax 后重载
/*
admin.req({
url: 'xxx'
//,……
});
*/
table.reload('LAY-app-forumreply-list');
layer.msg('已删除');
});
}
}
//监听回贴审核
form.on('switch(recheck)', function(data){
var data= data.elem;
var status = data.checked ? 1 : -1;
//执行回帖审核
$.ajax({
type:'post',
url:"{:url('Forum/recheck')}",
data:{id:data.id,status:status},
dataType:'json',
success:function(res){
if(res.code == 0){
layer.msg(res.msg,{
icon:res.icon,
time:2000
});
} else {
layer.open({
title:'审核失败',
content:res.msg,
icon:5,
adim:6
})
}
table.reload('LAY-app-forumreply-list');
}
});
return false;
});
$('.layui-btn.layuiadmin-btn-replys').on('click', function(){
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
});
</script>
{/block}

View File

@ -1,39 +0,0 @@
{extend name="public:base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-replys" id="layuiadmin-form-replys" style="padding: 20px 30px 0 0;">
<div class="layui-form-item">
<label class="layui-form-label">回帖内容</label>
<div class="layui-input-block">
<textarea name="content" lay-verify="required" autocomplete="off" class="layui-textarea" style="height: 200px;"></textarea>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form', 'upload'], function(){
var $ = layui.$
,form = layui.form
,upload = layui.upload;
upload.render({
elem: '#layuiadmin-upload-replys'
,url: layui.setter.base + 'json/upload/demo.js'
,accept: 'images'
,method: 'get'
,acceptMime: 'image/*'
,done: function(res){
$(this.item).prev("div").children("input").val(res.data.src)
}
});
})
</script>
{/block}

View File

@ -1,257 +0,0 @@
{extend name="public:base" /}
{block name="css"}<link rel="stylesheet" href="/static/admin/tree/css/treeTable.css">{/block}
{block name="css"}
<style type="text/css">
.layui-table-body, .layui-table-box, .layui-table-cell{
overflow: visible;
}
/* 设置下拉框的高度与表格单元相同 */
td .layui-table-cell .layui-form-select {
margin-top: -10px;
margin-left: -15px;
margin-right: -15px;
}
</style>
{/block}
{block name="body"}
<div class="layui-fluid">
<div class="layui-card">
<div class="layui-card-header layuiadmin-card-header-auto">
{if condition="checkRuleButton('forum/addtags')"}
<button class="layui-btn layuiadmin-btn-tags" data-type="add">添加</button>
{/if}
</div>
<div class="page-wrapper">
<div class="demo-side">
<table id="Article-cate-list"></table>
</div>
</div>
<div class="layui-card-body">
<script type="text/html" id="buttonHot">
{if condition="checkRuleButton('Forum/tagshot')"}<input type="checkbox" name="is_hot" lay-skin="primary" lay-filter="menu-show" {{# if(d.is_hot ==1){ }} checked value="0"{{# } else { }}value="1"{{# } }} id="{{d.id}}" >
{else /}<input type="checkbox" title="禁用" disabled> {/if}
</script>
<script type="text/html" id="layuiadmin-app-cont-tagsbar">
{if condition="checkRuleButton('forum/tagsform')"}
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i></a>
{else /}<a class="layui-btn layui-btn-disabled layui-btn-normal layui-btn-xs"><i class="layui-icon layui-icon-edit"></i></a>{/if}
{if condition="checkRuleButton('forum/tagsdelete')"}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i></a>
{else /}<a class="layui-btn layui-btn-disabled layui-btn-danger layui-btn-xs"><i class="layui-icon layui-icon-delete"></i></a>{/if}
</script>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
var forumList = "{:url('Forum/list')}",
forumListdel = "{:url('Forum/listdel')}",
forumListform = "{:url('Forum/listform')}",
forumReplys = "{:url('Forum/replys')}",
forumRedel = "{:url('Forum/redel')}",
forumReplysform = "{:url('Forum/replysform')}",
forumTags = "{:url('Forum/tags')}",
forumTagsDelete = "{:url('Forum/tagsdelete')}",
forumTagsForm = "{:url('Forum/tagsform')}";
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index','treeTable'], function(){
var table = layui.table, form = layui.form;
var $ = layui.$,treeTable = layui.treeTable;
// 渲染分类表格
var insTb = treeTable.render({
elem: '#Article-cate-list',
url: forumTags,
//toolbar: 'default',
//height: 'full-200',
tree: {
iconIndex: 2,
isPidData: true,
idName: 'id',
pidName: 'pid'
},
defaultToolbar: ['filter', 'print', 'exports'],
cols: [
[
{type: 'numbers'},
{type: 'checkbox'}
,{field: 'catename', title: '分类名', width: 150}
,{field: 'appname', title: '所属应用', width: 90}
,{field: 'ename', title: 'EN别名', width: 100}
,{field: 'detpl',title: '模板', align: 'center',width: 100}
,{title: '图标', align: 'center',width: 50,templet: '<p><i class="layui-icon {{d.icon}}"></i></p>'}
,{field: 'is_hot', title: '热门', align: 'center',width: 50, templet: '#buttonHot'}
,{field: 'desc', title: '描述', minWidth: 200}
,{field: 'id', title: 'ID',width: 60}
,{field: 'sort', title: '排序', width: 80, sort: true}
,{title: '操作', width: 120, align: 'center', toolbar: '#layuiadmin-app-cont-tagsbar'}
]
],
style: 'margin-top:0;'
});
//监听工具条
treeTable.on('tool(Article-cate-list)', function(obj){
var data = obj.data;
if(obj.event === 'del'){
layer.confirm('是否删除此分类及分类下内容?', function(index){
$.ajax({
type:'post',
url:forumTagsDelete,
data:{id:data.id},
dataType:'json',
success:function(data){
if(data.code == 0){layer.msg(data.msg,{icon:6,time:2000},function(){
location.reload();
});
} else {
layer.open({title:'删除失败',content:data.msg,icon:5,adim:6})
}
}
});
layer.close(index);
});
} else if(obj.event === 'edit'){
var tr = $(obj.tr);
layer.open({
type: 2
,title: '编辑分类'
,content: forumTagsForm + '?id='+ data.id
,area: ['400px', '500px']
,btn: ['确定', '取消']
,yes: function(index, layero){
//获取iframe元素的值
var othis = layero.find('iframe').contents().find("#layuiadmin-app-form-tags")
,pid = othis.find('input[name="pid"]').val()
,sort = othis.find('input[name="sort"]').val()
,appname = othis.find('select[name="appname"]').val()
,catename = othis.find('input[name="catename"]').val()
,ename = othis.find('input[name="ename"]').val()
,detpl = othis.find('select[name="detpl"]').val()
,icon = othis.find('input[name="icon"]').val()
,desc = othis.find('input[name="desc"]').val();
if(!catename.replace(/\s/g, '')) return;
$.ajax({
type:"post",
url:forumTagsForm,
data:{"id":data.id,"pid":pid,"sort":sort,"appname":appname,"catename":catename,"ename":ename,"detpl":detpl,"icon":icon,"desc":desc},
daType:"json",
success:function (data){
if(data.code == 0){layer.msg(data.msg,{icon:6,time:2000},function(){
location.reload();
});
} else {
layer.open({title:'修改失败',content:data.msg,icon:5,adim:6})
}
}
});
/*
obj.update({
tags: tags
,ename: ename
,sort: sort
});
*/
treeTable.reload('Article-cate-list'); //数据刷新
layer.close(index);
}
,success: function(layero, index){
//给iframe元素赋值
var othis = layero.find('iframe').contents().find("#layuiadmin-app-form-tags").click();
othis.find('input[name="pid"]').val(data.pid)
,othis.find('input[name="sort"]').val(data.sort)
,othis.find('select[name="appname"]').val(data.appname)
,othis.find('input[name="catename"]').val(data.catename)
,othis.find('input[name="ename"]').val(data.ename)
,othis.find('input[name="icon"]').val(data.icon)
,othis.find('input[name="desc"]').val(data.desc);
}
});
}
});
var active = {
add: function(){
layer.open({
type: 2
,title: '添加分类'
,content: 'tagsform.html'
,area: ['450px', '550px']
,btn: ['确定', '取消']
,yes: function(index, layero){
var othis = layero.find('iframe').contents().find("#layuiadmin-app-form-tags")
,pid = othis.find('input[name="pid"]').val()
,sort = othis.find('input[name="sort"]').val()
,appname = othis.find('select[name="appname"]').val()
,catename = othis.find('input[name="catename"]').val()
,ename = othis.find('input[name="ename"]').val()
,detpl = othis.find('select[name="detpl"]').val()
,icon = othis.find('input[name="icon"]').val()
,desc = othis.find('input[name="desc"]').val();
if(!catename.replace(/\s/g, '')) return;
$.ajax({
type:"post",
url:"{:url('Forum/tagsform')}",
data:{pid:pid,"sort":sort,"appname":appname,"catename":catename,"ename":ename,"detpl":detpl,"icon":icon,"desc":desc},
daType:"json",
success:function (data){
if (data.code == 0) {
layer.msg(data.msg,{icon:6,time:2000});
} else {
layer.open({title:'添加失败',content:data.msg,icon:5,anim:6});
}
}
});
table.reload('LAY-app-content-tags');
layer.close(index);
}
});
}
}
//分类热点控制
form.on('checkbox(menu-show)', function(data){
var data = data.elem;
data.value = data.checked ? 1 : 0;
$.ajax({
type:'post',
url:"{:url('Forum/tagshot')}",
data:{"id":data.id,"is_hot":data.value,},
dataType:'json',
success:function(data){
if(data.code == 0){
layer.msg(data.msg,{icon:6,time:2000});
} else {
layer.open({title:'修改失败',content:data.msg,icon:5,adim:6});
}
}
});
return false;
});
$('.layui-btn.layuiadmin-btn-tags').on('click', function(){
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
});
</script>
{/block}

View File

@ -1,183 +0,0 @@
{extend name="public:base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-tags" id="layuiadmin-app-form-tags" style="padding: 20px 30px 0 0 ; text-align: center;">
<div class="layui-form-item">
<label class="layui-form-label">上级分类</label>
<div class="layui-input-block">
<div id="menuSelectBox" class="ew-xmselect-tree"></div>
</div>
</div>
<label class="layui-form-label">所属应用</label>
<div class="layui-input-block">
<select name="appname" lay-filter="appname" lay-verify="required">
{volist name="appname" id="vo"}
<option value="{$vo}" {if($vo == $cate.appname)} selected {/if}>{$vo}</option>
{/volist}
</select>
</div>
<div class="layui-form-item">
<label class="layui-form-label">分类名</label>
<div class="layui-input-block">
<input type="text" name="catename" lay-verify="required" placeholder="分类名*" autocomplete="off" class="layui-input">
</div>
<label class="layui-form-label">EN别名</label>
<div class="layui-input-block">
<input type="text" name="ename" lay-verify="required" placeholder="英文名*" autocomplete="off" class="layui-input">
</div>
<label class="layui-form-label">图标</label>
<div class="layui-input-block">
<input type="text" name="icon" placeholder="图标*" id="iconPicker" lay-filter="iconPicker" style="display:none;" class="layui-input">
</div>
<label class="layui-form-label">详情页模板</label>
<div class="layui-input-block">
<select name="detpl" id="tpl" lay-verify="required">
{volist name="template" id="vo"}
<option value="{$vo}" {if($vo == $cate.detpl)} selected {/if} >{$vo}</option>
{/volist}
</select>
</div>
<label class="layui-form-label">描述</label>
<div class="layui-input-block">
<input type="text" name="desc" lay-verify="required" placeholder="描述*" autocomplete="off" class="layui-input">
</div>
<label class="layui-form-label">排序</label>
<div class="layui-input-block">
<input type="text" name="sort" lay-verify="number|required" placeholder="请填数字" autocomplete="off" class="layui-input">
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form','admin', 'iconPicker', 'xmSelect',], function(){
var $ = layui.$
,form = layui.form ;
var admin = layui.admin;
var iconPicker = layui.iconPicker;
var xmSelect = layui.xmSelect;
var initPid = "{$cate.pid}";
//初始化图标选择
iconPicker.render({
elem: '#iconPicker',
type: 'fontClass',
search: false,
page: true,
limit: 12,
click: function (data) {
//console.log(data);
}
});
// 根据应用名动态选择应用下模板
form.on('select(appname)', function(data){
var appName = data.value;
$("#tpl").children('option').remove();
$.post("{:url('Forum/getAppNameView')}", {appname:appName},function (res){
var str = '<option value="" >请选择</option>';
for(var i=0; i < res.data.length; i++ ) {
str += '<option value="'+ res.data[i] +'" >' + res.data[i] + '</option>';
// $("select[name='detpl']").append('<option value="'+ arr[i] +'" >' + arr[i] + '</option>');
}
$("#tpl").append(str);
// 动态select重新渲染
form.render('select');
})
});
//分类菜单结构
admin.req({
type: "post",
url: "{:url('Forum/getCateTree')}",
data:{},
done:function(res){
var data = res.data;
// 渲染下拉树
xmSelect.render({
el: '#menuSelectBox',
name: 'pid',
height: '250px',
layVerify: 'required',
layVerType: 'tips',
data: data,
initValue: [initPid],
model: {label: {type: 'text'}},
prop: {
name: 'catename',
value: 'id'
},
radio: true,
clickClose: true,
tree: {
show: true,
indent: 15,
strict: false,
expandedKeys: true
},
tips: '请选择上级菜单'
});
// var demo4 = xmSelect.render({
// el: '#menuSelectBox',
// model: { label: { type: 'text' } },
// tree: {
// show: true,
// strict: false,
// expandedKeys: [ -1 ],
// },
// on: function(data){
// if(data.isAdd){
// return data.change.slice(0, 1)
// }
// },
// height: 'auto',
// })
// //这里模拟ajax
// setTimeout(function(){
// demo4.update({
// data: [
// {name: '销售员', value: -1, children: [
// {name: '张三', value: 100, children: []},
// {name: '李四1', value: 2},
// {name: '王五1', value: 3, disabled: true},
// ]},
// {name: '奖品', value: -2, children: [
// {name: '奖品3', value: -3, children: [
// {name: '苹果3', value: 14},
// {name: '香蕉3', value: 15},
// {name: '葡萄3', value: 16},
// ]},
// {name: '苹果2', value: 4, disabled: true},
// {name: '香蕉2', value: 5},
// {name: '葡萄2', value: 6},
// ]},
// ]
// })
// //设置默认值
// demo4.setValue([
// {name: '李四1', value: 2},
// {name: '苹果3', value: 14},
// ], null, true)
// }, 300)
}
});
})
</script>
{/block}

View File

@ -600,6 +600,30 @@
})
});
// 升级提醒
$(function (){
console.log(123)
$.get("{:url('system.upgrade/check')}",function (data){
if (data.code === 1) {
//可升级
layer.confirm('发现新版本V' + data.data.version + ',确定升级?',{icon: 3, title:'系统检测'}, function(index){
//更新
$.get("{:url('system.upgrade/upload')}",function (res){
if (res.code === 0) {
layer.close(index);
toast.info({title:"通知消息", message: res.msg ,position: 'topRight'})
} else {
layer.close(index);
toast.error({title:"服务器错误", message:res.msg})
}
return false;
});
//关闭load加载层
});
}
});
});
});
</script>
</body>

View File

@ -16,7 +16,7 @@
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-header"><i class="layui-icon layui-icon-voice"></i><a id="up_version" lay-href="{:url('system.upgrade/index')}"></a></div>
<div class="layui-card-header"><i class="layui-icon layui-icon-voice"></i><a href="{:url('system.upgrade/index')}" id="up_version" lay-href="{:url('system.upgrade/index')}"></a></div>
</div>
</div>
<div class="layui-col-md6">
@ -518,7 +518,7 @@
//加载版本检测
(function(){
$.get("{:url('Index/checkVersion')}",function(data){
$.get("{:url('Index/sysUpgradeCheck')}",function(data){
$('#up_version').html(data);
})
})();

View File

@ -1,67 +0,0 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-fluid">
<div class="layui-row layui-col-space15">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-body">
<div class="layui-form layui-form-pane">
<div class="layui-tab layui-tab-brief" lay-filter="timeline">
<div class="layui-tab-content" id="LAY_ucm" style="padding: 20px 0;">
<div class="layui-tab-item layui-show">
<div class="layui-row layui-col-space15 layui-form-item">
<div class="layui-col-md3">
<label class="layui-form-label">发送类型</label>
<div class="layui-input-block">
<select lay-verify="required" name="type" lay-filter="type">
<option {if condition="$msg.type eq 0"} selected {/if} value="0">站内通知</option>
</select>
</div>
</div>
<div class="layui-col-md9">
<label for="L_title" class="layui-form-label">标题</label>
<div class="layui-input-block">
<input type="text" id="L_title" name="title" required lay-verify="required" autocomplete="off" class="layui-input" value="{$msg.title}">
</div>
</div>
<div class="layui-form-item layui-form-text">
<div class="layui-input-block">
<textarea id="L_content" name="content" required lay-verify="content" autocomplete="off" class="layui-textarea " >{$msg.content}</textarea>
</div>
</div>
<div class="layui-form-item layui-hide">
<input type="text" name="id" class="layui-input" value="{$msg.id}">
</div>
<div class="layui-form-item layui-hide">
<button type="submit" class="layui-btn" lay-filter="notice-edit" lay-submit id="notice-edit">立即发布</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
var noticeIndex = "{:url('Notice/index')}";
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index','notice'],function(){
var $ = layui.jquery;
});
</script>
{/block}

View File

@ -1,130 +0,0 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-fluid">
<div class="layui-row layui-col-space15">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-body">
<div class="layui-form layui-form-pane">
<div class="layui-tab layui-tab-brief" lay-filter="timeline">
<div class="layui-tab-content" id="LAY_ucm" style="padding: 20px 0;">
<div class="layui-tab-item layui-show">
<div class="layui-row layui-col-space15 layui-form-item">
<div class="layui-col-md3">
<label class="layui-form-label">发送类型</label>
<div class="layui-input-block">
<select lay-verify="required" name="type" lay-filter="type">
<option value="0">站内通知</option>
<option value="1">用户通知</option>
</select>
</div>
</div>
<div class="layui-col-md9">
<label for="L_title" class="layui-form-label">标题</label>
<div class="layui-input-block">
<input type="text" id="L_title" name="title" required lay-verify="required" autocomplete="off" class="layui-input" >
</div>
</div>
<div class="layui-form-item layui-form-text">
<div class="layui-input-block">
<textarea id="L_content" name="content" required lay-verify="content" autocomplete="off" class="layui-textarea "></textarea>
</div>
</div>
<div class="layui-form-item">
{if condition="checkRuleButton('notice/add')"}
<button type="submit" class="layui-btn " lay-filter="notice-add" lay-submit id="notice-add">立即发布</button>
{else /}<button type="submit" class="layui-btn layui-btn-disabled">立即发布</button>{/if}
</div>
</div>
</div>
</div>
</div>
</div>
<div class="layui-form-item">
<table id="notice-list" lay-filter="notice-list"></table>
<script type="text/html" id="notice-tool">
{if condition="checkRuleButton('notice/edit')"}
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>
{else /}<a class="layui-btn layui-btn-normal layui-btn-xs layui-btn-disabled"><i class="layui-icon layui-icon-edit"></i>编辑</a>{/if}
{if condition="checkRuleButton('notice/delete')"}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
{else /}<a class="layui-btn layui-btn-danger layui-btn-xs layui-btn-disabled"><i class="layui-icon layui-icon-delete"></i>删除</a>{/if}
</script>
</div>
</div>
</div>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
var noticeIndex = "{:url('Notice/index')}",
noticeAdd = "{:url('Notice/add')}",
noticeDelete = "{:url('Notice/delete')}",
noticeEdit = "{:url('Notice/edit')}";
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index','notice', 'layedit','form' ,'table'],function(){
var $ = layui.jquery
,layedit = layui.layedit
,table = layui.table
,form = layui.form;
/*
form.on('select(type)', function(data){
var tpl = '<div class="layui-col-md12">\
<label for="L_title" class="layui-form-label">收件人</label>\
<div class="layui-input-block">\
<input type="text" id="receve_id" name="receve_id" required lay-verify="required" autocomplete="off" class="layui-input" >\
</div>\
</div>';
//如果选择是用户追加收件人
if(data.value == 1){
$(this).parents('div .layui-col-md3').next('div').after(tpl);
}else{
$(this).parents('div .layui-col-md3').nextAll('div .layui-col-md12').remove();
}
});
//发布通知
form.on('submit(notice-add)', function(data){
var field = data.field;
console.log(field);
$.ajax({
type:"post",
url:"{:url('Notice/add')}",
data:field,
dataType:"json",
success:function (data){
if (data.code == 0) {
layer.msg(data.msg,{
icon:6,
time:2000
});
} else {
layer.open({
content:data.msg,
icon:5,
anim:6
});
}
}
});
table.reload('notice-list'); //数据刷新
return false;
});
*/
});
</script>
{/block}

View File

@ -1,477 +0,0 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-fluid" id="component-tabs">
<div class="layui-row">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-body">
<div class="layui-tab layui-tab-card" lay-filter="seo-tabs-brief">
<ul class="layui-tab-title">
<li lay-id="config"><span style="color:red">* </span>接口配置</li>
<li class="layui-this" lay-id="push">百度推送</li>
<li lay-id="map">站点地图</li>
<li lay-id="robots">robots</li>
<li lay-id="push_js">自动提交</li>
<li lay-id="tag_link">TagLink</li>
<li lay-id="search_show">蜘蛛分析</li>
</ul>
<div class="layui-tab-content">
<div class="layui-tab-item">
<div class="layui-form" wid100 lay-filter="config">
<div class="layui-form-item">
<label class="layui-form-label">key</label>
<div class="layui-input-inline">
<input type="text" name="client_id" value="{:config('taoler.baidu.client_id')}" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">百度分词API Key</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">secret</label>
<div class="layui-input-inline">
<input type="text" name="client_secret" value="{:config('taoler.baidu.client_secret')}" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">百度分词Secret Key</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">推送接口</label>
<div class="layui-input-inline">
<input type="text" name="push_api" value="{:config('taoler.baidu.push_api')}" placeholder="http://完整的接口地址" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">接口调用地址:http://data.zz.baidu.com/urls?site=https://www.youurl.com&token=yuotoken</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn" lay-submit lay-filter="baidu_config">确认保存</button>
</div>
</div>
</div>
</div>
<div class="layui-tab-item layui-show">
<div class="layui-form" wid100 lay-filter="push">
<div class="layui-form-item">
<label class="layui-form-label">推送范围</label>
<div class="layui-input-inline" style="width: 100px;">
<input type="text" name="start_id" value="" placeholder="开始ID" class="layui-input" >
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline" style="width: 100px;">
<input type="text" name="end_id" placeholder="结束ID" autocomplete="off" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">帖子ID范围,如果不填,默认全站提交</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">选择时间</label>
<div class="layui-input-inline">
<select name="time" lay-verify="required">
<option value="today">今天</option>
<option value="yesterday">昨天</option>
<option value="week">本周</option>
<option value="month">本月</option>
<option value="''">全部</option>
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">推送至API</label>
<div class="layui-input-block">
{if condition="checkRuleButton('Seo/push')"}
<button class="layui-btn" lay-submit lay-filter="search_push">提交推送</button>
{else /}
<button class="layui-btn layui-btn-disabled">提交推送</button>
{/if}
</div>
</div>
</div>
</div>
<div class="layui-tab-item">
<div class="layui-form" wid100 lay-filter="map">
<div class="layui-form-item">
<label class="layui-form-label">限定数量</label>
<div class="layui-input-inline">
<input type="text" name="map_num" value="{:config('taoler.sitemap.map_num')}" placeholder="推荐5000" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">单个map文件xml数量</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">更新频率</label>
<div class="layui-input-inline">
<input type="text" name="map_time" value="" placeholder="daily" 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="map_level" value="" placeholder="默认0.5" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">0.0-1.0之间</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn" lay-submit lay-filter="map_xml">生成</button>
</div>
</div>
<hr>
<div class="layui-form-item">
<div class="layui-input-block">
<textarea type="text" class="layui-textarea" style="height: 300px;">{$xml}</textarea>
</div>
</div>
</div>
</div>
<div class="layui-tab-item">
<div class="layui-form" wid100 lay-filter="robots">
<div class="layui-form-item">
<label class="layui-form-label">内容</label>
<div class="layui-input-block">
<textarea type="text" name="robots" placeholder="请正确填写robots内容" class="layui-textarea" style="height: 400px;">{$robots}</textarea>
<div class="layui-form-mid layui-word-aux">会自动写入sitemap的链接</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn" lay-submit lay-filter="robots_submit">生成</button>
</div>
</div>
</div>
</div>
<div class="layui-tab-item">
<div class="layui-form" wid100 lay-filter="push_js">
<div class="layui-form-item">
<label class="layui-form-label">名称</label>
<div class="layui-input-inline">
<input type="text" name="name" required placeholder="请正确填写js平台名称" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">js自动收录平台</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">JS代码</label>
<div class="layui-input-block">
<textarea type="text" name="jscode" required placeholder="请正确填写robots内容" class="layui-textarea" style="height: 200px;"></textarea>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn layui-btn-danger" lay-submit lay-filter="push_jscode_submit">新增</button>
</div>
</div>
</div>
{volist name="jscode" id="vo"}
<hr>
<div class="layui-form" wid100>
<div class="layui-form-item">
<label class="layui-form-label">{$vo.name}</label>
<div class="layui-input-block">
<textarea type="text" name="jscode" placeholder="请正确填写robots内容" class="layui-textarea" style="height: 200px;">{$vo.jscode}</textarea>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<input type="text" name="id" class="layui-hide" value="{$vo.id}">
<button class="layui-btn layui-btn-sm" lay-submit lay-filter="push_jscode_del">删除</button>
</div>
</div>
</div>
{/volist}
</div>
{//taglink}
<div class="layui-tab-item">
<div class="layui-form" wid100 lay-filter="tag_link">
<div class="layui-form-item">
<label class="layui-form-label">关键词</label>
<div class="layui-input-inline">
<input type="text" name="name" required lay-verify="required" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">链接</label>
<div class="layui-input-inline">
<input type="text" name="jscode" required lay-verify="required" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn layui-btn-danger" lay-submit lay-filter="tag_link_submit">提交</button>
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<table id="taglink" lay-filter="taglink"></table>
<script type="text/html" id="barDemo">
<a class="layui-btn layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i></a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i></a>
</script>
<!--textarea type="text" name="search_list" placeholder="搜索引擎抓取结果" class="layui-textarea" style="height: 600px;"></textarea-->
</div>
</div>
</div>
{//蜘蛛分析}
<div class="layui-tab-item">
<div class="layui-form" wid100 lay-filter="search_show">
<div class="layui-form-item">
<label class="layui-form-label">选择时间</label>
<div class="layui-input-inline">
<input type="text" name="search_time" id="search_time" required lay-verify="required" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">选择蜘蛛</label>
<div class="layui-input-inline">
<select type="text" name="spider_name" required lay-verify="required" autocomplete="off" class="layui-input">
<option value="Baiduspider" selected>百度</option>
<option value="Bytespider" >头条</option>
<option value="Googlebot" >谷歌</option>
<option value="bingbot" >bing</option>
<option value="''" >全部</option>
</select>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn layui-btn-danger" lay-submit lay-filter="search_show_submit">开始分析</button>
</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">分析结果</label>
<div class="layui-input-block">
<table id="spider" lay-filter="spider"></table>
<!--textarea type="text" name="search_list" placeholder="搜索引擎抓取结果" class="layui-textarea" style="height: 600px;"></textarea-->
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
var setWebSite ="{:url('Set/website')}";
var setEmail ="{:url('Set/email')}";
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index'], function(){
var $ = layui.$
,form = layui.form
var element =layui.element ;
var laydate = layui.laydate;
var table = layui.table;
//执行一个laydate实例
laydate.render({
elem: '#search_time' //指定元素
,type: 'date'
,format: 'yyyyMM/dd'
,value: new Date()
});
//蜘蛛列表
table.render({
elem: '#spider'
,url: "{:url('seo/searchLog')}" //数据接口
,page: true //开启分页
,cols: [[ //表头
{field: 'id', title: 'ID', width:80, sort: true, fixed: 'left'}
,{field: 'time', title: '时间', width:160}
,{field: 'name', title: '名称', width:120, sort: true}
,{field: 'ip', title: 'IP', width:200}
,{field: 'url', title: 'URL', minWidth: 200, templet: '<div><a href="{{d.url}}" target="_blank">{{d.url}}</a></div>'}
]]
,limit: 20
,text: '对不起,加载出现异常!'
});
//taglink列表
table.render({
elem: '#taglink'
,url: "{:url('seo/tagLinkList')}" //数据接口
,cols: [[ //表头
{field: 'id', title: 'ID', width:80, sort: true, fixed: 'left'}
,{field: 'tag', title: '名称', width:120, sort: true}
,{field: 'link', title: 'URL', minWidth: 200, templet: '<div><a href="{{d.link}}" target="_blank">{{d.link}}</a></div>'}
,{field: 'time', title: '时间', width:160}
,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:150}
]]
,text: '对不起,加载出现异常!'
});
// baidu push
form.on('submit(search_push)', function(data){
var field = data.field;
$.post("{:url('seo/push')}",field,function(res){
if(res.code == 0){
layer.msg(res.msg,{icon:6,tiye:2000},function(){
location.reload();
});
} else {
layer.open({title:"推送失败",content:res.msg,icon:5,anim:6});
}
});
return false;
});
//网站配置
form.on('submit(baidu_config)', function(data){
var field = data.field;
$.post("{:url('seo/config')}",field,function(res){
if(res.code == 0){
layer.msg(res.msg,{icon:6,tiye:2000},function(){
location.reload();
});
} else {
layer.open({title:"配置失败",content:res.msg,icon:5,anim:6});
}
});
return false;
});
// map
form.on('submit(map_xml)', function(data){
var field = data.field;
$.post("{:url('seo/map')}",field,function(res){
if(res.code == 0){
layer.msg(res.msg,{icon:6,tiye:2000},function(){
location.reload();
});
} else {
layer.open({title:"生成失败",content:res.msg,icon:5,anim:6});
}
});
return false;
});
// robots
form.on('submit(robots_submit)', function(data){
var field = data.field;
$.post("{:url('seo/robots')}",field,function(res){
if(res.code == 0){
layer.msg(res.msg,{icon:6,tiye:2000},function(){
location.reload();
});
} else {
layer.open({title:"设置失败",content:res.msg,icon:5,anim:6});
}
});
return false;
});
// 添加自动提交JS代码
form.on('submit(push_jscode_submit)', function(data){
var field = data.field;
field.type = 1;
$.post("{:url('seo/savePushJs')}",field,function(res){
if(res.code == 0){
layer.msg(res.msg,{icon:6,tiye:2000},function(){
location.reload();
});
} else {
layer.open({title:"添加失败",content:res.msg,icon:5,anim:6});
}
});
return false;
});
// 删除自动提交JS代码
form.on('submit(push_jscode_del)', function(data){
var field = data.field;
$.post("{:url('seo/delPushJs')}",field,function(res){
if(res.code == 0){
layer.msg(res.msg,{icon:6,tiye:2000},function(){
location.reload();
});
} else {
layer.open({title:"删除失败",content:res.msg,icon:5,anim:6});
}
});
return false;
});
// 添加taglink
form.on('submit(tag_link_submit)', function(data){
var field = data.field;
field.type = 2;
$.post("{:url('seo/savePushJs')}",field,function(res){
if(res.code == 0){
layer.msg(res.msg,{icon:6,tiye:2000},function(){
location.reload();
});
} else {
layer.open({title:"添加失败",content:res.msg,icon:5,anim:6});
}
});
return false;
});
// 删除taglink代码
table.on('tool(taglink)', function(obj){
var data = obj.data;
if(obj.event === 'del'){
layer.confirm('真的删除行么', {icon: 3, title:'删除TagLink'}, function(index){
//提交 Ajax 成功后,静态更新表格中的数据
$.post("{:url('seo/delPushJs')}", {"id":data.id}, function(data){
if (data.code == 0) {
layer.msg(data.msg,{icon:6,time:2000}, function(){
location.reload();
});
} else {
layer.open({title:'删除失败',content:data.msg,icon:5,anim:6});
}
});
});
layer.close(index);
}
});
// 搜索引擎分析
form.on('submit(search_show_submit)', function(data){
var field = data.field;
$.post("{:url('seo/searchLog')}",field,function(res){
if(res.code == 0){
layer.msg(res.msg,{icon:6,tiye:2000},function(){
//$("textarea[name='search_list']").html(res.data);
});
} else {
layer.open({title:"添加失败",content:res.msg,icon:5,anim:6});
}
//执行重载
table.reload('spider', {
where: field
,page: {
curr: 1 //重新从第 1 页开始
}
});
});
return false;
});
// 显示当前tab
if(location.hash){
element.tabChange('seo-tabs-brief', location.hash.replace(/^#/, ''));
}
element.on('tab(seo-tabs-brief)', function(){
var othis = $(this), layid = othis.attr('lay-id');
if(layid){
location.hash = layid;
}
});
});
</script>
{/block}

View File

@ -1,116 +0,0 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-fluid" id="component-tabs">
<div class="layui-row">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-body">
<div class="layui-tab layui-tab-brief" lay-filter="server-tabs-brief">
<ul class="layui-tab-title">
{if hook('signstatushook') == 1}
<li class="layui-this" lay-id="score">签到规则</li>
{/if}
<li lay-id="vip" class="{if hook('signstatushook') == 0} layui-this {/if}">用户等级</li>
</ul>
<div class="layui-tab-content">
{:hook('signadminhook')}
<div class="layui-tab-item {if hook('signstatushook') == 0}layui-show{/if}">
<div class="layui-tab-content" style="padding: 20px 0;">
<div class="layui-form">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">用户积分</label>
<div class="layui-input-inline" style="width: 120px;">
<select name="vip">
<option value="0">普通</option>
<option value="1">VIP1</option>
<option value="2">VIP2</option>
<option value="3">VIP3</option>
<option value="4">VIP4</option>
<option value="5">VIP5</option>
</select>
</div>
<div class="layui-input-inline">
<input type="tel" name="score" lay-verify="required" placeholder="积分区间:0-99" autocomplete="off" class="layui-input">
</div>
<div class="layui-input-inline">
{if condition="checkRuleButton('Vip/add')"}
<input type="submit" class="layui-btn" lay-submit lay-filter="vip-rule-submit" id="vip-rule-submit" value="立即提交">
{else /}<input type="submit" class="layui-btn layui-btn-disabled" value="立即提交">{/if}
</div>
</div>
</div>
</div>
<div class="layui-form-item">
<table id="vip-rule" lay-filter="vip-rule"></table>
<script type="text/html" id="vip-rule-button">
{if condition="checkRuleButton('Vip/vipEdit')"}
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i></a>
{else /}<a class="layui-btn layui-btn-normal layui-btn-xs layui-btn-disabled"><i class="layui-icon layui-icon-edit"></i></a>{/if}
{if condition="checkRuleButton('Vip/delete')"}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i></a>
{else /}<a class="layui-btn layui-btn-danger layui-btn-xs layui-btn-disabled"><i class="layui-icon layui-icon-delete"></i></a>{/if}
</script>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
var vipRule ="{:url('Vip/vipRule')}";
var vipDelete ="{:url('Vip/delete')}";
var vipEdit ="{:url('Vip/vipEdit')}";
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'element','table', 'webset', 'form'], function(){
var $ = layui.$
,element = layui.element
,table = layui.table
,form = layui.form;
//添加VIP规则
form.on('submit(vip-rule-submit)',function(data){
var field = data.field;
$.ajax({
type:"post",
url:"{:url('Vip/add')}",
data:field,
daType:"json",
success:function (data){
if (data.code == 0) {
layer.msg(data.msg,{
icon:6,
time:2000
}, function(){
table.reload('vip-rule'); //数据刷新
});
} else {
layer.open({
title:'添加失败',
content:data.msg,
icon:5,
anim:6
});
}
}
});
return false;
});
});
</script>
{/block}

View File

@ -1,37 +0,0 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-form-useradmin" style="padding: 20px 30px 0 0;">
<div class="layui-form-item layui-hide">
<input type="text" name="id" class="layui-input" value="{$sign.id}">
</div>
<div class="layui-form-item">
<label class="layui-form-label">签到天数</label>
<div class="layui-input-inline">
<input type="text" name="days" disabled lay-verify="required" placeholder="请输入天数" autocomplete="off" class="layui-input layui-disabled" value="{$sign.days}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">获得积分</label>
<div class="layui-input-inline">
<input type="text" name="score" lay-verify="required" placeholder="请输入号码" autocomplete="off" class="layui-input" value="{$sign.score}">
</div>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="LAY-user-sign-submit" id="LAY-user-sign-submit" value="确认">
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index'], function(){
var $ = layui.$;
})
</script>
{/block}

View File

@ -1,53 +0,0 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-form-useradmin" style="padding: 20px 30px 0 0;">
<div class="layui-form-item layui-hide">
<input type="text" name="id" class="layui-input" value="{$vip.id}">
</div>
<div class="layui-form-item">
<label class="layui-form-label">Vip级别</label>
<div class="layui-input-inline" >
<select name="vip">
{volist name="level" id="vo"}
<option {if condition="$vip.vip eq $vo"} selected {/if} value="{$vo}">{if condition="$vo eq 0"}普通{else /}VIP{$vo}{/if}</option>
{/volist}
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">积分区间</label>
<div class="layui-input-inline">
<input type="text" name="score" lay-verify="required" placeholder="积分区间:0-99" autocomplete="off" class="layui-input" value="{$vip.score}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">认证</label>
<div class="layui-input-inline">
<input type="text" name="nick" lay-verify="required" placeholder="等级昵称" autocomplete="off" class="layui-input" value="{$vip.nick}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">权限</label>
<div class="layui-input-inline">
<input type="text" name="rules" lay-verify="" placeholder="请选择" autocomplete="off" class="layui-input" value="{$vip.rules}">
</div>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="LAY-user-vip-submit" id="LAY-user-vip-submit" value="确认">
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index'], function(){
var $ = layui.$;
})
</script>
{/block}

View File

@ -1,519 +0,0 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-fluid" id="component-tabs">
<div class="layui-row">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-body">
<div class="layui-tab layui-tab-brief" lay-filter="website-tabs-brief">
<ul class="layui-tab-title">
<li class="layui-this" lay-id="website">网站设置</li>{if hook('mailstatushook') ==1 }<li lay-id="email">邮箱服务</li>{/if}
<li lay-id="config">服务配置</li>
<li lay-id="domain">域名绑定</li>
<li lay-id="bind_map">应用映射</li>
<li lay-id="url_rewrite">URL美化</li>
</ul>
<div class="layui-tab-content">
<div class="layui-tab-item layui-show">
<div class="layui-form" wid100 lay-filter="website">
<div class="layui-form-item">
<label class="layui-form-label">网站名称</label>
<div class="layui-input-block">
<input type="text" name="webname" value="{$sysInfo.webname}" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">网站域名</label>
<div class="layui-input-block">
<input type="text" name="domain" value="{$sysInfo.domain}" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">模板切换</label>
<div class="layui-input-block">
<select name="template" lay-verify="required">
<option value=""></option>
{volist name="template" id="vo"}
<option {if condition="$sysInfo.template eq $vo"} selected {/if} value="{$vo}">{$vo}</option>
{/volist}
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">Logo</label>
<div class="layui-input-block">
<span><img src="{$sysInfo.logo}" hight="40" width="50" ></span>
{if condition="checkRuleButton('set/upload')"}
<button type="button" class="layui-btn layui-btn-sm" id="logo-img">选择文件</button>
<button type="button" class="layui-btn layui-btn-sm" id="logo-upload-button">开始上传</button>
{else /}<button type="button" class="layui-btn layui-btn-sm layui-btn-disabled">选择文件</button>{/if}
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">M-logo</label>
<div class="layui-input-block">
<span><img src="{$sysInfo.m_logo}" hight="40" width="50" ></span>
{if condition="checkRuleButton('set/upload')"}
<button type="button" class="layui-btn layui-btn-sm" id="m-logo-img">选择文件</button>
<button type="button" class="layui-btn layui-btn-sm" id="m-logo-upload-button">开始上传</button>
{else /}<button type="button" class="layui-btn layui-btn-sm layui-btn-disabled">选择文件</button>{/if}
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">缓存时间</label>
<div class="layui-input-inline" style="width: 80px;">
<input type="text" name="cache" lay-verify="number" value="{$sysInfo.cache}" class="layui-input">
</div>
<div class="layui-input-inline layui-input-company">分钟</div>
<div class="layui-form-mid layui-word-aux">本地开发一般推荐设置为 0线上环境建议设置为 10。</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">最大文件上传</label>
<div class="layui-input-inline" style="width: 80px;">
<input type="text" name="upsize" lay-verify="number" value="{$sysInfo.upsize}" class="layui-input">
</div>
<div class="layui-input-inline layui-input-company">KB</div>
<div class="layui-form-mid layui-word-aux">提示1 M = 1024 KB</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">上传文件类型</label>
<div class="layui-input-block">
<input type="text" name="uptype" value="{$sysInfo.uptype}" placeholder="请依照格式image:jgp|png,多个组合用,分开" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">禁止注册名</label>
<div class="layui-input-block">
<input type="text" name="blackname" value="{$sysInfo.blackname}" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">首页标题</label>
<div class="layui-input-block">
<input type="text" name="webtitle" value="{$sysInfo.webtitle}" class="layui-input">
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">META关键词</label>
<div class="layui-input-block">
<textarea name="keywords" class="layui-textarea" placeholder="多个关键词在英文状态下用,分开">{$sysInfo.keywords}</textarea>
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">META描述</label>
<div class="layui-input-block">
<textarea name="descript" class="layui-textarea">{$sysInfo.descript}</textarea>
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">网站声明</label>
<div class="layui-input-block">
<textarea name="state" class="layui-textarea">{$sysInfo.state}</textarea>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">备案号</label>
<div class="layui-input-inline">
<input type="text" name="icp" value="{$sysInfo.icp}" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">访问统计</label>
<div class="layui-input-block">
<input type="text" name="showlist" value="{$sysInfo.showlist}" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">版权信息</label>
<div class="layui-input-inline" style="width: 400px;">
<input type="text" name="copyright" value="{$sysInfo.copyright}" class="layui-input">
</div>
<div class="layui-input-inline layui-input-company">提示</div>
<div class="layui-form-mid layui-word-aux">未授权版本,不限制功能,但严禁私自改写此处版权脚本,一旦发现,永久关闭升级服务!!</div>
<div class="layui-form-mid layui-word-aux"></div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
{if condition="checkRuleButton('Set/website')"}
<button class="layui-btn" lay-submit lay-filter="set_website">确认保存</button>
{else /}<button class="layui-btn layui-btn-disabled">确认保存</button>{/if}
</div>
</div>
</div>
</div>
{:hook('mailsethook')}
<div class="layui-tab-item">
<div class="layui-form" wid100 lay-filter="config">
<div class="layui-form-item">
<label class="layui-form-label">注册开关:</label>
<div class="layui-input-inline" style="width: 30px;">
<input type="checkbox" name="is_regist" lay-skin="primary" value=1 {if config('taoler.config.is_regist') == 1} checked {/if}>
</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" style="width: 30px;">
<input type="checkbox" name="is_login" lay-skin="primary" value=1 {if config('taoler.config.is_login') == 1} checked {/if}>
</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" style="width: 30px;">
<input type="checkbox" name="is_post" lay-skin="primary" value=1 {if config('taoler.config.is_post') == 1} checked {/if}>
</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" style="width: 30px;">
<input type="checkbox" name="is_reply" lay-skin="primary" value=1 {if config('taoler.config.is_reply') == 1} checked {/if}>
</div>
<div class="layui-form-mid layui-word-aux">勾选可评论</div>
</div>
<hr>
<div class="layui-form-item">
<label class="layui-form-label">注册审核:</label>
<div class="layui-input-inline" style="width: 30px;">
<input type="checkbox" name="regist_check" lay-skin="primary" value=0 {if config('taoler.config.regist_check') == 0} checked {/if}>
</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" style="width: 30px;">
<input type="checkbox" name="posts_check" lay-skin="primary" value=0 {if config('taoler.config.posts_check') == 0} checked {/if}>
</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" style="width: 30px;">
<input type="checkbox" name="commnets_check" lay-skin="primary" value=0 {if config('taoler.config.commnets_check') == 0} checked {/if}>
</div>
<div class="layui-form-mid layui-word-aux">勾选需审核</div>
</div>
<hr>
<div class="layui-form-item">
<label class="layui-form-label">注册验证:</label>
<div class="layui-input-block">
<input type="radio" name="regist_type" value=1 title="验证码" {if config('taoler.config.regist_type') == 1} checked {/if}>
<input type="radio" name="regist_type" value=2 title="邮箱验证" {if config('taoler.config.regist_type') == 2} checked {/if}>
<input type="radio" name="regist_type" value=3 title="手机短信" {if config('taoler.config.regist_type') == 3} checked {/if}>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">登录验证码:</label>
<div class="layui-input-inline" style="width: 30px;">
<input type="checkbox" name="login_captcha" lay-skin="primary" value=1 {if config('taoler.config.login_captcha') == 1} checked {/if}>
</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" style="width: 30px;">
<input type="checkbox" name="post_captcha" lay-skin="primary" value=1 {if config('taoler.config.post_captcha') == 1} checked {/if}>
</div>
<div class="layui-form-mid layui-word-aux">勾选需验证</div>
</div>
<hr>
<div class="layui-form-item">
<label class="layui-form-label">分类显示:</label>
<div class="layui-input-inline" style="width: 30px;">
<input type="checkbox" name="cate_show" lay-skin="primary" value=1 {if config('taoler.config.cate_show') == 1} checked {/if}>
</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" style="width: 30px;">
<input type="checkbox" name="area_show" lay-skin="primary" value=1 {if config('taoler.config.area_show') == 1} checked {/if}>
</div>
<div class="layui-form-mid layui-word-aux">勾选显示归属地简称</div>
</div>
<hr>
<div class="layui-form-item">
<label class="layui-form-label">百度词条:</label>
<div class="layui-input-inline" style="width: 60px;">
<input type="checkbox" name="baidu_title_switch" lay-skin="switch" lay-text="开启|关闭" value=1 {if config('taoler.config.baidu_title_switch') == 1} checked {/if}>
</div>
<div class="layui-form-mid layui-word-aux">发文章标题引用百度词条</div>
</div>
<hr>
{if hook('mailserveractivehook')}
<div class="layui-form-item">
<label class="layui-form-label">邮件通知:</label>
<div class="layui-input-inline" style="width: 30px;">
<input type="checkbox" name="email_notice" lay-skin="primary" value=1 {if config('taoler.config.email_notice') == 1} checked {/if}>
</div>
<div class="layui-form-mid layui-word-aux">发帖及评论等邮件提醒(邮箱服务未激活无法设置)</div>
</div>
{/if}
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn" lay-submit lay-filter="set_system_config">确认保存</button>
</div>
</div>
</div>
</div>
<div class="layui-tab-item">
<div class="layui-form" wid100 lay-filter="domain">
<div class="layui-form-item">
<label class="layui-form-label">多域名开关</label>
<div class="layui-input-inline">
<input type="checkbox" name="domain_check" lay-skin="switch" lay-filter="domain_check" lay-text="开启|关闭" {if empty(config('app.domain_bind')) == false} checked {/if}>
</div>
</div>
<div id="set_domain" class="{if empty(config('app.domain_bind')) == true} layui-hide {/if}">
<div class="layui-form-item">
<label class="layui-form-label">Index前端</label>
<div class="layui-input-inline">
<input type="text" name="index" required lay-verify="required" placeholder="只需填写子域如www" value="{$index}" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">访问则为www.aieok.com</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">Admin后端</label>
<div class="layui-input-inline">
<input type="text" name="admin" required lay-verify="required" placeholder="只需填写子域如admin" value="{$admin}" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">访问则为admin.aieok.com</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
{if condition="checkRuleButton('Set/email')"}
<button class="layui-btn" lay-submit lay-filter="set_system_domain">确认保存</button>
{else /}<button class="layui-btn layui-btn-disabled">确认保存</button>{/if}
</div>
</div>
</div>
</div>
</div>
<div class="layui-tab-item">
<div class="layui-form" wid100 lay-filter="bind_map">
<div class="layui-form-item">
<label class="layui-form-label">Index应用</label>
<div class="layui-input-inline">
<input type="text" name="index_map" required value="{$index_map}" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">改变后原路径访问无效</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">Admin应用</label>
<div class="layui-input-inline">
<input type="text" name="admin_map" required value="{$admin_map}" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">设置后需要使用新路径</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn" lay-submit lay-filter="set_bind_map">确认保存</button>
</div>
</div>
</div>
</div>
<div class="layui-tab-item">
<div class="layui-form" wid100 lay-filter="url_rewrite">
<div class="layui-form-item">
<label class="layui-form-label">帖子url字段</label>
<div class="layui-input-inline">
<input type="text" name="article_as" required value="{$url_re['article_as']}" class="layui-input">
</div>
<div id="artdesc" class="layui-form-mid layui-word-aux">www.aieok.com/article/1.html</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">分类url字段</label>
<div class="layui-input-inline">
<input type="text" name="cate_as" required value="{$url_re['cate_as']}" class="layui-input">
</div>
<div id="catedesc" class="layui-form-mid layui-word-aux">www.aieok.com/cate/ask.html</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn" lay-submit lay-filter="set_url_rewrite">确认保存</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
var setWebSite ="{:url('Set/website')}";
var setEmail ="{:url('Set/email')}";
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'set', 'upload'], function(){
var $ = layui.$
,form = layui.form
,upload = layui.upload;
var element =layui.element ;
//LOGO选完文件后不自动上传
upload.render({
elem: '#logo-img'
,url: "{:url('set/upload')}"
,data: {type:'image',field:'logo'}
,auto: false
,exts: 'jpg|png|gif|bmp|jpeg'
,size: 1000
//,multiple: true
,bindAction: '#logo-upload-button'
,done: function(res){
if(res.code == 0){
layer.msg(res.msg,{icon:6,tiye:2000},function(){
location.reload();
});
} else {
layer.open({title:"上传失败",content:res.msg,icon:5,anim:6});
}
}
});
//移动端logo
upload.render({
elem: '#m-logo-img'
,url: "{:url('set/upload')}"
,data: {type:'image',field:'mlogo'}
,auto: false
,exts: 'jpg|png|gif|bmp|jpeg'
,size: 1000
//,multiple: true
,bindAction: '#m-logo-upload-button'
,done: function(res){
if(res.code == 0){
layer.msg(res.msg,{icon:6,tiye:2000},function(){
location.reload();
});
} else {
layer.open({title:"上传失败",content:res.msg,icon:5,anim:6});
}
}
});
//网站配置
form.on('submit(set_system_config)', function(data){
var field = data.field;
$.post("{:url('set/config')}",field,function(res){
if(res.code == 0){
layer.msg(res.msg,{icon:6,tiye:2000},function(){
location.reload();
});
} else {
layer.open({title:"设置失败",content:res.msg,icon:5,anim:6});
}
});
return false;
});
//网站配置
form.on('submit(set_system_domain)', function(data){
var field = data.field;
$.post("{:url('set/setDomain')}",field,function(res){
if(res.code == 0){
layer.msg(res.msg,{icon:6,tiye:2000},function(){
location.reload();
});
} else {
layer.open({title:"设置失败",content:res.msg,icon:5,anim:6});
}
});
return false;
});
// URL美化
form.on('submit(set_url_rewrite)', function(data){
var field = data.field;
$.post("{:url('set/setUrl')}",field,function(res){
if(res.code == 0){
layer.msg(res.msg,{icon:6,tiye:2000},function(){
location.reload();
});
} else {
layer.open({title:"设置失败",content:res.msg,icon:5,anim:6});
}
});
return false;
});
// 获取描述的内容
$("input[name='article_as']").bind('input propertychange', function(){
var content = $(this).val()
$('#artdesc').html('如www.aieok.com/'+ content +'/1.html');
})
$("input[name='cate_as']").bind('input propertychange', function(){
var content = $(this).val()
$('#catedesc').html('如www.aieok.com/'+ content +'/ask.html');
})
// 域名绑定
form.on('switch(domain_check)', function(data){
var data = data.elem;
status = data.checked ? 'on' : 'off';
if(status == 'on'){
$('#set_domain').removeClass('layui-hide');
} else {
$('#set_domain').addClass('layui-hide');
$.post("{:url('set/setDomain')}",{"domain_check":status},function(res){
if(res.code == 0){
layer.msg(res.msg,{icon:6,tiye:2000},function(){
location.reload();
});
} else {
layer.open({title:"设置失败",content:res.msg,icon:5,anim:6});
}
});
}
return false;
});
// 应用映射
form.on('submit(set_bind_map)', function(data){
var field = data.field;
$.post("{:url('set/bindMap')}",field,function(res){
if(res.code == 0){
layer.msg(res.msg,{icon:6,tiye:2000},function(){
window.location.reload();
});
} else {
layer.open({title:"设置失败",content:res.msg,icon:5,anim:6});
}
});
return false;
});
//显示当前tab
if(location.hash){
element.tabChange('website-tabs-brief', location.hash.replace(/^#/, ''));
}
element.on('tab(website-tabs-brief)', function(){
var othis = $(this), layid = othis.attr('lay-id');
if(layid){
location.hash = layid;
}
});
});
</script>
{/block}

View File

@ -1,101 +0,0 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-fluid">
<div class="layui-row layui-col-space15">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-header">设置我的资料</div>
<div class="layui-card-body" pad15>
<div class="layui-form" lay-filter="">
<div class="layui-form-item layui-hide">
<input type="text" name="id" class="layui-input" value="{$admin.id}">
</div>
<div class="layui-form-item">
<label class="layui-form-label">我的角色</label>
<div class="layui-input-inline">
<input type="text" name="auth_group_id" value="{$authGroupTitle}" readonly class="layui-input layui-disabled" disabled>
</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="username" value="{$admin.username}" readonly class="layui-input layui-disabled">
</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="nickname" value="{$admin.nickname}" lay-verify="nickname" autocomplete="off" placeholder="请输入昵称" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">性别</label>
<div class="layui-input-block">
<input type="radio" name="sex" value="0" {if condition="$admin['sex'] eq 0"} checked {/if} title="男">
<input type="radio" name="sex" value="1" {if condition="$admin['sex'] eq 1"} checked {/if} title="女">
</div>
</div>
<!--div class="layui-form-item">
<label class="layui-form-label">头像</label>
<div class="layui-input-inline">
<input name="avatar" lay-verify="required" id="LAY_avatarSrc" placeholder="图片地址" value="http://cdn.layui.com/avatar/168.jpg" class="layui-input">
</div>
<div class="layui-input-inline layui-btn-container" style="width: auto;">
<button type="button" class="layui-btn layui-btn-primary" id="LAY_avatarUpload">
<i class="layui-icon">&#xe67c;</i>上传图片
</button>
<button class="layui-btn layui-btn-primary" layadmin-event="avartatPreview">查看图片</button >
</div>
</div-->
<div class="layui-form-item">
<label class="layui-form-label">手机</label>
<div class="layui-input-inline">
<input type="text" name="mobile" value="{$admin.mobile}" lay-verify="phone" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">邮箱</label>
<div class="layui-input-inline">
<input type="text" name="email" value="{$admin.email}" lay-verify="email" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">备注</label>
<div class="layui-input-block">
<textarea name="remarks" placeholder="请输入内容" class="layui-textarea">{$admin.remarks}</textarea>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
{if condition="checkRuleButton('Admin/infoSet')"}
<button class="layui-btn" lay-submit lay-filter="setmyinfo">确认修改</button>
{else /}
<button class="layui-btn layui-btn-disabled">确认修改</button>
{/if}
<!--button type="reset" class="layui-btn layui-btn-primary">重新填写</button-->
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
var adminInfoSet ="{:url('Admin/infoSet')}";
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'set']);
</script>
{/block}

View File

@ -1,67 +0,0 @@
<!--
* @Author: TaoLer <alipey_tao@qq.com>
* @Date: 2021-12-06 16:04:50
* @LastEditTime: 2022-04-19 17:11:28
* @LastEditors: TaoLer
* @Description: 搜索引擎SEO优化设置
* @FilePath: \TaoLer\app\admin\view\set\user\repass.html
* Copyright (c) 2020~2022 http://www.aieok.com All rights reserved.
-->
{extend name="public/base" /}
{block name="body"}
<div class="layui-fluid">
<div class="layui-row layui-col-space15">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-header">修改密码</div>
<div class="layui-card-body" pad15>
<div class="layui-form" lay-filter="">
<div class="layui-form-item">
<label class="layui-form-label">当前密码</label>
<div class="layui-input-inline">
<input type="password" name="oldPassword" lay-verify="required" lay-verType="tips" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">新密码</label>
<div class="layui-input-inline">
<input type="password" name="password" lay-verify="pass" lay-verType="tips" autocomplete="off" id="LAY_password" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">6到16个字符</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">确认新密码</label>
<div class="layui-input-inline">
<input type="password" name="repassword" lay-verify="repass" lay-verType="tips" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
{if condition="checkRuleButton('Admin/repassSet')"}
<button class="layui-btn" lay-submit lay-filter="setmypass">确认修改</button>
{else /}
<button class="layui-btn layui-btn-disabled">确认修改</button>
{/if}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
var adminRepassSet ="{:url('Admin/repassSet')}";
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'set']);
</script>
{/block}

View File

@ -1,132 +0,0 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-slider" id="layuiadmin-form-slider" style="padding: 20px 20px 0 0;">
<div class="layui-form-item">
<label class="layui-form-label">位置</label>
<div class="layui-input-inline">
<select name="slid_type" lay-verify="required">
<option value="">链接投放位置</option>
<option value="1">1首页幻灯 - 1126x410</option>
<option value="2">2首页图片</option>
<option value="3">3分类图片</option>
<option value="4">4详情图片</option>
<option value="5">5首页赞助</option>
<option value="6">6分类赞助</option>
<option value="7">7详情赞助</option>
<option value="8">8温馨通道</option>
<option value="9">9友情链接</option>
<option value="10">10头部菜单</option>
<option value="11">11页脚链接</option>
<option value="12">12移动首页幻灯-360x172</option>
<option value="13">13首页右栏广告</option>
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">名称</label>
<div class="layui-input-inline">
<input type="text" name="slid_name" lay-verify="required" placeholder="请输入名称" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">图片</label>
<div class="layui-input-inline">
<input type="text" name="slid_img" lay-verify="" placeholder="位置1-4需上传;位10贴icon图" autocomplete="off" class="layui-input" >
</div>
<button style="float: left;" type="button" class="layui-btn" id="layuiadmin-upload-slid-img">选图</button>
</div>
<div class="layui-form-item">
<label class="layui-form-label">背景</label>
<div class="layui-input-inline">
<input type="text" name="slid_color" lay-verify="" placeholder="选位置5,6,7请选背景色" autocomplete="off" class="layui-input" id="color-select">
</div>
<div class="layui-inline" style="left: -11px;">
<div id="coloer-form"></div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">链接</label>
<div class="layui-input-inline">
<input type="text" name="slid_href" lay-verify="required" placeholder="输入完整连接*必填" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">开始</label>
<div class="layui-input-inline">
<input type="text" name="slid_start" id="start-time" lay-verify="required" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">结束</label>
<div class="layui-input-inline">
<input type="text" name="slid_over" id="over-time" lay-verify="required" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="LAY-slider-submit" id="LAY-slider-submit" value="确认">
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index','imgcom'], function(){
var $ = layui.$
,form = layui.form
,laydate = layui.laydate
,upload = layui.upload
,imgcom = layui.imgcom;
var colorpicker = layui.colorpicker;
//颜色表单赋值
colorpicker.render({
elem: '#coloer-form'
,color: '#1c97f5'
,done: function(color){
$('#color-select').val(color);
}
});
//开始时间
laydate.render({
elem: '#start-time'
,btns: ['clear', 'now']
,trigger: 'click'
});
//结束时间
laydate.render({
elem: '#over-time'
,btns: ['clear', 'now']
,trigger: 'click'
});
//上传图片
upload.render({
elem: '#layuiadmin-upload-slid-img'
,url: 'uploadImg'
,data:{type:'image'}
,accept: 'images'
,acceptMime: 'image/*'
,auto: false
,choose: function (obj) { //选择文件后的回调
imgcom.uploads(obj);
}
,done: function(res){
$(this.item).prev("div").children("input").val(res.src)
if(res.code == 0){
layer.msg(res.msg,{icon:6,tiye:2000});
} else {
layer.open({title:"上传失败",content:res.msg,icon:5,anim:6});
}
}
});
})
</script>
{/block}

View File

@ -1,134 +0,0 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-slider" id="layuiadmin-form-slider" style="padding: 20px 0 0 0;">
<div class="layui-form-item">
<label class="layui-form-label">位置</label>
<div class="layui-input-inline">
<select name="slid_type" lay-verify="required">
<option {if condition="$slider.slid_type eq 1"} selected {/if} value="1">1首页幻灯</option>
<option {if condition="$slider.slid_type eq 2"} selected {/if} value="2">2首页图片</option>
<option {if condition="$slider.slid_type eq 3"} selected {/if} value="3">3分类图片</option>
<option {if condition="$slider.slid_type eq 4"} selected {/if} value="4">4详情图片</option>
<option {if condition="$slider.slid_type eq 5"} selected {/if} value="5">5首页赞助</option>
<option {if condition="$slider.slid_type eq 6"} selected {/if} value="6">6分类赞助</option>
<option {if condition="$slider.slid_type eq 7"} selected {/if} value="7">7详情赞助</option>
<option {if condition="$slider.slid_type eq 8"} selected {/if} value="8">8温馨通道</option>
<option {if condition="$slider.slid_type eq 9"} selected {/if} value="9">9友情链接</option>
<option {if condition="$slider.slid_type eq 10"} selected {/if} value="10">10头部菜单</option>
<option {if condition="$slider.slid_type eq 11"} selected {/if} value="11">11页脚链接</option>
<option {if condition="$slider.slid_type eq 12"} selected {/if} value="12">12移动首页幻灯</option>
<option {if condition="$slider.slid_type eq 13"} selected {/if} value="13">13移动首页幻灯</option>
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">名称</label>
<div class="layui-input-inline">
<input type="text" name="slid_name" lay-verify="required" placeholder="请输入名称" autocomplete="off" class="layui-input" value="{$slider.slid_name}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">图片</label>
<div class="layui-input-inline">
<input type="text" name="slid_img" lay-verify="" placeholder="位置1,2需上传;位8需贴icon图标" autocomplete="off" class="layui-input" value="{$slider.slid_img}">
</div>
<button style="float: left;" type="button" class="layui-btn" dataid="{$slider.id}" id="layuiadmin-upload-slid-img">选图</button>
</div>
<div class="layui-form-item">
<label class="layui-form-label">背景</label>
<div class="layui-input-inline">
<input type="text" name="slid_color" lay-verify="" placeholder="选位置3,4,5请选背景色" autocomplete="off" class="layui-input" value="{$slider.slid_color}" id="color-select">
</div>
<div class="layui-inline" style="left: -11px;">
<div id="coloer-form"></div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">链接</label>
<div class="layui-input-inline">
<input type="text" name="slid_href" lay-verify="required" placeholder="输入连接" autocomplete="off" class="layui-input" value="{$slider.slid_href}" >
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">开始</label>
<div class="layui-input-inline">
<input type="text" name="slid_start" id="start-time" lay-verify="required" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input" value="{$slider.slid_start|date='Y-m-d'}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">结束</label>
<div class="layui-input-inline">
<input type="text" name="slid_over" id="over-time" lay-verify="required" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input" value="{$slider.slid_over|date='Y-m-d'}" >
</div>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="LAY-slider-submit" id="LAY-slider-submit" value="确认">
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form', 'upload','laydate','colorpicker', 'imgcom'], function(){
var $ = layui.$
,form = layui.form
,laydate = layui.laydate
,upload = layui.upload
,imgcom = layui.imgcom;
var colorpicker = layui.colorpicker;
//颜色表单赋值
colorpicker.render({
elem: '#coloer-form'
,color: '#1c97f5'
,done: function(color){
$('#color-select').val(color);
}
});
//开始时间
laydate.render({
elem: '#start-time'
,btns: ['clear', 'now']
,trigger: 'click'
});
//结束时间
laydate.render({
elem: '#over-time'
,btns: ['clear', 'now']
,trigger: 'click'
});
//上传图片
upload.render({
//var id = $('.layui-btn').(this).attr('dataid');
elem: '#layuiadmin-upload-slid-img'
,url: 'uploadImg'
,data:{type:'image'}
,accept: 'images'
,method: 'get'
,acceptMime: 'image/*'
,auto: false
,choose: function (obj) { //选择文件后的回调
imgcom.uploads(obj);
}
,done: function(res){
$(this.item).prev("div").children("input").val(res.src)
if(res.code == 0){
layer.msg(res.msg,{icon:6,tiye:2000});
} else {
layer.open({title:"上传失败",content:res.msg,icon:5,anim:6
});
}
}
});
})
</script>
{/block}

View File

@ -1,210 +0,0 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-fluid">
<div class="layui-row layui-col-space15">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-body">
<div class="layui-form" wid100 lay-filter="">
<div class="layui-upload">
<button type="button" class="layui-btn layui-btn-normal" id="slid-add">添加</button>
<div class="layui-form" lay-filter="select_type">位置:
<div class="layui-inline">
<select name="slid_type" lay-verify="required" lay-filter="slid-type">
<option value="">链接投放位置</option>
<option value="1">1首页幻灯</option>
<option value="2">2首页图片</option>
<option value="3">3分类图片</option>
<option value="4">4详情图片</option>
<option value="5">5首页赞助</option>
<option value="6">6分类赞助</option>
<option value="7">7详情赞助</option>
<option value="8">8温馨通道</option>
<option value="9">9友情链接</option>
<option value="10">10头部菜单</option>
<option value="11">11页脚链接</option>
<option value="12">12移动首页幻灯</option>
<option value="13">13首页右栏广告</option>
</select>
</div>
</div>
<table id="slider" lay-filter="slider"></table>
<script type="text/html" id="imgTpl">
{{# if(d.slid_type == "头部菜单"){ }}<i class="layui-icon {{d.slid_img}}"></i>{{# } else { }} {{# if(d.slid_img == "") { }}无{{# } else { }} <img src="{{d.slid_img}}" height="40" width="80">{{# } }} {{# } }}
</script>
<script type="text/html" id="barDemo">
<a class="layui-btn layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i></a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i></a>
</script>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index','layer','table','util','form'], function(){
var $ = layui.jquery
,layer = layui.layer
,table = layui.table
,form = layui.form;
var util = layui.util;
//第一个实例
table.render({
elem: '#slider'
,url: "{:url('slider/list')}" //数据接口
,page: true //开启分页
,cols: [[ //表头
{field: 'id', title: 'ID', width:80, sort: true, fixed: 'left'}
,{field: 'slid_type', title: '位置', width:120}
,{field: 'slid_img', title: '图片/icon', width:120, templet: '#imgTpl'}
,{field: 'slid_name', title: '名称', width:180}
,{field: 'slid_href', title: 'URL', minWidth: 250}
,{field: 'slid_color', title: '颜色', width: 80}
,{field: 'slid_start', title: '开始', width: 150, sort: true}
,{field: 'slid_over', title: '结束','escape':false, width: 150, sort: true}
,{field: 'slid_status', title: '状态', width: 80}
,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:150}
]]
,limit: 15
,text: '对不起,加载出现异常!'
});
form.on('select(slid-type)', function(data){
$.post("{:url('slider/list')}", {"slid_type":data.value}, function (data){
if (data.code == -1){
layer.open({content:data.msg,icon:5,anim:6});
}
}
);
//执行重载
table.reload('slider', {
where: {slid_type: data.value}
,page: {
curr: 1 //重新从第 1 页开始
}
});
});
//监听行工具事件
table.on('tool(slider)', function(obj){
var data = obj.data;
var id = data.id;
//console.log(obj)
if(obj.event === 'del'){
layer.confirm('真的删除行么', {icon: 3, title:'删除链接?'}, function(index){
//提交 Ajax 成功后,静态更新表格中的数据
$.post("{:url('slider/delete')}", {"id":data.id}, function(data){
if (data.code == 0) {
layer.msg(data.msg,{icon:6,time:2000}, function(){
location.reload();
});
} else {
layer.open({title:'删除失败',content:data.msg,icon:5,anim:6});
}
});
});
layer.close(index);
} else if(obj.event === 'edit'){
layer.open({
type: 2,
title: '编辑链接',
content: 'edit.html?id='+ id,
maxmin: true,
area : ['500px' , '600px'],
btn: ['确定', '取消'],
yes: function(index, layero){
var iframeWindow = window['layui-layer-iframe'+ index]
,submitID = 'LAY-slider-submit'
,submit = layero.find('iframe').contents().find('#'+ submitID);
//监听提交
iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
var field = data.field; //获取提交的字段
//提交 Ajax 成功后,静态更新表格中的数据
$.ajax({
type:"post",
url:"{:url('slider/edit')}",
data:{"id":id,"slid_type":field.slid_type,"slid_name":field.slid_name,"slid_color":field.slid_color,"slid_start":field.slid_start,"slid_over":field.slid_over,"slid_href":field.slid_href,"slid_img":field.slid_img},
daType:"json",
success:function (data){
if (data.code == 0) {
layer.msg(data.msg,{icon:6,time:2000}, function(){
location.reload();
});
} else {
layer.open({title:'添加失败',content:data.msg,icon:5,anim:6});
}
}
});
layer.close(index);
});
submit.trigger('click');
}
});
}
});
//添加幻灯
$('#slid-add').on('click', function(){
layer.open({
type: 2,
title: '添加链接',
content: 'add.html',
maxmin: true,
area : ['500px' , '600px'],
btn: ['确定', '取消'],
yes: function(index, layero){
var iframeWindow = window['layui-layer-iframe'+ index]
,submitID = 'LAY-slider-submit'
,submit = layero.find('iframe').contents().find('#'+ submitID);
//监听提交
iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
var field = data.field; //获取提交的字段
//提交 Ajax 成功后,静态更新表格中的数据
$.ajax({
type:"post",
url:"{:url('slider/add')}",
data:{"slid_type":field.slid_type,"slid_name":field.slid_name,"slid_color":field.slid_color,"slid_start":field.slid_start,"slid_over":field.slid_over,"slid_href":field.slid_href,"slid_img":field.slid_img},
daType:"json",
success:function (data){
if (data.code == 0) {
layer.msg(data.msg,{
icon:6,
time:2000
}, function(){
location.reload();
});
} else {
layer.open({
title:'添加失败',
content:data.msg,
icon:5,
anim:6
});
}
}
});
layer.close(index);
});
submit.trigger('click');
}
});
});
});
</script>
{/block}

View File

@ -89,11 +89,11 @@
});
$.get("{:url('system.upgrade/check')}",function (data){
if (data.code == 0) {
if (data.code === 0) {
//已件最新版本
layer.close(loading);
toast.info({title:"通知消息", message: data.msg ,position: 'topRight'})
} else if (data.code == 1) {
} else if (data.code === 1) {
//可升级
layer.close(loading);
$('div#ver_nums').after('<div class="layui-input-inline layui-input-company">发现<span style="color:red">'+data.data.upnum+'</span>个新版本:<span style="color:red">可更新至v' + data.data.version + ' [!重要:' + data.data.info + ']</span></div>');
@ -107,7 +107,6 @@
//服务器错误
layer.close(loading);
toast.error({title:"服务器错误",message:data.msg});
//notify.error(data.msg);
}
});
return false;
@ -128,7 +127,6 @@
} else {
layer.close(load);
toast.error({title:"服务器错误", message:data.msg})
//notify.error(data.msg);
return false;
}
}

View File

@ -1,52 +0,0 @@
<!--
* @Author: TaoLer <317927823@qq.com>
* @Date: 2022-05-09 08:31:24
* @LastEditTime: 2022-08-14 10:19:20
* @LastEditors: TaoLer
* @Description: 优化版
* @FilePath: \github\TaoLer\app\admin\view\tag\add.html
* Copyright (c) 2020~2022 https://www.aieok.com All rights reserved.
-->
{extend name="public/base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-slider" id="layuiadmin-form-slider" style="padding: 20px 20px 0 0;">
<div class="layui-form-item">
<div class="layui-form-item">
<label class="layui-form-label">名称</label>
<div class="layui-input-inline">
<input type="text" name="name" lay-verify="required" placeholder="tag名" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">别名</label>
<div class="layui-input-inline">
<input type="text" name="ename" lay-verify="required" placeholder="英文或者拼音别名" autocomplete="off" class="layui-input" >
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">关键词</label>
<div class="layui-input-inline">
<input type="text" name="keywords" lay-verify="required" placeholder="关键词 多个以逗号,隔开" autocomplete="off" class="layui-input" >
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">摘要</label>
<div class="layui-input-block">
<textarea type="text" name="description" lay-verify="required" placeholder="请输入内容" autocomplete="off" class="layui-textarea"></textarea>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">seo标题</label>
<div class="layui-input-inline">
<input type="text" name="title" lay-verify="required" placeholder="tag标题" autocomplete="off" class="layui-input" >
</div>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="Tag-submit" id="Tag-submit" value="确认">
</div>
</div>
{/block}
{block name="js"}{/block}

View File

@ -1,55 +0,0 @@
<!--
* @Author: TaoLer <317927823@qq.com>
* @Date: 2022-05-09 08:31:24
* @LastEditTime: 2022-08-14 10:51:17
* @LastEditors: TaoLer
* @Description: 优化版
* @FilePath: \github\TaoLer\app\admin\view\tag\edit.html
* Copyright (c) 2020~2022 https://www.aieok.com All rights reserved.
-->
{extend name="public/base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-tag" id="layuiadmin-form-tag" style="padding: 20px 20px 0 0;">
<div class="layui-form-item">
<label class="layui-form-label">名称</label>
<div class="layui-input-inline">
<input type="text" name="name" lay-verify="required" placeholder="tag名" class="layui-input" value="{$tag.name}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">别名</label>
<div class="layui-input-inline">
<input type="text" name="ename" lay-verify="required" placeholder="英文或者拼音别名" class="layui-input" value="{$tag.ename}" >
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">关键词</label>
<div class="layui-input-inline">
<input type="text" name="keywords" lay-verify="required" placeholder="关键词 多个以逗号,隔开" autocomplete="off" class="layui-input" value="{$tag.keywords}">
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">摘要</label>
<div class="layui-input-block">
<textarea type="text" name="description" lay-verify="required" placeholder="请输入内容" autocomplete="off" class="layui-textarea">{$tag.description}</textarea>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">seo标题</label>
<div class="layui-input-inline">
<input type="text" name="title" lay-verify="required" placeholder="tag标题" autocomplete="off" class="layui-input" value="{$tag.title}">
</div>
</div>
<div class="layui-form-item layui-hide">
<input type="text" name="id" class="layui-input layui-hide" value="{$tag.id}">
<input type="button" lay-submit lay-filter="Tag-submit" id="Tag-submit" value="确认">
</div>
</div>
{/block}
{block name="js"}
<script>
</script>
{/block}

View File

@ -1,186 +0,0 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-fluid">
<div class="layui-row layui-col-space15">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-body">
<!--div class="layui-form layui-card-header layuiadmin-card-header-auto">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">Tag关键词</label>
<div class="layui-input-block">
<input type="text" name="tag" placeholder="请输入关键词" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<button class="layui-btn layuiadmin-btn-forum-list" lay-submit lay-filter="Tag-link-search">
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
</button>
</div>
</div>
</div-->
<div style="padding-bottom: 10px;">
<button type="button" class="layui-btn layuiadmin-btn-forum-list" id="slid-add">添加</button>
</div>
<table id="tag" lay-filter="tag"></table>
<script type="text/html" id="barDemo">
<a class="layui-btn layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i></a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i></a>
</script>
</div>
</div>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index','table'], function(){
var $ = layui.jquery
,layer = layui.layer
,table = layui.table
,form = layui.form;
//第一个实例
table.render({
elem: '#tag'
,url: "{:url('Tag/list')}" //数据接口
,page: true //开启分页
,cols: [[ //表头
{type: 'numbers', fixed: 'left'}
,{field: 'name', title: '名称', width:100}
,{field: 'ename', title: '别名', width:100}
,{field: 'keywords', title: '关键词', width:150}
,{field: 'description', title: '摘要', minWidth:300}
,{field: 'title', title: 'seo标题', width:200}
,{field: 'time', title: '时间', minWidth:100}
,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:150}
]]
,limit: 100
,text: '对不起,加载出现异常!'
});
form.on('submit(Tag-link-search)', function(data){
$.post("{:url('Tag/list')}", {"tag":data.value}, function (data){
if (data.code == -1){
layer.open({content:data.msg,icon:5,anim:6});
}
}
);
//执行重载
table.reload('tag-link', {
where: {tag: data.value}
,page: {
curr: 1 //重新从第 1 页开始
}
});
});
//监听行工具事件
table.on('tool(tag)', function(obj){
var data = obj.data;
var id = data.id;
if(obj.event === 'del'){
layer.confirm('真的删除行么', {icon: 3, title:'删除TagLink'}, function(index){
//提交 Ajax 成功后,静态更新表格中的数据
$.post("{:url('Tag/delete')}", {"id":id}, function(data){
if (data.code == 0) {
layer.msg(data.msg,{icon:6,time:2000}, function(){
location.reload();
});
} else {
layer.open({title:'删除失败',content:data.msg,icon:5,anim:6});
}
});
});
layer.close(index);
} else if(obj.event === 'edit'){
layer.open({
type: 2,
title: '编辑Tag',
content: 'edit.html?id='+ id,
maxmin: true,
area : ['450px' , '80%'],
btn: ['确定', '取消'],
yes: function(index, layero){
var iframeWindow = window['layui-layer-iframe'+ index]
,submitID = 'Tag-submit'
,submit = layero.find('iframe').contents().find('#'+ submitID);
//监听提交
iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
var field = data.field; //获取提交的字段
$.ajax({
type:"post",
url:"{:url('Tag/edit')}",
data: field,
daType:"json",
success:function (data){
if (data.code == 0) {
layer.msg(data.msg,{icon:6,time:2000}, function(){
location.reload();
});
} else {
layer.open({title:'添加失败',content:data.msg,icon:5,anim:6});
}
}
});
layer.close(index);
});
submit.trigger('click');
}
});
}
});
// 添加
$('#slid-add').on('click', function(){
layer.open({
type: 2,
title: '添加Tag',
content: 'add.html',
maxmin: true,
area : ['450px' , '80%'],
btn: ['确定', '取消'],
yes: function(index, layero){
var iframeWindow = window['layui-layer-iframe'+ index]
,submitID = 'Tag-submit'
,submit = layero.find('iframe').contents().find('#'+ submitID);
//监听提交
iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
var field = data.field; //获取提交的字段
//提交 Ajax 成功后,静态更新表格中的数据
$.ajax({
type:"post",
url:"{:url('Tag/add')}",
data: field,
daType:"json",
success:function (data){
if (data.code == 0) {
layer.msg(data.msg,{icon:6,time:2000}, function(){
location.reload();
});
} else {
layer.open({title:'添加失败',content:data.msg,icon:5,anim:6});
}
}
});
layer.close(index);
});
submit.trigger('click');
}
});
});
});
</script>
{/block}

View File

@ -1,37 +0,0 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-slider" id="layuiadmin-form-slider" style="padding: 20px 20px 0 0;">
<div class="layui-form-item">
<div class="layui-form-item">
<label class="layui-form-label">Tag</label>
<div class="layui-input-inline">
<input type="text" name="tag" lay-verify="required" placeholder="tag匹配关键词" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">Link</label>
<div class="layui-input-inline">
<input type="text" name="link" lay-verify="required|url" placeholder="http://链接" autocomplete="off" class="layui-input" >
</div>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="Tag-Link-submit" id="Tag-Link-submit" value="确认">
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form'], function(){
var $ = layui.$
,form = layui.form;
})
</script>
{/block}

View File

@ -1,27 +0,0 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-slider" id="layuiadmin-form-slider" style="padding: 20px 20px 0 0;">
<div class="layui-form-item">
<label class="layui-form-label">Tag</label>
<div class="layui-input-inline">
<input type="text" name="tag" lay-verify="required" placeholder="请输入名称" autocomplete="off" class="layui-input layui-disabled" disabled value="{$tag}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">Link</label>
<div class="layui-input-inline">
<input type="text" name="link" lay-verify="required|url" placeholder="http://链接" autocomplete="off" class="layui-input" value="{$link}" >
</div>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="Tag-Link-submit" id="Tag-Link-submit" value="确认">
</div>
</div>
{/block}
{block name="js"}
<script>
</script>
{/block}

View File

@ -1,185 +0,0 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-fluid">
<div class="layui-row layui-col-space15">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-body">
<!--div class="layui-form layui-card-header layuiadmin-card-header-auto">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">Tag关键词</label>
<div class="layui-input-block">
<input type="text" name="tag" placeholder="请输入关键词" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<button class="layui-btn layuiadmin-btn-forum-list" lay-submit lay-filter="Tag-link-search">
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
</button>
</div>
</div>
</div-->
<div class="layui-form" wid100 lay-filter="">
<div class="layui-upload">
<button type="button" class="layui-btn layui-btn-normal" id="slid-add">添加</button>
<table id="tag-link" lay-filter="tag-link"></table>
<script type="text/html" id="barDemo">
<a class="layui-btn layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i></a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i></a>
</script>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index','layer','table','form'], function(){
var $ = layui.jquery
,layer = layui.layer
,table = layui.table
,form = layui.form;
//第一个实例
table.render({
elem: '#tag-link'
,url: "{:url('TagLink/list')}" //数据接口
,page: true //开启分页
,cols: [[ //表头
{type: 'numbers', fixed: 'left'}
,{field: 'tag', title: 'Tag', width:200}
,{field: 'link', title: 'Link', minWidth:300}
,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:150}
]]
,limit: 15
,text: '对不起,加载出现异常!'
});
form.on('submit(Tag-link-search)', function(data){
$.post("{:url('TagLink/list')}", {"tag":data.value}, function (data){
if (data.code == -1){
layer.open({content:data.msg,icon:5,anim:6});
}
}
);
//执行重载
table.reload('tag-link', {
where: {tag: data.value}
,page: {
curr: 1 //重新从第 1 页开始
}
});
});
//监听行工具事件
table.on('tool(tag-link)', function(obj){
var data = obj.data;
var tag = data.tag;
if(obj.event === 'del'){
layer.confirm('真的删除行么', {icon: 3, title:'删除TagLink'}, function(index){
//提交 Ajax 成功后,静态更新表格中的数据
$.post("{:url('TagLink/delete')}", {"tag":tag}, function(data){
if (data.code == 0) {
layer.msg(data.msg,{icon:6,time:2000}, function(){
location.reload();
});
} else {
layer.open({title:'删除失败',content:data.msg,icon:5,anim:6});
}
});
});
layer.close(index);
} else if(obj.event === 'edit'){
layer.open({
type: 2,
title: '编辑TagLink',
content: 'edit.html?tag='+ tag,
maxmin: true,
area : ['400px' , '300px'],
btn: ['确定', '取消'],
yes: function(index, layero){
var iframeWindow = window['layui-layer-iframe'+ index]
,submitID = 'Tag-Link-submit'
,submit = layero.find('iframe').contents().find('#'+ submitID);
//监听提交
iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
var field = data.field; //获取提交的字段
$.ajax({
type:"post",
url:"{:url('TagLink/edit')}",
data: field,
daType:"json",
success:function (data){
if (data.code == 0) {
layer.msg(data.msg,{icon:6,time:2000}, function(){
location.reload();
});
} else {
layer.open({title:'添加失败',content:data.msg,icon:5,anim:6});
}
}
});
layer.close(index);
});
submit.trigger('click');
}
});
}
});
// 添加
$('#slid-add').on('click', function(){
layer.open({
type: 2,
title: '添加TagLink',
content: 'add.html',
maxmin: true,
area : ['400px' , '300px'],
btn: ['确定', '取消'],
yes: function(index, layero){
var iframeWindow = window['layui-layer-iframe'+ index]
,submitID = 'Tag-Link-submit'
,submit = layero.find('iframe').contents().find('#'+ submitID);
//监听提交
iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
var field = data.field; //获取提交的字段
//提交 Ajax 成功后,静态更新表格中的数据
$.ajax({
type:"post",
url:"{:url('TagLink/add')}",
data: field,
daType:"json",
success:function (data){
if (data.code == 0) {
layer.msg(data.msg,{icon:6,time:2000}, function(){
location.reload();
});
} else {
layer.open({title:'添加失败',content:data.msg,icon:5,anim:6});
}
}
});
layer.close(index);
});
submit.trigger('click');
}
});
});
});
</script>
{/block}

View File

@ -1,2 +0,0 @@
*
!.gitignore

View File

@ -1,269 +0,0 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-fluid">
<div class="layui-row layui-col-space15">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-header">升级服务</div>
<div class="layui-card-body">
<div class="layui-form" wid100 lay-filter="">
{if ($ver_num.key == '')}
<div class="layui-form-item">
<label class="layui-form-label">配置Key</label>
<div class="layui-input-inline">
<input type="text" name="key" value="{$ver_num.key}" required class="layui-input" placeholder="填写申请得到在Key">
</div>
<div class="layui-input-inline layui-input-company"><button style="float: left;" type="button" class="layui-btn layui-btn-sm" id="upgrade-key">保存</button></div>
<div class="layui-form-mid layui-word-aux" >无Key不能升级</div>
<div class="layui-form-mid layui-word-aux " ><a href="https://www.aieok.com/article/user/key.html" target="_blank">去官网申请Key</a></div>
</div>
{else /}
<div class="layui-form-item">
<label class="layui-form-label">升级Key</label>
<div class="layui-form-item layui-hide">
<input type="text" name="key" value="{$ver_num.key}" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux " ><span style="color:red">{$ver_num.key}</span></div>
<div class="layui-input-inline layui-input-company">
{if condition="checkRuleButton('Upgrade/keyedit')"}
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit" id-data="{:url('upgrade/keyedit')}" ><i class="layui-icon layui-icon-edit"></i>修改?</a>
{else /}<a class="layui-btn layui-btn-normal layui-btn-xs layui-btn-disabled" ><i class="layui-icon layui-icon-edit"></i>修改?</a>{/if}
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">在线升级</label>
<div class="layui-input-inline layui-input-company" id="ver_nums" >当前版本Taoler v_{:config('taoler.version')}</div>
<div class="layui-upload">
{if condition="checkRuleButton('Upgrade/check')"}
<button type="button" class="layui-btn layui-btn-sm" data-url="{$ver_num.upcheck_url}" id="upload-check">检查更新</button>
{else /}<button type="button" class="layui-btn layui-btn-sm layui-btn-disabled">检查更新</button>{/if}
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">手动更新</label>
<div class="layui-upload">
{if condition="checkRuleButton('Upgrade/uploadzip')"}
<button type="button" class="layui-btn layui-btn-sm" id="select-file">选择文件</button>
<button type="button" class="layui-btn layui-btn-sm" id="upgrade-sys-button">开始升级</button>
{else /}<button type="button" class="layui-btn layui-btn-sm layui-btn-disabled">无权限</button>{/if}
</div>
</div>
{/if}
<div style="margin-top: 10px;">
<div class="layui-form-item">
<div class="layui-card-header">升级说明</div>
<div style="padding-left: 20px;">1.升级服务需要去官网申请key配置文件</div>
<div style="padding-left: 20px;">2.多个版本需要升级时,会自行判断依次序升级</div>
<div style="padding-left: 20px;">3.升级过程尽管会自动备份文件,但为了安全起见可以自行备份文件</div>
<div style="padding-left: 20px;">4.在某些特殊场合,可能需要手动升级</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index','notify','layer','form','upload'], function(){
var $ = layui.jquery
,layer = layui.layer
,form = layui.form
,upload = layui.upload;
var notify = layui.notify;
//检测并更新系统
$('#upload-check').on('click',function(){
var loading = layer.load(2, {
shade: [0.2, '#000'],
//time: 2000,
});
$.get("{:url('upgrade/check')}",function (data){
if (data.code == 0) {
//已件最新版本
layer.close(loading);
notify.info(data.msg);
} else if (data.code == 1) {
//可升级
layer.close(loading);
$('div#ver_nums').after('<div class="layui-input-inline layui-input-company">发现<span style="color:red">'+data.data.upnum+'</span>个新版本:<span style="color:red">可更新至v' + data.data.version + ' [!重要:' + data.data.info + ']</span></div>');
$('button#upload-check').hide();
//更新系统
layer.confirm('更新v' + data.data.version + ',升级说明:<span style="color:red">[!重要:' + data.data.info + ']</span><br>确定升级?',{icon: 3, title:'升级系统'}, function(index){
uploads(); //更新
layer.close(index); //关闭load加载层
});
} else {
//服务器错误
layer.close(loading);
notify.error(data.msg);
}
}
);
return false;
});
//更新
function uploads(){
var load = layer.load();
$.get("{:url('upgrade/upload')}",function (data){
if (data.code == 0) {
layer.close(load);
layer.msg(data.msg,{
icon:6,
time:2000
},function(){
location.reload();
});
} else {
layer.close(load);
notify.error(data.msg);
return false;
}
}
);
}
//手动更新,选完文件后不自动上传
upload.render({
elem: '#select-file'
,url: "{:url('upgrade/uploadzip')}"
,data: {type:'zip'}
,accept: 'file'
,acceptMime: 'application/zip'
,field: 'file'
,auto: false
,exts: 'zip|rar|7z'
,size: 10000
//,multiple: true
,bindAction: '#upgrade-sys-button'
,before: function(obj){ //obj参数包含的信息跟 choose回调完全一致可参见上文。
layer.load(); //上传loading
}
,done: function(res){
layer.closeAll('loading'); //关闭loading
if(res.code == 0){
layer.msg(res.msg,{
icon:6,
tiye:2000
},function(){
location.reload();
});
} else {
layer.open({
title:"上传失败",
content:res.msg,
icon:5,
anim:6
});
}
}
});
//确定升级操作
$(document).on('click','#update_system',function(){
//var url = $(this).attr('data-url'),
// key = $('input[name=key]').attr("value"),
uploads();
return false;
});
//设置key
$('#upgrade-key').on('click',function(){
var key = $('input[name=key]').val();
$.ajax({
type:"post",
url:"{:url('upgrade/key')}",
data:{"key":key},
daType:"json",
success:function (data){
if (data.code == 0) {
layer.msg(data.msg,{
icon:6,
time:2000
},function(){
location.reload();
});
} else {
layer.open({
title:'保存失败',
content:data.msg,
icon:5,
anim:6
});
}
}
});
return false;
});
//修改key
$('a[lay-event=edit]').on('click', function(){
layer.open({
type: 2,
title: '修改key',
content: 'keyedit.html',
maxmin: true,
area : ['420px' , '400px'],
btn: ['确定', '取消'],
yes: function(index, layero){
var iframeWindow = window['layui-layer-iframe'+ index]
,submitID = 'LAY-keyedit-submit'
,submit = layero.find('iframe').contents().find('#'+ submitID);
//监听提交
iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
var field = data.field; //获取提交的字段
//console.log(field);
//提交 Ajax 成功后,静态更新表格中的数据
$.ajax({
type:"post",
url:"{:url('upgrade/keyedit')}",
data:{"key":field.key,"upcheck_url":field.upcheck_url,"upgrade_url":field.upgrade_url},
daType:"json",
success:function (data){
if (data.code == 0) {
layer.msg(data.msg,{
icon:6,
time:2000
}, function(){
location.reload();
});
} else {
layer.open({
title:'修改失败',
content:data.msg,
icon:5,
anim:6
});
}
}
});
layer.close(index);
});
submit.trigger('click');
}
});
return false;
});
});
</script>
{/block}

View File

@ -1,61 +0,0 @@
<!--
* @Author: TaoLer <alipey_tao@qq.com>
* @Date: 2021-12-06 16:04:50
* @LastEditTime: 2022-04-18 14:11:27
* @LastEditors: TaoLer
* @Description: 搜索引擎SEO优化设置
* @FilePath: \TaoLer\app\admin\view\upgrade\keyedit.html
* Copyright (c) 2020~2022 http://www.aieok.com All rights reserved.
-->
{extend name="public/base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-keyedit" id="layuiadmin-form-keyedit" style="padding: 20px 30px 0 0;">
<div class="layui-form-item">
<label class="layui-form-label">配置Key</label>
<div class="layui-input-inline">
<input type="text" name="key" value="{$key.key}" required class="layui-input" autocomplete="off" placeholder="填写申请得到在Key">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">检测api</label>
<div class="layui-input-inline">
<input type="text" name="upcheck_url" value="{$key.upcheck_url}" required class="layui-input" autocomplete="off" placeholder="没换官网服务器情况下不要改">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">升级api</label>
<div class="layui-input-inline">
<input type="text" name="upgrade_url" value="{$key.upgrade_url}" required class="layui-input" autocomplete="off" placeholder="没换官网服务器情况下不要改">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">申请key?</label>
<div class="layui-input-inline">
<div class="layui-form-mid layui-word-aux " ><a href="https://www.aieok.com/article/user/key.html" target="_blank">更换网址,请去官网重新申请key</a></div>
<div class="layui-form-mid layui-word-aux " ><span>未通知api接口变更,请不要私自更改api否则无法升级</span></div>
</div>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="LAY-keyedit-submit" id="LAY-keyedit-submit" value="确认">
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form','table'], function(){
var $ = layui.$
,table = layui.table
,form = layui.form;
});
</script>
{/block}

View File

@ -75,9 +75,11 @@
let $ = layui.jquery;
let upload = layui.upload;
let ADD_URL = "{:url('user.user/add')}";
form.on('submit(user-save)', function(data) {
$.ajax({
url: "{:url('user.user/add')}",
url: ADD_URL,
data: JSON.stringify(data.field),
dataType: 'json',
contentType: 'application/json',
@ -88,8 +90,7 @@
icon: 1,
time: 1000
}, function() {
parent.layer.close(parent.layer.getFrameIndex(window
.name)); //关闭当前页
parent.layer.close(parent.layer.getFrameIndex(window.name)); //关闭当前页
parent.layui.table.reload("user-table");
});
} else {

View File

@ -19,12 +19,16 @@ use think\facade\Session;
use think\facade\Cache;
use app\facade\Article;
use app\BaseController as BaseCtrl;
use app\common\model\Cate;
/**
* 控制器基础类
*/
class BaseController extends BaseCtrl
{
protected $uid = '';
/**
* 初始化系统,导航,用户
*/
@ -72,7 +76,9 @@ class BaseController extends BaseCtrl
{
$appname = app('http')->getName();
//1.查询分类表获取所有分类
$cateList = Db::name('cate')->where(['status'=>1,'delete_time'=>0, 'appname' => $appname])->cache('catename' . $appname,3600)->select()->toArray();
// $cateList = Db::name('cate')->where(['status'=>1,'delete_time'=>0, 'appname' => $appname])->cache('catename' . $appname,3600)->select()->toArray();
$cate = new Cate();
$cateList = $cate->menu();
return getTree($cateList);
}

View File

@ -64,7 +64,7 @@ class Article extends Model
/**
* 添加
* @param array $data
* @return int|string
* @return int|string|array
*/
public function add(array $data)
{
@ -336,7 +336,7 @@ class Article extends Model
*
* @param [type] $tagId 标签id
* @param [type] $limit 输出数量
* @return void
* @return array
*/
public function getAllTags($tagId)
{
@ -386,7 +386,7 @@ class Article extends Model
*
* @param [type] $id 当前文章ID
* @param [type] $cid 当前分类ID
* @return void
* @return void|array
*/
public function getPrevNextArticle($id,$cid)
{

View File

@ -10,6 +10,9 @@
*/
namespace app\common\model;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\facade\Lang;
use think\Model;
use think\model\concern\SoftDelete;
@ -72,5 +75,33 @@ class Cate extends Model
}
}
// 如果菜单下无内容URl不能点击
public function menu()
{
$appname = app('http')->getName();
try {
$cateList = $this->where(['status' => 1, 'appname' => $appname])
->cache('catename' . $appname, 3600)
->append(['url'])
->select()
->toArray();
return $cateList;
} catch (DbException $e) {
return $e->getMessage();
}
}
// 获取url
public function getUrlAttr($value,$data)
{
// 栏目下存在帖子则返回正常url,否则为死链
$articleArr = Article::where('cate_id',$data['id'])->column('id');
if(empty($articleArr)) {
return 'javascript:void(0);';
}
return (string) url('cate',['ename' => $data['ename']]);;
}
}

File diff suppressed because it is too large Load Diff

115
composer.lock generated
View File

@ -281,16 +281,16 @@
},
{
"name": "dasprid/enum",
"version": "1.0.3",
"version": "1.0.4",
"source": {
"type": "git",
"url": "https://github.com/DASPRiD/Enum.git",
"reference": "5abf82f213618696dda8e3bf6f64dd042d8542b2"
"reference": "8e6b6ea76eabbf19ea2bf5b67b98e1860474012f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/DASPRiD/Enum/zipball/5abf82f213618696dda8e3bf6f64dd042d8542b2",
"reference": "5abf82f213618696dda8e3bf6f64dd042d8542b2",
"url": "https://api.github.com/repos/DASPRiD/Enum/zipball/8e6b6ea76eabbf19ea2bf5b67b98e1860474012f",
"reference": "8e6b6ea76eabbf19ea2bf5b67b98e1860474012f",
"shasum": "",
"mirrors": [
{
@ -299,9 +299,12 @@
}
]
},
"require": {
"php": ">=7.1 <9.0"
},
"require-dev": {
"phpunit/phpunit": "^7 | ^8 | ^9",
"squizlabs/php_codesniffer": "^3.4"
"squizlabs/php_codesniffer": "*"
},
"type": "library",
"autoload": {
@ -328,9 +331,9 @@
],
"support": {
"issues": "https://github.com/DASPRiD/Enum/issues",
"source": "https://github.com/DASPRiD/Enum/tree/1.0.3"
"source": "https://github.com/DASPRiD/Enum/tree/1.0.4"
},
"time": "2020-10-02T16:03:48+00:00"
"time": "2023-03-01T18:44:03+00:00"
},
{
"name": "endroid/qr-code",
@ -2374,16 +2377,16 @@
},
{
"name": "symfony/var-exporter",
"version": "v5.4.19",
"version": "v5.4.21",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-exporter.git",
"reference": "2a1d06fcf2b30829d6c01dae8e6e188424d1f8f6"
"reference": "be74908a6942fdd331554b3cec27ff41b45ccad4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/var-exporter/zipball/2a1d06fcf2b30829d6c01dae8e6e188424d1f8f6",
"reference": "2a1d06fcf2b30829d6c01dae8e6e188424d1f8f6",
"url": "https://api.github.com/repos/symfony/var-exporter/zipball/be74908a6942fdd331554b3cec27ff41b45ccad4",
"reference": "be74908a6942fdd331554b3cec27ff41b45ccad4",
"shasum": "",
"mirrors": [
{
@ -2433,7 +2436,7 @@
"serialize"
],
"support": {
"source": "https://github.com/symfony/var-exporter/tree/v5.4.19"
"source": "https://github.com/symfony/var-exporter/tree/v5.4.21"
},
"funding": [
{
@ -2449,7 +2452,7 @@
"type": "tidelift"
}
],
"time": "2023-01-12T16:39:29+00:00"
"time": "2023-02-21T19:46:44+00:00"
},
{
"name": "taoser/think-addons",
@ -2516,16 +2519,16 @@
},
{
"name": "taoser/think-auth",
"version": "v1.0.0",
"version": "v1.0.1",
"source": {
"type": "git",
"url": "https://github.com/taoser/think-auth.git",
"reference": "19bb04e4fb957a95ff3fdc142939922c19167b43"
"reference": "d3aa853b7d2a34624bcc566150105f2815e68ad0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/taoser/think-auth/zipball/19bb04e4fb957a95ff3fdc142939922c19167b43",
"reference": "19bb04e4fb957a95ff3fdc142939922c19167b43",
"url": "https://api.github.com/repos/taoser/think-auth/zipball/d3aa853b7d2a34624bcc566150105f2815e68ad0",
"reference": "d3aa853b7d2a34624bcc566150105f2815e68ad0",
"shasum": "",
"mirrors": [
{
@ -2569,9 +2572,9 @@
],
"support": {
"issues": "https://github.com/taoser/think-auth/issues",
"source": "https://github.com/taoser/think-auth/tree/master"
"source": "https://github.com/taoser/think-auth/tree/v1.0.1"
},
"time": "2020-02-11T06:16:10+00:00"
"time": "2023-02-26T03:08:39+00:00"
},
{
"name": "taoser/think-setarr",
@ -2914,16 +2917,16 @@
},
{
"name": "topthink/think-migration",
"version": "v3.0.3",
"version": "v3.0.4",
"source": {
"type": "git",
"url": "https://github.com/top-think/think-migration.git",
"reference": "5717d9e5f3ea745f6dbfd1e30b4402aaadff9a79"
"reference": "c5880669b277762d5ff935e551bc0d5c71de6811"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/top-think/think-migration/zipball/5717d9e5f3ea745f6dbfd1e30b4402aaadff9a79",
"reference": "5717d9e5f3ea745f6dbfd1e30b4402aaadff9a79",
"url": "https://api.github.com/repos/top-think/think-migration/zipball/c5880669b277762d5ff935e551bc0d5c71de6811",
"reference": "c5880669b277762d5ff935e551bc0d5c71de6811",
"shasum": "",
"mirrors": [
{
@ -2933,7 +2936,7 @@
]
},
"require": {
"topthink/framework": "^6.0.0",
"topthink/framework": "^6.0",
"topthink/think-helper": "^3.0.3"
},
"require-dev": {
@ -2968,22 +2971,22 @@
],
"support": {
"issues": "https://github.com/top-think/think-migration/issues",
"source": "https://github.com/top-think/think-migration/tree/v3.0.3"
"source": "https://github.com/top-think/think-migration/tree/v3.0.4"
},
"time": "2020-12-07T05:54:22+00:00"
"time": "2022-10-26T07:57:54+00:00"
},
{
"name": "topthink/think-multi-app",
"version": "v1.0.15",
"version": "v1.0.16",
"source": {
"type": "git",
"url": "https://github.com/top-think/think-multi-app.git",
"reference": "387e0dac059c20f92cac5da41a871e10829c1c97"
"reference": "07b9183855150455e1f76f8cbe9d77d6d1bc399f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/top-think/think-multi-app/zipball/387e0dac059c20f92cac5da41a871e10829c1c97",
"reference": "387e0dac059c20f92cac5da41a871e10829c1c97",
"url": "https://api.github.com/repos/top-think/think-multi-app/zipball/07b9183855150455e1f76f8cbe9d77d6d1bc399f",
"reference": "07b9183855150455e1f76f8cbe9d77d6d1bc399f",
"shasum": "",
"mirrors": [
{
@ -2994,7 +2997,7 @@
},
"require": {
"php": ">=7.1.0",
"topthink/framework": "^6.0"
"topthink/framework": "^6.0|^8.0"
},
"type": "library",
"extra": {
@ -3022,22 +3025,22 @@
"description": "thinkphp6 multi app support",
"support": {
"issues": "https://github.com/top-think/think-multi-app/issues",
"source": "https://github.com/top-think/think-multi-app/tree/v1.0.15"
"source": "https://github.com/top-think/think-multi-app/tree/v1.0.16"
},
"time": "2022-10-26T08:03:06+00:00"
"time": "2023-02-07T08:40:09+00:00"
},
{
"name": "topthink/think-orm",
"version": "v2.0.57",
"version": "v2.0.59",
"source": {
"type": "git",
"url": "https://github.com/top-think/think-orm.git",
"reference": "b68e3bb15322dc2d977ac62682d6df05c98bd23c"
"reference": "ac0f18bc3063ca924ed5b4af6e405d74f44d2870"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/top-think/think-orm/zipball/b68e3bb15322dc2d977ac62682d6df05c98bd23c",
"reference": "b68e3bb15322dc2d977ac62682d6df05c98bd23c",
"url": "https://api.github.com/repos/top-think/think-orm/zipball/ac0f18bc3063ca924ed5b4af6e405d74f44d2870",
"reference": "ac0f18bc3063ca924ed5b4af6e405d74f44d2870",
"shasum": "",
"mirrors": [
{
@ -3083,22 +3086,22 @@
],
"support": {
"issues": "https://github.com/top-think/think-orm/issues",
"source": "https://github.com/top-think/think-orm/tree/v2.0.57"
"source": "https://github.com/top-think/think-orm/tree/v2.0.59"
},
"time": "2023-02-03T11:35:52+00:00"
"time": "2023-03-06T10:12:41+00:00"
},
{
"name": "topthink/think-template",
"version": "v2.0.8",
"version": "v2.0.9",
"source": {
"type": "git",
"url": "https://github.com/top-think/think-template.git",
"reference": "abfc293f74f9ef5127b5c416310a01fe42e59368"
"reference": "6d25642ae0e306166742fd7073dc7a159e18073c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/top-think/think-template/zipball/abfc293f74f9ef5127b5c416310a01fe42e59368",
"reference": "abfc293f74f9ef5127b5c416310a01fe42e59368",
"url": "https://api.github.com/repos/top-think/think-template/zipball/6d25642ae0e306166742fd7073dc7a159e18073c",
"reference": "6d25642ae0e306166742fd7073dc7a159e18073c",
"shasum": "",
"mirrors": [
{
@ -3130,9 +3133,9 @@
"description": "the php template engine",
"support": {
"issues": "https://github.com/top-think/think-template/issues",
"source": "https://github.com/top-think/think-template/tree/v2.0.8"
"source": "https://github.com/top-think/think-template/tree/v2.0.9"
},
"time": "2020-12-10T07:52:03+00:00"
"time": "2023-02-14T10:50:39+00:00"
},
{
"name": "topthink/think-view",
@ -3328,16 +3331,16 @@
},
{
"name": "workerman/workerman",
"version": "v4.1.6",
"version": "v4.1.9",
"source": {
"type": "git",
"url": "https://github.com/walkor/workerman.git",
"reference": "a278ddcc78040e5d1e25ca2022eeb7ccfdccc86b"
"reference": "1f92d02c26106b5fbe6f61ea776198aad6e426f7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/walkor/workerman/zipball/a278ddcc78040e5d1e25ca2022eeb7ccfdccc86b",
"reference": "a278ddcc78040e5d1e25ca2022eeb7ccfdccc86b",
"url": "https://api.github.com/repos/walkor/workerman/zipball/1f92d02c26106b5fbe6f61ea776198aad6e426f7",
"reference": "1f92d02c26106b5fbe6f61ea776198aad6e426f7",
"shasum": "",
"mirrors": [
{
@ -3393,7 +3396,7 @@
"type": "patreon"
}
],
"time": "2023-01-13T02:17:21+00:00"
"time": "2023-03-10T13:59:12+00:00"
},
{
"name": "yansongda/pay",
@ -3547,16 +3550,16 @@
},
{
"name": "yzh52521/easyhttp",
"version": "v1.0.6",
"version": "v1.0.7",
"source": {
"type": "git",
"url": "https://github.com/yzh52521/easyhttp.git",
"reference": "6c4795316e6847ba691ecad9c9f5fd9f073b33e2"
"reference": "52cb9aba60a725bef77acd9c4c48ecc78931af9e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/yzh52521/easyhttp/zipball/6c4795316e6847ba691ecad9c9f5fd9f073b33e2",
"reference": "6c4795316e6847ba691ecad9c9f5fd9f073b33e2",
"url": "https://api.github.com/repos/yzh52521/easyhttp/zipball/52cb9aba60a725bef77acd9c4c48ecc78931af9e",
"reference": "52cb9aba60a725bef77acd9c4c48ecc78931af9e",
"shasum": "",
"mirrors": [
{
@ -3599,9 +3602,9 @@
],
"support": {
"issues": "https://github.com/yzh52521/easyhttp/issues",
"source": "https://github.com/yzh52521/easyhttp/tree/v1.0.6"
"source": "https://github.com/yzh52521/easyhttp/tree/v1.0.7"
},
"time": "2023-02-08T09:24:06+00:00"
"time": "2023-02-16T03:04:02+00:00"
}
],
"packages-dev": [

View File

@ -16,7 +16,7 @@ return [
// 应用名,此项不可更改
'appname' => 'TaoLer',
// 版本配置
'version' => '2.1.3',
'version' => '2.2.2',
// 加盐
'salt' => 'taoler',
// 数据库备份目录

3
public/static/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
/addons
/app
/home

12
public/static/README.md Normal file
View File

@ -0,0 +1,12 @@
# static
#### 介绍
1. addons 插件静态资源
2. admin 管理系统资源
3. app 应用静态资源
4. component 管理系统资源(勿动)
5. config 管理系统配置文件

View File

@ -1,130 +0,0 @@
/**
@NamelayuiAdmin iframe版全局配置
@Author贤心
@Sitehttp://www.layui.com/admin/
@LicenseLPPLlayui付费产品协议
*/
layui.define(['laytpl', 'layer', 'element', 'util'], function(exports){
exports('setter', {
container: 'LAY_app' //容器ID
,base: layui.cache.base //记录静态资源所在路径
,views: layui.cache.base + 'tpl/' //动态模板所在目录
,entry: 'index' //默认视图文件名
,engine: '.html' //视图文件后缀名
,pageTabs: true //是否开启页面选项卡功能。iframe版推荐开启
,version: new Date().getTime() //这样你每次刷新页面,都会更新一次缓存
,name: 'layuiAdmin'
,tableName: 'layuiAdmin' //本地存储表名
,MOD_NAME: 'admin' //模块事件名
,debug: false //是否开启调试模式。如开启,接口异常时会抛出异常 URL 等信息
//自定义请求字段
,request: {
tokenName: false //自动携带 token 的字段名access_token。可设置 false 不携带。
}
//自定义响应字段
,response: {
statusName: 'code' //数据状态的字段名称
,statusCode: {
ok: 0 //数据状态一切正常的状态码
,logout: 1001 //登录状态失效的状态码
,error: -1 //增加登录失败的状态码
}
,msgName: 'msg' //状态信息的字段名称
,dataName: 'data' //数据详情的字段名称
}
//扩展的第三方模块
,extend: [
'echarts', //echarts 核心包
'echartsTheme' //echarts 主题
]
//主题配置
,theme: {
//内置主题配色方案
color: [{
main: '#20222A' //主题色
,selected: '#009688' //选中色
,alias: 'default' //默认别名
},{
main: '#03152A'
,selected: '#3B91FF'
,alias: 'dark-blue' //藏蓝
},{
main: '#2E241B'
,selected: '#A48566'
,alias: 'coffee' //咖啡
},{
main: '#50314F'
,selected: '#7A4D7B'
,alias: 'purple-red' //紫红
},{
main: '#344058'
,logo: '#1E9FFF'
,selected: '#1E9FFF'
,alias: 'ocean' //海洋
},{
main: '#3A3D49'
,logo: '#2F9688'
,selected: '#5FB878'
,alias: 'green' //墨绿
},{
main: '#20222A'
,logo: '#F78400'
,selected: '#F78400'
,alias: 'red' //橙色
},{
main: '#28333E'
,logo: '#AA3130'
,selected: '#AA3130'
,alias: 'fashion-red' //时尚红
},{
main: '#24262F'
,logo: '#3A3D49'
,selected: '#009688'
,alias: 'classic-black' //经典黑
},{
logo: '#226A62'
,header: '#2F9688'
,alias: 'green-header' //墨绿头
},{
main: '#344058'
,logo: '#0085E8'
,selected: '#1E9FFF'
,header: '#1E9FFF'
,alias: 'ocean-header' //海洋头
},{
header: '#393D49'
,alias: 'classic-black-header' //经典黑头
},{
main: '#50314F'
,logo: '#50314F'
,selected: '#7A4D7B'
,header: '#50314F'
,alias: 'purple-red-header' //紫红头
},{
main: '#28333E'
,logo: '#28333E'
,selected: '#AA3130'
,header: '#AA3130'
,alias: 'fashion-red-header' //时尚红头
},{
main: '#28333E'
,logo: '#009688'
,selected: '#009688'
,header: '#009688'
,alias: 'green-header' //墨绿头
}]
//初始的颜色索引,对应上面的配色方案数组索引
//如果本地已经有主题色记录则以本地记录为优先除非请求本地数据localStorage
,initColorIndex: 0
}
});
});

View File

@ -1,129 +0,0 @@
/*
* @Author: layui-2
* @Date: 2018-08-31 11:40:42
* @Last Modified by: layui-2
* @Last Modified time: 2018-09-04 14:44:38
*/
layui.define(['jquery','layer'],function(exports){
"use strict";
var $ = layui.jquery,layer = layui.layer
//外部接口
,inputTags = {
config: {}
//设置全局项
,set: function(options){
var that = this;
that.config = $.extend({}, that.config, options);
return that;
}
// 事件监听
,on: function(events, callback){
return layui.onevent.call(this, MOD_NAME, events, callback)
}
}
//操作当前实例
,thisinputTags = function(){
var that = this
,options = that.config;
return {
config: options
}
}
//字符常量
,MOD_NAME = 'inputTags'
// 构造器
,Class = function(options){
var that = this;
that.config = $.extend({}, that.config, inputTags.config, options);
that.render();
};
//默认配置
Class.prototype.config = {
close: false //默认:不开启关闭按钮
,theme: '' //背景:颜色
,content: [] //默认标签
,aldaBtn: false //默认配置
};
// 初始化
Class.prototype.init = function(){
var that = this
,spans = ''
,options = that.config
,span = document.createElement("span"),
spantext = $(span).text("获取全部数据").addClass('albtn');
if(options.aldaBtn){
$('body').append(spantext)
}
$.each(options.content,function(index,item){
spans +='<span><em>'+item+'</em><button type="button" class="close">×</button></span>';
// $('<div class="layui-flow-more"><a href="javascript:;">'+ ELEM_TEXT +'</a></div>');
})
options.elem.before(spans)
that.events()
}
Class.prototype.render = function(){
var that = this
,options = that.config
options.elem = $(options.elem);
that.enter()
};
// 回车生成标签
Class.prototype.enter = function(){
var that = this
,spans = ''
,options = that.config;
options.elem.focus();
options.elem.keypress(function(event){
var keynum = (event.keyCode ? event.keyCode : event.which);
if(keynum == '13'){
var $val = options.elem.val().trim();
if(!$val) return false;
if(options.content.indexOf($val) == -1){
options.content.push($val)
that.render()
spans ='<span><em>'+$val+'</em><button type="button" class="close">×</button></span>';
options.elem.before(spans)
}
options.done && typeof options.done === 'function' && options.done($val);
options.elem.val('');
}
})
};
//事件处理
Class.prototype.events = function(){
var that = this
,options = that.config;
$('.albtn').on('click',function(){
console.log(options.content)
})
$('#tags').on('click','.close',function(){
var Thisremov = $(this).parent('span').remove(),
ThisText = $(Thisremov).find('em').text();
options.content.splice($.inArray(ThisText,options.content),1)
})
};
//核心入口
inputTags.render = function(options){
var inst = new Class(options);
inst.init();
return thisinputTags.call(inst);
};
exports('inputTags',inputTags);
}).link('/static/res/css/inputTags.css')

View File

@ -1,36 +0,0 @@
{
"code": 0
,"msg": ""
,"count": "100"
,"data": [{
"prograss": "开会"
,"time": "一小时"
,"complete": "已完成"
,"LAY_CHECKED": true
},{
"prograss": "项目开发"
,"time": "两小时"
,"complete": "进行中"
,"LAY_CHECKED": true
},{
"prograss": "陪吃饭"
,"time": "一小时"
,"complete": "未完成"
},{
"prograss": "修改小bug"
,"time": "半小时"
,"complete": "未完成"
},{
"prograss": "修改大bug"
,"time": "两小时"
,"complete": "未完成"
},{
"prograss": "修改小bug"
,"time": "半小时"
,"complete": "未完成"
},{
"prograss": "修改大bug"
,"time": "两小时"
,"complete": "未完成"
}]
}

View File

@ -1,76 +0,0 @@
{
"code": 0
,"msg": ""
,"count": "100"
,"data": [{
"id": 111
,"title": "社区开始接受 “赞助商广告” 投放"
,"username": "贤心"
,"channel": "公告"
,"href": "http://fly.layui.com/jie/15697/"
,"crt": 61632
},{
"id": 222
,"title": "layui 一周年"
,"username": "猫吃"
,"channel": "讨论"
,"href": "http://fly.layui.com/jie/16622/"
,"crt": 61632
},{
"id": 333
,"title": "四个月的前端"
,"username": "fd"
,"channel": "分享"
,"href": "http://fly.layui.com/jie/16651/"
,"crt": 61632
},{
"id": 333
,"title": "如何评价LayUI和他的作者闲心"
,"username": "纸飞机"
,"channel": "提问"
,"href": "http://fly.layui.com/jie/9352/"
,"crt": 61632
},{
"id": 333
,"title": "如何评价LayUI和他的作者闲心"
,"username": "纸飞机"
,"channel": "提问"
,"href": "http://fly.layui.com/jie/9352/"
,"crt": 61632
},{
"id": 333
,"title": "如何评价LayUI和他的作者闲心"
,"username": "纸飞机"
,"channel": "提问"
,"href": "http://fly.layui.com/jie/9352/"
,"crt": 61632
},{
"id": 333
,"title": "如何评价LayUI和他的作者闲心"
,"username": "纸飞机"
,"channel": "提问"
,"href": "http://fly.layui.com/jie/9352/"
,"crt": 61632
},{
"id": 333
,"title": "如何评价LayUI和他的作者闲心"
,"username": "纸飞机"
,"channel": "提问"
,"href": "http://fly.layui.com/jie/9352/"
,"crt": 61632
},{
"id": 333
,"title": "如何评价LayUI和他的作者闲心"
,"username": "纸飞机"
,"channel": "提问"
,"href": "http://fly.layui.com/jie/9352/"
,"crt": 61632
},{
"id": 333
,"title": "如何评价LayUI和他的作者闲心"
,"username": "纸飞机"
,"channel": "提问"
,"href": "http://fly.layui.com/jie/9352/"
,"crt": 61632
}]
}

View File

@ -1,46 +0,0 @@
{
"code": 0
,"msg": ""
,"count": "100"
,"data": [{
"keywords": "贤心是男是女"
,"frequency": 8520
,"userNums": 2216
},{
"keywords": "Java程序员能找到女朋友吗"
,"frequency": 666
,"userNums": 333
},{
"keywords": "此表格是静态模拟数据"
,"frequency": 666
,"userNums": 333
},{
"keywords": "layui官方教程"
,"frequency": 666
,"userNums": 333
},{
"keywords": "layui官方教程"
,"frequency": 666
,"userNums": 333
},{
"keywords": "layui官方教程"
,"frequency": 666
,"userNums": 333
},{
"keywords": "layui官方教程"
,"frequency": 666
,"userNums": 333
},{
"keywords": "layui官方教程"
,"frequency": 666
,"userNums": 333
},{
"keywords": "layui官方教程"
,"frequency": 666
,"userNums": 333
},{
"keywords": "layui官方教程"
,"frequency": 666
,"userNums": 333
}]
}

View File

@ -1,56 +0,0 @@
{
"code": 0
,"msg": ""
,"count": "100"
,"data": [{
"id": "001"
,"reviewers": "赵"
,"content": "我又爱上编程了"
,"commtime": 20160312
},{
"id": "002"
,"reviewers": "钱"
,"content": "女生出门要小心"
,"commtime": 20160821
},{
"id": "003"
,"reviewers": "孙"
,"content": "框架就用layui"
,"commtime": 20161212
},{
"id": "004"
,"reviewers": "李"
,"content": "心姐么么哒"
,"commtime": 20170311
},{
"id": "005"
,"reviewers": "周"
,"content": "希望明天是个好天气"
,"commtime": 20170612
},{
"id": "006"
,"reviewers": "吴"
,"content": "我又爱上编程了"
,"commtime": 20171112
},{
"id": "007"
,"reviewers": "郑"
,"content": "女生出门要小心"
,"commtime": 20171230
},{
"id": "008"
,"reviewers": "王"
,"content": "框架就用layui"
,"commtime": 20180112
},{
"id": "009"
,"reviewers": "冯"
,"content": "心姐么么哒"
,"commtime": 20180221
},{
"id": "010"
,"reviewers": "陈"
,"content": "希望明天是个好天气"
,"commtime": 20180312
}]
}

View File

@ -1,62 +0,0 @@
{
"code": 0
,"msg": ""
,"count": "100"
,"data": [{
"id": "001"
,"label": "美食"
,"title": "舌尖上的中国第一季"
,"author": "作者-1"
,"content": "通过中华美食的多个侧面,来展现食物给中国人生活带来的仪式、伦理等方面的文化;见识中国特色食材以及与食物相关、构成中国美食特有气质的一系列元素;了解中华饮食文化的精致和源远流长"
,"uploadtime": 20121204
,"status": true
},{
"id": "002"
,"label": "美食"
,"title": "舌尖上的中国第二季"
,"author": "作者-2"
,"content": "以食物为窗口,读懂中国——通过美食,使人们可以有滋有味地认知这个古老的东方国度。“一方水土一方人”,本片将通过展示人们日常生活中与美食相关的多重侧面,描绘与感知中国人的文化传统、家族观念、生活态度与故土难离。人们收获、保存、烹饪、生产美食,并在其过程中留存和传承食物所承载的味觉记忆、饮食习俗、文化样态与家常情感。"
,"uploadtime": 20141204
,"status": false
},{
"id": "003"
,"label": "美食"
,"title": "舌尖上的中国第三季"
,"author": "作者-3"
,"content": "以食物为窗口,读懂中国——通过美食,使人们可以有滋有味地认知这个古老的东方国度。“一方水土一方人”,本片将通过展示人们日常生活中与美食相关的多重侧面,描绘与感知中国人的文化传统、家族观念、生活态度与故土难离。人们收获、保存、烹饪、生产美食,并在其过程中留存和传承食物所承载的味觉记忆、饮食习俗、文化样态与家常情感将世界美食和中国美食进行比照。春耕、夏耘、秋收、冬藏,天人合一的东方哲学让中国饮食依时而变,智慧灵动,中医营养摄生学说创造了食材运用的新天地,儒家人伦道德则把心意和家的味道端上我们的餐桌。淘洗历史,糅合时光,一代又一代的中国人在天地间升起烟火,用至精至诚的心意烹制食物,一餐一食之间,中国人展示个性,确认归属,构建文明,理解和把握着世界的奥妙。"
,"uploadtime": 20161204
,"status": false
},{
"id": "004"
,"label": "历史"
,"title": "诸葛亮骂王朗"
,"author": "作者-1"
,"content": "皓首匹夫!苍髯老贼!你即将命归于九泉之下,届时,有何面目见汉朝二十四代先帝?二臣贼子!你枉活七十有六,一生未立寸功,只会摇唇舞舌,助曹为虐!一条断脊之犬,还敢在我军阵前狺狺狂吠!我从未见过如此厚颜无耻之人!!!"
,"uploadtime": 20180201
,"status": false
},{
"id": "005"
,"label": "新闻"
,"title": "新时代特色中国梦"
,"author": "作者-1"
,"content": "今天,我们比历史上任何时期都更接近、更有信心和能力实现中华民族伟大复兴的目标。新时代已经到来,蓝图已经绘就,中国梦离我们越来越近了。"
,"uploadtime": 20180512
,"status": false
},{
"id": "006"
,"label": "新闻"
,"title": "新时代特色中国梦"
,"author": "作者-2"
,"content": "梦想不会主动走向我们,只有我们去主动实现梦想。行百里者半九十。虽然中国梦离我们越来越近了,但是要实现中国梦,还要靠我们以永不懈怠的精神状态、功在不舍的坚强意志,不忘初心,继续前进。"
,"uploadtime": 20180514
,"status": false
},{
"id": "007"
,"label": "体育"
,"title": "皇马大战利物浦"
,"author": "作者-3"
,"content": "对欧足联而言,更想要产生个新冠军。连续三年都是同一个冠军队,这会毁掉欧冠……”格里姆表态,“皇马有梦幻般的阵容,但从促进竞争的角度而言,另一支球队获胜会更好。"
,"uploadtime": 20180515
,"status": false
}]
}

View File

@ -1,21 +0,0 @@
{
"code": 0
,"msg": ""
,"count": "100"
,"data": [{
"id": "001"
,"tags": "美食"
},{
"id": "002"
,"tags": "新闻"
},{
"id": "003"
,"tags": "八卦"
},{
"id": "004"
,"tags": "体育"
},{
"id": "005"
,"tags": "音乐"
}]
}

View File

@ -1,62 +0,0 @@
{
"code": 0
,"msg": ""
,"count": "100"
,"data": [{
"id": "1001"
,"poster": "赵"
,"avatar": "https://wx4.sinaimg.cn/mw1024/5db11ff4gy1fmx4keaw9pj20dw08caa4.jpg"
,"content": "为什么花儿这么么红"
,"posttime": 20160805
,"top": false
},{
"id": "1002"
,"poster": "钱"
,"avatar": "https://wx4.sinaimg.cn/mw1024/5db11ff4gy1fmx4keaw9pj20dw08caa4.jpg"
,"content": "喜欢胡歌,赞赞赞"
,"posttime": 20161205
,"top": true
},{
"id": "1003"
,"poster": "孙"
,"avatar": "https://wx4.sinaimg.cn/mw1024/5db11ff4gy1fmx4keaw9pj20dw08caa4.jpg"
,"content": "明天就要考试了,好紧张,求保佑"
,"posttime": 20170405
,"top": false
},{
"id": "1004"
,"poster": "李"
,"avatar": "https://wx4.sinaimg.cn/mw1024/5db11ff4gy1fmx4keaw9pj20dw08caa4.jpg"
,"content": "希望明天是个好天气"
,"posttime": 20171005
,"top": false
},{
"id": "1005"
,"poster": "周"
,"avatar": "https://wx4.sinaimg.cn/mw1024/5db11ff4gy1fmx4keaw9pj20dw08caa4.jpg"
,"content": "女追男隔层纱,是不是真的"
,"posttime": 20180205
,"top": false
},{
"id": "1006"
,"poster": "吴"
,"avatar": "https://wx4.sinaimg.cn/mw1024/5db11ff4gy1fmx4keaw9pj20dw08caa4.jpg"
,"content": "竟然有人跳楼,年轻人想不开啊!"
,"posttime": 20180512
,"top": false
},{
"id": "1007"
,"poster": "郑"
,"avatar": "https://wx4.sinaimg.cn/mw1024/5db11ff4gy1fmx4keaw9pj20dw08caa4.jpg"
,"content": "大家一定不能学那个年轻人,珍爱生命啊"
,"posttime": 20180512
,"top": false
},{
"id": "1008"
,"poster": "王"
,"avatar": "https://wx4.sinaimg.cn/mw1024/5db11ff4gy1fmx4keaw9pj20dw08caa4.jpg"
,"content": "想知道南昌哪里有好吃的西安肉夹馍"
,"posttime": 20180514
,"top": false
}]
}

View File

@ -1,69 +0,0 @@
{
"code": 0
,"msg": ""
,"count": "100"
,"data": [{
"id": "001"
,"replyer": "吴"
,"cardid": "1002"
,"avatar": "https://wx2.sinaimg.cn/mw690/5db11ff4gy1fmx4kec5bvj20eb0h3mxh.jpg"
,"content": "有眼光,我也喜欢胡歌!"
,"replytime": 20161205
},{
"id": "002"
,"replyer": "郑"
,"cardid": "1002"
,"avatar": "https://wx2.sinaimg.cn/mw690/5db11ff4gy1fmx4kec5bvj20eb0h3mxh.jpg"
,"content": "同上同上。"
,"replytime": 20161205
},{
"id": "003"
,"replyer": "王"
,"cardid": "1003"
,"avatar": "https://wx2.sinaimg.cn/mw690/5db11ff4gy1fmx4kec5bvj20eb0h3mxh.jpg"
,"content": "能过一定过,不能过紧张也没用"
,"replytime": 20170405
},{
"id": "004"
,"replyer": "冯"
,"cardid": "1001"
,"avatar": "https://wx2.sinaimg.cn/mw690/5db11ff4gy1fmx4kec5bvj20eb0h3mxh.jpg"
,"content": "可能因为你流鼻血了。"
,"replytime": 20170405
},{
"id": "005"
,"replyer": "陈"
,"cardid": "1003"
,"avatar": "https://wx2.sinaimg.cn/mw690/5db11ff4gy1fmx4kec5bvj20eb0h3mxh.jpg"
,"content": "加油加油,看好你"
,"replytime": 20170405
},{
"id": "006"
,"replyer": "褚"
,"cardid": "1005"
,"avatar": "https://wx2.sinaimg.cn/mw690/5db11ff4gy1fmx4kec5bvj20eb0h3mxh.jpg"
,"content": "纯属放屁"
,"replytime": 20180207
},{
"id": "007"
,"replyer": "卫"
,"cardid": "1005"
,"avatar": "https://wx2.sinaimg.cn/mw690/5db11ff4gy1fmx4kec5bvj20eb0h3mxh.jpg"
,"content": "可以试试"
,"replytime": 20180207
},{
"id": "006"
,"replyer": "蒋"
,"cardid": "1006"
,"avatar": "https://wx2.sinaimg.cn/mw690/5db11ff4gy1fmx4kec5bvj20eb0h3mxh.jpg"
,"content": "是啊是啊,太恐怖了。"
,"replytime": 20180512
},{
"id": "007"
,"replyer": "沈"
,"cardid": "1008"
,"avatar": "https://wx2.sinaimg.cn/mw690/5db11ff4gy1fmx4kec5bvj20eb0h3mxh.jpg"
,"content": "魏家凉皮的凉皮就很不错奥。"
,"replytime": 20180515
}]
}

View File

@ -1,39 +0,0 @@
{
"code": 0,
"msg": "",
"title": "JSON请求的相册",
"id": 8,
"start": 0,
"data": [
{
"alt": "layer",
"pid": 109,
"src": "https://wx4.sinaimg.cn/mw1024/5db11ff4gy1fmx4keaw9pj20dw08caa4.jpg",
"thumb": ""
},
{
"alt": "说好的一起Fly",
"pid": 110,
"src": "https://wx4.sinaimg.cn/mw1024/5db11ff4gy1fmx4kebemcj20ga09saa1.jpg",
"thumb": ""
},
{
"alt": "佟丽娅女神",
"pid": 111,
"src": "https://wx2.sinaimg.cn/mw690/5db11ff4gy1fmx4kec5bvj20eb0h3mxh.jpg",
"thumb": ""
},
{
"alt": "凤姐是个好人",
"pid": 112,
"src": "https://wx3.sinaimg.cn/mw690/5db11ff4gy1fmx4kec9vuj20b20dwmyk.jpg",
"thumb": ""
},
{
"alt": "星空如此深邃",
"pid": 113,
"src": "https://wx3.sinaimg.cn/mw690/5db11ff4gy1fmx4keca8ag208g06iglw.gif",
"thumb": ""
}
]
}

View File

@ -1,96 +0,0 @@
{
"code": 0
,"msg": ""
,"data": {
"mine": {
"username": "纸飞机"
,"id": "100000"
,"status": "online"
,"sign": "在深邃的编码世界,做一枚轻盈的纸飞机"
,"avatar": "//res.layui.com/images/fly/avatar/00.jpg"
}
,"friend": [{
"groupname": "知名人物"
,"id": 0
,"list": [{
"username": "贤心"
,"id": "100001"
,"avatar": "//tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg"
,"sign": "这些都是测试数据,实际使用请严格按照该格式返回"
,"status": "online"
},{
"username": "刘涛tamia"
,"id": "100001222"
,"sign": "如约而至,不负姊妹欢乐颂"
,"avatar": "//tva4.sinaimg.cn/crop.0.1.1125.1125.180/475bb144jw8f9nwebnuhkj20v90vbwh9.jpg"
},{
"username": "谢楠"
,"id": "10034001"
,"avatar": "//tva2.sinaimg.cn/crop.1.0.747.747.180/633f068fjw8f9h040n951j20ku0kr74t.jpg"
,"sign": ""
},{
"username": "马小云"
,"id": "168168"
,"avatar": "//tva1.sinaimg.cn/crop.0.0.180.180.180/7fde8b93jw1e8qgp5bmzyj2050050aa8.jpg"
,"sign": "让天下没有难写的代码"
},{
"username": "徐小峥"
,"id": "666666"
,"avatar": "//tva1.sinaimg.cn/crop.0.0.512.512.180/6a4acad5jw8eqi6yaholjj20e80e8t9f.jpg"
,"sign": "代码在囧途,也要写到底"
}]
},{
"groupname": "网红声优"
,"id": 1
,"list": [{
"username": "罗玉凤"
,"id": "121286"
,"avatar": "//tva4.sinaimg.cn/crop.0.0.640.640.180/4a02849cjw8fc8vn18vktj20hs0hs75v.jpg"
,"sign": "在自己实力不济的时候,不要去相信什么媒体和记者。他们不是善良的人,有时候候他们的采访对当事人而言就是陷阱"
},{
"username": "Z_子晴"
,"id": "108101"
,"avatar": "//tva1.sinaimg.cn/crop.0.23.1242.1242.180/8693225ajw8fbimjimpjwj20yi0zs77l.jpg"
,"sign": "微电商达人"
},{
"username": "大鱼_MsYuyu"
,"id": "12123454"
,"avatar": "//tva2.sinaimg.cn/crop.0.0.512.512.180/005LMAegjw8f2bp9qg4mrj30e80e8dg5.jpg"
,"sign": "我瘋了!這也太準了吧 超級笑點低"
},{
"username": "醋醋cucu"
,"id": "102101"
,"avatar": "//tva2.sinaimg.cn/crop.0.0.640.640.180/648fbe5ejw8ethmg0u9egj20hs0ht0tn.jpg"
,"sign": ""
},{
"username": "柏雪近在它香"
,"id": "3435343"
,"avatar": "//tva2.sinaimg.cn/crop.0.8.751.751.180/961a9be5jw8fczq7q98i7j20kv0lcwfn.jpg"
,"sign": ""
}]
},{
"groupname": "女神艺人"
,"id": 2
,"list": [{
"username": "王祖贤"
,"id": "76543"
,"avatar": "//wx2.sinaimg.cn/mw690/5db11ff4gy1flxmew7edlj203d03wt8n.jpg"
,"sign": "我爱贤心"
},{
"username": "佟丽娅"
,"id": "4803920"
,"avatar": "//tva3.sinaimg.cn/crop.0.0.750.750.180/5033b6dbjw8etqysyifpkj20ku0kuwfw.jpg"
,"sign": "我也爱贤心吖吖啊"
}]
}]
,"group": [{
"groupname": "前端群"
,"id": "101"
,"avatar": "//tva1.sinaimg.cn/crop.0.0.200.200.50/006q8Q6bjw8f20zsdem2mj305k05kdfw.jpg"
},{
"groupname": "Fly社区官方群"
,"id": "102"
,"avatar": "//tva2.sinaimg.cn/crop.0.0.199.199.180/005Zseqhjw1eplix1brxxj305k05kjrf.jpg"
}]
}
}

Some files were not shown because too many files have changed in this diff Show More