mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 23:22:48 +08:00
Model类增加getPk方法用于获取主键
This commit is contained in:
@@ -316,11 +316,10 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
|||||||
*/
|
*/
|
||||||
public function getPk($tableName = '')
|
public function getPk($tableName = '')
|
||||||
{
|
{
|
||||||
if ($this->pk) {
|
if (!$this->pk) {
|
||||||
return $this->pk;
|
$this->pk = self::db()->getTableInfo($tableName, 'pk');
|
||||||
} else {
|
|
||||||
return self::db()->getTableInfo($tableName, 'pk');
|
|
||||||
}
|
}
|
||||||
|
return $this->pk;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user