notice message
This commit is contained in:
parent
642404359a
commit
ce856b2502
@ -36,7 +36,8 @@ class Notice extends AdminController
|
|||||||
//添加消息
|
//添加消息
|
||||||
public function add()
|
public function add()
|
||||||
{
|
{
|
||||||
$sendId = Session::get('user_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']; //个人通知
|
||||||
|
@ -27,7 +27,7 @@ class User extends AdminController
|
|||||||
{
|
{
|
||||||
if(Request::isAjax()){
|
if(Request::isAjax()){
|
||||||
$datas = Request::only(['id','name','email','sex']);
|
$datas = Request::only(['id','name','email','sex']);
|
||||||
$map = array_filter($datas);
|
$map = array_filter($datas,[$this,'filtrArr']);
|
||||||
$user = Db::name('user')->where(['delete_time'=>0])->where($map)->order('id desc')->select();
|
$user = Db::name('user')->where(['delete_time'=>0])->where($map)->order('id desc')->select();
|
||||||
$count = $user->count();
|
$count = $user->count();
|
||||||
$res = [];
|
$res = [];
|
||||||
@ -167,4 +167,13 @@ class User extends AdminController
|
|||||||
return json($res);
|
return json($res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//过滤数组中为空和null的值
|
||||||
|
public function filtrArr($arr)
|
||||||
|
{
|
||||||
|
if($arr === '' || $arr === null){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -50,17 +50,23 @@ class Message extends BaseController
|
|||||||
{
|
{
|
||||||
$id =input('id');
|
$id =input('id');
|
||||||
//$msg = Db::name('message_to')->where('id',$id)->save(['is_read'=>1]);
|
//$msg = Db::name('message_to')->where('id',$id)->save(['is_read'=>1]);
|
||||||
|
if($id){
|
||||||
$msg = MessageTo::field('id,message_id')->with(['messages' => function($query){
|
$msg = MessageTo::field('id,message_id')->with(['messages' => function($query){
|
||||||
$query->where('delete_time',0)->field('id,content');
|
$query->where('delete_time',0)->field('id,content');
|
||||||
}])->where('id',$id)->find();
|
}])->where('id',$id)->find();
|
||||||
//改变读状态
|
//改变读状态
|
||||||
$result = $msg->update(['id'=>$id,'is_read'=>1]);
|
$result = $msg->update(['id'=>$id,'is_read'=>1]);
|
||||||
if($result){
|
if($result){
|
||||||
$res=['status' =>0,'content'=>$msg['messages']['content']];
|
$res=['status' =>0,'content'=>$msg['messages']['content']];
|
||||||
return json($res);
|
return json($res);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return json(['status' =>0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//消息删除
|
//消息删除
|
||||||
|
@ -139,7 +139,7 @@ class User extends BaseController
|
|||||||
public function home($id)
|
public function home($id)
|
||||||
{
|
{
|
||||||
//用户
|
//用户
|
||||||
$u = Db::name('user')->field('name,nickname,city,sex,sign,user_img,point,create_time')->cache(3600)->find($id);
|
$u = Db::name('user')->field('name,nickname,city,sex,sign,user_img,point,vip,create_time')->cache(3600)->find($id);
|
||||||
//用户发贴
|
//用户发贴
|
||||||
$arts = Db::name('user')->alias('u')->join('article a','u.id = a.user_id')->field('u.id,a.id,a.title,a.pv,a.is_hot,a.create_time,a.delete_time')->where('a.delete_time',0)->where('a.user_id',$id)->order(['a.create_time'=>'desc'])->cache(3600)->select();
|
$arts = Db::name('user')->alias('u')->join('article a','u.id = a.user_id')->field('u.id,a.id,a.title,a.pv,a.is_hot,a.create_time,a.delete_time')->where('a.delete_time',0)->where('a.user_id',$id)->order(['a.create_time'=>'desc'])->cache(3600)->select();
|
||||||
//用户回答
|
//用户回答
|
||||||
|
@ -249,7 +249,7 @@ CREATE TABLE `tao_message` (
|
|||||||
`title` varchar(255) NOT NULL COMMENT '消息标题',
|
`title` varchar(255) NOT NULL COMMENT '消息标题',
|
||||||
`content` text COMMENT '消息内容',
|
`content` text COMMENT '消息内容',
|
||||||
`user_id` int(11) NOT NULL COMMENT '发送人ID',
|
`user_id` int(11) NOT NULL COMMENT '发送人ID',
|
||||||
`link` varchar(255) NOT NULL COMMENT '链接',
|
`link` varchar(255) COMMENT '链接',
|
||||||
`type` tinyint(1) NOT NULL DEFAULT '1' COMMENT '消息类型0系统消息1普通消息',
|
`type` tinyint(1) NOT NULL DEFAULT '1' COMMENT '消息类型0系统消息1普通消息',
|
||||||
`create_time` int(11) NOT NULL COMMENT '创建时间',
|
`create_time` int(11) NOT NULL COMMENT '创建时间',
|
||||||
`update_time` int(11) NOT NULL COMMENT '更新时间',
|
`update_time` int(11) NOT NULL COMMENT '更新时间',
|
||||||
|
@ -71,7 +71,6 @@
|
|||||||
,table = layui.table
|
,table = layui.table
|
||||||
,form = layui.form;
|
,form = layui.form;
|
||||||
/*
|
/*
|
||||||
//发站内通知信息
|
|
||||||
form.on('select(type)', function(data){
|
form.on('select(type)', function(data){
|
||||||
var tpl = '<div class="layui-col-md12">\
|
var tpl = '<div class="layui-col-md12">\
|
||||||
<label for="L_title" class="layui-form-label">收件人</label>\
|
<label for="L_title" class="layui-form-label">收件人</label>\
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
{$u.nickname ?: $u.name}
|
{$u.nickname ?: $u.name}
|
||||||
{if($u.sex==0)}<i class="iconfont icon-nan"></i>
|
{if($u.sex==0)}<i class="iconfont icon-nan"></i>
|
||||||
{else}<i class="iconfont icon-nv"></i> {/if}
|
{else}<i class="iconfont icon-nv"></i> {/if}
|
||||||
<i class="layui-badge fly-badge-vip">VIP3</i>
|
<i class="layui-badge fly-badge-vip">VIP{$u.vip}</i>
|
||||||
<!--
|
<!--
|
||||||
<span style="color:#c00;">(管理员)</span>
|
<span style="color:#c00;">(管理员)</span>
|
||||||
<span style="color:#5FB878;">(社区之光)</span>
|
<span style="color:#5FB878;">(社区之光)</span>
|
||||||
|
@ -27,45 +27,40 @@
|
|||||||
var id = $(this).attr('id-data');
|
var id = $(this).attr('id-data');
|
||||||
var othis = $(this);
|
var othis = $(this);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type:"post",
|
type:"post",
|
||||||
url:"{:url('message/read')}",
|
url:"{:url('message/read')}",
|
||||||
data:{"id":id},
|
data:{"id":id},
|
||||||
daType:"json",
|
daType:"json",
|
||||||
success:function (res){
|
success:function (res){
|
||||||
if(res.status == 0){
|
if(res.status == 0){
|
||||||
location.reload();
|
location.reload();
|
||||||
//othis.append('<span class="float:right">已读</span>');
|
//othis.append('<span class="float:right">已读</span>');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//点开标题写入系统信已读
|
//点开标题写入系统信已读
|
||||||
$('#LAY_minemsg').on('click','.sys-title', function(){
|
$('#LAY_minemsg').on('click','.sys-title', function(){
|
||||||
var id = $(this).attr('id-data');
|
var id = $(this).attr('id-data');
|
||||||
//var othis = $(this);
|
var othis = $(this);
|
||||||
console.log(id);
|
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type:"post",
|
type:"post",
|
||||||
url:"{:url('message/read')}",
|
url:"{:url('message/read')}",
|
||||||
data:{"id":id},
|
data:{"id":id},
|
||||||
daType:"json",
|
daType:"json",
|
||||||
success:function (res){
|
success:function (res){
|
||||||
if(res.status == 0){
|
if(res.status == 0){
|
||||||
layer.open({
|
layer.open({
|
||||||
type: 1,
|
type: 1,
|
||||||
skin: 'layui-layer-rim', //加上边框
|
skin: 'layui-layer-rim', //加上边框
|
||||||
area: ['420px', '240px'], //宽高
|
area: ['500px', '350px'], //宽高
|
||||||
content: '<div class="layui-form" tyle="padding: 20px 30px 0 0;"> '+ res.content +'</div>'
|
content: '<div class="layui-form" style="padding: 10px 20px 0 20px;"> '+ res.content +'</div>'
|
||||||
});
|
});
|
||||||
//location.reload();
|
//location.reload(); //数据刷新
|
||||||
//othis.append('<span class="float:right">已读</span>');
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user