当前位置: 首页>>代码示例>>PHP>>正文


PHP Route::makeShopSystemUrl方法代码示例

本文整理汇总了PHP中Core\Helper\Utility\Route::makeShopSystemUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Route::makeShopSystemUrl方法的具体用法?PHP Route::makeShopSystemUrl怎么用?PHP Route::makeShopSystemUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Core\Helper\Utility\Route的用法示例。


在下文中一共展示了Route::makeShopSystemUrl方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: smarty_helper_function_make_system_url

/**
 * 用于生成系统的操作链接,符合系统 URL 调用规范
 *
 * 在模板中的使用方法 {{makeUrl controller='/User/Login' username='xxx' password='xxx' }}
 *
 * 必须要有 controller 用于指定控制器,其它参数可以没有
 *
 * */
function smarty_helper_function_make_system_url(array $paramArray, $smarty)
{
    $system = isset($paramArray['system']) ? $paramArray['system'] : '';
    $controller = isset($paramArray['controller']) ? $paramArray['controller'] : '/Error/E404';
    $static = isset($paramArray['static']) ? $paramArray['static'] : null;
    if (empty($system)) {
        return '';
    }
    // 去除 system,controller, static ,其它都是控制器的参数
    unset($paramArray['system']);
    unset($paramArray['controller']);
    unset($paramArray['static']);
    return RouteHelper::makeShopSystemUrl($system, $controller, $paramArray, $static);
}
开发者ID:jackycgq,项目名称:bzfshop,代码行数:22,代码来源:smarty_helper.php

示例2: get

 public function get($f3)
 {
     global $smarty;
     // 生成 smarty 的缓存 id
     $smartyCacheId = 'Shop|Index';
     // 开启并设置 smarty 缓存时间
     enableSmartyCache(true, bzf_get_option_value('smarty_cache_time_shop_index'));
     if ($smarty->isCached('shop_index.tpl', $smartyCacheId)) {
         goto out_display;
     }
     // 滑动图片广告
     $shop_index_adv_slider = json_decode(bzf_get_option_value('shop_index_adv_slider'), true);
     if (!empty($shop_index_adv_slider)) {
         $smarty->assign('shop_index_adv_slider', $shop_index_adv_slider);
     }
     // 今日新品
     $recommandGoodsArray = SearchHelper::search(SearchHelper::Module_Goods, $this->searchFieldSelector, $this->searchExtraCondArray, array(array('goods_id', 'desc')), 0, 40);
     if (!empty($recommandGoodsArray)) {
         $smarty->assign('recommandGoodsArray', $recommandGoodsArray);
     }
     // 广告 advBlock
     $shop_index_advblock_json_data = json_decode(bzf_get_option_value('shop_index_advblock_json_data'), true);
     if (!empty($shop_index_advblock_json_data)) {
         // 生成随机的 id 号给 html 使用
         foreach ($shop_index_advblock_json_data as &$advBlockObject) {
             $advBlockObject['id'] = Utils::generateRandomHtmlId();
             foreach ($advBlockObject['advBlockImageArray'] as &$advBlockImage) {
                 $advBlockImage['id'] = Utils::generateRandomHtmlId();
             }
         }
         $smarty->assign('shop_index_advblock_json_data', $shop_index_advblock_json_data);
     }
     // 移动端对应的 URL,用于百度页面适配
     $smarty->assign('currentPageMobileUrl', RouteHelper::makeShopSystemUrl(PluginHelper::SYSTEM_MOBILE, '/'));
     out_display:
     $smarty->assign('seo_title', $smarty->getTemplateVars('seo_title') . ',' . $f3->get('HOST'));
     $smarty->display('shop_index.tpl', $smartyCacheId);
 }
开发者ID:jackycgq,项目名称:bzfshop,代码行数:38,代码来源:Index.php

示例3: smarty_helper_function_goods_view_toolbar

/**
 * 生成商品查看的 toolbar,用户可以查看 团购、商城、移动
 *
 * @param array $paramArray
 * @param       $smarty
 *
 * @return string
 */
