Let's see how the following code calls the monthly data to call all data or a year's data
List of previous deals
Public Function expired ()
{
$partitions = D ("Goods")->getgoodspartitions ();
$this->assign ("Partitions", $partitions);
$site _name = Trim ($_request[' site_name ');
$cate _id = intval ($_request[' cate_id ');
$name = Trim ($_request[' name ');
$status = Trim ($_request[' status ');
$city = Trim ($_request[' city ');
$end _time = intval ($_request[' end_time ');
if (Isset ($partitions [$end _time])
$partition = $partitions [$end _time];
Else
{
$partition = current ($partitions);
$end _time = $partition [' min_date '];
}
$this->assign ("End_time", $end _time);
$parameter = Array ();
$parameter [' end_time '] = $end _time;
$is _empty = false;
$where = ";
if (!empty ($site _name))
{
$this->assign ("Site_Name", $site _name);
$parameter [' site_name '] = $site _name;
$ids = Array ();
$site _ids = D (' site ')->where ("name like '% $site _name% '")->field (' id ')->findall ();
foreach ($site _ids as $site)
{
$ids [] = $site [' id '];
}
if (count ($ids) > 0)
$where. = ' and gk.site_id in ('. Implode (', ', $ids). ') ';
Else
$is _empty = true;
}
if (!empty ($cate _id))
{
$this->assign ("cate_id", $cate _id);
$where. = "and gk.cate_id = $cate _id";
$parameter [' cate_id '] = $cate _id;
}
if (!empty ($city))
{
$this->assign ("City", $city);
$where. = "and gk.city = ' $city '";
$parameter [' city '] = $city;
}
if (!empty ($name))
{
$name _query = Clearsymbol ($name);
if (!empty ($name _query))
{
$name _query = Segmenttounicode ($name _query, ' + ');
$match _sql = ' inner join '. C ("Db_prefix"). ' Goods_match as GM on gm.id = Gk.id ';
$where. = "and MATCH (gm.content) against (' $name _query ' in BOOLEAN MODE)";
$this->assign ("name", $name);
$parameter [' name '] = $name;
}
}
if ($status! = "" "&& $status >= 0)
{
$where. = "and g.status = $status";
$this->assign ("status", $status);
$parameter [' status '] = $status;
}
Else
{
$this->assign ("status",-1);
}
if (! $is _empty)
{
$model = M ();
$count _str = ' SELECT count (g.id) as Gcount
From '. C ("Db_prefix"). ' Goods_key as GK
INNER JOIN '. C ("Db_prefix"). ' Goods as G on g.id = Gk.id '. $match _sql.
"Where $partition [where] $where";
$count = $model->query ($count _str);
$count = $count [0][' Gcount '];
$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
From '. C ("Db_prefix"). ' Goods_key as GK
INNER JOIN '. C ("Db_prefix"). ' Goods as G on g.id = Gk.id '. $match _sql.
"Where $partition [where] $where";
$voList = $this->_sqllist ($model, $sql _str, $count, $parameter, ' id ', false);
}
Else
$voList = Array ();
L ("Forbid", "not audited");
L ("NORMAL", "audited");
$group _city_list = D ("groupcity")->where ("Status=1")->order ("Sort asc,id asc")->findall ();
$this->assign ("Group_city_list", $group _city_list);
$goodsCates = D (' goodscate '), where ("Status=1"), FindAll ();
$goodsCates = D (' goodscate '), Toformattree ($goodsCates, Array (' name '));
$this->assign ("Goodscates", $goodsCates);
$this->display ();
}
The calling code for the foreground is this: Selected >{$partition. Date}
His drop-down menu selection is all the stale data for each month, and the effect I want is the drop-down menu plus a full expired data or an expired data per year
------to solve the idea----------------------
Check out D ("Goods")->getgoodspartitions (); This method, change
Wait downstairs.
------to solve the idea----------------------
$partitions = D ("Goods")->getgoodspartitions ();
What does this function look like?