message
This commit is contained in:
parent
787d5051b1
commit
4f9c25ab3d
@ -37,7 +37,7 @@ class Notice extends AdminController
|
|||||||
public function add()
|
public function add()
|
||||||
{
|
{
|
||||||
$sendId = Session::get('admin_id');
|
$sendId = Session::get('admin_id');
|
||||||
var_dump($sendId);
|
|
||||||
$data = Request::only(['type','title','receve_id','content']);
|
$data = Request::only(['type','title','receve_id','content']);
|
||||||
if($data['type'] == 1){
|
if($data['type'] == 1){
|
||||||
$receveId = $data['receve_id']; //个人通知
|
$receveId = $data['receve_id']; //个人通知
|
||||||
@ -49,6 +49,7 @@ class Notice extends AdminController
|
|||||||
//写入信息库
|
//写入信息库
|
||||||
$result = Message::sendMsg($sendId,$receveId,$data);
|
$result = Message::sendMsg($sendId,$receveId,$data);
|
||||||
if($result){
|
if($result){
|
||||||
|
event('Message');
|
||||||
$res = ['code'=>0,'msg'=>'发布成功'];
|
$res = ['code'=>0,'msg'=>'发布成功'];
|
||||||
} else {
|
} else {
|
||||||
$res = ['code'=>0,'msg'=>'发布失败'];
|
$res = ['code'=>0,'msg'=>'发布失败'];
|
||||||
|
30
app/common/lib/UploadFile.php
Normal file
30
app/common/lib/UploadFile.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
namespace app\common\lib;
|
||||||
|
|
||||||
|
class UploadFile
|
||||||
|
{
|
||||||
|
protected static $_instance = null;
|
||||||
|
protected $file;
|
||||||
|
protected $path;
|
||||||
|
protected $filesize;
|
||||||
|
protected $fileExt;
|
||||||
|
|
||||||
|
private function __construct($path)
|
||||||
|
{
|
||||||
|
$this->path = $path;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function __clone()
|
||||||
|
{
|
||||||
|
// TODO: Implement __clone() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
static function getInstance()
|
||||||
|
{
|
||||||
|
if(!(self::$_instance)){
|
||||||
|
self::$_instance = new self();
|
||||||
|
}
|
||||||
|
return self::$_instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -2,6 +2,7 @@
|
|||||||
// 事件定义文件
|
// 事件定义文件
|
||||||
return [
|
return [
|
||||||
'bind' => [
|
'bind' => [
|
||||||
|
'Message' => 'app\event\Message',
|
||||||
],
|
],
|
||||||
|
|
||||||
'listen' => [
|
'listen' => [
|
||||||
@ -10,6 +11,8 @@ return [
|
|||||||
'HttpEnd' => [],
|
'HttpEnd' => [],
|
||||||
'LogLevel' => [],
|
'LogLevel' => [],
|
||||||
'LogWrite' => [],
|
'LogWrite' => [],
|
||||||
|
'Message' => ['app\listener\Message'],
|
||||||
|
'CommMsg' => ['app\listener\CommMsg'],
|
||||||
],
|
],
|
||||||
|
|
||||||
'subscribe' => [
|
'subscribe' => [
|
||||||
|
11
app/event/Message.php
Normal file
11
app/event/Message.php
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
declare (strict_types = 1);
|
||||||
|
|
||||||
|
namespace app\event;
|
||||||
|
|
||||||
|
class Message
|
||||||
|
{
|
||||||
|
public function msg(){
|
||||||
|
echo "这是一个事件";
|
||||||
|
}
|
||||||
|
}
|
@ -170,6 +170,7 @@ class Article extends BaseController
|
|||||||
$comments = $article->comments()->where('status',1)->order(['cai'=>'asc','create_time'=>'asc'])->paginate(10);
|
$comments = $article->comments()->where('status',1)->order(['cai'=>'asc','create_time'=>'asc'])->paginate(10);
|
||||||
$article->inc('pv')->update();
|
$article->inc('pv')->update();
|
||||||
$pv = Db::name('article')->field('pv')->where('id',$id)->value('pv');
|
$pv = Db::name('article')->field('pv')->where('id',$id)->value('pv');
|
||||||
|
$download = download($article->upzip,'file');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
$nt = time();
|
$nt = time();
|
||||||
@ -193,7 +194,7 @@ class Article extends BaseController
|
|||||||
//通用右栏
|
//通用右栏
|
||||||
$ad_comm = Db::name('slider')->where('slid_status',1)->where('delete_time',0)->where('slid_type',2)->whereTime('slid_over','>=',time())->select();
|
$ad_comm = Db::name('slider')->where('slid_status',1)->where('delete_time',0)->where('slid_type',2)->whereTime('slid_over','>=',time())->select();
|
||||||
|
|
||||||
View::assign(['article'=>$article,'pv'=>$pv,'comments'=>$comments,'artHot'=>$artHot,'ad_art'=>$ad_article,'ad_comm'=>$ad_comm]);
|
View::assign(['article'=>$article,'pv'=>$pv,'comments'=>$comments,'artHot'=>$artHot,'ad_art'=>$ad_article,'ad_comm'=>$ad_comm,$download]);
|
||||||
return View::fetch();
|
return View::fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,7 +225,7 @@ class Article extends BaseController
|
|||||||
}
|
}
|
||||||
$data = ['title'=>$title,'content'=>'评论通知','link'=>$link,'user_id'=>$sendId,'type'=>1];
|
$data = ['title'=>$title,'content'=>'评论通知','link'=>$link,'user_id'=>$sendId,'type'=>1];
|
||||||
Message::sendMsg($sendId,$receveId,$data);
|
Message::sendMsg($sendId,$receveId,$data);
|
||||||
|
//event('CommMsg');
|
||||||
$res = ['code'=>0, 'msg'=>'留言成功'];
|
$res = ['code'=>0, 'msg'=>'留言成功'];
|
||||||
} else {
|
} else {
|
||||||
$res = ['code'=>-1, 'msg'=>'留言失败'];
|
$res = ['code'=>-1, 'msg'=>'留言失败'];
|
||||||
|
@ -2,12 +2,11 @@
|
|||||||
namespace app\index\controller;
|
namespace app\index\controller;
|
||||||
|
|
||||||
use think\facade\View;
|
use think\facade\View;
|
||||||
use app\common\controller\BaseController;
|
|
||||||
|
|
||||||
class Error extends BaseController
|
class Error
|
||||||
{
|
{
|
||||||
public function __call($method, $args)
|
public function __call($method, $args)
|
||||||
{
|
{
|
||||||
return View::fetch('error/404');
|
return View::fetch('../view/404');
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -66,7 +66,7 @@ class Login extends BaseController
|
|||||||
$res = $user->login($data);
|
$res = $user->login($data);
|
||||||
if ($res == 1) {
|
if ($res == 1) {
|
||||||
//获取系统站内通知信息
|
//获取系统站内通知信息
|
||||||
Message::insertMsg(session('user_id'));
|
//Message::insertMsg(session('user_id'));
|
||||||
//跳转到登陆前页面
|
//跳转到登陆前页面
|
||||||
return json(['code'=>0,'msg'=>'登陆成功','url'=> Cookie::get('url')]);
|
return json(['code'=>0,'msg'=>'登陆成功','url'=> Cookie::get('url')]);
|
||||||
} else {
|
} else {
|
||||||
|
@ -69,15 +69,15 @@ class Message extends BaseController
|
|||||||
//消息删除
|
//消息删除
|
||||||
public function remove()
|
public function remove()
|
||||||
{
|
{
|
||||||
$uid = Session::get('user_id');
|
$uid = $this->uid;
|
||||||
|
|
||||||
$id = Request::only(['id']);
|
$id = Request::only(['id']);
|
||||||
if($id['id'] == 'true'){
|
if($id['id'] == 'true'){
|
||||||
//删除所有此用户消息
|
//删除所有此用户消息
|
||||||
$msg = Db::name('message_to')->where(['receve_id'=>$uid,'delete_time'=>0])->delete();
|
$msg = Db::name('message_to')->where(['receve_id'=>$uid,'delete_time'=>0])->useSoftDelete('delete_time',time())->delete();
|
||||||
} else {
|
} else {
|
||||||
//删除单条消息
|
//删除单条消息
|
||||||
$msg = Db::name('message_to')->where('id',$id['id'])->delete();
|
$msg = Db::name('message_to')->where('id',$id['id'])->useSoftDelete('delete_time',time())->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
if($msg){
|
if($msg){
|
||||||
|
21
app/listener/CommMsg.php
Normal file
21
app/listener/CommMsg.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
declare (strict_types = 1);
|
||||||
|
|
||||||
|
namespace app\listener;
|
||||||
|
use taoler\com\Message;
|
||||||
|
//use app\facade\Message;
|
||||||
|
|
||||||
|
class CommMsg
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 事件监听处理
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle($event)
|
||||||
|
{
|
||||||
|
//执行登陆用户消息数据写入
|
||||||
|
//Message::sendMsg();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
21
app/listener/Message.php
Normal file
21
app/listener/Message.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
declare (strict_types = 1);
|
||||||
|
|
||||||
|
namespace app\listener;
|
||||||
|
use taoler\com\Message as MessageIns;
|
||||||
|
//use app\facade\Message;
|
||||||
|
|
||||||
|
class Message
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 事件监听处理
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle($event)
|
||||||
|
{
|
||||||
|
//执行登陆用户消息数据写入
|
||||||
|
MessageIns::insertMsg(session('user_id'));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -20,19 +20,23 @@ return [
|
|||||||
// 应用映射(自动多应用模式有效)
|
// 应用映射(自动多应用模式有效)
|
||||||
'app_map' => [],
|
'app_map' => [],
|
||||||
// 域名绑定(自动多应用模式有效)
|
// 域名绑定(自动多应用模式有效)
|
||||||
'domain_bind' => [],
|
'domain_bind' => [
|
||||||
|
//'www' => 'index',
|
||||||
|
//'admin' => 'admin'
|
||||||
|
],
|
||||||
// 禁止URL访问的应用列表(自动多应用模式有效)
|
// 禁止URL访问的应用列表(自动多应用模式有效)
|
||||||
'deny_app_list' => [],
|
'deny_app_list' => [],
|
||||||
|
|
||||||
// 异常页面的模板文件
|
// 异常页面的模板文件
|
||||||
'exception_tmpl' => app()->getThinkPath() . 'tpl/think_exception.tpl',
|
'exception_tmpl' => app()->getThinkPath() . 'tpl/think_exception.tpl',
|
||||||
|
|
||||||
// 错误显示信息,非调试模式有效
|
// 错误显示信息,非调试模式有效
|
||||||
'error_message' => '页面错误!请稍后再试~',
|
'error_message' => '页面错误!请稍后再试~',
|
||||||
// 显示错误信息
|
// 显示错误信息
|
||||||
'show_error_msg' => false,
|
'show_error_msg' => true,
|
||||||
//异常页面模板
|
//异常页面模板
|
||||||
'http_exception_template' => [
|
'http_exception_template' => [
|
||||||
404 => '../view/404.html'
|
404 => '../view/404.html',
|
||||||
|
500 => '../view/404.html'
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
@ -5,7 +5,11 @@ use RecursiveIteratorIterator;
|
|||||||
use RecursiveDirectoryIterator;
|
use RecursiveDirectoryIterator;
|
||||||
class Files
|
class Files
|
||||||
{
|
{
|
||||||
//获取目录下子目录名
|
/**
|
||||||
|
* 获取目录下子目录名
|
||||||
|
* @param $path 目录
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
public static function getDirName($path)
|
public static function getDirName($path)
|
||||||
{
|
{
|
||||||
if (is_dir($path)) {
|
if (is_dir($path)) {
|
||||||
@ -20,7 +24,11 @@ class Files
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//创建文件夹及子文件夹
|
/**
|
||||||
|
* 创建文件夹及子文件夹
|
||||||
|
* @param $path
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
public static function create_dirs($path)
|
public static function create_dirs($path)
|
||||||
{
|
{
|
||||||
if (!is_dir($path))
|
if (!is_dir($path))
|
||||||
@ -42,11 +50,12 @@ class Files
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除文件夹及内容
|
* 删除文件夹及内容
|
||||||
* @param $dirPath 所删除的目录
|
* @param $dirPath 所删除的目录
|
||||||
* @param $nowDir 是否删除当前文件夹$dirPath true false
|
* @param bool $nowDir 是否删除当前文件夹$dirPath true false
|
||||||
*/
|
* @return bool
|
||||||
|
*/
|
||||||
public static function delDirAndFile( $dirPath, $nowDir=false )
|
public static function delDirAndFile( $dirPath, $nowDir=false )
|
||||||
{
|
{
|
||||||
if ( $handle = opendir($dirPath) ) {
|
if ( $handle = opendir($dirPath) ) {
|
||||||
@ -63,7 +72,7 @@ class Files
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir( $handle );
|
closedir( $handle );
|
||||||
//删除当前文件夹
|
//删除当前文件夹
|
||||||
if($nowDir == true){
|
if($nowDir == true){
|
||||||
if(rmdir($dirPath)){
|
if(rmdir($dirPath)){
|
||||||
return true;
|
return true;
|
||||||
@ -77,12 +86,13 @@ class Files
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 复制文件夹$source下的文件和子文件夹下的内容到$dest下 升级+备份代码
|
* 复制文件夹$source下的文件和子文件夹下的内容到$dest下 升级+备份代码
|
||||||
* @param $source
|
* @param $source
|
||||||
* @param $dest
|
* @param $dest
|
||||||
* @param $ex 指定只复制$source下的目录,默认全复制
|
* @param array $ex 指定只复制$source下的目录,默认全复制
|
||||||
*/
|
* @return bool
|
||||||
|
*/
|
||||||
public function copyDirs($source, $dest, $ex=array())
|
public function copyDirs($source, $dest, $ex=array())
|
||||||
{
|
{
|
||||||
$count = count($ex);
|
$count = count($ex);
|
||||||
@ -91,7 +101,7 @@ class Files
|
|||||||
while (($file = readdir($handle)) !== false) {
|
while (($file = readdir($handle)) !== false) {
|
||||||
if (( $file != '.' ) && ( $file != '..' )) {
|
if (( $file != '.' ) && ( $file != '..' )) {
|
||||||
if ( is_dir($source . $file) ) {
|
if ( is_dir($source . $file) ) {
|
||||||
//指定文件夹
|
//ָ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>
|
||||||
if($count != 0){
|
if($count != 0){
|
||||||
if(in_array($file,$ex)){
|
if(in_array($file,$ex)){
|
||||||
self::copyDirs($source . $file.'/', $dest . $file.'/');
|
self::copyDirs($source . $file.'/', $dest . $file.'/');
|
||||||
@ -111,11 +121,10 @@ class Files
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检测目录并循环创建目录
|
* 检测目录并循环创建目录
|
||||||
*
|
* @param $dir
|
||||||
* @param $catalogue
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function mkdirs($dir)
|
public static function mkdirs($dir)
|
||||||
{
|
{
|
||||||
@ -127,12 +136,12 @@ class Files
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 删除文件以及目录
|
||||||
* @param $dir
|
* @param $dir
|
||||||
* @return bool
|
* @return bool
|
||||||
* 删除文件以及目录
|
|
||||||
*/
|
*/
|
||||||
public static function delDir($dir) {
|
public static function delDir($dir) {
|
||||||
//先删除目录下的文件:
|
//先删除目录下的文件:
|
||||||
// var_dump(is_dir($dir));
|
// var_dump(is_dir($dir));
|
||||||
// if(!is_dir($dir)){
|
// if(!is_dir($dir)){
|
||||||
// return true;
|
// return true;
|
||||||
@ -149,7 +158,7 @@ class Files
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir($dh);
|
closedir($dh);
|
||||||
//删除当前文件夹:
|
//删除当前文件夹
|
||||||
if(rmdir($dir)) {
|
if(rmdir($dir)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@ -158,9 +167,10 @@ class Files
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 复制文件到指定文件
|
||||||
* @param $source
|
* @param $source
|
||||||
* @param $dest
|
* @param $dest
|
||||||
* 复制文件到指定文件
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function copyDir($source, $dest)
|
public static function copyDir($source, $dest)
|
||||||
{
|
{
|
||||||
@ -185,10 +195,13 @@ class Files
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*写入
|
/**
|
||||||
* @param string $type 1 为生成控制器 2 模型
|
* 写入
|
||||||
*/
|
* @param $content
|
||||||
|
* @param $filepath
|
||||||
|
* @param $type $type 1 为生成控制器 2 模型
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
public static function filePutContents($content,$filepath,$type){
|
public static function filePutContents($content,$filepath,$type){
|
||||||
if($type==1){
|
if($type==1){
|
||||||
$str = file_get_contents($filepath);
|
$str = file_get_contents($filepath);
|
||||||
@ -212,11 +225,11 @@ class Files
|
|||||||
$File->write($filepath, $_cache);
|
$File->write($filepath, $_cache);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取文件夹大小
|
* 获取文件夹大小
|
||||||
*
|
* @param $dir 根文件夹路径
|
||||||
* @param string $dir 根文件夹路径
|
* @return bool|int
|
||||||
* @return int
|
|
||||||
*/
|
*/
|
||||||
public static function getDirSize($dir)
|
public static function getDirSize($dir)
|
||||||
{
|
{
|
||||||
@ -240,9 +253,10 @@ class Files
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建文件
|
* 创建文件
|
||||||
*
|
* @param $file
|
||||||
* @param $files
|
* @param $content
|
||||||
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function createFile($file,$content)
|
public static function createFile($file,$content)
|
||||||
{
|
{
|
||||||
@ -252,9 +266,9 @@ class Files
|
|||||||
fclose($myfile);
|
fclose($myfile);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 基于数组创建目录
|
* 基于数组创建目录
|
||||||
*
|
|
||||||
* @param $files
|
* @param $files
|
||||||
*/
|
*/
|
||||||
public static function createDirOrFiles($files)
|
public static function createDirOrFiles($files)
|
||||||
@ -268,7 +282,12 @@ class Files
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 判断文件或目录是否有写的权限
|
|
||||||
|
/**
|
||||||
|
* 判断文件或目录是否有写的权限
|
||||||
|
* @param $file
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
public static function isWritable($file)
|
public static function isWritable($file)
|
||||||
{
|
{
|
||||||
if (DIRECTORY_SEPARATOR == '/' AND @ ini_get("safe_mode") == FALSE) {
|
if (DIRECTORY_SEPARATOR == '/' AND @ ini_get("safe_mode") == FALSE) {
|
||||||
@ -282,8 +301,7 @@ class Files
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 写入日志
|
* 写入日志
|
||||||
*
|
|
||||||
* @param $path
|
* @param $path
|
||||||
* @param $content
|
* @param $content
|
||||||
* @return bool|int
|
* @return bool|int
|
||||||
|
@ -8,7 +8,13 @@ use app\common\model\MessageTo;
|
|||||||
|
|
||||||
class Message
|
class Message
|
||||||
{
|
{
|
||||||
//send msg
|
/**
|
||||||
|
* 发送消息
|
||||||
|
* @param $sendId 发送者
|
||||||
|
* @param $receveId 接收者
|
||||||
|
* @param $data 发送数据
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
public static function sendMsg($sendId,$receveId,$data)
|
public static function sendMsg($sendId,$receveId,$data)
|
||||||
{
|
{
|
||||||
//写入消息库
|
//写入消息库
|
||||||
@ -29,7 +35,14 @@ class Message
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//receve msg
|
/**
|
||||||
|
* 接收消息
|
||||||
|
* @param $uid 接收消息用户ID
|
||||||
|
* @return \think\Collection
|
||||||
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
|
* @throws \think\db\exception\DbException
|
||||||
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
|
*/
|
||||||
public static function receveMsg($uid)
|
public static function receveMsg($uid)
|
||||||
{
|
{
|
||||||
$msg = Db::name('message_to')
|
$msg = Db::name('message_to')
|
||||||
@ -44,13 +57,19 @@ class Message
|
|||||||
return $msg;
|
return $msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
//登录后插入系统消息
|
/**
|
||||||
|
* 登录用户把消息写入数据表
|
||||||
|
* @param $uid 登陆用户ID
|
||||||
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
|
* @throws \think\db\exception\DbException
|
||||||
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
|
*/
|
||||||
public static function insertMsg($uid)
|
public static function insertMsg($uid)
|
||||||
{
|
{
|
||||||
//得到所有系统消息
|
//得到所有系统消息
|
||||||
$sysmsg = MessageModel::where(['type'=>0,'delete_time'=>0])->select();
|
$sysmsg = MessageModel::where(['type'=>0,'delete_time'=>0])->select();
|
||||||
foreach($sysmsg as $smg){
|
foreach($sysmsg as $smg){
|
||||||
//检验通知是否被写入个人收件箱
|
//检验通知ID是否被写入个人收件箱
|
||||||
$msgId = Db::name('message_to')->where('message_id',$smg['id'])->find();
|
$msgId = Db::name('message_to')->where('message_id',$smg['id'])->find();
|
||||||
if(!$msgId){
|
if(!$msgId){
|
||||||
$result = MessageTo::create(['send_id'=>$smg['user_id'],'receve_id'=>$uid,'message_id'=>$smg['id'],'message_type'=>$smg['type']]);
|
$result = MessageTo::create(['send_id'=>$smg['user_id'],'receve_id'=>$uid,'message_id'=>$smg['id'],'message_type'=>$smg['type']]);
|
||||||
|
124
public/static/admin/modules/addons.js
Normal file
124
public/static/admin/modules/addons.js
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
//网站app版本发布
|
||||||
|
|
||||||
|
layui.define(['table', 'form','upload'], function(exports){
|
||||||
|
var $ = layui.$
|
||||||
|
,table = layui.table
|
||||||
|
,form = layui.form
|
||||||
|
,upload = layui.upload;
|
||||||
|
|
||||||
|
//版本推送
|
||||||
|
table.render({
|
||||||
|
elem: '#addons-list',
|
||||||
|
url: addonsIndex,
|
||||||
|
limit: 5,
|
||||||
|
cols:[[
|
||||||
|
{type: 'numbers', fixed: 'left'},
|
||||||
|
{field: 'addons_name',title: '插件', width: 150},
|
||||||
|
{field: 'addons_version',title: '版本', width: 100},
|
||||||
|
{field: 'addons_auther',title: '作者', width: 100},
|
||||||
|
{field: 'addons_resume',title: '简介', minWidth: 200},
|
||||||
|
{field: 'addons_price',title: '价格(元)'},
|
||||||
|
{field: 'addons_status',title: '状态', width: 100},
|
||||||
|
{field: 'ctime',title: '时间', width: 150},
|
||||||
|
{title: '操作', width: 150, align:'center', fixed: 'right', toolbar: '#addons-tool'}
|
||||||
|
]]
|
||||||
|
,page: true
|
||||||
|
,limit: 10
|
||||||
|
,height: 'full-220'
|
||||||
|
,text: '对不起,加载出现异常!'
|
||||||
|
});
|
||||||
|
|
||||||
|
//监听工具条
|
||||||
|
table.on('tool(addons-list)', function(obj){
|
||||||
|
var data = obj.data;
|
||||||
|
if(obj.event === 'del'){
|
||||||
|
layer.prompt({
|
||||||
|
formType: 1
|
||||||
|
,title: '敏感操作,请验证口令'
|
||||||
|
}, function(value, index){
|
||||||
|
layer.close(index);
|
||||||
|
|
||||||
|
layer.confirm('真的删除行么', function(index){
|
||||||
|
//obj.del();
|
||||||
|
$.ajax({
|
||||||
|
type:'post',
|
||||||
|
url:addonsDelete,
|
||||||
|
data:{id:data.id},
|
||||||
|
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
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
table.reload('addons-list');
|
||||||
|
layer.close(index);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else if(obj.event === 'edit'){
|
||||||
|
var tr = $(obj.tr);
|
||||||
|
layer.open({
|
||||||
|
type: 2
|
||||||
|
,title: '编辑插件'
|
||||||
|
,content: addonsEdit + '?id='+ data.id
|
||||||
|
,maxmin: true
|
||||||
|
,area: ['400px', '620px']
|
||||||
|
,btn: ['确定', '取消']
|
||||||
|
,yes: function(index, layero){
|
||||||
|
|
||||||
|
var iframeWindow = window['layui-layer-iframe'+ index]
|
||||||
|
,submitID = 'LAY-addons-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:addonsEdit,
|
||||||
|
data:field,
|
||||||
|
daType:"json",
|
||||||
|
success:function (res){
|
||||||
|
if (res.code == 0) {
|
||||||
|
layer.msg(res.msg,{
|
||||||
|
icon:6,
|
||||||
|
time:2000
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
layer.open({
|
||||||
|
tiele:'修改失败',
|
||||||
|
content:res.msg,
|
||||||
|
icon:5,
|
||||||
|
anim:6
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
table.reload('addons-list'); //数据刷新
|
||||||
|
layer.close(index); //关闭弹层
|
||||||
|
});
|
||||||
|
|
||||||
|
submit.trigger('click');
|
||||||
|
}
|
||||||
|
,success: function(layero, index){
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
exports('addons', {})
|
||||||
|
});
|
@ -78,10 +78,8 @@ layui.define(['table', 'form', 'layedit','upload'], function(exports){
|
|||||||
dataType:"json",
|
dataType:"json",
|
||||||
success:function (data){
|
success:function (data){
|
||||||
if (data.code == 0) {
|
if (data.code == 0) {
|
||||||
conosle.log('123');
|
//$('#L_title').text('');
|
||||||
$('#L_title').text('');
|
//$('#L_content').text('');
|
||||||
|
|
||||||
$('#L_content').text('');
|
|
||||||
layer.msg(data.msg,{
|
layer.msg(data.msg,{
|
||||||
icon:6,
|
icon:6,
|
||||||
time:2000
|
time:2000
|
||||||
@ -97,7 +95,7 @@ layui.define(['table', 'form', 'layedit','upload'], function(exports){
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('#L_title').val('');
|
$('#L_title').val('');
|
||||||
$('#L_content').value = '';
|
$('#L_content').val('');
|
||||||
table.reload('notice-list'); //数据刷新
|
table.reload('notice-list'); //数据刷新
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<div class="fly-panel">
|
<div class="fly-panel">
|
||||||
<div class="fly-none">
|
<div class="fly-none">
|
||||||
<h2><i class="iconfont icon-404"></i></h2>
|
<h2><i class="iconfont icon-404"></i></h2>
|
||||||
<p>页面或者数据被<a href="http://www.aieok.com"> 纸飞机 </a>运到火星了,啥都看不到了…</p>
|
<p>页面或者数据被<a href="http://www.aieok.com"> 纸飞机</a>运到火星了,啥都看不到了…</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,46 +0,0 @@
|
|||||||
{extend name="public/base" /}
|
|
||||||
|
|
||||||
{block name="title"}404 - {$sysInfo.webname}{/block}
|
|
||||||
{block name="keywords"}{$sysInfo.keywords}{/block}
|
|
||||||
{block name="description"}{$sysInfo.descript}{/block}
|
|
||||||
{block name="column"}{include file="public/column" /}{/block}
|
|
||||||
{block name="content"}
|
|
||||||
<div class="layui-container fly-marginTop">
|
|
||||||
<div class="fly-panel">
|
|
||||||
<div class="fly-none">
|
|
||||||
<h2><i class="iconfont icon-404"></i></h2>
|
|
||||||
<p>页面或者数据被<a href="http://www.aieok.com"> 纸飞机 </a>运到火星了,啥都看不到了…</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/block}
|
|
||||||
|
|
||||||
{block name="script"}
|
|
||||||
<script>
|
|
||||||
layui.cache.page = 'user';
|
|
||||||
layui.cache.user = {
|
|
||||||
username: '{$user.name??'游客'}'
|
|
||||||
,uid: '{$user.id ?? -1}'
|
|
||||||
,avatar: '{$user['user_img'] ?? '/static/res/images/avatar/00.jpg'}'
|
|
||||||
,experience: '{$user.point ?? ''}'
|
|
||||||
,sex: '{$user.sex ? '女':'男'}'
|
|
||||||
};
|
|
||||||
layui.config({
|
|
||||||
version: "3.0.0"
|
|
||||||
,base: '/static/res/mods/'
|
|
||||||
}).extend({
|
|
||||||
fly: 'index'
|
|
||||||
}).use('fly');
|
|
||||||
</script>
|
|
||||||
{/block}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,57 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title>404 - TaoLer社区</title>
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
|
||||||
<meta name="keywords" content="fly,layui,前端社区">
|
|
||||||
<meta name="description" content="Fly社区是模块化前端UI框架Layui的官网社区,致力于为web开发提供强劲动力">
|
|
||||||
<link rel="stylesheet" href="/static/layui/css/layui.css">
|
|
||||||
<link rel="stylesheet" href="/static/res/css/global.css" charset="utf-8">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<include file="./index/public/header.html" />
|
|
||||||
<include file="./index/public/column" />
|
|
||||||
<div class="layui-container fly-marginTop">
|
|
||||||
<div class="fly-panel">
|
|
||||||
<div class="fly-none">
|
|
||||||
<h2><i class="iconfont icon-404"></i></h2>
|
|
||||||
<p>页面或者数据被<a href="/" target="_blank"> 纸飞机 </a>运到火星了,啥都看不到了…</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<include file="./footer" />
|
|
||||||
<script src="/static/layui/jquery.min.js" charset="utf-8"></script>
|
|
||||||
<script src="/static/layui/layui.js" charset="utf-8"></script>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
layui.cache.user = {
|
|
||||||
username: '{$user.name??'游客'}'
|
|
||||||
,uid: '{$user.id ?? -1}'
|
|
||||||
,avatar: '{$user['user_img'] ?? '/static/res/images/avatar/00.jpg'}'
|
|
||||||
,experience: '{$user.point ?? ''}'
|
|
||||||
,sex: '{$user.sex ? '女':'男'}'
|
|
||||||
};
|
|
||||||
layui.config({
|
|
||||||
version: "3.0.0"
|
|
||||||
,base: '/static/res/mods/'
|
|
||||||
}).extend({
|
|
||||||
fly: 'index'
|
|
||||||
}).use('fly');
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user