<?php
namespace app\index\controller;
use app\index\controller\Common;
class Sendnewsz extends Common{
public function index(){
$conf=db('conf')->where('id',1)->find();
$check['name']="ptid";
$check['id']="0";
$ptid=0;
$pid=0;
$price=0;
$fensi=0;
$yuedu=0;
$lei=0;
if (request()->isGet() && input('ptid') ) {
$check['name']='ptid';
$check['id']=input('ptid');
$where['ptid']=input('ptid');
$ptid=input('ptid');
}
if (request()->isGet() && input('pid') ) {
$check['name']='pid';
$check['id']=input('pid');
$where['pdtype']=input('pid');
$pid=input('pid');
}
if (input('price')) {
$check['name']='price';
$check['id']=input('price');
if ($check['id']==1) {
$where['price']=array('between','1,10');
}
if ($check['id']==2) {
$where['price']=array('between','10,20');
}
if ($check['id']==3) {
$where['price']=array('between','20,50');
}
if ($check['id']==4) {
$where['price']=array('between','50,100');
}
if($check['id']==5){
$where['price']=array('egt','100');
}
$price=input('price');
}
if (input('fensi')) {
$check['name']='fensi';
$check['id']=input('fensi');
if ($check['id']==1) {
$where['fensi']=array('between','0,10000');
}
if ($check['id']==2) {
$where['fensi']=array('between','10000,50000');
}
if ($check['id']==3) {
$where['fensi']=array('between','50000,100000');
}
if ($check['id']==4) {
$where['fensi']=array('between','100000,500000');
}
if($check['id']==5){
$where['fensi']=array('egt','500000');
}
$fensi=input('fensi');
}
if (input('yuedu')) {
$check['name']='yuedu';
$check['id']=input('yuedu');
if ($check['id']==1) {
$where['yuedu']=array('between','0,1000');
}
if ($check['id']==2) {
$where['yuedu']=array('between','1000,5000');
}
if ($check['id']==3) {
$where['yuedu']=array('between','5000,10000');
}
if ($check['id']==4) {
$where['yuedu']=array('between','10000,20000');
}
if($check['id']==5){
$where['yuedu']=array('egt','20000');
}
$yuedu=input('yuedu');
}
if (input('lei')) {
$check['name']='lei';
$check['id']=input('lei');
if ($check['id']==1) {
$where['week']=1;
}
if ($check['id']==2) {
$where['neilian']=1;
}
if ($check['id']==3) {
$where['lxfs']=1;
}
if ($check['id']==4) {
$where['tishi']=1;
}
if ($check['id']==5) {
$where['tishi']=2;
}
if ($check['id']==6) {
$where['tishi']=3;
}
if ($check['id']==7) {
$where['renzheng']=1;
}
$lei=input('lei');
}
$ptname=db('ptname')->select();
$pdtype=db('pdtype')->select();
$where['status']=2;
$lsts=db('mediaz')->where($where)->alias('a')->join('ptname b','a.ptid=b.id','left')->join('pdtype c','a.pdtype=c.pid','left')->order('a.price')->field('a.*,b.ptname,c.pname')->paginate(20,false, [
'query' => request()->param()]);
$this->assign(['ptname'=>$ptname,'pdtype'=>$pdtype]);
$lst['title']='自媒体价格';
$this->assign('lsts',$lsts);
$this->assign('lst',$lst);
$this->assign('check',$check);
$this->assign('conf',$conf);
$this->assign('ptid',$ptid);
$this->assign('pid',$pid);
$this->assign('fensi',$fensi);
$this->assign('yuedu',$yuedu);
$this->assign('lei',$lei);
$this->assign('price',$price);
return view();
}
public function search(){
if (input('post.url')) {
$url=input('post.url');
$where['url']=array('like','%'.$url.'%');
$this->assign('search',$url);
}elseif(input('post.title')) {
$title=input('post.title');
$where['title']=array('like','%'.$title.'%');
$this->assign('title',$title);
}
$conf=db('conf')->where('id',1)->find();
$check['name']="cid";
$check['id']="0";
$ptname=db('ptname')->select();
$pdtype=db('pdtype')->select();
$where['status']=2;
$lsts=db('mediaz')->where($where)->alias('a')->join('ptname b','a.ptid=b.id','left')->join('pdtype c','a.pdtype=c.pid','left')->order('a.price')->field('a.id,a.title,a.url,a.price,b.ptname,c.pname,a.fensi,a.yuedu,a.neilian,a.lxfs,a.renzheng,a.week,a.uid,a.remarks,a.tishi')->select();
$this->assign(['ptname'=>$ptname,'pdtype'=>$pdtype]);
$lst['title']='自媒体价格';
$this->assign('lst',$lst);
$this->assign('lsts',$lsts);
$this->assign('check',$check);
$this->assign('conf',$conf);
return view();
}
public function daochu(){
if (request()->isGet() && input('cid') ) {
$check['name']='cid';
$check['id']=input('cid');
$where['area']=input('cid');
$cid=input('cid');
}
if (request()->isGet() && input('ptid') ) {
$check['name']='ptid';
$check['id']=input('ptid');
$where['ptid']=input('ptid');
$ptid=input('ptid');
}
if (request()->isGet() && input('pid') ) {
$check['name']='pid';
$check['id']=input('pid');
$where['pdtype']=input('pid');
$pid=input('pid');
}
if (input('price')) {
$check['name']='price';
$check['id']=input('price');
if ($check['id']==1) {
$where['price']=array('between','1,10');
}
if ($check['id']==2) {
$where['price']=array('between','10,20');
}
if ($check['id']==3) {
$where['price']=array('between','20,50');
}
if ($check['id']==4) {
$where['price']=array('between','50,100');
}
if($check['id']==5){
$where['price']=array('egt','100');
}
$price=input('price');
}
if (input('fensi')) {
$check['name']='fensi';
$check['id']=input('fensi');
if ($check['id']==1) {
$where['fensi']=array('between','0,10000');
}
if ($check['id']==2) {
$where['fensi']=array('between','10000,50000');
}
if ($check['id']==3) {
$where['fensi']=array('between','50000,100000');
}
if ($check['id']==4) {
$where['fensi']=array('between','100000,500000');
}
if($check['id']==5){
$where['fensi']=array('egt','500000');
}
$fensi=input('fensi');
}
if (input('yuedu')) {
$check['name']='yuedu';
$check['id']=input('yuedu');
if ($check['id']==1) {
$where['yuedu']=array('between','0,1000');
}
if ($check['id']==2) {
$where['yuedu']=array('between','1000,5000');
}
if ($check['id']==3) {
$where['yuedu']=array('between','5000,10000');
}
if ($check['id']==4) {
$where['yuedu']=array('between','10000,20000');
}
if($check['id']==5){
$where['yuedu']=array('egt','20000');
}
$yuedu=input('yuedu');
}
if (input('lei')) {
$check['name']='lei';
$check['id']=input('lei');
if ($check['id']==1) {
$where['week']=1;
}
if ($check['id']==2) {
$where['neilian']=1;
}
if ($check['id']==3) {
$where['lxfs']=1;
}
if ($check['id']==4) {
$where['tishi']=1;
}
if ($check['id']==5) {
$where['tishi']=2;
}
if ($check['id']==6) {
$where['tishi']=3;
}
if ($check['id']==7) {
$where['renzheng']=1;
}
$lei=input('lei');
}
$where['status']=2;
$list=db('mediaz')->where($where)->alias('a')->join('ptname b','a.ptid=b.id','left')->join('pdtype c','a.pdtype=c.pid','left')->order('id')->field('a.id,a.title,a.url,a.price,b.ptname,a.tishi,c.pname,a.fensi,a.yuedu,a.neilian,a.lxfs,a.renzheng,a.week,a.uid,a.remarks')->select();
vendor("PHPExcel.PHPExcel");
set_time_limit(0);
ini_set("memory_limit", "1024M");
\PHPExcel_CachedObjectStorageFactory::cache_in_memory_gzip; // 单元格缓存为MemoryGZip
$objPHPExcel = new \PHPExcel();
$objPHPExcel->getProperties()->setCreator("ctos")
->setLastModifiedBy("ctos")
->setTitle("Office 2007 XLSX Test Document")
->setSubject("Office 2007 XLSX Test Document")
->setDescription("Test