|
@@ -4,23 +4,39 @@ namespace app\admin\controller\platform;
|
|
|
|
|
|
|
|
use app\common\controller\Backend;
|
|
use app\common\controller\Backend;
|
|
|
|
|
|
|
|
|
|
+/**
|
|
|
|
|
+ * 第三方平台列表
|
|
|
|
|
+ *
|
|
|
|
|
+ */
|
|
|
class Platform extends Backend
|
|
class Platform extends Backend
|
|
|
{
|
|
{
|
|
|
- // 模型对象
|
|
|
|
|
|
|
+
|
|
|
|
|
+ protected $relationSearch = true;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
protected $model = null;
|
|
protected $model = null;
|
|
|
|
|
|
|
|
public function _initialize()
|
|
public function _initialize()
|
|
|
{
|
|
{
|
|
|
parent::_initialize();
|
|
parent::_initialize();
|
|
|
- $this->model = new \app\admin\model\third\Platform;
|
|
|
|
|
-// $this->model = model('Platform');
|
|
|
|
|
-// $this->model = model('app\common\model\Platform');
|
|
|
|
|
|
|
+// $this->model = new \app\admin\model\third\Platform;
|
|
|
|
|
+ $this->model = new \app\common\model\Platform;
|
|
|
|
|
+// $this->model = model('platform');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 列表页
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 查看
|
|
|
|
|
+ */
|
|
|
public function index()
|
|
public function index()
|
|
|
{
|
|
{
|
|
|
|
|
+ //设置过滤方法
|
|
|
|
|
+
|
|
|
|
|
+ $this->request->filter(['strip_tags']);
|
|
|
if ($this->request->isAjax()) {
|
|
if ($this->request->isAjax()) {
|
|
|
|
|
+ //如果发送的来源是Selectpage,则转发到Selectpage
|
|
|
|
|
+ if ($this->request->request('keyField')) {
|
|
|
|
|
+ return $this->selectpage();
|
|
|
|
|
+ }
|
|
|
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
|
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
|
|
$total = $this->model
|
|
$total = $this->model
|
|
|
->where($where)
|
|
->where($where)
|
|
@@ -31,41 +47,25 @@ class Platform extends Backend
|
|
|
->order($sort, $order)
|
|
->order($sort, $order)
|
|
|
->limit($offset, $limit)
|
|
->limit($offset, $limit)
|
|
|
->select();
|
|
->select();
|
|
|
- $result = [
|
|
|
|
|
- "total" => $total,
|
|
|
|
|
- "rows" => $list,
|
|
|
|
|
- ];
|
|
|
|
|
|
|
+ $result = array("total" => $total, "rows" => $list);
|
|
|
return json($result);
|
|
return json($result);
|
|
|
}
|
|
}
|
|
|
return $this->view->fetch();
|
|
return $this->view->fetch();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 添加/编辑
|
|
|
|
|
- public function add()
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 编辑
|
|
|
|
|
+ */
|
|
|
|
|
+ public function edit($ids = NULL)
|
|
|
{
|
|
{
|
|
|
- if ($this->request->isPost()) {
|
|
|
|
|
- $params = $this->request->post("row/a");
|
|
|
|
|
- if ($params) {
|
|
|
|
|
- $params['createtime'] = time(); // 自动填充时间戳
|
|
|
|
|
- $result = $this->model->save($params);
|
|
|
|
|
- if ($result) {
|
|
|
|
|
- $this->success();
|
|
|
|
|
- } else {
|
|
|
|
|
- $this->error(__('Operation failed'));
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- $this->error(__('Parameter %s can not be empty', ''));
|
|
|
|
|
- }
|
|
|
|
|
- return $this->view->fetch();
|
|
|
|
|
|
|
+ $row = $this->model->get($ids);
|
|
|
|
|
+ if (!$row)
|
|
|
|
|
+ $this->error(__('No Results were found'));
|
|
|
|
|
+ return parent::edit($ids);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- // 删除
|
|
|
|
|
- public function del($ids = "")
|
|
|
|
|
|
|
+ public function add()
|
|
|
{
|
|
{
|
|
|
- if ($ids) {
|
|
|
|
|
- $this->model->destroy($ids);
|
|
|
|
|
- $this->success();
|
|
|
|
|
- }
|
|
|
|
|
- $this->error(__('Parameter %s can not be empty', 'ids'));
|
|
|
|
|
|
|
+ return parent::add();
|
|
|
}
|
|
}
|
|
|
-}
|
|
|
|
|
|
|
+
|
|
|
|
|
+}
|