|
@@ -1,75 +1,69 @@
|
|
|
<?php
|
|
<?php
|
|
|
|
|
|
|
|
-namespace app\admin\controller\platform;
|
|
|
|
|
|
|
+namespace app\admin\controller\third;
|
|
|
|
|
|
|
|
use app\common\controller\Backend;
|
|
use app\common\controller\Backend;
|
|
|
|
|
|
|
|
-/**
|
|
|
|
|
- * 第三方平台列表
|
|
|
|
|
- *
|
|
|
|
|
- * @icon fa fa-user
|
|
|
|
|
- */
|
|
|
|
|
class Platform extends Backend
|
|
class Platform extends Backend
|
|
|
{
|
|
{
|
|
|
-
|
|
|
|
|
- protected $relationSearch = true;
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * @var \app\admin\model\User
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ // 模型对象
|
|
|
protected $model = null;
|
|
protected $model = null;
|
|
|
|
|
|
|
|
public function _initialize()
|
|
public function _initialize()
|
|
|
{
|
|
{
|
|
|
parent::_initialize();
|
|
parent::_initialize();
|
|
|
- $this->model = model('platform');
|
|
|
|
|
|
|
+ $this->model = new \app\admin\model\third\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
|
|
|
-// ->with('user')
|
|
|
|
|
->where($where)
|
|
->where($where)
|
|
|
->order($sort, $order)
|
|
->order($sort, $order)
|
|
|
->count();
|
|
->count();
|
|
|
$list = $this->model
|
|
$list = $this->model
|
|
|
-// ->with('user')
|
|
|
|
|
->where($where)
|
|
->where($where)
|
|
|
->order($sort, $order)
|
|
->order($sort, $order)
|
|
|
->limit($offset, $limit)
|
|
->limit($offset, $limit)
|
|
|
->select();
|
|
->select();
|
|
|
- $result = array("total" => $total, "rows" => $list);
|
|
|
|
|
|
|
+ $result = [
|
|
|
|
|
+ "total" => $total,
|
|
|
|
|
+ "rows" => $list,
|
|
|
|
|
+ ];
|
|
|
return json($result);
|
|
return json($result);
|
|
|
}
|
|
}
|
|
|
return $this->view->fetch();
|
|
return $this->view->fetch();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 编辑
|
|
|
|
|
- */
|
|
|
|
|
- public function edit($ids = NULL)
|
|
|
|
|
- {
|
|
|
|
|
- $row = $this->model->get($ids);
|
|
|
|
|
- if (!$row)
|
|
|
|
|
- $this->error(__('No Results were found'));
|
|
|
|
|
- return parent::edit($ids);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 添加/编辑
|
|
|
public function add()
|
|
public function add()
|
|
|
{
|
|
{
|
|
|
- return parent::add();
|
|
|
|
|
|
|
+ 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();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-}
|
|
|
|
|
|
|
+ // 删除
|
|
|
|
|
+ public function del($ids = "")
|
|
|
|
|
+ {
|
|
|
|
|
+ if ($ids) {
|
|
|
|
|
+ $this->model->destroy($ids);
|
|
|
|
|
+ $this->success();
|
|
|
|
|
+ }
|
|
|
|
|
+ $this->error(__('Parameter %s can not be empty', 'ids'));
|
|
|
|
|
+ }
|
|
|
|
|
+}
|