婚恋交友网站开发制作,第二篇

Posted Myjiaoyouweb

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了婚恋交友网站开发制作,第二篇相关的知识,希望对你有一定的参考价值。


前端时间因为时间太慢了,没有接着更新,现在接着把这个项目的婚恋交友网站开发制作开发过程的后面代码发布一下,希望能够帮到帮到大家的学习和使用。

这个是前台的,会员部分控制器

推荐部分

class IndexController extends SiteController {

public function index($w=""){
    if(!$this->uinfo){

       redirect(U("Public/index"));

       exit;

    }  
    if(C("onlywx")==1 && strpos($_SERVER[\'HTTP_USER_AGENT\'], \'MicroMessenger\') === false){

        $this->siteDisplay(\'jg_qzwxdk\');

        exit;

    }      

    $media=$this->getMedia(\'推荐\');

    $this->assign(\'media\', $media);
    

    $where = " 1=1 ";

    

    $sex = I("post.sex",\'\',\'intval\');

    if(!$sex){//默认

        $sex = $this->uinfo[\'sex\']==1?\'2\':\'1\';

        $cookiesex =cookie(\'defsex\');        

        $sex = $cookiesex?$cookiesex:$sex;        

    }else{

        $sex = $sex;

        cookie(\'defsex\',$sex,3600);

    }        

    if($sex>0)

    $where.=" and sex=".$sex;
    
    $where.=" and ismj=1";
    
    $age = I("post.age",\'\',\'intval\');    

    if($age>0){

        $now = date("Y");

        switch($age){

            case 1:                

            $where.=" and age between ".($now-25)." and ".($now-18);

            break;

            case 2:                

            $where.=" and age between ".($now-35)." and ".($now-26);

            break;

            case 3:                

            $where.=" and age between ".($now-40)." and ".($now-36);

            break;

            case 4:                

            $where.=" and age between ".($now-50)." and ".($now-40);

            break;

            case 5:                

            $where.=" and age between ".($now-100)." and ".($now-50);

            break;

        }

    }    

地区部分

$areaList = A(\'Home/Site\')->get_area();

    foreach ($areaList as $v){

        if($v[\'rootid\']==0){

            $province[] =$v;

        }

        if($v[\'rootid\']==$querypama[\'provinceid\']){

            $city[] =$v;

        }                

    }

    $this->assign(\'province\',$province);

    $this->assign(\'city\',$city);

    //地区

    

    //dump($querypama);

    if($_POST[\'p\']>=200)exit;

    if (I("post.ajax") == 1)

    $this -> ajaxReturn($list);
    shuffle($list);
    $this -> assign(\'list1\', $list);

    $this -> assign(\'page\', $show);

    $this -> assign(\'sex\', $sex);

    $this -> assign(\'age\', $age);

    

    if(cookie("dw"))

        $this -> assign(\'dw\', 0);

    else

        $this -> assign(\'dw\', 1);

    

    

    $today = date("Ymd",time());

    if($today == cookie(\'qiandaotime\'.$this->uinfo["id"])||$today == S(\'qiandaotime\'.$this->uinfo["id"]) || C(\'qd_config\') == 0){

        $this -> assign(\'qd\',1);

    }else{

        $this -> assign(\'qd\', 0);

    }

    //if(cookie(\'newberenwu\'.$this->uinfo["id"]))
    $this -> assign(\'nonewbe\',1);

    $gg = M(\'Content\')->cache(true,300)->where(\'class_id=8 and (sex=0 or sex=\'.$this->uinfo[\'sex\'].\')\')->order(\'sequence desc,time desc\')->limit(1)->find();

    if(cookie(\'gg\')!=$gg[\'content_id\'])    

        cookie(\'gg\',0,300);

    $this->assign(\'gg\',$gg);

    $this->siteDisplay(C(\'TPL_INDEX\'));

}

图片设置

public function photo(){

    if(!$this->uinfo){

       redirect(U("Public/index"));

       exit;

    }        

    $media=$this->getMedia(\'相册\');

    $this->assign(\'media\', $media);

    $where = " 1=1 ";

    

    

    $sex = I("post.sex",\'\',\'intval\');

    if(!$sex){//默认

        $sex = $this->uinfo[\'sex\']==1?\'2\':\'1\';

        $cookiesex =cookie(\'defsex\');        

        $sex = $cookiesex?$cookiesex:$sex;        

    }else{

        $sex = $sex;

        cookie(\'defsex\',$sex,3600);

    }        

    if($sex>0)

    $where.=" and sex=".$sex;

    

    

    $age = I("post.age",\'\',\'intval\');    

    if($age>0){

        $now = date("Y");

        switch($age){

            case 1:                

            $where.=" and age between ".($now-25)." and ".($now-18);

            break;

            case 2:                

            $where.=" and age between ".($now-35)." and ".($now-26);

            break;

            case 3:                

            $where.=" and age between ".($now-40)." and ".($now-36);

            break;

            case 4:                

            $where.=" and age between ".($now-50)." and ".($now-40);

            break;

            case 5:                

            $where.=" and age between ".($now-100)." and ".($now-50);

            break;

        }

    }

    

    $provinceid = I("post.provinceid",\'\',\'intval\');    

    $cityid = I("post.cityid",\'\',\'intval\');            

    $querypama = $this->get_areaid_toquery($provinceid,$cityid);

        if($querypama[\'id\']){

        $where .= " and u.".$querypama[\'type\'].\'=\'.$querypama[\'id\'];            

        }

    $where .=\' or cityid=0\';

    $where .=" and p.flag =1 and p.phototype=0"; //elite=1 and     

    $User = M("user_photo");

    $count = $User->alias(\'p\')->cache(true,300)->join("__USERS__ as u ON u.id=p.uid")->where($where) -> count();

    $_GET[\'p\']=$_POST[\'p\'];

    $Page = new \\Think\\Page($count, 15);        

    $show = $Page -> show();        

    $list = $User->alias(\'p\')->cache(true,300) ->field(\'p.thumbfiles,u.avatar,p.photoid,p.idmd5,u.user_nicename,p.hits\')->join("__USERS__ as u ON u.id=p.uid")-> where($where) -> order(\'p.elite,p.photoid desc\') -> limit($Page -> firstRow . \',\' . $Page -> listRows) -> select();        

    foreach($list as $key=> $val){

        $list[$key][\'aurl\'] = U("Show/photo", array("pid" => $val[idmd5]));

    }

以上是关于婚恋交友网站开发制作,第二篇的主要内容,如果未能解决你的问题,请参考以下文章

相亲网站系统建设,手机微信交友平台网站定制开发,婚恋相亲网站制作公司

婚恋网站建设交友网站定制开发相亲网站建设

小学期——第二篇

第二篇-ubuntu18.04下怎么制作GIF动画

Mybatis框架第二篇

Hadoop第二篇:使用Maven开发Hadoop编程进阶