mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 07:12:47 +08:00
修改 Model类的saveall方法 返回值
This commit is contained in:
@@ -631,16 +631,16 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
|||||||
* 保存多个数据到当前数据对象
|
* 保存多个数据到当前数据对象
|
||||||
* @access public
|
* @access public
|
||||||
* @param array $data 数据
|
* @param array $data 数据
|
||||||
* @return integer
|
* @return array|false
|
||||||
*/
|
*/
|
||||||
public function saveAll($dataSet)
|
public function saveAll($dataSet)
|
||||||
{
|
{
|
||||||
$result = 0;
|
$result = [];
|
||||||
$db = $this->db();
|
$db = $this->db();
|
||||||
$db->startTrans();
|
$db->startTrans();
|
||||||
try {
|
try {
|
||||||
foreach ($dataSet as $data) {
|
foreach ($dataSet as $data) {
|
||||||
$result = $this->isUpdate(false)->save($data, [], false);
|
$result[] = $this->isUpdate(false)->save($data, [], true);
|
||||||
}
|
}
|
||||||
$db->commit();
|
$db->commit();
|
||||||
return $result;
|
return $result;
|
||||||
|
|||||||
@@ -90,23 +90,20 @@ class Response
|
|||||||
*/
|
*/
|
||||||
public function send()
|
public function send()
|
||||||
{
|
{
|
||||||
|
|
||||||
// 处理输出数据
|
// 处理输出数据
|
||||||
$data = $this->getContent();
|
$data = $this->getContent();
|
||||||
|
|
||||||
// 监听response_data
|
// 监听response_data
|
||||||
Hook::listen('response_data', $data, $this);
|
Hook::listen('response_data', $data, $this);
|
||||||
|
|
||||||
// 发送头部信息
|
|
||||||
if (!headers_sent() && !empty($this->header)) {
|
if (!headers_sent() && !empty($this->header)) {
|
||||||
// 发送状态码
|
// 发送状态码
|
||||||
http_response_code($this->code);
|
http_response_code($this->code);
|
||||||
|
// 发送头部信息
|
||||||
foreach ($this->header as $name => $val) {
|
foreach ($this->header as $name => $val) {
|
||||||
header($name . ':' . $val);
|
header($name . ':' . $val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo $data;
|
echo $data;
|
||||||
|
|
||||||
if (function_exists('fastcgi_finish_request')) {
|
if (function_exists('fastcgi_finish_request')) {
|
||||||
@@ -151,7 +148,6 @@ class Response
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置响应头
|
* 设置响应头
|
||||||
* @access public
|
* @access public
|
||||||
@@ -264,17 +260,16 @@ class Response
|
|||||||
$content = $this->output($this->data);
|
$content = $this->output($this->data);
|
||||||
|
|
||||||
if (null !== $content && !is_string($content) && !is_numeric($content) && !is_callable([
|
if (null !== $content && !is_string($content) && !is_numeric($content) && !is_callable([
|
||||||
$content,
|
$content,
|
||||||
'__toString'
|
'__toString',
|
||||||
])
|
])
|
||||||
) {
|
) {
|
||||||
throw new \InvalidArgumentException(sprintf('variable type error: %s', gettype($content)));
|
throw new \InvalidArgumentException(sprintf('variable type error: %s', gettype($content)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return (string)$content;
|
return (string) $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取状态码
|
* 获取状态码
|
||||||
* @return integer
|
* @return integer
|
||||||
|
|||||||
Reference in New Issue
Block a user