From 4e657d1f2536fb980a8f24309c2e0abd398d7824 Mon Sep 17 00:00:00 2001 From: Karson Date: Fri, 4 Jun 2021 14:53:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9D=83=E9=87=8D=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=20=E4=BC=98=E5=8C=96=E6=9D=83=E9=99=90=E8=A7=84?= =?UTF-8?q?=E5=88=99=E5=86=99=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/Ajax.php | 2 +- application/admin/model/AuthRule.php | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/application/admin/controller/Ajax.php b/application/admin/controller/Ajax.php index a1cc8a71..bd0b5d00 100644 --- a/application/admin/controller/Ajax.php +++ b/application/admin/controller/Ajax.php @@ -158,7 +158,7 @@ class Ajax extends Backend $weighdata[$v[$prikey]] = $v[$field]; } $position = array_search($changeid, $ids); - $desc_id = $sour[$position]; //移动到目标的ID值,取出所处改变前位置的值 + $desc_id = isset($sour[$position]) ? $sour[$position] : end($sour); //移动到目标的ID值,取出所处改变前位置的值 $sour_id = $changeid; $weighids = array(); $temp = array_values(array_diff_assoc($ids, $sour)); diff --git a/application/admin/model/AuthRule.php b/application/admin/model/AuthRule.php index 236cb638..526b6b59 100644 --- a/application/admin/model/AuthRule.php +++ b/application/admin/model/AuthRule.php @@ -16,6 +16,12 @@ class AuthRule extends Model protected static function init() { + self::beforeWrite(function ($row) { + if (isset($_POST['row']) && is_array($_POST['row']) && isset($_POST['row']['condition'])) { + $originRow = $_POST['row']; + $row['condition'] = $originRow['condition'] ?? ''; + } + }); self::afterWrite(function ($row) { Cache::rm('__menu__'); });