Compare commits

..

No commits in common. "e25404ee2f03fc9d186ba49b71f7902d7507c26e" and "1d353934584751579ebdb1e9e74cd2630bc88975" have entirely different histories.

11 changed files with 23 additions and 136 deletions

View File

@ -4,7 +4,6 @@ namespace app\admin\controller;
use app\admin\extend\Util as Util;
use app\admin\model\AdminLog as lModel;
use app\common\model\AdvertInfo;
use app\Request;
use Exception;
use think\db\exception\DataNotFoundException;

View File

@ -25,7 +25,7 @@ class AdminNotify extends AuthController
['start_time', ''],
['end_time', ''],
['is_read', ''],
['uid', $this->adminId],
['aid', $this->adminId],
]);
$this->assign("where", $where);
$this->assign("list", nModel::systemPage($where));

View File

@ -254,9 +254,6 @@ class Advert extends AuthController
* 保存修改
* @param string $id
* @return mixed
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function saveAdvert($id = "")
{
@ -286,18 +283,4 @@ class Advert extends AuthController
cache(Data::DATA_ADVERT . '_' . $info['alias'], null);//清除缓存
return $res ? app("json")->success("操作成功", 'code') : app("json")->fail("操作失败");
}
/**
* 删除广告
* @param Request $request
* @return mixed
*/
public function delAdvert(Request $request)
{
$where = Util::postMore([
['id', ''],
],$request);
if (empty($where['id'])) return app("json")->fail("参数错误,请刷新后重试");
return (new \app\common\model\AdvertInfo)->where('id',$where['id'])->delete() ? app("json")->success("删除成功") : app("json")->fail("删除失败");
}
}

View File

@ -88,7 +88,7 @@ class Article extends AuthController
['is_recommend', 0],
['is_top', 0],
['is_hot', 0],
['template', 'detail.html'],
['theme', 'detail.html'],
['link_str', ''],
['is_jump', 0],
['cover_path', ''],

View File

@ -40,7 +40,7 @@ class Image extends AuthController
* @throws DbException
* @throws ModelNotFoundException
*/
public function category()
public function category(): array
{
return app("json")->success(AttachmentCategory::buildNodes($this->type, 0, $this->request->param("title", "")));
}

View File

@ -19,7 +19,7 @@ class Index extends AuthController
{
$this->assign("adminInfo", $this->adminInfo);
$this->assign("menu", AdminAuth::getAuthList($this->adminId,$this->auth));
$this->assign("message", AdminNotify::pageList($this->adminId,5));
$this->assign("message", AdminNotify::pageList(5));
return $this->fetch();
}

View File

@ -31,7 +31,7 @@ class AdminNotify extends BaseModel
}
if ($where['title'] != '') $model = $model->where("title|content", "like", "%$where[title]%");
if ($where['is_read'] != '') $model = $model->where("is_read", $where['is_read']);
if ($where['uid'] != '') $model = $model->where("uid", $where['uid']);
if ($where['aid'] != '') $model = $model->where("aid", $where['aid']);
$model = $model->order("is_read");
$model = $model->order("create_time desc");
return $model->paginate(10)->appends($where);
@ -53,17 +53,16 @@ class AdminNotify extends BaseModel
/**
* 后台首页获取通知信息
* @param $uid
* @param int $num
* @return array
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public static function pageList($uid,int $num): array
public static function pageList(int $num): array
{
$model = new self;
$model = $model->where("is_read", 0)->where("uid",$uid);
$model = $model->where("is_read", 0);
$count = self::count();
$model = $model->order("create_time desc");
$model = $model->page(1, $num);

View File

@ -87,9 +87,11 @@ class Document extends BaseModel
/**
* 更新文件信息
* @param $data
* @param $date
* @param string $type
* @return bool
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function updateInfo($data, string $type = Data::DOCUMENT_TYPE_ARTICLE)
{

View File

@ -1,72 +0,0 @@
<?php
namespace app\common\model;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\Paginator;
/**
* 消息通知
* Class AdminNotify
* @package app\admin\model\admin
*/
class Message extends BaseModel
{
/**
* 系统分页
* @param array $where
* @return Paginator
* @throws DbException
*/
public static function systemPage(array $where)
{
$model = new self;
if ($where['start_time'] != "" && $where['end_time'] != "") {
$model = $model->where("create_time", "between", [strtotime($where['start_time'] . " 00:00:00"), strtotime($where['end_time'] . " 23:59:59")]);
}
if ($where['title'] != '') $model = $model->where("title|content", "like", "%$where[title]%");
if ($where['is_read'] != '') $model = $model->where("is_read", $where['is_read']);
if ($where['uid'] != '') $model = $model->where("aid", $where['aid']);
$model = $model->order("is_read");
$model = $model->order("create_time desc");
return $model->paginate(10)->appends($where);
}
/**
* 添加记录
* @param array $data
* @return int|string
*/
public static function addLog(array $data): bool
{
if (self::create($data)){
return true;
}else{
return false;
}
}
/**
* 后台首页获取通知信息
* @param int $num
* @return array
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public static function pageList(int $num): array
{
$model = new self;
$model = $model->where("is_read", 0);
$count = self::count();
$model = $model->order("create_time desc");
$model = $model->page(1, $num);
$data = $model->select();
if ($data) $data = $data->toArray();
return compact("data", "count");
}
}

View File

@ -126,7 +126,7 @@ class Article extends Base
//更新浏览次数
$documentModel->where('id', $article['id'])->inc('view')->update();
//读取模板文件
$template = Data::DOCUMENT_TYPE_ARTICLE . '/' . ($article['template'] ?: 'detail.html');
$template = Data::DOCUMENT_TYPE_ARTICLE . '/' . ($article['theme'] ?: 'detail.html');
$templateFile = config('view.view_path') . $template;
if (!is_file($templateFile)) {
//配置的模版文件不存在则走默认模版

View File

@ -704,30 +704,6 @@ CREATE TABLE `ape_url_log` (
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for ape_message
-- ----------------------------
DROP TABLE IF EXISTS `ape_message`;
CREATE TABLE `ape_message` (
`id` int(10) NOT NULL AUTO_INCREMENT COMMENT '消息ID',
`uid` int(10) NOT NULL DEFAULT '0' COMMENT '用户id包含管理员',
`title` varchar(255) NOT NULL DEFAULT '' COMMENT '标题',
`content` mediumtext NOT NULL COMMENT '内容',
`from` varchar(10) NOT NULL DEFAULT '' COMMENT '消息来源 谁发的',
`type` varchar(10) NOT NULL DEFAULT 'system' COMMENT '消息类型 公告、通知、私信等',
`url` varchar(255) NOT NULL DEFAULT '' COMMENT '跳转路径 不填写时自动判断',
`is_read` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否已读',
`create_time` int(10) NOT NULL DEFAULT '0' COMMENT '添加时间',
`update_time` int(10) NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='消息通知表';
-- ----------------------------
-- Records of ape_message
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for ape_user
-- ----------------------------