public function index() { $shopId = input::get('shop_id'); $pagedata = $this->__common($shopId); if (userAuth::check()) { $pagedata['nologin'] = 1; } //店铺自定义区域 $params = shopWidgets::getWidgetsData('custom', $shopId); if ($params) { $pagedata['params'] = $params['custom']; } //店铺商品 $items = shopWidgets::getWidgetsData('showitems', $shopId, '0,1'); if ($items) { $itemIds = array(); foreach ($items as $row) { $itemIds = array_merge($itemIds, array_column($row, 'item_id')); } $activityParams['item_id'] = implode(',', array_unique($itemIds)); $activityParams['status'] = 'agree'; $activityParams['end_time'] = 'bthan'; $activityParams['start_time'] = 'sthan'; $activityParams['fields'] = 'activity_id,item_id,activity_tag,price,activity_price'; $activityItemList = app::get('topc')->rpcCall('promotion.activity.item.list', $activityParams); if ($activityItemList) { $activatyItem = array_bind_key($activityItemList['list'], 'item_id'); foreach ($items as &$row) { foreach ($row as &$item) { if ($activatyItem[$item['item_id']]) { $item['activity_tag'] = $activatyItem[$item['item_id']]['activity_tag']; $item['price'] = $activatyItem[$item['item_id']]['activity_price']; } } } } } $pagedata['items'] = $items; // 店铺优惠券信息, $params = array('page_no' => 0, 'page_size' => 10, 'fields' => '*', 'shop_id' => $shopId, 'platform' => 'pc', 'is_cansend' => 1); $couponListData = app::get('topc')->rpcCall('promotion.coupon.list', $params, 'buyer'); $pagedata['homeCouponList'] = $couponListData['coupons']; $pagedata['file'] = "topc/shop/center.html"; return $this->page('topc/shop/index.html', $pagedata); }
/** * 获取店铺模板页面头部共用部分的数据 * * @param int $shopId 店铺ID * @return array */ private function __common($shopId) { $shopId = intval($shopId); //店铺信息 $shopdata = app::get('topm')->rpcCall('shop.get', array('shop_id' => $shopId)); $commonData['shopdata'] = $shopdata; //店铺招牌背景色 $wapslider = shopWidgets::getWapInfo('waplogo', $shopId); //echo '<pre>';print_r($wapslider);exit(); $commonData['logo_image'] = $wapslider[0]['params']; //$commonData['background_image'] = shopWidgets::getWidgetsData('shopsign',$shopId); //店铺论播广告 $wapslider = shopWidgets::getWapInfo('wapslider', $shopId); $commonData['slider'] = $wapslider[0]['params']; //店铺菜单 $navData = shopWidgets::getWidgetsData('nav', $shopId); $commonData['navdata'] = $navData; //标签展示 $itemList = shopWidgets::getWapInfo('waptags', $shopId); $commonData['itemInfo'] = $this->__getItemInfo($itemList); //获取默认图片信息 $commonData['defaultImageId'] = app::get('image')->getConf('image.set'); return $commonData; }
/** * 获取企业模板页面头部共用部分的数据 * * @param int $shopId 企业ID * @return array */ private function __common($shopId) { $shopId = intval($shopId); //企业信息 $shopdata = app::get('topc')->rpcCall('shop.get', array('shop_id' => $shopId)); $commonData['shopdata'] = $shopdata; $shopInfodata = app::get("sysshop")->model("shop_info")->getList("*", array("shop_id" => $shopId)); $commonData["shopInfo"] = $shopInfodata[0]; $seller_id = app::get("sysshop")->model("shop")->getRow("*", array("shop_id" => $shopId))["seller_id"]; $seller_type = app::get("sysshop")->model("seller")->getRow("*", array("shop_id" => $shopId))["seller_type"]; $commonData["seller_type"] = $seller_type; $login_account = app::get("sysshop")->model("account")->getRow("*", array("seller_id" => $seller_id))["login_account"]; $userid = app::get("sysuser")->model("account")->getRow("*", array("login_account" => $login_account))["user_id"]; $sql = "select id ,variety_name, type from (\n select require_id as id,variety_name ,1 as type,create_time from sysspfb_requireInfo where user_id = " . $userid . " \n union ALL\n select supply_id,variety_name,2,create_time from sysspfb_supplyInfo where user_id=" . $userid . " )a\n order by create_time desc"; $gqlistall = app::get("base")->database()->executeQuery($sql)->fetchAll(); $gqlist = array_slice($gqlistall, 0, 4); $commonData["gqList"] = $gqlist; $commonData["userid"] = $userid; $gqcount = count($gqlistall); //供求数量 $commonData["gqcount"] = $gqcount; //交易量 $trandeSql = "select title,id,type,create_time from(\n select trading_title title,bidding_id id ,'1' type,create_time from sysshoppubt_biddings where shop_id=" . $shopId . "\n and isok<>1 and is_through=1 \n union ALL \n SELECT trading_title,tender_id id,'2' type,create_time from sysshoppubt_tender where shop_id=" . $shopId . " and isok<>1 and is_through=1)a\n ORDER BY create_time desc;"; $trandeList = app::get("base")->database()->executeQuery($trandeSql)->fetchAll(); $biddingAry = array(); $tendAry = array(); foreach ($trandeList as $key => $value) { if ($value["type"] == "1") { $tenderList = app::get("sysshoppubt")->model("tradeorder")->getList("*", array("bidding_id" => $value['id'])); $trandeList[$key]["Tcount"] = count($tenderList); array_push($biddingAry, $values); } else { $tenderList = app::get("sysshoppubt")->model("tenderenter")->getList("*", array("tender_id" => $value['id'])); $trandeList[$key]["Tcount"] = count($tenderList); array_push($tendAry, $values); } } foreach ($trandeList as $key => $value) { $trandeList[$key]["create_time"] = date('Y-m-d', $value["create_time"]); } $commonData["trandeList"] = array_slice($trandeList, 0, 6); $commonData["biddcount"] = count($biddingAry); $commonData["tendcount"] = count($tendAry); $b = $trandeList[0]; //标准商品产品 $BzitemSql = "select * from sysitem_item where shop_id=" . $shopId . " and type=0 and product_type=0 and is_shop_show=1"; $BzItemList = app::get("base")->database()->executeQuery($BzitemSql)->fetchAll(); $commonData["BzItemList"] = $BzItemList; //标准商品生产设备 $BzitemSbSql = "select * from sysitem_item where shop_id=" . $shopId . " and type=0 and product_type=1 and is_shop_show=1"; $BzItemSbList = app::get("base")->database()->executeQuery($BzitemSbSql)->fetchAll(); $commonData["BzItemSbList"] = $BzItemSbList; //非标准商品 固废 $NBzitemSql = "select * from sysitem_item where shop_id=" . $shopId . " and type=1 and product_type=2 and is_shop_show=1"; $NBzItemList = app::get("base")->database()->executeQuery($NBzitemSql)->fetchAll(); $commonData["NBzItemList"] = $NBzItemList; //非标准商品 储存状态 $NBzitemCcSql = "select * from sysitem_item where shop_id=" . $shopId . " and type=1 and product_type=3 and is_shop_show=1"; $NBzItemCcList = app::get("base")->database()->executeQuery($NBzitemCcSql)->fetchAll(); $commonData["NBzItemCcList"] = $NBzItemCcList; //企业招牌背景色 $commonData['background_image'] = shopWidgets::getWidgetsData('shopsign', $shopId); $a = $commonData['background_image']; //企业菜单 //$navData = shopWidgets::getWidgetsData('nav',$shopId); //$commonData['navdata'] = $navData; //获取默认图片信息 $commonData['defaultImageId'] = app::get('image')->getConf('image.set'); if (userAuth::check()) { $commonData['nologin'] = 1; } //资质证书图片信息 $qualificationsSql = "select shop_id,certificate_img 'img',certificate 'imgname' from sysshop_shop_certificate where shop_id=" . $shopId . " UNION ALL select shop_id,manage_img 'img',manage 'imgname' from sysshop_shop_manage where shop_id=" . $shopId; $QualificationsImgs = app::get("base")->database()->executeQuery($qualificationsSql)->fetchAll(); $commonData["QualificationsImgList"] = $QualificationsImgs; //产品出售 $projectitemSql = "select * from sysshoppubt_sprodrelease sd join sysshoppubt_standard_item si on sd.uniqid=si.uniqid join sysitem_item st on st.item_id=si.item_id where sd.shop_id=" . $shopId; $projectitemImgs = app::get("base")->database()->executeQuery($projectitemSql)->fetchAll(); $commonData["projectitemList"] = $projectitemImgs; //主营 $product = app::get("sysshop")->model("shop_product")->getList("*", array("shop_id" => $shopId)); $commonData["product"] = $product; return $commonData; }