WIN-2308041133\Administrator 8 months ago
parent
commit
b4f70502f0

+ 12 - 0
application/admin/controller/platform/Videoplatform.php

@@ -63,6 +63,18 @@ class Videoplatform 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 add()
 //    {

+ 1 - 1
public/assets/js/backend/platform/videoplatform.js

@@ -10,7 +10,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                     edit_url: 'platform/videoplatform/edit',
                     del_url: 'platform/videoplatform/del',
                     multi_url: 'platform/videoplatform/multi',
-                    dragsort_url: 'ajax/weigh',
+                    dragsort_url: 'platform/videoplatform/dragsort',
                     table: 'video_platform',
                 }
             });