public function getProinfo($pidArr, $type = 1) { $proArr = $brandidArr = array(); $profields = array('pid', 'proname', 'picurl', 'cid', 'pricetype', 'siteprice', 'minprice', 'maxprice', 'brand', 'brandname', 'brandlogo', 'cate1', 'cate2', 'cate3'); $cacheProduct = new CacheProduct(); $proArr = $cacheProduct->getSpecialpro($pidArr, $profields); $brandidArr = array_unique(array_column($proArr, 'brand')); $brandidStr = implode(',', $brandidArr); $brandArr = OpBrand::find(array('conditions' => 'brandid IN (' . $brandidStr . ') and state = 1', 'columns' => ' * ')); if (!empty($brandArr)) { $brandArr = $brandArr->toArray(); } foreach ($brandArr as $key => &$value) { $provinceArr = Area::getProvince($value['province']); $cityArr = Area::getCity($value['city']); $value['province_format'] = !empty($provinceArr) ? $provinceArr['areaname'] : ''; $value['city_format'] = !empty($cityArr) ? $cityArr['areaname'] : ''; $brand[$value['brandid']] = $value; } foreach ($proArr as $key => $value) { $tmp['proname'] = $value['proname']; $tmp['picurl'] = $value['picurl'][0]; $tmp['prourl'] = \Xz\Func\UrlHelper::proLinkCre($value['pid'], $value['cate2'], $value['cate3'], $type); $tmp['brand'] = $value['brand']; $tmp['brandname'] = $value['brandname']; $tmp['brandlogo'] = $value['brandlogo']; $tmp['siteprice'] = $value['siteprice']; $tmp['maxprice'] = $value['maxprice']; $tmp['minprice'] = $value['minprice']; $tmp['pricetype'] = $value['pricetype']; $tmp['cate2'] = $value['cate2']; if (isset($brand[$value['brand']])) { $tmp['province_format'] = $brand[$value['brand']]['province_format']; $tmp['city_format'] = $brand[$value['brand']]['city_format']; $tmp['brandaddtime'] = $brand[$value['brand']]['addtime']; } $retArr[] = $tmp; } return $retArr; }
public function getProinfo($pidArr, $type = 1) { $proArr = $retArr = array(); $profields = array('pid', 'proname', 'picurl', 'cid', 'pricetype', 'siteprice', 'minprice', 'maxprice', 'brand', 'brandname', 'brandlogo', 'cate1', 'cate2', 'cate3', 'is_op'); $cacheProduct = new CacheProduct(); $proArr = $cacheProduct->getSpecialpro($pidArr, $profields); foreach ($proArr as $key => $value) { $tmp['proname'] = $value['proname']; $tmp['picurl'] = $value['picurl'][0]; $tmp['prourl'] = \Xz\Func\UrlHelper::proLinkCre($value['pid'], $value['cate2'], $value['cate3'], $type); $tmp['brand'] = $value['brandname']; $tmp['siteprice'] = $value['siteprice']; $tmp['maxprice'] = $value['maxprice']; $tmp['minprice'] = $value['minprice']; $tmp['pricetype'] = $value['pricetype']; $tmp['cate2'] = $value['cate2']; $tmp['brandid'] = $value['brand']; $tmp['brandlogo'] = $value['brandlogo']; $tmp['is_op'] = $value['is_op']; $retArr[] = $tmp; } return $retArr; }