function smarty_helper_function_goods_view_toolbar(array $paramArray, $smarty)
{
    $goods_id = isset($paramArray['goods_id']) ? intval($paramArray['goods_id']) : 0;
    $system_tag_list = isset($paramArray['system_tag_list']) ? $paramArray['system_tag_list'] : '';
    // 参数不对,没有东西可以输出
    if ($goods_id <= 0) {
        return 'goods_id [' . $goods_id . '] 非法';
    }
    // 如果不提供 system_tag_list 参数,我们从数据库查询
    if (!array_key_exists('system_tag_list', $paramArray)) {
        static $goodsBasicService = null;
        if (!$goodsBasicService) {
            $goodsBasicService = new GoodsBasicService();
        }
        // 缓存 5 秒钟
        $goods = $goodsBasicService->loadGoodsById($goods_id, 5);
        if (!$goods->isEmpty()) {
            $system_tag_list = $goods['system_tag_list'];
        } else {
            return 'goods_id [' . $goods_id . '] 非法';
        }
    }
    // 解析成 System Array
    $systemArray = \Core\Helper\Utility\Utils::parseTagString($system_tag_list);
    $htmlContent = '<div class="btn-group">';
    $system_url_base_array = json_decode(\Theme\Manage\ManageThemePlugin::getOptionValue('system_url_base_array'), true);
    if (!empty($system_url_base_array)) {
        foreach ($systemArray as $system) {
            if (!array_key_exists($system, $system_url_base_array)) {
                // 不存在的系统,跳过
                continue;
            }
            $themeSystem = $system_url_base_array[$system];
            $htmlContent .= '<a title="查看' . $themeSystem['name'] . '商品详情" target="_blank" href="' . RouteHelper::makeShopSystemUrl($system, '/Goods/View', array('goods_id' => $goods_id)) . '" class="btn btn-mini btn-info">' . $themeSystem['name'] . '</a>';
        }
    }
    $htmlContent .= '</div>';
    return htmlspecialchars($htmlContent);
}
开发者ID:jackycgq,项目名称:bzfshop,代码行数:47,代码来源:smarty_helper.php

示例4: get


