query($sql)); $Page = new \Think\Page($count,C('BACK_PAGE_NUM')); $show = $Page->show();// 分页显示输出 $sql.=' order by sg.addtime desc LIMIT '.$Page->firstRow.','.$Page->listRows; $list=M()->query($sql); foreach ($list as $key => $value) { $list[$key]['image']=resize($value['image'], 100, 100); if( !empty($value['voucher_id']) ) { $voucher_info = M('voucher')->where( array('id' => $value['voucher_id']) )->find(); $list[$key]['voucher_title'] = ''.$voucher_info['voucher_title'].'
剩余数量: '.( $voucher_info['total_count'] - $voucher_info['send_count'] )."
"; } else { $list[$key]['voucher_title'] = '未指定券'; } //index.html voucher_title } return array( 'empty'=>'~~暂无数据', 'list'=>$list, 'page'=>$show ); } } ?>