".time(); } else if($search['state'] == 1) { $sql.=" and p.state=1"; } else if($search['state'] == 2) { $sql.=" and (p.state=2 or (p.state = 0 and p.end_time <".time()." ) )"; } } $count=count(M()->query($sql)); $Page = new \Think\Page($count,C('BACK_PAGE_NUM')); $show = $Page->show();// 分页显示输出 $sql.=' ORDER BY p.pin_id desc LIMIT '.$Page->firstRow.','.$Page->listRows; $list=M()->query($sql); foreach($list as $key => $val) { $sql = "select count(o.order_id) as count from ".C('DB_PREFIX')."pin_order as po,".C('DB_PREFIX')."order as o where po.order_id= o.order_id and po.pin_id = ".$val['pin_id']." and o.order_status_id in(1,2,4,6,7,8,9,10) "; $count_arr = M()->query($sql); $pin_buy_count = $count_arr[0]['count']; if($val['state'] == 0 && $val['end_time'] '~~暂无数据', 'list'=>$list, 'page'=>$show ); } public function pin_info() { } } ?>