帮忙看下怎么把下面代码调用每月的数据改成调用所有数据或某年份的数据
//往期团购列表<br /> public function expired()<br /> {<br /> $partitions = D("Goods")->getGoodsPartitions();<br /> $this->assign("partitions",$partitions);<br /><br /> $site_name = trim($_REQUEST['site_name']);<br /> $cate_id = intval($_REQUEST['cate_id']);<br /> $name = trim($_REQUEST['name']);<br /> $status = trim($_REQUEST['status']);<br /> $city = trim($_REQUEST['city']);<br /> $end_time = intval($_REQUEST['end_time']);<br /> if(isset($partitions[$end_time]))<br /> $partition = $partitions[$end_time];<br /> else<br /> {<br /> $partition = current($partitions);<br /> $end_time = $partition['min_date'];<br /> }<br /> $this->assign("end_time",$end_time);<br /><br /> $parameter = array();<br /> $parameter['end_time'] = $end_time;<br /><br /> $is_empty = false;<br /> $where = '';<br /><br /> if(!empty($site_name))<br /> {<br /> $this->assign("site_name",$site_name);<br /> $parameter['site_name'] = $site_name;<br /> $ids = array();<br /> $site_ids = D('Site')->where("name like '%$site_name%'")->field('id')->findAll();<br /> foreach($site_ids as $site)<br /> {<br /> $ids[] = $site['id'];<br /> }<br /><br /> if(count($ids) > 0)<br /> $where .= ' and gk.site_id in ('.implode(',', $ids).')';<br /> else<br /> $is_empty = true;<br /> }<br /><br /> if(!empty($cate_id))<br /> {<br /> $this->assign("cate_id",$cate_id);<br /> $where.=" and gk.cate_id = $cate_id";<br /> $parameter['cate_id'] = $cate_id;<br /> }<br /><br /> if(!empty($city))<br /> {<br /> $this->assign("city",$city);<br /> $where.=" and gk.city = '$city'";<br /> $parameter['city'] = $city;<br /> }<br /><br /> if(!empty($name))<br /> {<br /> $name_query = clearSymbol($name);<br /> if(!empty($name_query))<br /> {<br /> $name_query = segmentToUnicode($name_query,'+');<br /> $match_sql = ' inner join '.C("DB_PREFIX").'goods_match as gm ON gm.id = gk.id ';<br /> $where.=" AND MATCH (gm.content) AGAINST ('$name_query' IN BOOLEAN MODE)";<br /> $this->assign("name",$name);<br /> $parameter['name'] = $name;<br /> }<br /> }<br /><br /> if($status != "" && $status >= 0)<br /> {<br /> $where.=" and g.status = $status";<br /> $this->assign("status",$status);<br /> $parameter['status'] = $status;<br /> }<br /> else<br /> {<br /> $this->assign("status",-1);<br /> }<br /><br /> if(!$is_empty)<br /> {<br /> $model = M();<br /> $count_str = 'SELECT count(g.id) as gcount<br /> FROM '.C("DB_PREFIX").'goods_key as gk<br /> inner join '.C("DB_PREFIX").'goods as g on g.id = gk.id '.$match_sql.<br /> "where $partition[where] $where ";<br /><br /> $count = $model->query($count_str);<br /> $count = $count[0]['gcount'];<br /><br /> $sql_str = 'SELECT g.id,g.name,g.shop_price,g.city,g.end_time,g.status,g.is_best,g.sort,g.cate_id,g.bought,g.site_name<br /> FROM '.C("DB_PREFIX").'goods_key as gk<br /> inner join '.C("DB_PREFIX").'goods as g on g.id = gk.id '.$match_sql.<br /> "where $partition[where] $where ";<br /><br /> $voList = $this->_sqlList($model, $sql_str, $count,$parameter, 'id', false);<br /> }<br /> else<br /> $voList = array();<br /><br /> L("FORBID","未审核");<br /> L("NORMAL","已审核");<br /><br /> $group_city_list = D("GroupCity")->where("status=1")->order("sort asc,id asc")->findAll();<br /> $this->assign("group_city_list",$group_city_list);<br /><br /> $goodsCates = D('GoodsCate')-> where("status=1")-> findAll();<br /> $goodsCates = D('GoodsCate')-> toFormatTree($goodsCates,array('name'));<br /> $this->assign("goodsCates",$goodsCates);<br /><br /> $this->display();<br /> }
前台的调用代码是这样的:
他的下拉菜单选择都是每个月的所有过期数据,我要的效果是下拉菜单加一个全部过期数据或每年份的过期数据
------解决思路----------------------
看一下 D("Goods")->getGoodsPartitions(); 这个方法,改一改
等楼下
------解决思路----------------------
$partitions = D("Goods")->getGoodsPartitions();
这个函数长什么样子

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP remains important in the modernization process because it supports a large number of websites and applications and adapts to development needs through frameworks. 1.PHP7 improves performance and introduces new features. 2. Modern frameworks such as Laravel, Symfony and CodeIgniter simplify development and improve code quality. 3. Performance optimization and best practices further improve application efficiency.

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values and handle functions that may return null values.

In PHP, use the clone keyword to create a copy of the object and customize the cloning behavior through the \_\_clone magic method. 1. Use the clone keyword to make a shallow copy, cloning the object's properties but not the object's properties. 2. The \_\_clone method can deeply copy nested objects to avoid shallow copying problems. 3. Pay attention to avoid circular references and performance problems in cloning, and optimize cloning operations to improve efficiency.

PHP is suitable for web development and content management systems, and Python is suitable for data science, machine learning and automation scripts. 1.PHP performs well in building fast and scalable websites and applications and is commonly used in CMS such as WordPress. 2. Python has performed outstandingly in the fields of data science and machine learning, with rich libraries such as NumPy and TensorFlow.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Dreamweaver Mac version
Visual web development tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

WebStorm Mac version
Useful JavaScript development tools