婚恋交友网站开发制作,第二篇
时间:2023-04-22 08:36:01 | 来源:网站运营
时间:2023-04-22 08:36:01 来源:网站运营
婚恋交友网站开发制作,第二篇:好像没有更新了,这个项目的记录了,今天来整理一下,把这个项目的开发实现的记录给记录下来
回顾章节
第一篇
婚恋交友网站开发制作,第一篇_承接各种网站建设开发定制-CSDN博客
1.首页是会员中心
控制器部分
<?php
namespace Home/Controller;
use Home/Controller/SiteController;
/**
*
http://lxphp.com */
class UserController extends SiteController {
public function __construct() {
parent::__construct ();
if(!$this->uinfo){
redirect(U("Public/index"));
exit;
}
$this -> assign('nav', 'User');
if(C("onlywx")==1 && strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') === false){
$this->siteDisplay('jg_qzwxdk');
exit;
}
}
入口方法
public function index(){
$media = $this->getMedia ( '用户中心', '', '', '用户中心', 'ismenu' );
//$uinfo = $this->uinfo;
$usermod = M('Users');
$uinfo =$usermod->where(' id ='.$this->uinfo['id'])->find();
if(!$uinfo || $uinfo['user_status']==0) redirect(U('Public/dologout'));
$uinfo['age'] = date('Y',time())-$uinfo['age'];
$userCount = M('UserCount')->where('uid = '.$uinfo['id'])->find();
$userProfile =M('userProfile')->where('uid ='.$uinfo['id'])->find();
$areaList = $this->get_area();
$uinfo['province_name'] =$areaList[$uinfo['provinceid']]['areaname'];
$uinfo['city_name'] =$areaList[$uinfo['cityid']]['areaname'];
$this->setUserinfo('money',$uinfo['money']);
if($uinfo['user_nicename']){
$this->setUserinfo('user_nicename',$uinfo['user_nicename']);
}else if($uinfo['user_nicename']!=$this->uinfo['user_nicename']){
$uinfo['user_nicename']=$this->uinfo['user_nicename'];
}
$this->setUserinfo('provinceid',$uinfo['provinceid']);
$this->setUserinfo('cityid',$uinfo['cityid']);
$this->setUserinfo('avatar',$uinfo['avatar']);
$this->setUserinfo('user_rank',$uinfo['user_rank']);
$this->setUserinfo('rank_time',$uinfo['rank_time']);
$this->setUserinfo('user_status',$uinfo['user_status']);
$uinfo = $this->get_jifen_rank_name($uinfo);
if($userCount['wdsxnum']>0 || $userCount['wdgznum']>0 || $userCount['wdsysnum']>0 || $userCount['wdgiftnum']>0){
cookie('wdsxnum',1,3600);
}
$this->assign ( 'userProfile', $userProfile );
$this->assign ( 'userCount', $userCount );
if( S('qiandaotime'.$this->uinfo["id"]) == date('Ymd',time()) )
$this->assign ( 'isqd', 1 );
if($this->uinfo['last_login_time']<time()-86400){
$usermod->where('id='.$this->uinfo['id'])->setField('last_login_time',time());
$this->setUserinfo('last_login_time',time());
}
if($isvip = $this->isvip($uinfo)){
$uinfo['user_rank'] = $isvip['user_rank'];
}else{
if($this->uinfo['user_rank']>0){
$usermod->where('id='.$this->uinfo['id'])->setField('user_rank',0);
$this->setUserinfo('user_rank',0);
}
$uinfo['user_rank'] = 0;
}
$this->assign ( 'uinfo', $uinfo );
$this->assign ( 'media', $media );
$this->siteDisplay ( 'user_center' );
}
我的关注/我的粉丝
public function MySubscribe(){
$mod =M('UserSubscribe');
$type = I('get.type',0,'intval');
$type? $where['a.touid'] = $this->uinfo['id']:$where['a.fromuid'] = $this->uinfo['id'];
$type? $str = 'a.fromuid':$str = 'a.touid';
$name = $type? '我的粉丝':'我的关注';
$count = $mod ->alias('a')-> where($where) -> count();
$Page = new /Think/Page($count, 15);
$show = $Page -> show();
$list = $mod ->alias('a')->join('__USERS__ b ON b.id='.$str,'LEFT')->join('__USER_PROFILE__ c ON c.uid= '.$str,'LEFT')->field('a.time,b.user_nicename,b.avatar,b.sex,b.age,b.jifen,b.user_rank,b.rank_time,b.provinceid,b.cityid,c.monolog,c.astro,b.idmd5')-> where($where) -> order('a.time desc') -> limit($Page -> firstRow . ',' . $Page -> listRows) -> select();
$areaList = $this->get_area();
$Constellation = C('Constellation');
if($list){
foreach ($list as $k=>$v){
$list[$k]['time'] = $this->new_format_date($v['time']);
$list[$k]['province_name'] =$areaList[$v['provinceid']]['areaname'];
$list[$k]['city_name'] =$areaList[$v['cityid']]['areaname'];
$list[$k]['astro'] =$Constellation[$v['astro']];
$list[$k]['age'] = date('Y',time())-$v['age'];
$list[$k]['vip'] = $this -> isvip($v);
//$list[$k] = array_filter($list[$k]);
}
}
if($_GET['p']>=200)exit;
if (I("get.ajax") == 1)
$this -> ajaxReturn($list);
//
// dump($list);
// exit;
$this -> assign('type',$type);
$media = $this->getMedia ( $name, '', '', $name, 'ismenu' );
$this->assign ( 'name', $name );
$this->assign ( 'media', $media );
$this -> assign('list', $list);
$this -> assign('page', $show);
$this->siteDisplay ( 'user_subscribe' );
}
我的相册
public function MyPhoto(){
$mod = M('UserPhoto');
$where =array('uid'=>$this->uinfo['id'],'flag'=>1,'phototype'=>0);
$cphoto = $mod->where($where)->count();
if($cphoto) $cinfo = $mod->where($where)->order('photoid desc')->getField('thumbfiles');
$where['phototype'] = 1;
$sphoto = $mod->where($where)->count();
if($sphoto) $sinfo = $mod->where($where)->order('photoid desc')->getField('thumbfiles');
$photo_config = M('UserProfile')->where('uid = '.$this->uinfo['id'])->getField('photo_config');
if($photo_config) $photo_config = unserialize($photo_config);
$this -> assign('photo_config', $photo_config);
$this -> assign('cphoto', $cphoto);
$this -> assign('cinfo', $cinfo);
$this -> assign('sphoto', $sphoto);
$this -> assign('sinfo', $sinfo);
$media = $this->getMedia ( '我的相册', '', '', '我的相册', 'ismenu' );
$this->assign ( 'media', $media );
$this->siteDisplay ( 'user_photo' );
}
有什么疑问可以,找我,各位,扣2360248-666