mirror of https://gitee.com/karson/fastadmin.git
修复自定义data-primary-key为字符串内容时排序报错BUG
parent
8d0384ee49
commit
2a131ae573
|
|
@ -540,12 +540,10 @@ class Backend extends Controller
|
||||||
if ($primaryvalue !== null && preg_match("/^[a-z0-9_\-]+$/i", $primarykey)) {
|
if ($primaryvalue !== null && preg_match("/^[a-z0-9_\-]+$/i", $primarykey)) {
|
||||||
$primaryvalue = array_unique(is_array($primaryvalue) ? $primaryvalue : explode(',', $primaryvalue));
|
$primaryvalue = array_unique(is_array($primaryvalue) ? $primaryvalue : explode(',', $primaryvalue));
|
||||||
//修复自定义data-primary-key为字符串内容时,给排序字段添加上引号
|
//修复自定义data-primary-key为字符串内容时,给排序字段添加上引号
|
||||||
$pk = $this->model->getPk();
|
$primaryvalue= array_map(function ($value) {
|
||||||
if ($primarykey != $pk) {
|
return '\'' . $value . '\'';
|
||||||
$primaryvalue= array_map(function ($value) {
|
}, $primaryvalue);
|
||||||
return '\'' . $value . '\'';
|
|
||||||
}, $primaryvalue);
|
|
||||||
}
|
|
||||||
$primaryvalue = implode(',', $primaryvalue);
|
$primaryvalue = implode(',', $primaryvalue);
|
||||||
|
|
||||||
$this->model->orderRaw("FIELD(`{$primarykey}`, {$primaryvalue})");
|
$this->model->orderRaw("FIELD(`{$primarykey}`, {$primaryvalue})");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue