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


PHP Fields::getReserveFieldsByModulePath方法代码示例

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


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

示例1: getList

    public function getList()
    {
        $start = microtime(true);
        $data = array('list' => array(), 'categories' => array());
        $parentIds = array();
        $sql = '
			SELECT DISTINCT {{catalog}}.*, {{tree}}.* FROM {{catalog}}
			INNER JOIN {{tree}} ON {{catalog}}.tree={{tree}}.id
			WHERE {{catalog}}.market=1 AND {{catalog}}.price>0 AND {{tree}}.visible=1 AND available=1
			ORDER BY num
		';
        //print DB::prefix($sql);
        $catalog = DB::getPagi($sql);
        $fields = Fields::getReserveFieldsByModulePath($tab);
        $k = 1;
        $date_b = explode('.', Funcs::$conf['akcia']['date_begin']);
        $date_e = explode('.', Funcs::$conf['akcia']['date_end']);
        $date_b = mktime(0, 0, 0, $date_b[1], $date_b[0], $date_b[2]);
        $date_e = mktime(23, 59, 59, $date_e[1], $date_e[0], $date_e[2]);
        $today = mktime();
        $yes = 0;
        if ($today >= $date_b && $today <= $date_e) {
            $yes = 1;
        }
        foreach ($catalog as $i => $model) {
            $akcia = '0';
            //if ($yes==1)
            //$akcia=$model['akcia'];
            $data['list'][] = array('id' => $model['id'], 'parent' => $model['parent'], 'fields' => Fields::getFieldsByTree($model['tree'], 'wide'), 'name' => Market::clearInfo($model['name']), 'path' => Catalog::getPathToTree($model['tree']), 'available' => $model['available'], 'bid' => $model['bid'], 'akcia' => $akcia, 'cbid' => $model['cbid'], 'typePrefix' => $model['typePrefix'], 'vendor' => Funcs::$referenceId['vendor'][$model['vendor']]['name'], 'yandex_description' => Market::clearInfo($model['yandex_description']), 'price' => $model['price'], 'local_delivery_cost' => $model['price'] < 4000 ? '200' : '0', 'manufacturer_warranty' => $model['manufacturer_warranty']);
            $parentIds[] = $model['parent'];
            $k++;
            //echo $k.' Время выполнения скрипта '.(microtime(true) - $start).'<br />';
        }
        $parentIds = array_unique($parentIds);
        if (count($parentIds) > 0) {
            $sql = '
				SELECT * FROM {{tree}} WHERE id IN (' . implode(',', $parentIds) . ')
			';
            $list = DB::getAll($sql);
            $parentIds = array();
            foreach ($list as $item) {
                $data['categories'][] = array('id' => $item['id'], 'parent' => $item['parent'], 'name' => $item['name']);
                $parentIds[] = $item['parent'];
            }
            if (count($parentIds) > 0) {
                $sql = '
					SELECT * FROM {{tree}} WHERE id IN (' . implode(',', $parentIds) . ')
				';
                $list = DB::getAll($sql);
                foreach ($list as $item) {
                    $data['categories'][] = array('id' => $item['id'], 'name' => $item['name']);
                }
            }
        }
        return $data;
    }
开发者ID:sov-20-07,项目名称:billing,代码行数:56,代码来源:MarketModel.php

示例2: getOne

    public function getOne($id)
    {
        //die($id);
        if (!Cache::get('model' . $id)) {
            $fields = Fields::getReserveFieldsByModulePath('catalog');
            $sql = '
				SELECT {{catalog}}.*, {{tree}}.* FROM {{catalog}} 
				INNER JOIN {{tree}} ON {{catalog}}.tree={{tree}}.id
				WHERE {{tree}}.id =' . $id . '
			';
            $model = DB::getRow($sql);
            if ($model) {
                foreach ($fields as $key => $item) {
                    if (in_array($item['path'], OneSSA::$catalogStandart)) {
                        $temp[$item['path']] = $model[$item['path']];
                    }
                }
                $return = $temp;
                $return['id'] = $id;
                $parentpath = Tree::getPathToTree($model['parent']);
                $return['path'] = $parentpath . $id . '/';
                $return['tree'] = $id;
                $return['name'] = $model['name'];
                $return['parent'] = $model['parent'];
                $return['rating'] = $model['rating'];
                $return['report'] = Catalog::getCountReport($id);
                $return['sale'] = $item['price'] - $item['supprice'];
                $fields = Fields::getFieldsByTree($id, 'wide');
                $return['pics'] = $fields['files_gal']['image'];
                /*$date_b=explode('.', Funcs::$conf['akcia']['date_begin']);
                		$date_e=explode('.', Funcs::$conf['akcia']['date_end']);
                		$date_b=mktime(0,0,0,$date_b[1], $date_b[0],$date_b[2]);
                		$date_e=mktime(23,59,59,$date_e[1], $date_e[0],$date_e[2]);
                		$today=mktime();
                		$yes=0;
                		if (($today>=$date_b)&&($today<=$date_e))
                		$yes=1;
                		$akcia='0';
                		if ($yes==1)
                		$akcia=$model['akcia'];*/
                $return['akcia'] = $akcia;
                $return['files'] = $fields['files_gal']['application'];
                $multi = Fields::getMultiFields($id);
                if (count($multi['tv']) > 0) {
                    $return['descr1'] = 'Телевидение';
                    $return['descr2'] = Funcs::$referenceId['tv'][$multi['tv'][0]]['name'];
                }
                unset($fields['files_gal']);
                unset($fields['gal']);
                $return['additional'] = Catalog::getAdditionalFieldsArray($fields);
                Cache::set('model' . $id, $return);
                return $return;
            }
        } else {
            return Cache::get('model' . $id);
        }
    }
开发者ID:sov-20-07,项目名称:billing,代码行数:57,代码来源:CatalogModel.php


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