| | |
| | | $LogicPdd = new LogicPdd(); |
| | | $LogicHaodanku = new LogicHaodanku(); |
| | | $LogicDataoke=new LogicDataoke(); |
| | | // $c=$exclude_tb+$exclude_jd+$exclude_pdd+$exclude_dy; |
| | | // $pagesize=bcdiv(40,(4-$c)==0?1:(4-$c),0)+1; |
| | | $pagesize=10; |
| | | //根据标题查询天猫商品 |
| | | $taobaoGoods = $LogicDataoke->superSearch($title,1,40,0,1); |
| | | //去除销量为0的商品并按照价格排序 |
| | |
| | | $common_relation_id='168369887871568'; |
| | | //根据标题查询拼多多商品 |
| | | if(!empty($common_relation_id)){ |
| | | $ppdGoodes=$LogicPdd->searchGoods($title,'',$common_relation_id,'',1,20,0,''); |
| | | $ppdGoodes=$LogicPdd->searchGoods($title,'',$common_relation_id,'',1,40,0,''); |
| | | //去除销量为0的商品并按照价格排序 |
| | | $ppdGoodes = array_filter($ppdGoodes,function($v){ |
| | | return $v['monthSales'] > 0; |
| | |
| | | } |
| | | |
| | | //根据标题查询抖音商品 |
| | | $dyGoods =$LogicHaodanku->getDygoodsList('',$title,0,1,20); |
| | | $dyGoods =$LogicHaodanku->getDygoodsList('',$title,0,1,40); |
| | | //去除销量为0的商品并按照价格排序 |
| | | $dyGoods = array_filter($dyGoods,function($v){ |
| | | return $v['monthSales'] > 0; |
| | |
| | | $sort1 = array_column($dyGoods, 'actualPrice'); |
| | | array_multisort($sort1, SORT_ASC, $dyGoods); |
| | | |
| | | $goodscount=count(array_slice($tmGoods,0,10))+count(array_slice($jdGoods,0,10))+count(array_slice($ppdGoodes,0,10))+count(array_slice($dyGoods,0,10))+count(array_slice($tmcsGoods,0,10)); |
| | | $goodscount=count(array_slice($tmGoods,0,$pagesize))+count(array_slice($jdGoods,0,$pagesize))+count(array_slice($ppdGoodes,0,$pagesize))+count(array_slice($dyGoods,0,$pagesize))+count(array_slice($tmcsGoods,0,$pagesize)); |
| | | if($goodscount<40){ |
| | | //如果goodscount不满足20则从天猫商品里补足20 |
| | | $needcount=40-$goodscount+10; |
| | | if($exclude_tb==0){ |
| | | $newGoods =array_merge($newGoods,array_slice($tmGoods,0,10)); |
| | | $newGoods =array_merge($newGoods,array_slice($tmcsGoods,0,10)); |
| | | $newGoods =array_merge($newGoods,array_slice($tmGoods,0,$pagesize)); |
| | | $newGoods =array_merge($newGoods,array_slice($tmcsGoods,0,$pagesize)); |
| | | } |
| | | if($exclude_jd==0){ |
| | | $newGoods =array_merge($newGoods,array_slice($jdGoods,0,10)); |
| | | $newGoods =array_merge($newGoods,array_slice($jdGoods,0,$pagesize)); |
| | | } |
| | | //按照价格排序 |
| | | if(count($newGoods)>0){ |
| | |
| | | array_multisort($sort1, SORT_ASC, $newGoods); |
| | | } |
| | | if($exclude_pdd==0){ |
| | | $newGoods =array_merge($newGoods,array_slice($ppdGoodes,0,10)); |
| | | $newGoods =array_merge($newGoods,array_slice($ppdGoodes,0,$pagesize)); |
| | | } |
| | | if($exclude_tb==0){ |
| | | $newGoods =array_merge($newGoods,array_slice($taobaoGoods,0,$needcount)); |
| | | } |
| | | if($exclude_dy==0){ |
| | | $newGoods =array_merge($newGoods,array_slice($dyGoods,0,10)); |
| | | $newGoods =array_merge($newGoods,array_slice($dyGoods,0,$pagesize)); |
| | | } |
| | | } |
| | | else{ |
| | | if($exclude_tb==0){ |
| | | $newGoods =array_merge($newGoods,array_slice($tmGoods,0,10)); |
| | | $newGoods =array_merge($newGoods,array_slice($tmcsGoods,0,10)); |
| | | $newGoods =array_merge($newGoods,array_slice($tmGoods,0,$pagesize)); |
| | | $newGoods =array_merge($newGoods,array_slice($tmcsGoods,0,$pagesize)); |
| | | } |
| | | if($exclude_jd==0){ |
| | | $newGoods =array_merge($newGoods,array_slice($jdGoods,0,10)); |
| | | $newGoods =array_merge($newGoods,array_slice($jdGoods,0,$pagesize)); |
| | | } |
| | | //按照价格排序 |
| | | if(count($newGoods)>0){ |
| | |
| | | array_multisort($sort1, SORT_ASC, $newGoods); |
| | | } |
| | | if($exclude_pdd==0){ |
| | | $newGoods =array_merge($newGoods,array_slice($ppdGoodes,0,10)); |
| | | $newGoods =array_merge($newGoods,array_slice($ppdGoodes,0,$pagesize)); |
| | | } |
| | | if($exclude_dy==0){ |
| | | $newGoods =array_merge($newGoods,array_slice($dyGoods,0,10)); |
| | | $newGoods =array_merge($newGoods,array_slice($dyGoods,0,$pagesize)); |
| | | } |
| | | } |
| | | //如果还是不满足20则从淘宝商品里补足20 |
| | | if(count($newGoods)<20){ |
| | | if(count($newGoods)<40){ |
| | | if($exclude_tb==0){ |
| | | $tbGoods = $LogicDataoke->superSearch($title,1,20,0,0); |
| | | //去除销量为0的商品并按照价格排序 |