Commit ae8b3c68 authored by 梁俊杰's avatar 梁俊杰

修复函数bug

parent 1ecb889a
...@@ -495,6 +495,13 @@ if (!function_exists('get_collection_values')) { ...@@ -495,6 +495,13 @@ if (!function_exists('get_collection_values')) {
$values[] = $value; $values[] = $value;
} }
} else { } else {
if (is_array($value) || is_countable($collection[$t])) {
foreach ($value as $vv) {
if (isset($vv[$ik])) {
$values[] = $vv[$ik];
}
}
}
break; break;
} }
} }
...@@ -524,8 +531,12 @@ if (!function_exists('put_collection_values')) { ...@@ -524,8 +531,12 @@ if (!function_exists('put_collection_values')) {
} }
$valueList = $valueList->keyBy($valueKey); $valueList = $valueList->keyBy($valueKey);
} }
foreach ($collection as $index => $value) { if (isset($collection[0])) {
$collection[$index] = private_put_collection_values($value, $itemKeys, $valueList, $collectionNewKey); foreach ($collection as $index => $value) {
$collection[$index] = private_put_collection_values($value, $itemKeys, $valueList, $collectionNewKey);
}
} else {
private_put_collection_values($collection, $itemKeys, $valueList, $collectionNewKey);
} }
} }
return $collection; return $collection;
...@@ -548,7 +559,13 @@ if (!function_exists('private_put_collection_values')) { ...@@ -548,7 +559,13 @@ if (!function_exists('private_put_collection_values')) {
$t = $itemKeys[0]; $t = $itemKeys[0];
unset($itemKeys[0]); unset($itemKeys[0]);
$itemKeys = array_values($itemKeys); $itemKeys = array_values($itemKeys);
$collection[$t] = private_put_collection_values($collection[$t], $itemKeys, $valueList, $collectionNewKey); if (is_array($collection[$t]) || is_countable($collection[$t])) {
foreach ($collection[$t] as $k => $v) {
$collection[$t][$k] = private_put_collection_values($v, $itemKeys, $valueList, $collectionNewKey);
}
} else {
$collection[$t] = private_put_collection_values($collection[$t], $itemKeys, $valueList, $collectionNewKey);
}
} else { } else {
if (isset($valueList[$collection[$itemKeys[0]]])) { if (isset($valueList[$collection[$itemKeys[0]]])) {
$collection[$collectionNewKey] = $valueList[$collection[$itemKeys[0]]]; $collection[$collectionNewKey] = $valueList[$collection[$itemKeys[0]]];
...@@ -568,7 +585,7 @@ if (!function_exists('human_time')) { ...@@ -568,7 +585,7 @@ if (!function_exists('human_time')) {
*/ */
function human_time($time) function human_time($time)
{ {
if (is_numeric($time)) { if (!is_numeric($time)) {
$time = strtotime($time); $time = strtotime($time);
} }
$time = abs($time); $time = abs($time);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment