/** * 获取init1页所需信息 * @author francis * @param int id 用户id * @return array 单条用户数据 */ public function getInit1($supid) { $com = \Gccominfo\Models\GcCompany::findFirst(array("supid=:supid:", 'bind' => array('supid' => $supid))); if (is_object($com)) { $com = $com->toArray(); } $com['provincename'] = \Xz\Lib\Area::getProvince($com['province']); $com['cityname'] = \Xz\Lib\Area::getCity($com['city']); $com['areaname'] = \Xz\Lib\Area::getZone($com['zone']); $comData = \Gccominfo\Models\GcComData::findFirst(array("cid=:cid:", 'bind' => array('cid' => $com['cid']))); if (is_object($comData)) { $comData = $comData->toArray(); } $cate1 = \Xz\Lib\Cate::getCate(); return $this->outputData(array('info' => $com, 'data' => $comData, 'cate1' => $cate1)); }
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; }