/** * */ public function getAllVendorInfo($vendorId) { $res = array(); // 根据id获取商家信息 $dao = new DaoVendor(); $vendors = $dao->getVendorById($vendorId); if (count($vendors) == 1) { $vendor = $vendors[0]; //获取法人验证信息id $idenId = $vendor['vendor_iden_id']; if ($idenId != null) { $daoVendorAuth = new DaoVendorAuth(); $res['iden'] = $daoVendorAuth->getVendorAuthById($idenId); } //获取公司验证信息id $certiId = $vendor['vendor_certi_id']; if ($certiId != null) { $daoVendorAuth = new DaoVendorAuth(); $res['certi'] = $daoVendorAuth->getVendorAuthById($certiId); } //获取公司信息id $info_id = $vendor['vendor_info_id']; if ($info_id) { $dao = new DaoVendorInfo(); $res['info'] = $dao->getVendorInfoById($info_id); } //获取产品总数 $dao = new DaoProduct(); $res['productSum'] = $dao->getCountProductByVendorId($vendorId); } return $res; }
/** * * @param $top 获取的产品个数 * @param $type 产品类型 * @return 获取产品信息的基本列表 * @return 同时获取相应产品的商家名称 */ public function getTopProductByType($top, $type) { $res = array(); $dao = new DaoProductBasicinfo(); $res = $dao->getTopBasicinfoByType($top, $type); if (!empty($res)) { $daoProduct = new DaoProduct(); $daoVendor = new DaoVendor(); $daoVendorInfo = new DaoVendorInfo(); for ($i = 0, $len = count($res); $i < $len; $i++) { $res[$i]['vendor_info'] = 0; $productId = (int) $res[$i]['product_id']; if (!empty($productId)) { $vendorIdList = $daoProduct->getVendorIdByProductId($productId); if (count($vendorIdList) == 1) { $vendor = $daoVendor->getVendorById((int) $vendorIdList[0]); if (!empty($vendor) && ($info_id = $vendor[0]['vendor_info_id']) != null) { $vendor_info = $daoVendorInfo->getVendorInfoById((int) $info_id); if (count($vendor_info) == 1) { $res[$i]['vendor_info'] = $vendor_info[0]; } } } } } } return $res; }
/** * 获取产品基本信息列表 * @param $pageNumber 页码 * @param $pageSize 一页放产品的数量 * @param $keyword 关键字 */ public function getVendorList($pageNumber, $pageSize, $keyword) { $dao = new DaoVendor(); $vendorList = $dao->getVendorList($pageNumber, $pageSize, $keyword); if (!empty($vendorList)) { for ($i = 0, $len = count($vendorList); $i < $len; $i++) { $certiId = $vendorList[$i]['vendor_certi_id']; $infoId = $vendorList[$i]['vendor_info_id']; if (!empty($certiId)) { $daoVendorAuth = new DaoVendorAuth(); $vendorList[$i]['vendorAuth'] = $daoVendorAuth->getVendorAuthById($certiId); } else { $vendorList[$i]['vendorAuth'] = 0; } //获取商家基本信息 if (!empty($infoId)) { $daoVendorInfo = new DaoVendorInfo(); $vendorList[$i]['vendorInfo'] = $daoVendorInfo->getVendorInfoById($infoId); } else { $vendorList[$i]['vendorInfo'] = 0; } } } return $vendorList; }