|
@@ -247,7 +247,6 @@ class special_helper
|
|
|
|
|
|
return $blocks;
|
|
|
}
|
|
|
-
|
|
|
private function filter_item($special,&$goods_ids,&$scale)
|
|
|
{
|
|
|
$scale = false;
|
|
@@ -296,7 +295,6 @@ class special_helper
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 处理type=url 时的&字符转义问题
|
|
|
* @param array $data
|
|
@@ -336,6 +334,26 @@ class special_helper
|
|
|
return $str;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private function check_goods($ids)
|
|
|
+ {
|
|
|
+ if(empty($ids)) return true;
|
|
|
+
|
|
|
+ $ids = array_unique($ids);
|
|
|
+ $mod = Model('goods');
|
|
|
+ $goods = $mod->getGoodsOnlineList(array("goods_id" => array("in",$ids)));
|
|
|
+
|
|
|
+ $gids = [];
|
|
|
+ foreach ($goods as $item) {
|
|
|
+ $gids[] = intval($item['goods_id']);
|
|
|
+ }
|
|
|
+ if(count($ids) == count($gids)) {
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private function filter_home1($val,&$goods_ids,&$scale)
|
|
|
{
|
|
|
$items = [];
|
|
@@ -346,17 +364,19 @@ class special_helper
|
|
|
$item['title'] = $this->safe_string($val['title']);
|
|
|
|
|
|
$scale = $this->scale($item['image']);
|
|
|
- $items[] = $item;
|
|
|
|
|
|
- if($item['type'] == 'goods')
|
|
|
- {
|
|
|
- $goods_id = intval($item['data']);
|
|
|
- if($goods_id > 0) {
|
|
|
- array_push($goods_ids,$goods_id);
|
|
|
- }
|
|
|
+ $ids = [];
|
|
|
+ if($item['type'] == 'goods') {
|
|
|
+ $ids[] = intval($item['data']);
|
|
|
}
|
|
|
|
|
|
- return $items;
|
|
|
+ if(self::check_goods($ids)) {
|
|
|
+ array_push($goods_ids,$goods_id);
|
|
|
+ $items[] = $item;
|
|
|
+ return $items;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private function filter_home2($val,&$goods_ids,&$scale)
|
|
@@ -386,18 +406,20 @@ class special_helper
|
|
|
$items[] = $item;
|
|
|
}
|
|
|
|
|
|
+ $ids = [];
|
|
|
foreach ($items as $item)
|
|
|
{
|
|
|
- if($item['type'] == 'goods')
|
|
|
- {
|
|
|
- $goods_id = intval($item['data']);
|
|
|
- if($goods_id > 0) {
|
|
|
- array_push($goods_ids,$goods_id);
|
|
|
- }
|
|
|
+ if($item['type'] == 'goods') {
|
|
|
+ $ids[] = intval($item['data']);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return $items;
|
|
|
+ if(self::check_goods($ids)) {
|
|
|
+ $goods_ids = array_merge($goods_ids,$ids);
|
|
|
+ return $items;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private function filter_home3($items,&$goods_ids,&$scale)
|
|
@@ -407,7 +429,7 @@ class special_helper
|
|
|
$has_set = false;
|
|
|
foreach($items as $item)
|
|
|
{
|
|
|
- $result[] = $item;
|
|
|
+
|
|
|
if($has_set == false) {
|
|
|
$scale = $this->scale($item['image']);
|
|
|
if($scale != false) {
|
|
@@ -419,12 +441,23 @@ class special_helper
|
|
|
if($item['type'] == 'goods')
|
|
|
{
|
|
|
$goods_id = intval($item['data']);
|
|
|
- if($goods_id > 0) {
|
|
|
+ if(self::check_goods(array($goods_id))) {
|
|
|
array_push($goods_ids,$goods_id);
|
|
|
+ $result[] = $item;
|
|
|
+ } else {
|
|
|
+ continue;
|
|
|
}
|
|
|
}
|
|
|
+ else {
|
|
|
+ $result[] = $item;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(empty($result)) {
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ return $result;
|
|
|
}
|
|
|
- return $result;
|
|
|
}
|
|
|
|
|
|
private function filter_home4($val,&$goods_ids,&$scale)
|
|
@@ -454,18 +487,20 @@ class special_helper
|
|
|
$items[] = $item;
|
|
|
}
|
|
|
|
|
|
+ $ids = [];
|
|
|
foreach ($items as $item)
|
|
|
{
|
|
|
- if($item['type'] == 'goods')
|
|
|
- {
|
|
|
- $goods_id = intval($item['data']);
|
|
|
- if($goods_id > 0) {
|
|
|
- array_push($goods_ids,$goods_id);
|
|
|
- }
|
|
|
+ if($item['type'] == 'goods') {
|
|
|
+ $ids[] = intval($item['data']);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return $items;
|
|
|
+ if(self::check_goods($ids)) {
|
|
|
+ $goods_ids = array_merge($goods_ids,$ids);
|
|
|
+ return $items;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private function filter_goods($items,&$goods_ids,&$scale)
|
|
@@ -480,14 +515,20 @@ class special_helper
|
|
|
$item['image'] = $val['goods_image'];
|
|
|
$item['title'] = $val['goods_name'];
|
|
|
|
|
|
- $result[] = $item;
|
|
|
$goods_id = intval($val['goods_id']);
|
|
|
- if($goods_id > 0) {
|
|
|
+ if(self::check_goods(array($goods_id))) {
|
|
|
array_push($goods_ids,$goods_id);
|
|
|
+ $result[] = $item;
|
|
|
+ } else {
|
|
|
+ continue;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return $result;
|
|
|
+ if(empty($result)) {
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ return $result;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private function filter_adv($items,&$goods_ids,&$scale)
|
|
@@ -502,7 +543,6 @@ class special_helper
|
|
|
$val['data'] = $item['data'];
|
|
|
$val['title'] = $this->safe_string($item['title']);
|
|
|
|
|
|
- $result[] = $val;
|
|
|
if($has_set == false) {
|
|
|
$scale = $this->scale($item['image']);
|
|
|
$has_set = true;
|
|
@@ -511,10 +551,16 @@ class special_helper
|
|
|
if($item['type'] == 'goods')
|
|
|
{
|
|
|
$goods_id = intval($item['data']);
|
|
|
- if($goods_id > 0) {
|
|
|
+ if(self::check_goods(array($goods_id))) {
|
|
|
array_push($goods_ids,$goods_id);
|
|
|
+ $result[] = $val;
|
|
|
+ } else {
|
|
|
+ continue;
|
|
|
}
|
|
|
}
|
|
|
+ else {
|
|
|
+ $result[] = $val;
|
|
|
+ }
|
|
|
}
|
|
|
return $result;
|
|
|
}
|