This commit is contained in:
thinkphp
2016-04-18 10:58:20 +08:00
parent 289f2e7741
commit 2a09d8d8db
3 changed files with 5 additions and 5 deletions

View File

@@ -181,7 +181,7 @@ class View
throw new Exception('template file not exists:' . $template, 10700); throw new Exception('template file not exists:' . $template, 10700);
} }
// 记录视图信息 // 记录视图信息
APP_DEBUG && Log::record('[ VIEW ] ' . $template . ' [ ' . var_export($vars, true) . ' ]', 'info'); APP_DEBUG && Log::record('[ VIEW ] ' . $template . ' [ ' . var_export(array_keys($vars), true) . ' ]', 'info');
} }
if (is_null($this->engine)) { if (is_null($this->engine)) {
// 初始化模板引擎 // 初始化模板引擎

View File

@@ -299,13 +299,13 @@ abstract class Builder
if ($value instanceof \Closure) { if ($value instanceof \Closure) {
$whereStr .= $key . ' ' . $exp . ' ' . $this->parseClosure($value); $whereStr .= $key . ' ' . $exp . ' ' . $this->parseClosure($value);
} else { } else {
$value = is_string($value) ? explode(',', $value) : $value; $value = is_array($value) ? $value : explode(',', $value) ;
$zone = implode(',', $this->parseValue($value)); $zone = implode(',', $this->parseValue($value));
$whereStr .= $key . ' ' . $exp . ' (' . $zone . ')'; $whereStr .= $key . ' ' . $exp . ' (' . $zone . ')';
} }
} elseif (in_array($exp, ['NOT BETWEEN', 'BETWEEN'])) { } elseif (in_array($exp, ['NOT BETWEEN', 'BETWEEN'])) {
// BETWEEN 查询 // BETWEEN 查询
$data = is_string($value) ? explode(',', $value) : $value; $data = is_array($value) ? $value : explode(',', $value) ;
$whereStr .= $key . ' ' . $exp . ' ' . $this->parseValue($data[0]) . ' AND ' . $this->parseValue($data[1]); $whereStr .= $key . ' ' . $exp . ' ' . $this->parseValue($data[0]) . ' AND ' . $this->parseValue($data[1]);
} elseif (in_array($exp, ['NOT EXISTS', 'EXISTS'])) { } elseif (in_array($exp, ['NOT EXISTS', 'EXISTS'])) {
// EXISTS 查询 // EXISTS 查询

View File

@@ -240,7 +240,7 @@ class Relation
// 重新组装模型数据 // 重新组装模型数据
foreach ($result->toArray() as $key => $val) { foreach ($result->toArray() as $key => $val) {
if (strpos($key, '__')) { if (strpos($key, '__')) {
list($name, $attr) = explode('__', $key); list($name, $attr) = explode('__', $key,2);
if ($name == $modelName) { if ($name == $modelName) {
$list[$name][$attr] = $val; $list[$name][$attr] = $val;
unset($result->$key); unset($result->$key);
@@ -300,7 +300,7 @@ class Relation
$pivot = []; $pivot = [];
foreach ($set->toArray() as $key => $val) { foreach ($set->toArray() as $key => $val) {
if (strpos($key, '__')) { if (strpos($key, '__')) {
list($name, $attr) = explode('__', $key); list($name, $attr) = explode('__', $key,2);
if ('pivot' == $name) { if ('pivot' == $name) {
$pivot[$attr] = $val; $pivot[$attr] = $val;
unset($set->$key); unset($set->$key);