mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-06 07:02:47 +08:00
修正Merge类 改进File类
This commit is contained in:
@@ -106,6 +106,7 @@ class File extends SplFileObject
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$path = rtrim($path, DS) . DS;
|
||||||
// 文件保存命名规则
|
// 文件保存命名规则
|
||||||
$savename = $this->getSaveName($savename);
|
$savename = $this->getSaveName($savename);
|
||||||
|
|
||||||
|
|||||||
@@ -145,13 +145,14 @@ class Merge extends Model
|
|||||||
* @param mixed $data 数据
|
* @param mixed $data 数据
|
||||||
* @param array $where 更新条件
|
* @param array $where 更新条件
|
||||||
* @param bool $getId 新增的时候是否获取id
|
* @param bool $getId 新增的时候是否获取id
|
||||||
|
* @param bool $replace 是否replace
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function save($data = [], $where = [], $getId = true)
|
public function save($data = [], $where = [], $getId = true, $replace = false)
|
||||||
{
|
{
|
||||||
if (!empty($data)) {
|
if (!empty($data)) {
|
||||||
// 数据自动验证
|
// 数据自动验证
|
||||||
if (!$this->validateData()) {
|
if (!$this->validateData($data)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// 数据对象赋值
|
// 数据对象赋值
|
||||||
@@ -214,7 +215,7 @@ class Merge extends Model
|
|||||||
// 处理模型数据
|
// 处理模型数据
|
||||||
$data = $this->parseData($this->name, $this->data);
|
$data = $this->parseData($this->name, $this->data);
|
||||||
// 写入主表数据
|
// 写入主表数据
|
||||||
$result = $db->name($this->name)->strict(false)->insert($data);
|
$result = $db->name($this->name)->strict(false)->insert($data, $replace);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$insertId = $db->getLastInsID();
|
$insertId = $db->getLastInsID();
|
||||||
// 写入外键数据
|
// 写入外键数据
|
||||||
|
|||||||
Reference in New Issue
Block a user