You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
115 lines
4.1 KiB
115 lines
4.1 KiB
7 months ago
|
<?php
|
||
|
class Admin_NewController extends Ctrl_Admin{
|
||
|
public function indexAction(){
|
||
|
//权限判断跳转
|
||
|
/*$tMsg = '';
|
||
|
switch($_SESSION['admin']['roles']){
|
||
|
case 5:$tMsg = '/admin_purchases/';break;
|
||
|
case 8:$tMsg = '/admin_overseer/';break;
|
||
|
case 10:$tMsg = '/admin_wages/';break;
|
||
|
default:$tMsg = '/admin_senior/';break;
|
||
|
}*/
|
||
|
}
|
||
|
public function activeAction(){
|
||
|
//权限判断跳转
|
||
|
/*$tMsg = '';
|
||
|
switch($_SESSION['admin']['roles']){
|
||
|
case 5:$tMsg = '/admin_purchases/';break;
|
||
|
case 8:$tMsg = '/admin_overseer/';break;
|
||
|
case 10:$tMsg = '/admin_wages/';break;
|
||
|
default:$tMsg = '/admin_senior/';break;
|
||
|
}*/
|
||
|
}
|
||
|
public function schoolAction(){
|
||
|
//权限判断跳转
|
||
|
/*$tMsg = '';
|
||
|
switch($_SESSION['admin']['roles']){
|
||
|
case 5:$tMsg = '/admin_purchases/';break;
|
||
|
case 8:$tMsg = '/admin_overseer/';break;
|
||
|
case 10:$tMsg = '/admin_wages/';break;
|
||
|
default:$tMsg = '/admin_senior/';break;
|
||
|
}*/
|
||
|
}
|
||
|
public function dangjianAction(){
|
||
|
//权限判断跳转
|
||
|
/*$tMsg = '';
|
||
|
switch($_SESSION['admin']['roles']){
|
||
|
case 5:$tMsg = '/admin_purchases/';break;
|
||
|
case 8:$tMsg = '/admin_overseer/';break;
|
||
|
case 10:$tMsg = '/admin_wages/';break;
|
||
|
default:$tMsg = '/admin_senior/';break;
|
||
|
}*/
|
||
|
}
|
||
|
public function zhaoshengAction(){
|
||
|
//权限判断跳转
|
||
|
/*$tMsg = '';
|
||
|
switch($_SESSION['admin']['roles']){
|
||
|
case 5:$tMsg = '/admin_purchases/';break;
|
||
|
case 8:$tMsg = '/admin_overseer/';break;
|
||
|
case 10:$tMsg = '/admin_wages/';break;
|
||
|
default:$tMsg = '/admin_senior/';break;
|
||
|
}*/
|
||
|
}
|
||
|
public function hezuoAction(){
|
||
|
//权限判断跳转
|
||
|
/*$tMsg = '';
|
||
|
switch($_SESSION['admin']['roles']){
|
||
|
case 5:$tMsg = '/admin_purchases/';break;
|
||
|
case 8:$tMsg = '/admin_overseer/';break;
|
||
|
case 10:$tMsg = '/admin_wages/';break;
|
||
|
default:$tMsg = '/admin_senior/';break;
|
||
|
}*/
|
||
|
}
|
||
|
public function zhoubaoAction(){
|
||
|
//权限判断跳转
|
||
|
/*$tMsg = '';
|
||
|
switch($_SESSION['admin']['roles']){
|
||
|
case 5:$tMsg = '/admin_purchases/';break;
|
||
|
case 8:$tMsg = '/admin_overseer/';break;
|
||
|
case 10:$tMsg = '/admin_wages/';break;
|
||
|
default:$tMsg = '/admin_senior/';break;
|
||
|
}*/
|
||
|
}
|
||
|
public function saveAction(){
|
||
|
$p = $_REQUEST;
|
||
|
$title = empty($p['title'])?Tool_Fnc::ajaxMsg('请填写标题'):$p['title'];
|
||
|
$img = empty($p['img'])?Tool_Fnc::ajaxMsg('请上传图片'):$p['img'];
|
||
|
$content = empty($p['content'])?Tool_Fnc::ajaxMsg('请填写内容'):$p['content'];
|
||
|
$type = empty($p['type'])?Tool_Fnc::ajaxMsg('请填写内容'):$p['type'];
|
||
|
$AMD = new ActiveModel;
|
||
|
if(!empty($id)){
|
||
|
$Data['id'] = $id;
|
||
|
}
|
||
|
$Data['log'] = $img;
|
||
|
$Data['content'] = $content;
|
||
|
$Data['type'] = $type;
|
||
|
$Data['title'] = $title;
|
||
|
$Data['created'] = date('Y-m-d h:i:s',time());
|
||
|
$Data['status'] = 1;
|
||
|
if(!$AMD->save($Data)){
|
||
|
Tool_Fnc::ajaxMsg('操作失败');
|
||
|
}
|
||
|
Tool_Fnc::ajaxMsg('操作成功',1);
|
||
|
}
|
||
|
public function listAction(){
|
||
|
$p = $_REQUEST;
|
||
|
$page = $p['page'];
|
||
|
$limit = $p['limit'];
|
||
|
$type = $p['type'];
|
||
|
$offset = ($page-1)*$limit;
|
||
|
$AMD = new ActiveModel;
|
||
|
$sql = "select * from active where type={$type} and status=1";
|
||
|
$count = $AMD->query($sql);
|
||
|
$sql = "select * from active where type={$type} and status=1 order by id desc limit {$offset},{$limit} ";
|
||
|
$data = $AMD->query($sql);
|
||
|
foreach ($data as $key => &$val){
|
||
|
$val['content'] = strip_tags($val['content']);
|
||
|
}
|
||
|
$return['code'] = 0;
|
||
|
$return['count'] = count($count);
|
||
|
$return['data'] = $data;
|
||
|
$return['msg'] = "成功";
|
||
|
echo json_encode($return);die;
|
||
|
}
|
||
|
}
|