Files
SRCMS/Application/Admin/Controller/OrderController.class.php
Martin Zhou 65e4506677 SRCMS·轻响应框架 V1.5正式版
SRCMS是专门为中小企业和互联网产品创业团队打造的应急响应中心网站建站框架
2016-01-24 11:54:16 +08:00

52 lines
1.4 KiB
PHP

<?php
namespace Admin\Controller;
use Admin\Controller;
/**
* @author Zhou Yuyang <1009465756@qq.com> 12:28 2016/1/23
* @copyright 2105-2018 SRCMS
* @homepage http://www.src.pw
* @version 1.5
*/
/**
* 单页管理
*/
class OrderController extends BaseController
{
/**
* 单页列表
* @return [type] [description]
*/
public function index($key="")
{
if($key == ""){
$model = M('order');
}else{
$where['title'] = array('like',"%$key%");
$where['name'] = array('like',"%$key%");
$where['_logic'] = 'or';
$model = M('order')->where($where);
}
$count = $model->where($where)->count();// 查询满足要求的总记录数
$Page = new \Extend\Page($count,15);// 实例化分页类 传入总记录数和每页显示的记录数(25)
$show = $Page->show();// 分页显示输出
$pages = $model->limit($Page->firstRow.','.$Page->listRows)->where($where)->order('id DESC')->select();
$this->assign('model', $pages);
$this->assign('page',$show);
$this->display();
}
public function delete()
{
$id = I('get.id',0,'intval');
$model = M('order');
$result = $model->where("user_id=".$id)->delete();
if($result){
$this->success("删除成功", U('info/index'));
}else{
$this->error("删除失败");
}
}
}