WIN-2308041133\Administrator 8 달 전
부모
커밋
8f7abfd8fc
2개의 변경된 파일34개의 추가작업 그리고 34개의 파일을 삭제
  1. 34 34
      application/admin/controller/platform/Platform.php
  2. 0 0
      application/common/model/Platform.php

+ 34 - 34
application/admin/controller/platform/Platform.php

@@ -4,23 +4,39 @@ namespace app\admin\controller\platform;
 
 use app\common\controller\Backend;
 
+/**
+ * 第三方平台列表
+ *
+ */
 class Platform extends Backend
 {
-    // 模型对象
+
+    protected $relationSearch = true;
+
+
     protected $model = null;
 
     public function _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()
     {
+        //设置过滤方法
+
+        $this->request->filter(['strip_tags']);
         if ($this->request->isAjax()) {
+            //如果发送的来源是Selectpage,则转发到Selectpage
+            if ($this->request->request('keyField')) {
+                return $this->selectpage();
+            }
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
             $total = $this->model
                 ->where($where)
@@ -31,41 +47,25 @@ class Platform extends Backend
                 ->order($sort, $order)
                 ->limit($offset, $limit)
                 ->select();
-            $result = [
-                "total" => $total,
-                "rows" => $list,
-            ];
+            $result = array("total" => $total, "rows" => $list);
             return json($result);
         }
         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();
     }
-}
+
+}

+ 0 - 0
application/common/model/platform.php → application/common/model/Platform.php