|
|
@@ -29,19 +29,19 @@ class Videoplatform extends Backend
|
|
|
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
|
|
|
|
|
// 强制指定排序字段别名
|
|
|
-// if ($sort === 'id') {
|
|
|
-// $sort = 'video_platform.id';
|
|
|
-// }
|
|
|
+ if ($sort === 'id') {
|
|
|
+ $sort = 'video_platform.id';
|
|
|
+ }
|
|
|
|
|
|
$total = $this->model
|
|
|
- ->with('videolist')
|
|
|
+ ->with('videolist,platform')
|
|
|
->where($where)
|
|
|
-// ->order($sort, $order)
|
|
|
+ ->order($sort)
|
|
|
->count();
|
|
|
$list = $this->model
|
|
|
- ->with('videolist')
|
|
|
+ ->with('videolist,platform')
|
|
|
->where($where)
|
|
|
-// ->order($sort, $order)
|
|
|
+ ->order($sort)
|
|
|
->limit($offset, $limit)
|
|
|
->select();
|
|
|
$result = ["total" => $total, "rows" => $list];
|
|
|
@@ -49,37 +49,50 @@ class Videoplatform extends Backend
|
|
|
}
|
|
|
return $this->view->fetch();
|
|
|
}
|
|
|
-
|
|
|
- // 添加
|
|
|
- public function add()
|
|
|
+ /**
|
|
|
+ * 编辑
|
|
|
+ */
|
|
|
+ public function edit($ids = NULL)
|
|
|
{
|
|
|
- if ($this->request->isPost()) {
|
|
|
- $params = $this->request->post("row/a");
|
|
|
- if ($params) {
|
|
|
- $result = $this->model->save($params);
|
|
|
- if ($result) $this->success();
|
|
|
- $this->error(__('操作失败'));
|
|
|
- }
|
|
|
- $this->error(__('参数错误'));
|
|
|
- }
|
|
|
- return $this->view->fetch();
|
|
|
+ $row = $this->model->get($ids);
|
|
|
+ if (!$row)
|
|
|
+ $this->error(__('No Results were found'));
|
|
|
+ return parent::edit($ids);
|
|
|
}
|
|
|
-
|
|
|
- // 编辑
|
|
|
- public function edit($ids = null)
|
|
|
+ public function add()
|
|
|
{
|
|
|
- $row = $this->model->get($ids);
|
|
|
- if (!$row) $this->error(__('记录不存在'));
|
|
|
- if ($this->request->isPost()) {
|
|
|
- $params = $this->request->post("row/a");
|
|
|
- if ($params) {
|
|
|
- $result = $row->save($params);
|
|
|
- if ($result) $this->success();
|
|
|
- $this->error(__('操作失败'));
|
|
|
- }
|
|
|
- $this->error(__('参数错误'));
|
|
|
- }
|
|
|
- $this->assign('row', $row);
|
|
|
- return $this->view->fetch();
|
|
|
+ return parent::add();
|
|
|
}
|
|
|
+// // 添加
|
|
|
+// public function add()
|
|
|
+// {
|
|
|
+// if ($this->request->isPost()) {
|
|
|
+// $params = $this->request->post("row/a");
|
|
|
+// if ($params) {
|
|
|
+// $result = $this->model->save($params);
|
|
|
+// if ($result) $this->success();
|
|
|
+// $this->error(__('操作失败'));
|
|
|
+// }
|
|
|
+// $this->error(__('参数错误'));
|
|
|
+// }
|
|
|
+// return $this->view->fetch();
|
|
|
+// }
|
|
|
+//
|
|
|
+// // 编辑
|
|
|
+// public function edit($ids = null)
|
|
|
+// {
|
|
|
+// $row = $this->model->get($ids);
|
|
|
+// if (!$row) $this->error(__('记录不存在'));
|
|
|
+// if ($this->request->isPost()) {
|
|
|
+// $params = $this->request->post("row/a");
|
|
|
+// if ($params) {
|
|
|
+// $result = $row->save($params);
|
|
|
+// if ($result) $this->success();
|
|
|
+// $this->error(__('操作失败'));
|
|
|
+// }
|
|
|
+// $this->error(__('参数错误'));
|
|
|
+// }
|
|
|
+// $this->assign('row', $row);
|
|
|
+// return $this->view->fetch();
|
|
|
+// }
|
|
|
}
|