优化代码

pull/477/MERGE
Karson 2024-11-28 11:53:18 +08:00
parent 279d8d876f
commit d7c3bc90ea
3 changed files with 10 additions and 4 deletions

View File

@ -175,18 +175,18 @@ class Ajax extends Backend
$weighdata[$v[$prikey]] = $v[$field];
}
$position = array_search($changeid, $ids);
$desc_id = isset($sour[$position]) ? $sour[$position] : end($sour); //移动到目标的ID值,取出所处改变前位置的值
$desc_id = $sour[$position] ?? end($sour); //移动到目标的ID值,取出所处改变前位置的值
$sour_id = $changeid;
$weighids = array();
$weighids = [];
$temp = array_values(array_diff_assoc($ids, $sour));
foreach ($temp as $m => $n) {
if ($n == $sour_id) {
$offset = $desc_id;
} else {
if ($sour_id == $temp[0]) {
$offset = isset($temp[$m + 1]) ? $temp[$m + 1] : $sour_id;
$offset = $temp[$m + 1] ?? $sour_id;
} else {
$offset = isset($temp[$m - 1]) ? $temp[$m - 1] : $sour_id;
$offset = $temp[$m - 1] ?? $sour_id;
}
}
if (!isset($weighdata[$offset])) {

View File

@ -7,6 +7,10 @@ use think\Model;
/**
* 会员模型
* @method static mixed getByUsername($str) 通过用户名查询用户
* @method static mixed getByNickname($str) 通过昵称查询用户
* @method static mixed getByMobile($str) 通过手机查询用户
* @method static mixed getByEmail($str) 通过邮箱查询用户
*/
class User extends Model
{

View File

@ -21,6 +21,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'user.id',
fixedColumns: true,
fixedRightNumber: 1,
columns: [
[
{checkbox: true},