public function doSlide()
{
list($id, $title, $image, $type, $data) = array($_GET['id'], $_POST['title'], $_POST['image'], $_POST['type'], $_POST['data']);
list($id, $title, $image, $type, $data) = array(intval($id), t($title), intval($image), t($type), $data);
if (!in_array($type, array('false', 'url', 'weiba', 'post', 'weibo', 'topic', 'channel', 'user'))) {
$this->error('跳转类型不正确');
} elseif (!$title) {
$this->error('标题不能为空');
} elseif (!$image) {
$this->error('必须上传轮播图片');
} elseif (in_array($type, array('url', 'weiba', 'post', 'weibo', 'topic', 'channel', 'user') and !$data)) {
$this->error('您设置的跳转类型必须设置类型参数');
}
$data = array('title' => $title, 'image' => $image, 'type' => $type, 'data' => $data);
if ($id and D('application_slide')->where('`id` = ' . $id)->field('id')->count()) {
D('application_slide')->where('`id` = ' . $id)->save($data);
$this->success('修改成功');
}
D('application_slide')->data($data)->add() or $this->error('添加失败');
$this->assign('jumpUrl', U('admin/Application/index'));
$this->success('添加成功');
}