海外多语言国际婚恋相亲网站开发制作,第四篇
时间:2023-06-10 08:42:02 | 来源:网站运营
时间:2023-06-10 08:42:02 来源:网站运营
海外多语言国际婚恋相亲网站开发制作,第四篇:第一篇:婚恋交友网站开发制作,第一篇_承接各种网站建设开发定制-CSDN博客
第二篇:婚恋交友网站开发制作,第二篇_承接各种网站建设开发定制-CSDN博客
第三篇:国际多语言婚恋交友网站开发制作,第三篇_承接各种网站建设开发定制-CSDN博客
这个是国际多语言婚恋交友网站开发制作的专栏:
多语言国际版婚恋交友网站开发制作_承接各种网站建设开发定制-CSDN博客
如果有什么疑问可以,找我,各位,我的扣是2360248-666
国际多语言婚恋交友网站开发制作,第四篇
粉丝部分的功能开发
浏览粉丝
public function index(){
//echo "浏览";
$atten = D('byattention');
$total = $atten->where('uid='.session('user')['id'])->count();
$page = new /Think/Page($total,9);
$mod = $atten->order('byaid desc')->field('uid')->limit($page->firstRow,$page->listRows)->where('byattenid='.session('user')['id'])->select();
//定义一个空数组
$list = array();
//根据attenid获取关注的用户详情
foreach($mod as $k=>$v){
$list[] = $v['uid'];
}
//定义一个空数组接受查询信息
$res = array();
$resu = array();
//遍历$list数组
foreach($list as $v1){
//执行查询
$res[$v1] = D('user_params')->where('userid='.$v1)->field('id,gender,ageyear,marrystatus,height,cityid,monolog')->find();
if(strlen($res[$v1]['monolog'])>27){
$res[$v1]['monolog1'] = mb_substr($res[$v1]['monolog'],0,12,"utf-8")."...";
}
$resu[$v1] = D('user')->where('id='.$v1)->field('username,avatar,id')->find();
}
//根据出生年算出年龄
$sex = array('1'=>'未婚','2'=>'已婚','3'=>'离异');
foreach($res as $k=>$v){
$res[$k]['ageyear'] = date('Y',time())-$res[$k]['ageyear'];
$res[$k]['marrystatus'] = $sex[$res[$k]['marrystatus']];
$city[$k] = D('district')->where('id='.$res[$k]['cityid'])->field('name,upid')->find();
$city1[$k] = D('district')->where('id='.$city[$k]['upid'])->field('name')->find();
}
$users = array();
foreach($resu as $k=>$v){
$users[$k] = $v;
if($users[$k]['avatar'] == null){
if($res[$k]['gender'] == 1){
$users[$k]['avatar'] = 'male.gif';
}else{
$users[$k]['avatar'] = 'female.gif';
}
}
}
$this->assign('city1',$city1);
$this->assign('city',$city);
$this->assign('users',$users);
$this->assign('res',$res);
$this->assign('pageInfo',$page->show());
$this->display('byattention');
}
}
?>
查询看过的用户信息
public function index(){
$atten = D('see');
$total = $atten->where('seeid='.session('user')['id'])->count();
$page = new /Think/Page($total,10);
$mod = $atten->order('id desc')->field('uid')->limit($page->firstRow,$page->listRows)->where('seeid='.session('user')['id'])->select();
//定义一个空数组
$list = array();
//根据attenid获取关注的用户详情
foreach($mod as $k=>$v){
$list[] = $v['uid'];
}
//定义一个空数组接受查询信息
$res = array();
$resu = array();
//遍历$list数组
foreach($list as $v1){
//执行查询
$res[$v1] = D('user_params')->where('userid='.$v1)->field('id,gender,ageyear,marrystatus,height,cityid,monolog,education,salary')->find();
if(strlen($res[$v1]['monolog'])>27){
$res[$v1]['monolog1'] = substr($res[$v1]['monolog'],0,27)."...";
}
$resu[$v1] = D('user')->where('id='.$v1)->field('username,avatar,id')->find();
}
//根据出生年算出年龄
$sex = array('1'=>'未婚','2'=>'已婚','3'=>'离异');
$education=array(1=>"中专以下学历",2=>"中专",3=>"大专",4=>"本科",5=>"硕士",6=>"博士",7=>"博士后");
$salary = array(1=>'低于2000元',2=>'2000~5000元',3=>'5000~10000元',4=>'10000~20000元',5=>'高于20000元');
foreach($res as $k=>$v){
$res[$k]['attentionid'] = $atten->field('id')->where('attenid='.$k)->find()['id'];
$res[$k]['ageyear'] = date('Y',time())-$res[$k]['ageyear'];
$res[$k]['marrystatus'] = $sex[$res[$k]['marrystatus']];
if(empty($res[$k]['education'])){
$res[$k]['education'] = "未填写";
}else{
$res[$k]['education'] = $education[$res[$k]['education']];
}
if(empty($res[$k]['salary'])){
$res[$k]['salary'] = "未填写";
}else{
$res[$k]['salary'] = $salary[$res[$k]['salary']];
}
$city[$k] = D('district')->where('id='.$res[$k]['cityid'])->field('name,upid')->find();
$city1[$k] = D('district')->where('id='.$city[$k]['upid'])->field('name')->find();
}
$users = array();
foreach($resu as $k=>$v){
$users[$k] = $v;
if($users[$k]['avatar'] == null){
if($res[$k]['gender'] == 1){
$users[$k]['avatar'] = 'male.gif';
}else{
$users[$k]['avatar'] = 'female.gif';
}
}
}
$this->assign('city1',$city1);
$this->assign('city',$city);
$this->assign('users',$users);
$this->assign('res',$res);
$this->assign('pageInfo',$page->show());
$this->assign('totalPages',$page->totalPages);
$this->display('index');
}
}
?>
浏览择友选项方法
public function index(){
$userid = session("user")['id'];
$sel = M("choose")->where("userid=".$userid)->order("id desc")->find();
//反串行化返回模板
$weight = unserialize($sel['weight']);
$education = unserialize($sel['education']);
$star = unserialize($sel['star']);
$age = unserialize($sel['age']);
$hismarriage = unserialize($sel['hismarriage']);
$type = unserialize($sel['type']);
$area = unserialize($sel['area']);
$this->assign("weight",$weight);
$this->assign("age",$age);
$this->assign("hismarriage",$hismarriage);
$this->assign("type",$type);;
$this->assign("education",$education);
$this->assign("areaa",json_encode($area[0]));
$this->assign("sex",$sel['sex']);
$this->assign("star",$star);
$this->assign("ishead",$sel['ishead']);
$mod = M("district");
$list = $mod->where("id=".$area[1])->find();
$this->assign("area",$list);
$this->display("index");
}
//设置择友条件方法
public function update(){
//串行化数组值
$userid = session("user")['id'];
$age = serialize($_POST['age']);
$weight = serialize($_POST['weight']);
$star = serialize($_POST['star']);
$education = serialize($_POST['education']);
$area = serialize($_POST['area']);
$hismarriage = serialize($_POST['hismarriage']);
$type = serialize($_POST['type']);
$data['userid'] = $userid;
$data['sex'] = $_POST['sex'];
$data['age'] = $age;
$data['weight'] = $weight;
$data['hismarriage'] = $hismarriage;
$data['type'] = $type;
$data['education'] = $education;
$data['area'] = $area;
$data['star'] = $star;
$data['ishead'] = $_POST['ishead'];
//封装信息
$cho = M('choose')->where("userid=".$userid)->field('userid')->find();
if(empty($cho)){
$s = M('choose')->add($data);
$this->assign("sysCall","添加成功!");
$this->assign("sysUrl",$_SERVER['HTTP_REFERER']);
$this->display("Login/loginInfo");
}else{
$d = M('choose')->where("userid=".$userid)->save($data);
$this->assign("sysCall","修改成功!");
$this->assign("sysUrl",$_SERVER['HTTP_REFERER']);
$this->display("Login/loginInfo");
}
}
//加载城市信息方法
public function loaddist($upid=0){
$mod = M("district");
$list = $mod->where("upid=".$upid)->select();
echo json_encode($list);
exit;
}
}
户中心拿出用户的一些信息
$user = D('User')->field()->find(session('user')['id']);
$this->userother=M('User_params')->where('userid='.session('user')['id'])->find();
$this->userother1=M('Contact_information')->where('userid='.session('user')['id'])->find();
// dump($this->userother1);
// dump($this->userother);
//$webconfig = M('Webconfig')->index('code')->select();
//var_dump($webconfig);exit;
$this->assign('user', $user);
//信件消息未读通知显示
$unreadMessige = D('user_message')->where(array('status'=>'1','receiveid'=>$_SESSION['user']['id']))->count();
$this->assign('unreadMessige',$unreadMessige);
$unreadGeet = D('hibox')->where(array('status'=>'1','touserid'=>$_SESSION['user']['id']))->count();
$this->assign('unreadGeet',$unreadGeet);
$unreadSysmessage = D('system_message')->where(array('status'=>'1','userid'=>$_SESSION['user']['id']))->count();
$this->assign('unreadSysmessage',$unreadSysmessage);
$unreadBesee = D('see')->where(array('status'=>'1','uid'=>$_SESSION['user']['id']))->count();
$this->assign('unreadBesee',$unreadBesee);
$unreadFensi = D('byattention')->where(array('status'=>'1','uid'=>$_SESSION['user']['id']))->count();
$unreadWeibo = D('user')->field('chat')->where('id ='.$_SESSION['user']['id'])->find();
$this->assign('unreadWeibo',$unreadWeibo);
$unreadIncome = D('user')->field('income')->where('id ='.$_SESSION['user']['id'])->find();
$this->assign('unreadIncome',$unreadIncome);
// dump($unreadFensi);exit;
$this->assign('unreadFensi',$unreadFensi);
}
//用户的一些操作是否登录,没有则跳转至登录界面
public function _initialize() {
parent::_initialize();
if(!session('?user')) {
$this->display('Login/login');
exit();
}
}
}