public function save() { $showdialog = input::get('showdialog', false); $params = input::get('params'); try { shopWidgets::setParams(input::get('widgets_id'), input::get('widgets'), input::get('dialog'), input::get('params'), $this->shopId); } catch (Exception $e) { return $this->splash('error', null, $e->getMessage(), true); } if ($showdialog) { $url = url::action('topshop_ctl_shop_decorate@dialog', array('widgets' => input::get('widgets'), 'dialog' => $showdialog)); } else { $url = url::action('topshop_ctl_shop_decorate@index'); } $msg = app::get('topshop')->_('保存成功'); return $this->splash('success', $url, $msg, true); }
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); }
public function checkImageSlider() { $widgetsInfo = input::get(); $dialogData = shopWidgets::getWapInfo($widgetsInfo['widgets'], $this->shopId, null); if (count($dialogData[0]['params']) >= 4) { //$url = url::action('topshop_ctl_wap_decorate@addTags',array('widgets'=>$widgetsInfo['widgets'],'dialog'=>$widgetsInfo['dialog'])); $msg = app::get('topshop')->_('前台商品配置项不能超过4个!'); return $this->splash('error', null, $msg, true); } }
private function __getItems($data) { $objLibFilter = kernel::single('topm_item_filter'); $params = $objLibFilter->decode($data); $params['use_platform'] = '0'; if ($params['shop_id']) { $pagedata['shopCat'] = $shopCat = app::get('topm')->rpcCall('shop.cat.get', array('shop_id' => $params['shop_id'])); } if ($params['shop_cat_id'] && $shopCat[$params['shop_cat_id']]) { $params['shop_cat_id'] = array_keys($shopCat[$params['shop_cat_id']]['children']); $params['shop_cat_id'] = implode(',', $params['shop_cat_id']); } //标签获取 if ($params['widgets_id'] && $params['widgets_type']) { $tagInfo = shopWidgets::getWapInfo($params['widgets_type'], $data['shop_id'], $data['widgets_id']); foreach ($tagInfo[0]['params']['item_id'] as $key => $value) { $item_id .= $value . ','; } $params['item_id'] = rtrim($item_id, ","); } $itemsList = $this->__search($params); $items = $itemsList['list']; $count = $itemsList['total_found']; $pagedata['items'] = $items; $pagedata['activeFilter'] = $params; $tmpFilter = $params; unset($tmpFilter['pages']); $pagedata['filter'] = $objLibFilter->encode($tmpFilter); $current = $params['pages'] ? $params['pages'] : 1; if ($count > 0) { $totalPage = ceil($count / $this->limit); } $pagedata['pagers'] = array('link' => url::action('topm_ctl_shopcenter@search', $params), 'current' => $current, 'total' => $totalPage <= $this->maxPages ? $totalPage : $this->maxPages); if (userAuth::check()) { $pagedata['nologin'] = 1; } return $pagedata; }
/** * 获取企业模板页面头部共用部分的数据 * * @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; }