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