fix:Tool类排序封装验证完善
This commit is contained in:
parent
afad2a9a35
commit
58e9909d1f
@ -364,6 +364,7 @@ class Tool
|
||||
//获取当前的主键字段名
|
||||
$guld_field = $model->db()->getPk();
|
||||
//排序字段名
|
||||
if (!isset($model->order_field)) throwErrorMsg('排序处理失败!模型层未定义排序字段$order_field');
|
||||
$order_field_name = $model->order_field;
|
||||
//当前数据原信息
|
||||
$original_oreder_find = $model->where($guld_field, $guid)->find();
|
||||
@ -397,6 +398,7 @@ class Tool
|
||||
//表名
|
||||
$table_name = $model->db()->getTable();
|
||||
//排序字段名
|
||||
if (!isset($model->order_field)) throwErrorMsg('排序处理失败!模型层未定义排序字段$order_field');
|
||||
$order_field_name = $model->order_field;
|
||||
//新增数据的所属排序号已有数据占用,则腾位处理(已占用的数据及其后面所有数据一起排序号腾位+1)
|
||||
if ($model->where($order_field_name, $order)->where($wheres)->value($order_field_name) !== null) {
|
||||
@ -422,6 +424,7 @@ class Tool
|
||||
//获取当前的主键字段名
|
||||
$guld_field_name = $model->db()->getPk();
|
||||
//获取当前表排序字段名
|
||||
if (!isset($model->order_field)) throwErrorMsg('排序处理失败!模型层未定义排序字段$order_field');
|
||||
$order_field_name = $model->order_field;
|
||||
//在所删除的数据之后的数据所属排序号将进行减位处理减位-1
|
||||
if ($find = $model->where($guld_field_name, $guid)->find()) {
|
||||
|
Loading…
Reference in New Issue
Block a user