You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
2.3 KiB
PHTML

2 years ago
<?php
namespace Admin\Controller;
class MsgController extends ThinkController{
public function lists($p=0){
$page = intval($p);
$page = $page ? $page : 1; //默认显示第一页数据
if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}
$map['user_id'] = session('user_auth.uid');
$map['status'] = array('neq','-1');
if(isset($_REQUEST['status'])){
if($_REQUEST['status']=='未读'){
$map['status']=2;
}elseif($_REQUEST['status']=='已读'){
$map['status']=1;
}
}
$data = D('Msg')->where($map)->page($page,$row)->order('status desc,create_time desc')->select();
$count = D('Msg')->where($map)->count();
$page = set_pagination($count,$row);
if($page) {$this->assign('_page', $page);}
$this->assign('list_data',$data);
$this->meta_title = "站内通知";
$this->m_title = '站内通知';
$this->assign('commonset',M('Kuaijieicon')->where(['url'=>'Msg/lists','status'=>1])->find());
$this->display();
}
public function read($ids=0){
/* if (!empty($ids)) {
$map['id'] = array('in', $ids);
$res = M('Msg', 'tab_')->where($map)->setField(array('status' => 1));
}
if (I('type') == 2){
$this->redirect("http://".$_SERVER['HTTP_HOST']."admin.php?s=/Msg/lists");
}else{
$this->success();
} */
if(empty($ids)){
$this->error('请选择要操作的数据');
}
$map['id'] = array('in',$ids);
$data = array('status' => 1);
$this->editRow( 'Msg' , $data, $map, array( 'success'=>'操作成功!', 'error'=>'操作失败!'));
}
public function looktoread($ids=0){
$model= M('Msg', 'tab_');
if (!empty($ids)) {
$map['id'] = $ids;
$res = $model->where($map)->setField(array('status' => 1));
}
$look= $model->where(['id'=>$ids])->find();
redirect("http://".$_SERVER['HTTP_HOST'] . '/admin.php?s=/Apply/and_lists/type/'.$look['sdk_version'].'/game_id/'.$look['game_id']);
}
}