婚恋交友网站开发社交聊天平台代码分享

Posted IT小跟班

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了婚恋交友网站开发社交聊天平台代码分享相关的知识,希望对你有一定的参考价值。

婚恋交友网站是基于网络平台的广泛性、互通性、娱乐性、经济性、安全性等优点,作为一种新兴的网络交流方式出现在网络上。网络交友较之其它交友方式更加经济、安全、健康。

我们的网站是用当今比较流行的网站开发技术php语言进行开发,数据库采用免费,小巧,易用的mysql数据库。

婚恋交友网站开发社交聊天平台代码分享(三)_php语言

婚恋交友网站的盈利模式最主要是在会员和礼物方面,那么现在来分享一下网站的礼物功能

婚恋交友网站开发社交聊天平台代码分享(三)_php语言_02

public function index()
$touid = I("get.uid",,trim);
$media=$this->getMedia(虚拟商城);
$this->assign(media, $media);
$w = I("post.data",,trim);
if($w)
if($w!=-1)
$w2= explode(,,$w);
if($w2[0]==0 && $w2[1]>0)
$where[_string]="price <".$w2[1];
if($w2[0]>0 && $w2[1]>0)
$where[_string]="price between ".$w2[0]." and ".$w2[1];
if($w2[1]==0 && $w2[0]>0)
$where[_string]="price >".$w2[0];

//$where[price]=$w;

$User = M(Gift);
$count = $User ->where($where) -> count();
$Page = new \\Think\\Page($count, 30);
$show = $Page -> show();
$list = $User->field(*)-> where($where) -> order(create_time desc,gift_id desc) -> limit($Page -> firstRow . , . $Page -> listRows) -> select();
//echo M()->_sql();
$this -> assign(touid, M("Users")->where("idmd5=$touid")->getField("id"));
$this -> assign(list, $list);
if(IS_AJAX)
if($list) $data = $this->sitefetch(ajax_gift_shop);
$this -> ajaxReturn($data);

$this->siteDisplay ( gift_shop );

获取礼物价格之类

public function show()
$gid = I("post.gid",,intval);
$User = M(Gift);
$re = $User->where("gift_id=".$gid)->find();
$userdb = M("Users")->field(money,user_rank)->where("id=".$this->uinfo["id"])->find();
$this->setUserinfo(money,$userdb[money]);
$this->setUserinfo(user_rank,$userdb[user_rank]);
$re[mymoney]=$userdb[money];
$giftvipzhe = C("vipgiftzhe");
$re[pricevip]=$re[price]/10*$giftvipzhe;
if($userdb[user_rank]>0)
$re[myprice] = $re[pricevip];
else
$re[myprice] =$re[price];
if($re)
$this->success($re);
else
$this->error("获取失败!");

送礼

婚恋交友网站开发社交聊天平台代码分享(三)_网站开发_03

public function sendgift()
$myid = $this->uinfo["id"];
$touid = I("post.touid",,intval);
$giftid = I("post.giftid",,intval);
if(!$giftid || !$touid || !$myid) $this->error(err);
$giftmod = M(Gift);
$giftinfo = $giftmod->where("gift_id=".$giftid)->find();
$data["fromuid"]=$myid;
$data["touid"]=$touid;
$data["gift_price"]=$giftinfo[price];;
$data["time"]=time();
$data["giftnum"]=I("post.giftnum",1,intval);
$data["gift_id"]=$giftid;
$data["gift_image"]= $giftinfo[images];
$logtab[table]="giftlist";
$logtab[data]=$data;
if($this->uinfo[user_rank]>0)
$giftvipzhe = C("vipgiftzhe");
$data[gift_price] = $data[gift_price]/10*$giftvipzhe;

$ip =get_client_ip();
$re = $this->changemoney($myid,(-1)*$data[gift_price]*$data[giftnum],1,送礼消耗,,$logtab,0,$ip,$touid,1); //付费
if($re>0)
$this->tongji($myid,sendgiftmoney,$data[gift_price]*$data[giftnum]);
$fljifen = $giftinfo[jifen]?$giftinfo[jifen]*$data[giftnum]:$giftinfo[price]/100*C(gift_def)*$data[giftnum];
$this->changejifen($fljifen,3,收到.$this->uinfo[user_nicename].礼物获得,$touid,0,$myid,$ip);//积分
$flmoney = $giftinfo[rebate]?$giftinfo[rebate]*$data[giftnum]:$giftinfo[price]/100*C(gift_fld_nv)*$data[giftnum];
if(C(giftnotice)>0 && $giftinfo[price]>C(giftnotice))
$notice = 1;
else
$notice = 0;
$reff = $this->changemoney($touid,$flmoney,3,收到.$this->uinfo[user_nicename].礼物获得返利,0,0,$notice,$ip,$myid,3);//返利
$qmdfee = $giftinfo[qmd]?$giftinfo[qmd]*$data[giftnum]:C(gift_qmd)*$data[giftnum];
$this->changeqinmidu($touid,$myid,$qmdfee,2,收到礼物);//亲密度
$tongji[wdgiftnum]=1;
$tongji[sumgift]=$data["giftnum"];
if($reff>0)
$tongji[giftmoney]=$flmoney;
$this->tongjiarr($touid,$tongji);
$this->setUserinfo(money,$re);
$touser_nicename = M(Users)->where(id=.$touid)->getField(user_nicename);
$this->success($touser_nicename,$re);
else
$this->error(err,$re);


public function giftlist()//礼物
$myuid = $this->uinfo["id"];
$ucoundmod = M("User_count");
$user_count =$ucoundmod->where("uid=".$myuid)->find();
$where ="touid=".$myuid;
$User = M("Giftlist as s");
$count = $User -> where($where) -> count();
$Page = new \\Think\\Page($count, 15);
$show = $Page -> show();
$list = $User->field("u.avatar,u.user_nicename,s.gift_price,s.giftnum,s.gift_image,s.time,u.user_rank,U.ID,u.idmd5")->join("__USERS__ as u ON u.id=s.fromuid")->where($where) -> order(s.giftlist_id desc) -> limit($Page -> firstRow . , . $Page -> listRows) -> select();
$this->assign(list, $list);
if($_GET[p]>=200)exit;
if (I("get.ajax") == 1)
$this -> ajaxReturn($this->sitefetch(ajax_sixin_c));
else
$User->where("touid=".$myuid)->setField("touser_isread",1);
$ucoundmod->where("uid=".$myuid)->setField("wdgiftnum",0);

$this->assign(user_count, $user_count);
$media=$this->getMedia(礼物);
$this->assign(media, $media);
$this->assign(nav, Wechat);
$this->assign(nav2, sixin_c);
$this->siteDisplay ( sixin_c );


?>

以上是关于婚恋交友网站开发社交聊天平台代码分享的主要内容,如果未能解决你的问题,请参考以下文章

婚恋交友网站开发社交聊天平台代码分享

基于php+mysql的校园交友网站

区块链社交IM系统开发,加密社交直播软件app

java app鸿鹄社交娱乐直播平台

java app鸿鹄社交娱乐直播平台

java ios Android鸿鹄社交娱乐直播平台源码