深圳全飞鸿
标题:
fastadmin勾选修改失效的原因分析
[打印本页]
作者:
syant
时间:
2024-11-7 08:31
标题:
fastadmin勾选修改失效的原因分析
现象:
勾选修改时,能跳转到的修改页面,但是修改页面显示的原始数据并不是勾选的那一行
分析:
改为
$row = $this->model->get(['id' => $ids])是可以正常的
public function edit($ids = null)
{
$row = $this->model->get($ids);
//$row = $this->model->get(['id' => $ids]);
if (!$row) {
$this->error(__('No Results were found'));
}
复制代码
代码:
htdocs\thinkphp\library\think\Model.php
加$sql = $query->buildSql()输出SQL发现没有带条件
public static function get($data, $with = [], $cache = false)
{
if (is_null($data)) {
return;
}
if (true === $with || is_int($with)) {
$cache = $with;
$with = [];
}
$query = static::parseQuery($data, $with, $cache);
$sql = $query->buildSql();
file_put_contents("c:/zzz.txt",$sql);
return $query->find($data);
}
原因:
对应表的id索引被改为id+另外一个表的联合索引,导致框架判断不到主键,框架并不报错,只是直接去掉了条码,导致全表查询取第一行。
欢迎光临 深圳全飞鸿 (http://www.nagomes.com/disc/)
Powered by Discuz! X3.2