mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-02 05:02:48 +08:00
traits 修改
This commit is contained in:
@@ -16,6 +16,9 @@ trait Auto {
|
||||
protected $_validate = []; // 自动验证定义
|
||||
protected $_auto = []; // 自动完成定义
|
||||
|
||||
public function test($auto=''){
|
||||
echo 'auto';
|
||||
}
|
||||
/**
|
||||
* 创建数据对象 但不保存到数据库
|
||||
* @access public
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
// | Author: liu21st <liu21st@gmail.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace Traits\Think;
|
||||
namespace Traits\Think\Model;
|
||||
|
||||
trait Extend {
|
||||
|
||||
@@ -176,34 +176,6 @@ trait Extend {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批处理执行SQL语句
|
||||
* 批处理的指令都认为是execute操作
|
||||
* @access public
|
||||
* @param array $sql SQL批处理指令
|
||||
* @return boolean
|
||||
*/
|
||||
public function patchQuery($sql=[]) {
|
||||
if(!is_array($sql)) return false;
|
||||
// 自动启动事务支持
|
||||
$this->startTrans();
|
||||
try{
|
||||
foreach ($sql as $_sql){
|
||||
$result = $this->execute($_sql);
|
||||
if(false === $result) {
|
||||
// 发生错误自动回滚事务
|
||||
$this->rollback();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// 提交事务
|
||||
$this->commit();
|
||||
} catch (\Think\Exception $e) {
|
||||
$this->rollback();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到分表的的数据表名
|
||||
* @access public
|
||||
|
||||
Reference in New Issue
Block a user