WIN-2308041133\Administrator 7 months ago
parent
commit
eb17856416
1 changed files with 20 additions and 23 deletions
  1. 20 23
      application/admin/controller/platform/Vplatform.php

+ 20 - 23
application/admin/controller/platform/Vplatform.php

@@ -26,28 +26,25 @@ class Vplatform extends Backend
     {
         $this->request->filter(['strip_tags']);
         if ($this->request->isAjax()) {
-            list($where, $sort, $order, $offset, $limit) = $this->buildparams();
-
-            // 强制指定排序字段别名
-            if ($sort === 'id') {
-                $sort = 'video_platform.id';
+            //如果发送的来源是Selectpage,则转发到Selectpage
+            if ($this->request->request('keyField')) {
+                return $this->selectpage();
             }
-
+            list($where, $sort, $order, $offset, $limit) = $this->buildparams();
             $total = $this->model
-                ->with('videolist,platform')
                 ->where($where)
-                ->order($sort)
+                ->order($sort, $order)
                 ->count();
             $list = $this->model
-                ->with('videolist,platform')
                 ->where($where)
-                ->order($sort)
+                ->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();
+
     }
     /**
      * 编辑
@@ -63,18 +60,18 @@ class Vplatform extends Backend
     {
         return parent::add();
     }
-    public function dragsort()
-    {
-        if ($this->request->isPost()) {
-            $ids = $this->request->post('ids');
-            // 根据 $ids 更新排序逻辑(示例代码)
-            foreach ($ids as $index => $id) {
-                $this->model::where('id', $id)->update(['sort' => $index + 1]);
-            }
-            $this->success();
-        }
-        $this->error(__('参数错误'));
-    }
+//    public function dragsort()
+//    {
+//        if ($this->request->isPost()) {
+//            $ids = $this->request->post('ids');
+//            // 根据 $ids 更新排序逻辑(示例代码)
+//            foreach ($ids as $index => $id) {
+//                $this->model::where('id', $id)->update(['sort' => $index + 1]);
+//            }
+//            $this->success();
+//        }
+//        $this->error(__('参数错误'));
+//    }
 //    // 添加
 //    public function add()
 //    {