The first paper: https://blog.csdn.net/weixin_…

Article 2: https://segmentfault.com/a/11…

Article 3: https://segmentfault.com/a/11…

This is the column of international multi-language dating website development and production:

https://blog.csdn.net/weixin_…

If you have any questions, you can call me, guys, my button is 2360248-666

International multilingual dating website development and production, the fourth part of the fan function development

Browse the fans

public function index(){

//echo "browse "; $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(); $list = array(); Foreach ($mod as $k=>$v){$list[] = $v['uid']; } $res = array(); $res = array(); $resu = array(); 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(); } / / according to the calculated age birth year $sex = array (' 1 '= >' married ', '2' = > 'married', '3' = > 'divorce'); 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'); }}

? >

Example Query the information about the user

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(); $list = array(); Foreach ($mod as $k=>$v){$list[] = $v['uid']; } $res = array(); $res = array(); $resu = array(); Foreach ($list as $v1){$res[$v1] = D('user_params')->where('userid='.$v1)->field('id,gender,ageyear,marrystatus,height,cityid,monolog,education,salary')->f ind(); 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(); } / / according to the calculated age birth year $sex = array (' 1 '= >' married ', '2' = > 'married', '3' = > 'divorce'); $education = array (1 = > "technical secondary school diploma", 2 = > "secondary", 3 = > "college", 4 = > "bachelor", 5 = > "master", 6 = > "Dr" and 7 = > "postdoctoral"); $salary = array (1 = > 'is less than 2000 yuan, 2 = >' 2000-5000 yuan, 3 = > '5000-10000 yuan, 4 = >' 10000-20000 yuan, 5 = > 'is higher than the $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 '] = "did not fill in"; }else{ $res[$k]['education'] = $education[$res[$k]['education']]; } the if (empty ($res [$k] [' salary '])) {$res [$k] [' salary '] = "did not fill in"; }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'); }}

? >

Browse the choice of friends

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']; / / packaging information $cho = M (' choose ') - > where (" userid = ". $userid) - > field (' userid ') - > the find (); if(empty($cho)){ $s = M('choose')->add($data); $this->assign("sysCall"," add! ") ); $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; }

}

The user center pulls out some information about the user

$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); // Unread notification of letter messages displays $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(); }}

}