fix:更新已知bug,优化代码

This commit is contained in:
Ying
2022-11-28 19:11:12 +08:00
parent f6aee95cfc
commit 9445b206a2
1378 changed files with 53759 additions and 20789 deletions

View File

@@ -14,6 +14,7 @@ namespace app\admin\controller;
use app\AdminController;
use app\common\library\ResultCode;
use app\common\library\Upload;
use support\Response;
/**
* Ajax类
@@ -24,16 +25,16 @@ class Ajax extends AdminController
{
/**
* 测试接口
* @return \support\Response
* @return Response
*/
public function index(): \support\Response
public function index(): Response
{
return json(ResultCode::SUCCESS);
}
/**
* 文件上传
* @return \support\Response|void
* @return Response|void
* @throws \Exception
*/
public function upload()
@@ -49,9 +50,9 @@ class Ajax extends AdminController
/**
* 远程下载图片
* @return mixed
* @return Response
*/
public function getImage()
public function getImage(): Response
{
if (request()->isPost()) {
$file = Upload::instance()->download(input('url'));
@@ -60,6 +61,8 @@ class Ajax extends AdminController
}
return json($file);
}
return json(ResultCode::EXCEPTION);
}
}

View File

@@ -12,48 +12,58 @@ declare(strict_types=1);
// +----------------------------------------------------------------------
namespace app\admin\controller;
use Psr\SimpleCache\InvalidArgumentException;
use support\Response;
use think\db\exception\BindParamException;
use think\facade\Cache;
use think\facade\Db;
use Webman\Event\Event;
use system\Random;
use think\cache\driver\Memcached;
use think\cache\driver\Redis;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use app\AdminController;
use app\common\library\Email;
use app\common\library\Ftp;
use think\cache\driver\Memcached;
use think\cache\driver\Redis;
use think\facade\Cache;
use Webman\Event\Event;
use app\common\model\system\AdminNotice;
use app\common\model\system\Attachment;
use app\common\model\system\Config;
use app\common\model\system\User;
use app\common\model\system\UserGroup;
use app\common\model\system\UserThird;
use app\common\model\system\UserValidate;
use system\Random;
use think\facade\Db;
class Index extends AdminController
{
/**
* 初始化函数
*/
public function __construct()
{
parent::__construct();
}
/**
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\DataNotFoundException
* @throws \Exception
*/
public function index()
{
return view('index/index');
$notice_count = AdminNotice::where('status', 0)->count();
return view('index/index', [
'notice_count' => $notice_count,
]);
}
/**
* 控制台首页
* @return mixed
* @throws \think\db\exception\BindParamException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @return response
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
* @throws BindParamException
*/
public function console()
{
@@ -64,17 +74,14 @@ class Index extends AdminController
if (request()->isPost()) {
$cycle = input('cycle');
if (Event::hasListener('cmsuserEcharts')) {
[$dataList, $seriesList] = Event::emit('cmsuserEcharts', $cycle, true);
if (empty($seriesList)) {
return $this->error('暂无数据');
}
$userChartsOptions = $this->getEchartsData(array_values($dataList), $seriesList);
return $this->success('操作成功', '', $userChartsOptions);
[$dataList, $seriesList] = $this->getUserEcharts($cycle);
if (empty($seriesList)) {
return $this->error('暂无数据');
}
return $this->error('请安装CMS插件');
$userChartsOptions = $this->getEchartsData(array_values($dataList), $seriesList);
return $this->success('操作成功', '', $userChartsOptions);
}
for ($i = -29; $i <= 0; $i++) {
@@ -87,13 +94,13 @@ class Index extends AdminController
foreach ($columns as $index => $field) {
$time = str_replace('invite_id', 'create_time', $field);
$resultList = User::where($time, 'between time', [$dateBefore, $dateAfter])
->when($condition, function ($query) use ($condition, $time, $field) {
$query->field("FROM_UNIXTIME($time, '$condition') as day,count(*) as count");
if ($field == 'invite_id') {
$query->where('invite_id', '<>', 0);
}
$query->group($time);
})->select()->toArray();
->when($condition, function ($query) use ($condition, $time, $field) {
$query->field("FROM_UNIXTIME($time, '$condition') as day,count(*) as count");
if ($field == 'invite_id') {
$query->where('invite_id', '<>', 0);
}
$query->group($time);
})->select()->toArray();
$tempList = [];
foreach ($dataList as $key => $item) {
$data = list_search($resultList, ['day' => $item]);
@@ -139,11 +146,11 @@ class Index extends AdminController
// 搜索词云数据
if (Event::hasListener('cmsHotSearch')) {
$searchWords = Event::emit('cmsHotSearch', null, true);
$searchWords = Event::emit('cmsHotSearch', [], true);
} else { // 模拟数据
for ($i = 0; $i < 50; $i++) {
$searchWords[] = [
'name' => Random::alpha(),
'name' => Random::lower(),
'value' => Random::number(),
];
}
@@ -222,11 +229,105 @@ class Index extends AdminController
];
}
/**
*
* @param string $cycle
* @return array
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
protected function getUserEcharts(string $cycle): array
{
$seriesList = [];
$dataList = [];
$condition = '%w';
$dateBefore = date('Y-m-d', strtotime('-7 day'));
$dateAfter = date('Y-m-d 23:59:59');
switch ($cycle) {
case 'week':
$dataList = array('周日', '周一', '周二', '周三', '周四', '周五', '周六');
break;
case 'month':
$condition = '%d';
$dateBefore = date('Y-m-01');
$dateAfter = date('Y-m-d', strtotime("+1 day"));
$dataList = array('01' => ['1'], '02' => ['2'], '03' => ['3'], '04' => ['4'], '05' => ['5'], '06' => ['6'], '07' => ['7'], '08' => ['8'],
'09' => ['9'], '10' => ['10'], '11' => ['11'], '12' => ['12'], '13' => ['13'], '14' => ['14'], '15' => ['15'], '16' => ['16'],
'17' => ['17'], '18' => ['18'], '19' => ['19'], '20' => ['20'], '21' => ['21'], '22' => ['22'], '23' => ['23'], '24' => ['24'],
'25' => ['25'], '26' => ['26'], '27' => ['27'], '28' => ['28'], '29' => ['29'], '30' => ['30'], '31' => ['31']);
break;
case 'year':
$condition = '%m';
$dateBefore = date('Y-01-01');
$dateAfter = date('Y-12-31 23:59:59');
$dataList = array('01' => ['一月'], '02' => ['二月'], '03' => ['三月'], '04' => ['四月'], '05' => ['五月'], '06' => ['六月'],
'07' => ['七月'], '08' => ['八月'], '09' => ['九月'], '10' => ['十月'], '11' => ['十一月'], '12' => ['十二月']);
break;
default:
break;
}
$resultList = $this->getCycleEcharts($dateBefore, $dateAfter, $condition);
foreach ($resultList as $index => $item) {
$tempList = [];
foreach ($dataList as $key => $value) {
$data = list_search($item, ['day' => $key]);
if (!empty($data)) {
$tempList[$key] = $data;
} else {
$tempList[$key] = ['day' => $value, 'count' => 0];
}
}
$seriesList[] = [
'name' => $index,
'type' => 'line',
'stack' => 'Total',
'showSymbol' => false,
'itemStyle' => ['normal' => ['areaStyle' => ['type' => 'default']]],
'data' => array_column($tempList, 'count'),
];
}
return [$dataList, $seriesList];
}
/**
* 获取一段时间内订单列表
* @param $dateBefore
* @param $dateAfter
* @param $condition
* @return array
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
protected function getCycleEcharts($dateBefore, $dateAfter, $condition): array
{
$resultList = [];
$columns = ['用户注册' => 'create_time', '用户登录' => 'login_time', '邀请注册' => 'invite_id'];
foreach ($columns as $index => $field) {
$time = str_replace('invite_id', 'create_time', $field);
$resultList[$index] = \app\common\model\system\User::where($time, 'between time', [$dateBefore, $dateAfter])
->when($condition, function ($query) use ($condition, $time, $field) {
$query->field("FROM_UNIXTIME($time, '$condition') as day,count(*) as count");
if ($field == 'invite_id') {
$query->where('invite_id', '<>', 0);
}
$query->group("FROM_UNIXTIME($time, '$condition')");
})->order($time, 'asc')->select()->toArray();
}
return $resultList;
}
/**
* 分析页
* @return mixed
*/
public function analysis(): \support\Response
public function analysis(): Response
{
return view('/index/analysis');
}
@@ -235,15 +336,19 @@ class Index extends AdminController
* 监控页
* @return mixed
*/
public function monitor(): \support\Response
public function monitor(): Response
{
return view('/index/monitor');
}
/**
* 获取系统配置
* @return Response
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function basecfg(): \support\Response
public function basecfg(): Response
{
$config = Config::all();
$config['fsockopen'] = function_exists('fsockopen');
@@ -254,14 +359,13 @@ class Index extends AdminController
/**
* 编辑系统配置
*
* @param array $config
* @return \support\Response
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @return Response
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
* @throws InvalidArgumentException
*/
public function baseSet(): \support\Response
public function baseSet(): Response
{
if (request()->isPost()) {
$config = [];
@@ -309,7 +413,7 @@ class Index extends AdminController
/**
* FTP测试上传
*/
public function testFtp(): \support\Response
public function testFtp(): Response
{
if (request()->isPost()) {
if (Ftp::instance()->ftpTest(request()->post())) {

View File

@@ -2,16 +2,15 @@
namespace app\admin\controller;
use support\Response;
use Webman\Event\Event;
use app\AdminController;
use app\common\model\system\Admin;
use app\common\model\system\LoginLog;
use app\common\model\system\AdminLog;
use Psr\SimpleCache\InvalidArgumentException;
use support\Response;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use Webman\Event\Event;
use Webman\Http\Request;
class Login extends AdminController
{
@@ -38,7 +37,7 @@ class Login extends AdminController
public function index(): \support\Response
{
// 禁止重复访问
if (isset(request()->adminInfo['id'])) {
if (isset(request()->adminData['id'])) {
return $this->redirect('/admin/index');
}
@@ -47,10 +46,10 @@ class Login extends AdminController
$user = request()->post('name');
$pwd = request()->post('pwd');
$captcha = request()->post('captcha');
if ((isset(request()->adminInfo['count'])
&& request()->adminInfo['count'] >= 5)
&& (isset(request()->adminInfo['time'])
&& request()->adminInfo['time'] >= strtotime('- 5 minutes'))
if ((isset(request()->adminData['count'])
&& request()->adminData['count'] >= 5)
&& (isset(request()->adminData['time'])
&& request()->adminData['time'] >= strtotime('- 5 minutes'))
) {
$error = '错误次数过多,请稍后再试!';
$this->writeLoginLogs($error);
@@ -58,7 +57,7 @@ class Login extends AdminController
}
// 验证码
if (isset(request()->adminInfo['isCaptcha'])) {
if (isset(request()->adminData['isCaptcha'])) {
if (!$captcha || !$this->captchaCheck($captcha)) {
$error = '验证码错误!';
$this->writeLoginLogs($error);
@@ -75,10 +74,10 @@ class Login extends AdminController
$result = Admin::checkLogin($user, $pwd);
if (empty($result)) {
request()->adminInfo['time'] = time();
request()->adminInfo['isCaptcha'] = true;
request()->adminInfo['count'] = isset(request()->adminInfo['count']) ? request()->adminInfo['count'] + 1 : 1;
request()->session()->set(AdminSession, request()->adminInfo);
request()->adminData['time'] = time();
request()->adminData['isCaptcha'] = true;
request()->adminData['count'] = isset(request()->adminData['count']) ? request()->adminData['count'] + 1 : 1;
request()->session()->set(AdminSession, request()->adminData);
$error = '用户名或密码错误!';
$this->writeLoginLogs($error);
Event::emit('adminLoginError', \request()->all());
@@ -98,7 +97,7 @@ class Login extends AdminController
try {
$result->save();
$session = array_merge(request()->adminInfo, $result->toArray());
$session = array_merge(request()->adminData, $result->toArray());
request()->session()->set(AdminSession, $session);
} catch (\Throwable $th) {
return $this->error($th->getMessage());
@@ -112,7 +111,7 @@ class Login extends AdminController
}
return view('login/index', [
'captcha' => request()->adminInfo['isCaptcha'] ?? false,
'captcha' => request()->adminData['isCaptcha'] ?? false,
]);
}
@@ -120,7 +119,6 @@ class Login extends AdminController
* 写入登录日志
* @param string $error
* @param int $status
* @return void
*/
private function writeLoginLogs(string $error, int $status = 0)
{
@@ -146,6 +144,6 @@ class Login extends AdminController
'status' => $status,
];
LoginLog::create($data);
AdminLog::create($data);
}
}

Binary file not shown.

View File

@@ -14,14 +14,18 @@ declare(strict_types=1);
namespace app\admin\controller\system;
use app\AdminController;
use app\common\model\system\AdminNotice;
use app\common\model\system\Jobs;
use app\common\model\system\Department;
use app\common\model\system\Admin as AdminModel;
use app\common\model\system\AdminGroup as AdminGroupModel;
use app\common\model\system\AdminAccess as AdminAccessModel;
use support\Log;
use support\Response;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\Exception;
use think\facade\Cache;
use Webman\Http\Request;
@@ -32,24 +36,23 @@ use Webman\Http\Request;
*/
class Admin extends AdminController
{
/**
* 用户管理组
* @var null
* @var mixed
*/
protected $group = null;
protected mixed $group;
/**
* 用户岗位
* @var null
* @var mixed
*/
public $jobs = null;
public mixed $jobs;
/**
* 用户部门
* @var null
* @var mixed
*/
public $department = null;
public mixed $department;
// 初始化函数
public function __construct()
@@ -122,15 +125,18 @@ class Admin extends AdminController
}
return view('/system/admin/index', [
'jobs' => $this->jobs,
'group' => $this->group,
'jobs' => $this->jobs,
'group' => $this->group,
'department' => json_encode($this->department),
]);
}
/**
* 添加管理员
* @return \support\Response
* @return Response
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function add(): \support\Response
{
@@ -294,58 +300,164 @@ class Admin extends AdminController
/**
* 模版页面
* @return Response
*/
public function theme()
public function theme(): Response
{
return view('/system/admin/theme');
}
/**
* 消息模板
* @return Response
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function message()
public function bells(): Response
{
// 配置消息
$msg = [
'msg' => [
'0' => [
'title' => '你收到了几份周报!',
'type' => '周报类型',
'create_time' => '1周前',
],
'1' => [
'title' => '你收到了来自女下属的周报',
'type' => '周报类型',
'create_time' => '2周前',
]
],
'comment' => [
'0' => [
'title' => '一个领导评论了你',
'content' => '小伙子不错,继续努力!',
'create_time' => '1周前',
]
],
'things' => [
'0' => [
'title' => '客户说尽快修复瞟了么APP闪退的问题...',
'type' => '0',
'create_time' => '1周前',
],
'1' => [
'title' => '秦老板和经销商的下季度合同尽快签订!',
'type' => '1',
'create_time' => '2周前',
]
],
];
$list = [];
$count = [];
$array = ['notice', 'message', 'todo'];
$type = input('type', 'notice');
if (\request()->isAjax()) {
$page = input('page', 1);
$limit = input('limit', 3);
// 计算最大页码
$data = AdminNotice::with(['admin'])->where(['type' => $type, 'admin_id' => \request()->admin_id])
->order('id', 'desc')->paginate(['list_rows' => $limit, 'page' => $page])->toArray();
return $this->success('获取成功', '', $data);
}
return view('/system/admin/message', [
'list' => $msg
foreach ($array as $item) {
$where = [
['type', '=', $item],
['admin_id', '=', request()->admin_id]
];
$count[$item] = AdminNotice::where($where)->where('status', 0)->count();
$list[$item] = AdminNotice::with(['admin'])->withoutField('content')->where($where)->limit(3)->order('id desc')->select()->toArray();
}
return view('/system/admin/bells', [
'list' => $list,
'count' => $count
]);
}
/**
* 阅读消息
* @return response
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function readNotice(): Response
{
$id = input('id', 0);
$type = input('type', 'notice');
if (!empty($id)) {
$detail = AdminNotice::with(['admin'])->where(['id' => $id, 'admin_id' => \request()->admin_id])->find();
if (empty($detail)) {
return $this->error('404 Not Found');
}
// 默认已读
if ($type !== 'todo') {
$detail->status = 1;
$detail->save();
}
}
return $this->view('/system/admin/' . $type, [
'detail' => $detail ?? []
]);
}
/**
* 更新即时消息
* @return Response|void
*/
public function saveNotice()
{
if (\request()->post()) {
$post = request()->post();
$post['send_id'] = request()->admin_id;
$post['type'] = 'message';
$post['send_ip'] = request()->getRealIp();
$post['create_time'] = time();
try {
AdminNotice::sendNotice($post, 'none');
} catch (\Exception $e) {
return $this->error('发送失败:' . $e->getMessage());
}
return $this->success('发送成功');
} else if (\request()->isAjax()) {
$id = input('id', 0);
$status = input('status', 1);
try {
if (empty($id)) {
throw new Exception('参数错误');
}
AdminNotice::where(['id' => $id, 'admin_id' => request()->admin_id])->update(['status' => $status]);
} catch (Exception $e) {
return $this->error('更新失败');
}
return $this->success('更新成功');
}
}
/**
* 清空消息
* @return Response|void
*/
public function clearNotice()
{
if (\request()->isAjax()) {
$type = input('type', 'notice');
$where = [
['type', '=', $type],
['status', '=', 1],
['admin_id', '=', request()->admin_id]
];
try {
AdminNotice::where($where)->delete();
} catch (Exception $e) {
return $this->error('清空失败');
}
return $this->success('清空成功');
}
}
/**
* 全部消息已读
* @return Response|void
*/
public function readAllNotice()
{
if (\request()->isAjax()) {
$type = input('type', 'notice');
$where = [
['type', '=', $type],
['admin_id', '=', request()->admin_id]
];
try {
AdminNotice::where($where)->update(['status' => 1]);
} catch (Exception $e) {
return $this->error('操作失败');
}
return $this->success('全部已读成功');
}
}
/**
* 个人中心
* @param Request $request
@@ -359,7 +471,7 @@ class Admin extends AdminController
if (request()->isPost()) {
$post = request()->post();
$post['id'] = $request->adminId;
$post['id'] = $request->admin_id;
if ($this->model->update($post)) {
return $this->success();
}
@@ -368,7 +480,7 @@ class Admin extends AdminController
}
$title = [];
$data = $this->model->find($request->adminId);
$data = $this->model->find($request->admin_id);
if (!empty($data['group_id'])) {
$group = AdminGroupModel::field('title')
->whereIn('id', $data['group_id'])
@@ -393,7 +505,7 @@ class Admin extends AdminController
{
if (request()->isAjax()) {
$post = request()->post();
$id = $request->adminId;
$id = $request->admin_id;
try {
//code...
switch ($post['field']) {
@@ -448,7 +560,7 @@ class Admin extends AdminController
* @throws DbException
* @throws ModelNotFoundException
*/
public function pwd(Request $request): \support\Response
public function pwd(): \support\Response
{
if (request()->isPost()) {
@@ -459,7 +571,7 @@ class Admin extends AdminController
}
// 查找数据
$where[] = ['id', '=', $request->admin_id];
$where[] = ['id', '=', request()->admin_id];
$where[] = ['pwd', '=', encryptPwd($pwd)];
$result = $this->model->where($where)->find();

View File

@@ -24,9 +24,19 @@ use Webman\Http\Request;
*/
class Attachment extends AdminController
{
// 上传文件夹地址
protected $upload;
/**
* 上传文件夹地址
* @var mixed
*/
protected mixed $upload;
/**
* 初始化函数
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function __construct()
{
parent::__construct();

View File

@@ -14,6 +14,10 @@ namespace app\admin\controller\system;
use app\AdminController;
use app\common\model\system\Company as CompanyModel;
use support\Response;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use Webman\Http\Request;
/**
@@ -33,7 +37,10 @@ class Company extends AdminController
/**
* 获取资源列表
* @return \support\Response
* @return Response
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function index(): \support\Response
{

View File

@@ -11,14 +11,12 @@ declare (strict_types = 1);
// +----------------------------------------------------------------------
namespace app\admin\controller\system;
use app\AdminController;
use app\common\model\system\Department as DepartmentModel;
use support\Response;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use Webman\Http\Request;
use app\common\model\system\Department as DepartmentModel;
/**
* 部门管理

View File

@@ -13,6 +13,10 @@ namespace app\admin\controller\system;
use app\AdminController;
use app\common\model\system\Dictionary as DictionaryModel;
use support\Response;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use Webman\Http\Request;
/**
@@ -31,7 +35,10 @@ class Dictionary extends AdminController
/**
* 字典首页
* @return \support\Response
* @return Response
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function index(): \support\Response
{
@@ -46,7 +53,7 @@ class Dictionary extends AdminController
if (request()->isAjax()) {
// 生成查询数据
$pid = !strstr($pid,',') ? $pid : explode(',',$pid);
$pid = !str_contains($pid, ',') ? $pid : explode(',',$pid);
$where[] = ['pid','in',$pid];
if (!empty($post['name'])) {
$where[] = ['name','like','%'.$post['name'].'%'];

View File

@@ -3,7 +3,7 @@ declare (strict_types = 1);
namespace app\admin\controller\system;
use app\AdminController;
use app\common\model\system\LoginLog as LoginLogModel;
use app\common\model\system\AdminLog as LoginLogModel;
use Webman\Http\Request;
/**

View File

@@ -14,11 +14,15 @@ namespace app\admin\controller\system;
use GuzzleHttp\Exception\TransferException;
use support\Response;
use system\File;
use system\Http;
use system\ZipArchives;
use app\AdminController;
use app\admin\library\Auth;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use Throwable;
use app\common\library\DataBase;
use app\common\model\system\AdminRules;
@@ -32,21 +36,21 @@ class Plugin extends AdminController
{
/**
* 查询最大数量
* @var int
* @var mixed
*/
protected $limit = 500;
protected mixed $limit = 500;
/**
* 错误信息
* @var array
* @var mixed
*/
static $errData = [];
static mixed $errData;
/**
* 获取本地插件列表
* @return \support\Response
* @return Response
*/
public function index(): \support\Response
public function index(): Response
{
$pluginList = get_plugin_list();
if (request()->isAjax()) {
@@ -59,7 +63,7 @@ class Plugin extends AdminController
/**
* 安装插件
* @return \support\Response|void
* @return Response|void
* @throws \Exception|\Psr\SimpleCache\InvalidArgumentException
*/
public function install()
@@ -98,7 +102,7 @@ class Plugin extends AdminController
/**
* 卸载插件
* @return \support\Response|void
* @return Response|void
* @throws \Exception|\Psr\SimpleCache\InvalidArgumentException
*/
public function uninstall()
@@ -266,10 +270,10 @@ class Plugin extends AdminController
/**
* 修改插件配置
* @return \support\Response
* @return Response
* @throws \Psr\SimpleCache\InvalidArgumentException
*/
public function config(): \support\Response
public function config(): Response
{
$name = input('name');
if (preg_replace('/[^a-zA-Z0-9]/i', '', $name) !== $name) {
@@ -298,7 +302,7 @@ class Plugin extends AdminController
/**
* 修改插件状态
* 启用 / 禁用
* @return \support\Response|void
* @return Response|void
*/
public function status()
{
@@ -350,7 +354,6 @@ class Plugin extends AdminController
* 执行SQL脚本文件
* @param string $name
* @param string $type
* @return void
*/
public static function executeSql(string $name, string $type = 'install')
{
@@ -362,10 +365,9 @@ class Plugin extends AdminController
/**
* 获取菜单项
* @param string $name
* @return void
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public static function pluginMenu(string $name)
{

View File

@@ -16,10 +16,8 @@ use support\Response;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use Webman\Http\Request;
use app\common\model\system\SystemLog as SystemLogModel;
/**
* 系统日志
* Class SystemLog

View File

@@ -30,17 +30,11 @@ use Webman\Http\Request;
*/
class User extends AdminController
{
/**
* @var array
*/
private $userGroup;
// 初始化函数
public function __construct()
{
parent::__construct();
$this->model = new UserModel();
$this->userGroup = UserGroupModel::select()->toArray();
}
/**
@@ -52,7 +46,7 @@ class User extends AdminController
*/
public function index(): \support\Response
{
$userGroup = UserGroupModel::select()->toArray();
if (request()->isAjax()) {
// 获取数据
@@ -83,7 +77,7 @@ class User extends AdminController
$region = Ip2Region::instance()->memorySearch($value['login_ip']);
$region = explode('|', $region['region']);
$list[$key]['region'] = $region;
$result = list_search($this->userGroup, ['id' => $value['group_id']]);
$result = list_search($userGroup, ['id' => $value['group_id']]);
if (!empty($result)) {
$list[$key]['group'] = $result['title'];
}
@@ -94,7 +88,7 @@ class User extends AdminController
}
return view('/system/user/index', [
'UserGroup' => $this->userGroup,
'UserGroup' => $userGroup,
]);
}
@@ -175,7 +169,7 @@ class User extends AdminController
/**
* 删除会员
*/
public function del()
public function del(): Response
{
return $this->error('不允许删除会员');
}

View File

@@ -15,6 +15,9 @@ use app\common\model\system\AdminAccess;
use app\common\model\system\Admin as AdminModel;
use app\common\model\system\AdminRules as AdminRulesModel;
use app\common\model\system\AdminGroup as AdminGroupModel;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\facade\Db;
use Webman\Event\Event;
@@ -25,49 +28,48 @@ class Auth
{
/**
* 数据库实例
* @var object
* @var mixed
*/
protected $model = null;
protected mixed $model;
/**
* 管理员数据
* @var array
* @var mixed
*/
private $admin;
private mixed $admin;
/**
* 分组标记
* @var array
* @var string
*/
public $authGroup = 'authGroup';
public string $authGroup = 'authGroup';
/**
* 用户私有标记
* @var array
* @var string
*/
public $authPrivate = 'authPrivate';
public string $authPrivate = 'authPrivate';
/**
* 默认权限字段
*
* @var string
*/
public $authFields = 'id,cid,pid,title,auth';
public string $authFields = 'id,cid,pid,title,auth';
/**
* 错误信息
* @var string
*/
protected $_error = '';
protected string $_error = '';
/**
* @var object 对象实例
* @var mixed
*/
private mixed $groupIDs;
// 对象实例
protected static $instance = null;
/**
* @var false|string[]
*/
private $groupIDs;
/**
* 类构造函数
@@ -83,7 +85,6 @@ class Auth
* @param array $options 参数
* @return object
*/
public static function instance($options = [])
{
if (is_null(self::$instance)) {
@@ -111,7 +112,7 @@ class Auth
// 转换格式
if (is_string($name)) {
$name = strtolower($name);
if (strpos($name, ',') !== false) {
if (str_contains($name, ',')) {
$name = explode(',', $name);
} else {
$name = [$name];
@@ -166,11 +167,11 @@ class Auth
* @param mixed $admin_id
* @param string $type
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function getRulesNode($admin_id = 0, string $type = AUTH_RULES): array
public function getRulesNode(mixed $admin_id = 0, string $type = AUTH_RULES): array
{
// 私有节点
$authGroup = $authPrivate = [];
@@ -260,13 +261,12 @@ class Auth
* @param mixed|null $type
* @param mixed|null $class
* @param bool $tree
* @return false|string|\think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @throws \Exception
* @return mixed
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function getRuleCatesTree($type = null, $class = null, bool $tree = true)
public function getRuleCatesTree(mixed $type = null, mixed $class = null, bool $tree = true)
{
$list = [];
if (is_array($type) && $type) {
@@ -292,16 +292,19 @@ class Auth
$list = AdminRulesModel::where($where)->order('sort asc')->select()->toArray();
}
} else {
/**
* 栏目二次开发接口
* @param $list
*/
if (!$this->superAdmin()) {
if (!empty($auth_nodes[$class])) {
$list = Event::emit('cmscategoryPermissions', [
$list = Event::emit('cmsCategoryPermissions', [
'field' => $this->authFields,
'nodes' => $auth_nodes[$class]
], true);
}
} else {
$list = Event::emit('cmscategoryPermissions', [
$list = Event::emit('cmsCategoryPermissions', [
'field' => $this->authFields
], true);
}
@@ -313,13 +316,13 @@ class Auth
/**
* 校验节点 避免越权
* @access public
* @param mixed|null $rules
* @param null $rules
* @param string|null $type
* @param string|null $class
* @param string $class
* @return bool
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function checkRuleOrCateNodes($rules = null, string $type = null, string $class = 'pri'): bool
{
@@ -391,26 +394,24 @@ class Auth
/**
* 获取用户信息
* @param $admin_id
* @return array|mixed|Db|\think\Model|null
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getUserInfo($admin_id)
public function getAdminData($admin_id): array
{
$admin_id = $admin_id ?? session('AdminLogin.id');
static $userinfo = [];
static $AdminData = [];
$user = Db::name('admin');
// 获取用户表主键
$_pk = is_string($user->getPk()) ? $user->getPk() : 'id';
if (!isset($userinfo[$admin_id])) {
$userinfo[$admin_id] = $user->where($_pk, $admin_id)->find();
if (!isset($AdminData[$admin_id])) {
$AdminData[$admin_id] = $user->where($_pk, $admin_id)->find();
}
return $userinfo[$admin_id];
return $AdminData[$admin_id];
}
/**
@@ -425,8 +426,9 @@ class Auth
/**
* 设置错误
* @param string $error 信息信息
* @return void
*/
protected function setError(string $error)
protected function setError(string $error): void
{
$this->_error = $error;
}

View File

@@ -21,7 +21,6 @@ class AdminLogin implements MiddlewareInterface
$request->session()->delete(AdminSession);
return response(request_error(), 404);
}
return $handler($request);
}
}

View File

@@ -2,12 +2,12 @@
namespace app\admin\middleware\system;
use support\View;
use app\admin\library\Auth;
use app\common\library\ResultCode;
use app\common\model\system\Admin as AdminModel;
use app\common\model\system\SystemLog;
use Psr\SimpleCache\InvalidArgumentException;
use support\View;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
@@ -27,7 +27,7 @@ class AdminPermissions implements MiddlewareInterface
* 不需要鉴权的方法
* @var array
*/
protected $noNeedAuth = [
protected array $noNeedAuth = [
'/Index/index',
'/Login/index',
'/Login/logout',
@@ -54,11 +54,11 @@ class AdminPermissions implements MiddlewareInterface
}
// 判断是否需要鉴权
$request->adminId = $AdminLogin['id'] ?? 0;
$request->adminInfo = $AdminLogin ?? [];
$request->admin_id = $AdminLogin['id'] ?? 0;
$request->adminData = $AdminLogin ?? [];
$method = '/' . $controller. '/' .$action;
if (!in_array($method, $this->noNeedAuth) && !in_array('*', $this->noNeedAuth)) {
if (!Auth::instance()->SuperAdmin() && !Auth::instance()->check($method, $request->adminId)) {
if (!Auth::instance()->SuperAdmin() && !Auth::instance()->check($method, $request->admin_id)) {
if (request()->isAjax()) {
return json(['code' => 101, 'msg' => '没有权限']);
} else {
@@ -98,7 +98,6 @@ class AdminPermissions implements MiddlewareInterface
/**
* 写入后台操作日志
* @return void
* @throws InvalidArgumentException
* @throws DataNotFoundException
* @throws DbException

View File

@@ -298,7 +298,19 @@
condition="$config['site_clearLink'] eq 0 "> checked </if>>
</div>
<div class="layui-form-mid layui-word-aux">
<font color="red">* </font>{:__('开启后发送内容自动清理非本站链接')}
<span style="color: red; ">* </span>{:__('开启后发送内容自动清理非本站链接')}
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">{:__('启用minify模板')}</label>
<div class="layui-input-inline">
<input type="radio" name="minify_page" value="1" title="开启" <if
condition="$config['minify_page'] eq 1 "> checked </if> >
<input type="radio" name="minify_page" value="0" title="关闭" <if
condition="$config['minify_page'] eq 0 "> checked </if>>
</div>
<div class="layui-form-mid layui-word-aux">
<span style="color: red; ">* </span>{:__('启用后页面加载速度会更快,但注意代码编写注释规范')}
</div>
</div>
@@ -1407,27 +1419,27 @@
</h2>
<div class="layui-colla-content">
<div class="layui-card-header" style="margin-bottom:20px;"><i
class="layui-icon">
<img src="/static/images/interface/aliyun.png?12x" width="16"
height="16" alt="">
</i>{:__('阿里SMS短信')}</div>
<div class="layui-form-item">
<label class="layui-form-label">{:__('短信服务商')}</label>
<div class="layui-input-inline">
<select name="smstype">
<option value="alisms" <eq name="$config['smstype']"
value="alisms"> selected="" </eq> >{:__('阿里云短信')}</option>
value="alisms"> selected="" </eq> >{:__('阿里云短信')}</option>
<option value="tensms" <eq name="$config['smstype']"
value="tensms"> selected="" </eq> >{:__('腾讯云短信')}</option>
value="tensms"> selected="" </eq> >{:__('腾讯云短信')}</option>
</select>
</div>
<div class="layui-form-mid layui-word-aux">* <font color="red">
{:__('请选择短信服务商类型')}!。</font>
{:__('请选择短信服务商类型')}!。</font>
</div>
</div>
<div class="layui-card-header" style="margin-bottom:20px;"><i
class="layui-icon">
<img src="/static/images/interface/aliyun.png?12x" width="16"
height="16" alt="">
</i>{:__('阿里SMS短信')}</div>
<div class="layui-form-item">
<label class="layui-form-label">APP_ID</label>
<div class="layui-input-inline">

View File

@@ -12,6 +12,7 @@
<meta name="format-detection" content="telephone=no">
<link href="__STATICADMIN__layui/css/layui.css?v={:release()}" rel="stylesheet" type="text/css"/>
<link href="__STATICADMIN__css/style.css?v={:release()}" rel="stylesheet" type="text/css"/>
<link href="__STATICADMIN__layui/css/font-awesome.css?v={:release()}" rel="stylesheet" type="text/css"/>
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
@@ -27,14 +28,14 @@
}
</style>
<script>
var _global_ = {
let _global_ = {
app: "{$app|default='admin.php'}",
controller: "{$controller|default='index'}",
action: "{$action|default='index'}",
api: "{:config('app.api_url')}"
};
var _upload_chunkSize = {:saenv('upload_chunk_size')};
let _upload_chunkSize = {:saenv('upload_chunk_size')};
</script>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
@@ -78,11 +79,12 @@
</a>
</li>
<li class="layui-nav-item" lay-unselect>
<a href="javascript:;" sa-event="message" lay-text="{:__('消息中心')}"
data-url="{:url('/system/admin/message',[],false)}">
<a href="javascript:;" sa-event="bells" lay-text="{:__('消息中心')}" data-url="{:url('/system/admin/bells',[],false)}">
<i class="layui-icon fa-bell-o"></i>
<!-- 如果有新消息,则显示小圆点 -->
<span class="layui-badge-dot"></span>
<neq name="notice_count" value="0">
<span class="layui-badge-dot"></span>
</neq>
</a>
</li>
@@ -135,7 +137,7 @@
</div>
<script src="__STATICADMIN__layui/layui.js?v={:release()}"></script>
<script src="__STATICADMIN__js/common.js?v={:release()}"></script>
<link href="__STATICADMIN__layui/css/font-awesome.css?v={:release()}" rel="stylesheet" type="text/css"/>
<script src="__STATICADMIN__js/plugin.js?v={:release()}"></script>
<script>
layui.use(['admin', 'mousewheel', 'dropdown'], function () {
let $ = layui.jquery;

View File

@@ -1,4 +1,3 @@
<include file="/public/header" />
<!-- 正文开始 -->
<div class="layui-fluid">

View File

@@ -16,7 +16,7 @@
<body>
<div class="swiftadmin-login">
<div class="swiftadmin-login-main">
<!-- // 头部信息2 -->
<!-- // 头部信息 -->
<div class="swiftadmin-login-box swiftadmin-login-header">
<h2><img src="__ADMINIMAGES__logo.png" alt="logo" class="logo">Swift Admin</h2>
<p>SwiftAdmin.NET 最懂你的极速开发框架管理后台 </p>

View File

@@ -13,7 +13,7 @@
*{ padding: 0; margin: 0; }
body{font-family: '微软雅黑',serif; color: #CCC; font-size: 16px;background:#f2f2f2 }
.system-message{ text-align: center; padding: 24px 48px;
box-shadow: 0 0 10px rgba(0,0,0,.2)!important; top:50%; width:500px; border-radius:5px;
box-shadow: 0 0 10px rgba(0,0,0,.2)!important; top:50%; width:380px; border-radius:5px;
-moz-border-radius:10px; /* Old Firefox */
margin: 12% auto auto;
background: #fff;}

View File

@@ -0,0 +1,262 @@
<include file="/public/header" />
<link href="__STATICADMIN__css/message.css" rel="stylesheet" type="text/css" />
<div class="layui-tab layui-tab-brief" >
<ul class="layui-tab-title" style="text-align: center;">
<li class="layui-this" id="msg" >{:__('通知')}({$count['notice']})</li>
<li>{:__('私信')}({$count['message']})</li>
<li>{:__('待办')}({$count['todo']})</li>
</ul>
<div class="layui-tab-content" style="padding: 5px 0px;">
<div class="layui-tab-item layui-show">
<ul id="notice" class="layui-instant-list" >
<volist name="list['notice']" id="vo">
<a data-id="{$vo.id}" data-type="notice" class="layui-instant-list-item active_{$vo.status}" href="javascript:;">
<img class="layui-instant-item-icon" src="__ADMINIMAGES__message.png">
<div class="layui-instant-item-right">
<h2 class="layui-instant-item-title">{$vo.title}</h2>
<p class="layui-instant-item-text">{$vo.create_time}</p>
</div>
</a>
</volist>
</ul>
<!-- // 列表为空 -->
<div class="layui-instant-list-empty" <empty name="$list['notice']"> style="display:black;" <else/> style="display:none;" </empty> >
<img src="__ADMINIMAGES__noting.png"><div>{:__('没有通知')}</div>
</div>
<!-- // 底部操作 -->
<notempty name="$list['notice']">
<div class="layui-instant-footer">
<a href="javascript:;" class="instant-clear" data-type="notice">{:__('清空通知')}</a>
<span>|</span>
<a href="javascript:;" class="instant-reads" data-type="notice">{:__('全部已读')}</a>
</div>
</notempty>
</div>
<div class="layui-tab-item">
<ul id="message" class="layui-instant-list" >
<volist name="list['message']" id="vo">
<a data-id="{$vo.id}" data-type="message" class="layui-instant-list-item active_{$vo.status}" href="javascript:;">
<img class="layui-instant-item-icon" src="{$vo.face|default='__ADMINIMAGES__head.png'}" >
<div class="layui-instant-item-right">
<h2 class="layui-instant-item-title">{$vo.title}</h2>
<p class="layui-instant-item-text">{$vo.create_time}</p>
</div>
</a>
</volist>
</ul>
<!-- // 列表为空 -->
<div class="layui-instant-list-empty" <empty name="$list['message']"> style="display:black;" <else/> style="display:none;" </empty> >
<img src="__ADMINIMAGES__noting.png"><div>{:__('没有私信')}</div>
</div>
<notempty name="$list['message']">
<div class="layui-instant-footer">
<a href="javascript:;" class="instant-clear" data-type="message">{:__('清空私信')}</a>
<span>|</span>
<a href="javascript:;" class="instant-reads" data-type="message">{:__('全部已读')}</a>
</div>
</notempty>
</div>
<div class="layui-tab-item">
<ul id="todo" class="layui-instant-list" >
<volist name="list['todo']" id="vo">
<a data-id="{$vo.id}" data-type="todo" class="layui-instant-list-item active_{$vo.status}" href="javascript:;">
<div class="layui-instant-item-right">
<eq name="$vo['status']" value="0">
<span class="layui-badge pull-right">{:__('待完成')}</span>
<else/>
<eq name="$vo['status']" value="3">
<span class="layui-badge layui-bg-green pull-right">{:__('进行中')}</span>
<else/>
<span class="layui-badge layui-bg-gray pull-right">{:__('已完成')}</span>
</eq>
</eq>
<h2 class="layui-instant-item-title">{$vo.title}</h2>
<p class="layui-instant-item-text">{$vo.create_time}</p>
</div>
</a>
</volist>
</ul>
<!-- // 列表为空 -->
<div class="layui-instant-list-empty" <empty name="$list['todo']"> style="display:black;" <else/> style="display:none;" </empty> >
<img src="__ADMINIMAGES__noting.png"><div>{:__('没有待办')}</div>
</div>
<notempty name="$list['todo']">
<div class="layui-instant-footer">
<a href="javascript:;" class="instant-clear" data-type="todo">{:__('清空待办')}</a>
<span>|</span>
<a href="javascript:;" class="instant-reads" data-type="todo">{:__('全部完成')}</a>
</div>
</notempty>
</div>
</div>
</div>
<include file="/public/footer" />
<script>
layui.use(['element'], function () {
let $ = layui.jquery;
let layer = layui.layer;
let flow = layui.flow;
let instantItem = {
notice: {
title: '{:__('我的通知')}',
anim: 2,
},
message: {
title: '{:__('我的私信')}',
anim: 0,
},
todo: {
title: '{:__('我的待办')}',
anim: 0,
},
};
// 执行通知流加载
$.each(instantItem, function (index, type) {
flow.load({
elem: '#' + index,
done: function (page, next) {
let list = [];
let url = "{:url('/system/admin/bells')}?type=" + index + "&page=" + page;
$.get(url, function (res) {
let data = res.data;
if (page >= 2) {
layui.each(data.data, function (key, item) {
let html = '';
switch (index) {
case 'notice':
html += '<a data-id="' + item.id + '" data-type="notice" class="layui-instant-list-item active_' + item.status + '" href="javascript:;">';
html += '<img class="layui-instant-item-icon" src="__ADMINIMAGES__message.png">';
html += '<div class="layui-instant-item-right">';
html += '<h2 class="layui-instant-item-title">' + item.title + '</h2>';
html += '<p class="layui-instant-item-text">' + item.create_time + '</p>';
html += '</div>';
html += '</a>';
break;
case 'message':
html += '<a data-id="' + item.id + '" data-type="message" class="layui-instant-list-item active_' + item.status + '" href="javascript:;">';
html += '<img class="layui-instant-item-icon" src="' + item.face + '">';
html += '<div class="layui-instant-item-right">';
html += '<h2 class="layui-instant-item-title">' + item.title + '</h2>';
html += '<p class="layui-instant-item-text">' + item.create_time + '</p>';
html += '</div>';
html += '</a>';
break;
case 'todo':
html += '<a data-id="' + item.id + '" data-type="todo" class="layui-instant-list-item active_' + item.status + '" href="javascript:;">';
html += '<div class="layui-instant-item-right">';
if (item.status === 0) {
html += '<span class="layui-badge pull-right">待完成</span>';
} else if (item.status === 3) {
html += '<span class="layui-badge layui-bg-green pull-right">进行中</span>';
} else {
html += '<span class="layui-badge layui-bg-gray pull-right">已完成</span>';
}
html += '<h2 class="layui-instant-item-title">' + item.title + '</h2>';
html += '<p class="layui-instant-item-text">' + item.create_time + '</p>';
html += '</div>';
html += '</a>';
break;
default:
break;
}
list.push(html);
});
}
next(list.join(''), page < data.last_page);
});
}
});
});
// 打开新窗口
$('.layui-instant-list').on('click', '.layui-instant-list-item', function () {
let that = this;
$(that).addClass('active_open');
$(that).removeClass('active_0').addClass('active_1');
let id = $(that).attr('data-id');
let type = $(that).attr('data-type');
let openURL = "{:url('/system/admin/readNotice')}?type=" + type + "&id=" + id;
parent.layer.open({
id: type + id,
type: 2,
title: instantItem[type].title,
shade: 0,
maxmin: true,
isOutAnim: false,
area: ['600px', '400px'],
offset: type === 'notice' ? 'rb' : 'none', // 可选位置
anim: instantItem[type].anim, // 可选动画
content: [openURL, 'no'],
success: function (layero, index) {
$('body').on('click', '.active_open', function (e) {
parent.layer.close(index);
$(that).removeClass('active_open');
})
}
});
});
// 清空消息点击事件
$('.instant-clear').click(function (obj) {
var that = $(this), type = that.data('type');
var findElem = $('#' + type);
// 删除元素
that.parent().prev().prev().remove();
that.parent().prev().show();
that.parent().remove();
// 替换标题
findElem.text(findElem.text().replace(/\([^\)]*\)/,''));
// 执行AJAX请求...
$.ajax({
url: "{:url('/system/admin/clearNotice')}",
type: 'post',
data: {type: type},
success: function (res) {
if (res.code === 200) {
layer.msg(res.msg);
} else {
layer.error(res.msg);
}
}
});
});
// 一键已读
$('.instant-reads').click(function (obj) {
var that = $(this), type = that.data('type');
// 执行AJAX请求...
$.ajax({
url: "{:url('/system/admin/readAllNotice')}",
type: 'post',
data: {type: type},
success: function (res) {
if (res.code === 200) {
layer.msg(res.msg);
$('.layui-instant-list-item').removeClass('active_0').addClass('active_1');
} else {
layer.error(res.msg);
}
}
});
});
});
</script>

View File

@@ -172,7 +172,7 @@
<div class="layui-card">
<div class="layui-card-body">
<div class="layui-tab layui-tab-brief" lay-filter="userInfoTab">
<div class="layui-tab layui-tab-brief" lay-filter="userDataTab">
<ul class="layui-tab-title">
<li class="layui-this">{:__('基本信息')}</li>
<li>{:__('账号绑定')}</li>
@@ -287,7 +287,7 @@
admin.callback.imgHead = function(clickthis, colletction) {
var res = colletction.res;
if (res.code == 200) { // 查找元素
if (res.code === 200) { // 查找元素
jquery('.imgHead').attr('src',res.url);
// // 执行后端投递工作
// jquery.post('{:url("/system/admin/modify")}',{

View File

@@ -294,16 +294,8 @@
}
})
// var rules = _ajax('cates');
// if (typeof rules.code != "undefined") {
// return layer.msg(rules.msg,'info');
// }
}
});
});
</script>

View File

@@ -1,129 +1,54 @@
<include file="/public/header" />
<link href="__STATICADMIN__css/message.css" rel="stylesheet" type="text/css" />
<div class="layui-tab layui-tab-brief" >
<ul class="layui-tab-title" style="text-align: center;">
<li class="layui-this" id="msg" >{:__('通知')}({:count($list['msg'])})</li>
<li id="comment" >{:__('私信')}({:count($list['comment'])})</li>
<li id="things" >{:__('待办')}({:count($list['things'])})</li>
</ul>
<div class="layui-tab-content" style="padding: 5px 0px;">
<div class="layui-tab-item layui-show">
<div class="layui-message-list" >
<volist name="list['msg']" id="vo">
<a class="layui-message-list-item" href="javascript:;">
<img class="layui-message-item-icon" src="__ADMINIMAGES__message.png">
<!-- <i class="layui-message-item-icon layui-icon layui-icon-email"></i> -->
<div class="layui-message-item-right">
<h2 class="layui-message-item-title">{$vo.title}</h2>
<p class="layui-message-item-text">{$vo.create_time}</p>
</div>
</a>
</volist>
<!-- // 重定位Style -->
<style>
.face {
margin-bottom: 3px;
}
</style>
<div id="instant-content" class="layui-card">
<div class="layui-card-body">
<div class="layui-panel">
<div class="layui-card-header">
<div class="title"><span class="titles"><img src="{$detail.face}" class="face" width="20"> </span>{$detail.nickname}</div>
<div class="time"><span class="times">时间:</span>{$detail.create_time}</div>
</div>
<!-- // 列表为空 -->
<div class="layui-message-list-empty" <empty name="$list['msg']"> style="display:black;" <else/> style="display:none;" </empty> >
<img src="__ADMINIMAGES__noting.png"><div>{:__('没有通知')}</div>
</div>
<!-- // 底部操作 -->
<notempty name="$list['msg']">
<div class="layui-message-footer">
<a href="javascript:;" class="clear" data-type="msg">{:__('清空通知')}</a><span>|</span><a href="javascript:;" class="more">{:__('查看更多')}</a>
</div>
</notempty>
</div>
<div class="layui-tab-item">
<div class="layui-message-list" >
<volist name="list['comment']" id="vo">
<a class="layui-message-list-item" href="javascript:;">
<img class="layui-message-item-icon" src="__ADMINIMAGES__head.png">
<div class="layui-message-item-right">
<h2 class="layui-message-item-title">{$vo.title}</h2>
<p class="layui-message-item-text">{$vo.content}</p>
<p class="layui-message-item-text">{$vo.create_time}</p>
</div>
</a>
</volist>
</div>
<!-- // 列表为空 -->
<div class="layui-message-list-empty" <empty name="$list['comment']"> style="display:black;" <else/> style="display:none;" </empty> >
<img src="__ADMINIMAGES__noting.png"><div>{:__('没有私信')}</div>
</div>
<notempty name="$list['msg']">
<div class="layui-message-footer">
<a href="javascript:;" class="clear"data-type="comment">{:__('清空私信')}</a><span>|</span><a href="javascript:;" class="more">{:__('查看更多')}</a>
</div>
</notempty>
<div id="layui-info">{$detail.content|raw}</div>
</div>
<div class="layui-tab-item">
<div class="layui-message-list" >
<volist name="list['things']" id="vo">
<a class="layui-message-list-item" href="javascript:;">
<div class="layui-message-item-right">
<eq name="$vo['type']" value="0">
<span class="layui-badge pull-right">{:__('待完成')}</span>
<else/>
<span class="layui-badge layui-bg-gray pull-right">{:__('已完成')}</span>
</eq>
<h2 class="layui-message-item-title">{$vo.title}</h2>
<p class="layui-message-item-text">{$vo.create_time}</p>
</div>
</a>
</volist>
<a id="more" class="layui-message-btn-more" href="javascript:;">{:__('更多')}</a>
</div>
<!-- // 列表为空 -->
<div class="layui-message-list-empty" <empty name="$list['things']"> style="display:black;" <else/> style="display:none;" </empty> >
<img src="__ADMINIMAGES__noting.png"><div>{:__('没有待办')}</div>
</div>
<notempty name="$list['things']">
<div class="layui-message-footer">
<a href="javascript:;" class="clear" data-type="things">{:__('清空待办')}</a><span>|</span><a href="javascript:;" class="more">{:__('查看更多')}</a>
</div>
</notempty>
<div class="layui-footer">
<!-- 底部固定区域 -->
<button type="button" class="layui-btn layui-btn-normal" lay-open data-title="回复私信" data-url="#replyForms" data-area="500px,350px" >回复</button>
<button type="button" class="layui-btn layui-btn-danger" sa-event="closeDialog" >关闭</button>
</div>
</div>
</div>
<script type="text/html" id="replyForms">
<div class="layui-fluid layui-bg-white" >
<form action="{:url('/system/admin/saveNotice')}" class="layui-form">
<input type="text" name="type" value="message" hidden>
<input type="text" name="admin_id" value="{$detail.send_id}" hidden>
<div class="layui-form-item">
<label class="layui-form-label"><span style="color: red; ">* </span>{:__('')}</label>
<div class="layui-input-block" >
<input type="text" name="title" class="layui-input" lay-verify="required" value="" placeholder="请输入私信标题">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label"><span style="color: red; ">* </span>{:__('')}</label>
<div class="layui-input-block">
<textarea name="content" class="layui-textarea" lay-verify="required" placeholder="请输入私信内容"></textarea>
</div>
</div>
<div class="layui-footer layui-form-item layui-center " >
<button class="layui-btn layui-btn-primary" type="button" sa-event="closePageDialog" >{:__('取消')}</button>
<button class="layui-btn" lay-filter="submitPage" lay-submit>{:__('提交')}</button>
</div>
</form>
</div>
</script>
<include file="/public/footer" />
<script>
layui.use(['element'], function () {
var $ = layui.jquery;
var element = layui.element;
// 加载更多
$('#more').click(function (obj) {
layer.msg('没有更多了','info');
})
// 清空消息点击事件
$('.clear').click(function (obj) {
var that = $(this), typeElem = that.data('type');
var findElem = $('#' + typeElem);
// 删除元素
that.parent().prev().prev().remove();
that.parent().prev().show();
that.parent().remove();
// 替换标题
findElem.text(findElem.text().replace(/\([^\)]*\)/,''));
// 执行AJAX请求...
});
});
</script>

View File

@@ -0,0 +1,26 @@
<include file="/public/header" />
<link href="__STATICADMIN__css/message.css" rel="stylesheet" type="text/css" />
<!-- // 重定位Style -->
<style></style>
<div id="instant-content" class="layui-card">
<div class="layui-card-body">
<div class="layui-panel">
<div class="layui-card-header">
<div class="title"><span class="titles">🔔 </span>{$detail.title}</div>
<div class="time"><span class="times">时间:</span>{$detail.create_time}</div>
</div>
<div id="layui-info">{$detail.content|raw}</div>
<div class="layui-banner">
<p>本消息属系统通知,来源于业务流程管理系统,请勿回复</p>
<p>在系统使用过程中,如果有问题请联系网站运维组:## </p>
</div>
</div>
<div class="layui-footer">
<!-- 底部固定区域 -->
<button type="button" class="layui-btn layui-btn-danger" sa-event="closeDialog" >关闭</button>
</div>
</div>
</div>
<include file="/public/footer" />

View File

@@ -47,7 +47,7 @@
<form class="layui-form" lay-filter="editforms" >
<input type="text" name="id" hidden="">
<div class="layui-form-item">
<label class="layui-form-label"><span style="color: red; ">* </span>{:__('')}</label>
<label class="layui-form-label">{:__('上级菜单')}</label>
<div class="layui-input-inline">
<div id="treeNode" name="pid" lay-filter="treeNode" ></div>
</div>
@@ -82,7 +82,7 @@
</div>
<div class="layui-form-item">
<label class="layui-form-label">{:__('路由地址')}</label>
<label class="layui-form-label"><span style="color: red; ">* </span>{:__('')}</label>
<div class="layui-input-inline">
<input name="router" placeholder="{:__('/system/Target/index')}" type="text" class="layui-input router" lay-verify="required" />
</div>

View File

@@ -0,0 +1,32 @@
<include file="/public/header" />
<link href="__STATICADMIN__css/message.css" rel="stylesheet" type="text/css" />
<!-- // 重定位Style -->
<style>
.face {
margin-bottom: 3px;
}
</style>
<div id="instant-content" class="layui-card">
<div class="layui-card-body">
<div class="layui-panel">
<div class="layui-card-header">
<div class="title">{$detail.title}</div>
<div class="time"><span class="times">任务创建于:</span>{$detail.create_time}</div>
</div>
<div id="layui-info">{$detail.content|raw}</div>
<div class="layui-banner">
<p>本消息属系统工作流待办流程管理</p>
<p>在系统使用过程中,如果有问题请联系网站运维组 </p>
</div>
</div>
<div class="layui-footer">
<!-- 底部固定区域 -->
<button type="button" class="layui-btn layui-btn-checked" lay-ajax data-url="{:url('/system/admin/saveNotice')}?id={$detail.id}&status=3" >进行中</button>
<button type="button" class="layui-btn layui-btn-primary" lay-ajax data-url="{:url('/system/admin/saveNotice')}?id={$detail.id}&status=1" >已完成</button>
<button type="button" class="layui-btn layui-btn-danger" sa-event="closeDialog" >关闭</button>
</div>
</div>
</div>
<include file="/public/footer" />

View File

@@ -64,6 +64,8 @@
url:'{:url('/system/Dictionary/index')}?pid=0',
toolbar: '#toolbar',
defaultToolbar: [],
limit: 20,
id:'lay-tree'}"
lay-filter="lay-tree" >
<thead>

View File

@@ -122,19 +122,7 @@
// 表格排序
done: function(obj) {
console.log(obj)
// let ids = [];
// for (const k in obj.cache) {
// ids.push(obj.cache[k].id)
// }
// $.post("/central.php/system/archives/sort.html",{
// ids : ids
// }, function(res) {
// if (res.code == 200) {
// layer.msg(res.msg);
// } else {
// layer.error(res.msg);
// }
// })
}
}
,done: function(res, curr, count) {

View File

@@ -24,11 +24,11 @@
<script>
layui.use(['layer','jquery','admin'],function(){
var $ = layui.jquery;
var layer = layui.layer;
var admin = layui.admin;
let $ = layui.jquery;
let layer = layui.layer;
let admin = layui.admin;
var editor = CodeMirror.fromTextArea(document.getElementById("htmlcode"), {
let editor = CodeMirror.fromTextArea(document.getElementById("htmlcode"), {
lineNumbers: true,
lineWrapping: true,
mode: "text/html",

View File

@@ -30,8 +30,8 @@
<script>
layui.use(['layer','jquery'],function(){
var $ = layui.jquery;
var layer = layui.layer;
let $ = layui.jquery;
let layer = layui.layer;
// 提交数据
$('.editTpl').on('click',function(){