//.........这里部分代码省略.........
     if ($goodsInfo->isEmpty() || !Utils::isTagExist(PluginHelper::SYSTEM_SHOP, $goodsInfo['system_tag_list'])) {
         $this->addFlashMessage('商品 [' . $goods_id . '] 不存在');
         goto out_fail;
     }
     // 取得商品的分类层级
     $goodsCategoryLevelArray = array();
     $goodsCategoryService = new GoodsCategoryService();
     $categoryLevel = 5;
     // 最多取 5 层分类
     $currentCategoryId = $goodsInfo['cat_id'];
     for (; $categoryLevel > 0; $categoryLevel--) {
         $category = $goodsCategoryService->loadCategoryById($currentCategoryId, 1800);
         if ($category->isEmpty()) {
             break;
         }
         array_unshift($goodsCategoryLevelArray, $category);
         if ($category['parent_meta_id'] <= 0) {
             break;
         }
         $currentCategoryId = $category['parent_meta_id'];
     }
     // 取商品推广信息设置
     $goodsPromote = $goodsBasicService->loadGoodsPromoteByGoodsId($goods_id);
     // 取商品图片集
     $goodsGalleryArray = GoodsGalleryCache::getGoodsGallery($goods_id);
     foreach ($goodsGalleryArray as &$galleryItem) {
         $galleryItem['img_original'] = RouteHelper::makeImageUrl($galleryItem['img_original']);
         $galleryItem['img_url'] = RouteHelper::makeImageUrl($galleryItem['img_url']);
         $galleryItem['thumb_url'] = RouteHelper::makeImageUrl($galleryItem['thumb_url']);
     }
     unset($galleryItem);
     // 取相互关联的商品
     $linkGoodsArray = $goodsBasicService->fetchLinkGoodsArray($goods_id);
     // 相同供货商的商品,一起购买只收一份邮费
     $goodsSupplierService = new GoodsSupplierService();
     // 取得供货商下面的商品总数,总数只缓存 10 分钟
     $supplierTotalGoodsCount = $goodsSupplierService->countSupplierGoodsArray($goodsInfo['suppliers_id'], 600);
     // 随机挑选 10 个商品
     $supplierGoodsSize = 10;
     $supplierGoodsOffset = $supplierTotalGoodsCount <= $supplierGoodsSize ? 0 : mt_rand(0, $supplierTotalGoodsCount - $supplierGoodsSize);
     $supplierGoodsArray = $goodsSupplierService->fetchSupplierGoodsArray($goodsInfo['suppliers_id'], $supplierGoodsOffset, $supplierGoodsSize);
     // 把自己去除掉
     $supplierGoodsKeyExcludeArray = array();
     foreach ($supplierGoodsArray as $supplierGoodsKey => $supplierGoodsItem) {
         if ($supplierGoodsItem['goods_id'] == $goods_id) {
             $supplierGoodsKeyExcludeArray[] = $supplierGoodsKey;
         }
     }
     foreach ($supplierGoodsKeyExcludeArray as $supplierGoodsKey) {
         unset($supplierGoodsArray[$supplierGoodsKey]);
     }
     // 设置商品页面的 SEO 信息
     $smarty->assign('seo_title', $goodsInfo['seo_title'] . ',' . $f3->get('sysConfig[site_name]'));
     $smarty->assign('seo_description', $goodsInfo['seo_description']);
     $smarty->assign('seo_keywords', $goodsInfo['seo_keyword']);
     // 给模板赋值
     $smarty->assign('goodsInfo', $goodsInfo);
     $smarty->assign('goodsPromote', $goodsPromote);
     // 商品购买选择的规格
     if (!empty($goodsInfo['goods_spec'])) {
         $goodsSpecService = new GoodsSpecService();
         $goodsSpecService->initWithJson($goodsInfo['goods_spec']);
         // 只显示有库存的商品规格
         $goodsSpecData = $goodsSpecService->getBuyableData();
         $smarty->assign($goodsSpecData);
         $smarty->assign('goodsSpecJson', json_encode($goodsSpecData));
     }
     // 商品的类型属性
     if ($goodsInfo['type_id'] > 0) {
         $goodsTypeService = new GoodsTypeService();
         $goodsAttrTreeTable = $goodsTypeService->fetchGoodsAttrItemValueTreeTable($goodsInfo['goods_id'], $goodsInfo['type_id']);
         $smarty->assign('goodsAttrTreeTable', $goodsAttrTreeTable);
     }
     if (!empty($goodsCategoryLevelArray)) {
         $smarty->assign('goodsCategoryLevelArray', $goodsCategoryLevelArray);
     }
     if (!Utils::isEmpty($goodsGalleryArray)) {
         $smarty->assign('goodsGalleryArray', $goodsGalleryArray);
     }
     if (!Utils::isEmpty($linkGoodsArray)) {
         $smarty->assign('linkGoodsArray', $linkGoodsArray);
     }
     if (!Utils::isEmpty($supplierGoodsArray)) {
         $smarty->assign('supplierGoodsArray', $supplierGoodsArray);
     }
     // 滑动图片广告
     $goods_view_adv_slider = json_decode(bzf_get_option_value('goods_view_adv_slider'), true);
     if (!empty($goods_view_adv_slider)) {
         $smarty->assign('goods_view_adv_slider', $goods_view_adv_slider);
     }
     // 移动端对应的 URL,用于百度页面适配
     $smarty->assign('currentPageMobileUrl', RouteHelper::makeShopSystemUrl(PluginHelper::SYSTEM_MOBILE, '/Goods/View', array('goods_id' => $goods_id)));
     out_display:
     $smarty->display('goods_view.tpl', $smartyCacheId);
     return;
     out_fail:
     // 失败从这里返回
     RouteHelper::reRoute($this, '/');
     // 返回首页
 }
开发者ID:jackycgq,项目名称:bzfshop,代码行数:101,代码来源:View.php


注:本文中的Core\Helper\Utility\Route::makeShopSystemUrl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。