query类增加insertGetId方法 模型类的save方法 新增的时候 返回自增id

This commit is contained in:
thinkphp
2016-04-28 23:10:04 +08:00
parent d8ac3012fe
commit 8eec4c5eb2
4 changed files with 25 additions and 6 deletions

View File

@@ -145,7 +145,7 @@ class Merge extends Model
* @param array $where 更新条件
* @return mixed
*/
public function save($data = [], $where = [], $getInsertId = true)
public function save($data = [], $where = [])
{
if (!empty($data)) {
// 数据对象赋值
@@ -211,6 +211,7 @@ class Merge extends Model
$data = $this->parseData($name, $this->data, true);
self::db()->table($table)->strict(false)->insert($data);
}
$result = $insertId;
}
// 新增回调
$this->trigger('after_insert', $this);