Previous Group Purchase list 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->a Ssign ("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 Gcountfrom '. C ("Db_prefix"). ' Goods_key as Gkinner 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_namefrom '. C ("Db_prefix"). ' Goods_key as Gkinner 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
Reply to discussion (solution)
Any help? Thanks, man.
Check out D ("Goods")->getgoodspartitions (); This method, change
Wait downstairs.
$partitions = D ("Goods")->getgoodspartitions ();
What does this function look like?
$partitions = D ("Goods")->getgoodspartitions ();
What does this function look like?
Public Function getgoodspartitions () {$now _time = GmtTime (); $date = D (' Goods ')->min (' End_time '); $min _year = ToDate ($ Date, ' Y '); $min _month = ToDate ($date, ' m '); $max _year = ToDate ($now _time, ' y '); $max _month = ToDate ($now _time, ' m '); $time _ arr = Array (); $partitions = Array (); for ($year = $min _year; $year <= $max _year; $year + +) {$mmonth = n; $month = 1;if ($year = = $max _year) $mmonth = $max _month;if ($year = = $min _year) $month = $min _month;for ($month; $month <= $mmonth; $month + +) {$ Next_year = $year; $next _month = $month + 1;if ($month = =) {$next _year++; $next _month = 1;} $time _arr[localstrtotime ($year. '-'. $month. ' -01 00:00:00 ')] = Localstrtotime ($next _year. '-'. $next _month. '-01 00:00:00 ');}} $index = 1; $count = count ($time _arr), foreach ($time _arr as $min _time = $max _time) {if ($max _time > $now _time) $max _ Time = $now _time; $where = "Gk.end_time >= $min _time and Gk.end_time < $max _time"; $partitions [$min _time][' date '] = t Odate ($min _time, ' Y year M Month '), $partitions [$min _time][' min_date '] = $min _time; $partitions[$min _time][' max_date '] = $max _time; $partitions [$min _time][' where '] = $where; $index + +;} Krsort ($partitions); return $partitions;}}
Finally, I found the file that defines this function, bro, thank you for your help.
No one to help???????