更新
This commit is contained in:
@@ -7,8 +7,8 @@
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\admin\controller;
|
||||
use app\common\controller\Admin;
|
||||
namespace app\controller\admin;
|
||||
use app\controller\Admin;
|
||||
|
||||
/**
|
||||
* @title 广告管理
|
||||
@@ -21,7 +21,7 @@ class Ad extends Admin {
|
||||
|
||||
public function _initialize() {
|
||||
parent::_initialize();
|
||||
$this->ad = db('Ad');
|
||||
$this->ad = db('Ad');
|
||||
$this->adplace = db('AdPlace');
|
||||
}
|
||||
|
||||
@@ -29,12 +29,12 @@ class Ad extends Admin {
|
||||
* @title 广告位管理
|
||||
*/
|
||||
public function index() {
|
||||
$map = array();
|
||||
$map = array();
|
||||
$order = "id desc";
|
||||
|
||||
$list = db('AdPlace')->where($map)->order($order)->paginate(10, false, array(
|
||||
'query' => $this->request->param()
|
||||
));
|
||||
'query' => $this->request->param(),
|
||||
));
|
||||
$data = array(
|
||||
'list' => $list,
|
||||
'page' => $list->render(),
|
||||
@@ -51,14 +51,14 @@ class Ad extends Admin {
|
||||
$place = model('AdPlace');
|
||||
if ($this->request->isPost()) {
|
||||
$result = $place->change();
|
||||
if (!empty($_POST['name'])){
|
||||
if (!empty($_POST['name'])) {
|
||||
$result = $place->change();
|
||||
if ($result) {
|
||||
return $this->success("添加成功!");
|
||||
} else {
|
||||
return $this->error($place->getError());
|
||||
}
|
||||
}else{
|
||||
}
|
||||
} else {
|
||||
return $this->error("标识不能为空!");
|
||||
}
|
||||
} else {
|
||||
@@ -89,7 +89,7 @@ class Ad extends Admin {
|
||||
return $this->error("非法操作!");
|
||||
}
|
||||
$data = array(
|
||||
'info' => $info,
|
||||
'info' => $info,
|
||||
'keyList' => $place->keyList,
|
||||
);
|
||||
$this->assign($data);
|
||||
@@ -108,7 +108,7 @@ class Ad extends Admin {
|
||||
return $this->error("非法操作!");
|
||||
}
|
||||
$map['id'] = array('IN', $id);
|
||||
$result = $this->adplace->where($map)->delete();
|
||||
$result = $this->adplace->where($map)->delete();
|
||||
if ($result) {
|
||||
return $this->success("删除成功!");
|
||||
} else {
|
||||
@@ -121,13 +121,13 @@ class Ad extends Admin {
|
||||
*/
|
||||
public function lists($id = null) {
|
||||
$map['place_id'] = $id;
|
||||
$order = "id desc";
|
||||
$order = "id desc";
|
||||
|
||||
$list = db('Ad')->where($map)->order($order)->paginate(10, false, array(
|
||||
'query' => $this->request->param()
|
||||
));
|
||||
'query' => $this->request->param(),
|
||||
));
|
||||
$data = array(
|
||||
'id' => $id,
|
||||
'id' => $id,
|
||||
'list' => $list,
|
||||
'page' => $list->render(),
|
||||
);
|
||||
@@ -150,8 +150,8 @@ class Ad extends Admin {
|
||||
}
|
||||
} else {
|
||||
$info['place_id'] = $id;
|
||||
$data = array(
|
||||
'info' => $info,
|
||||
$data = array(
|
||||
'info' => $info,
|
||||
'keyList' => $ad->keyList,
|
||||
);
|
||||
$this->assign($data);
|
||||
@@ -178,7 +178,7 @@ class Ad extends Admin {
|
||||
return $this->error("非法操作!");
|
||||
}
|
||||
$data = array(
|
||||
'info' => $info,
|
||||
'info' => $info,
|
||||
'keyList' => $ad->keyList,
|
||||
);
|
||||
$this->assign($data);
|
||||
@@ -197,7 +197,7 @@ class Ad extends Admin {
|
||||
return $this->error("非法操作!");
|
||||
}
|
||||
$map['id'] = array('IN', $id);
|
||||
$result = db('ad')->where($map)->delete();
|
||||
$result = db('ad')->where($map)->delete();
|
||||
if ($result) {
|
||||
return $this->success("删除成功!");
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user