Commit cdc23bba by 冷斌

首页

parent d64716fe
......@@ -516,11 +516,12 @@ class Api_Home extends PhalApi_Api
$uid = checkNull($this->uid);
$key = 'getRecommend';
$info = getcaches($key);
// $info = getcaches($key);
$info = false;
if (!$info) {
$domain = new Domain_Home();
$info = $domain->getRecommend();
setcaches($key, $info, 60 * 10);
// setcaches($key, $info, 60 * 10);
}
foreach ($info as $k => $v) {
......
......@@ -2,20 +2,20 @@
session_start();
class Model_Home extends PhalApi_Model_NotORM {
/* 轮播 */
public function getSlide(){
/* 轮播 */
public function getSlide(){
$rs=DI()->notorm->slide
->select("slide_pic,slide_url,slide_name")
->where("slide_status='1' and slide_cid='2' ")
->order("listorder asc")
->fetchAll();
foreach($rs as $k=>$v){
$rs[$k]['slide_pic']=get_upload_path($v['slide_pic']);
}
$rs=DI()->notorm->slide
->select("slide_pic,slide_url,slide_name")
->where("slide_status='1' and slide_cid='2' ")
->order("listorder asc")
->fetchAll();
foreach($rs as $k=>$v){
$rs[$k]['slide_pic']=get_upload_path($v['slide_pic']);
}
return $rs;
}
return $rs;
}
/* 印象标签 */
public function getImpressionLabel()
......@@ -47,70 +47,70 @@ class Model_Home extends PhalApi_Model_NotORM {
return $l;
}
/* 热门 */
/* 热门 */
public function getHot($p, $touids = [], $uid=0) {
if($p<1){
$p=1;
}
$pnum=50;
$start=($p-1)*$pnum;
$where=" islive= '1' and ishot='1' ";
if (!empty($touids)) {
$pnum=50;
$start=($p-1)*$pnum;
$where=" islive= '1' and ishot='1' ";
if (!empty($touids)) {
$touidss=implode(",",$touids);
$where.=" and uid in ({$touidss})";
}
if($p!=1){
$endtime=$_SESSION['hot_starttime'];
if($p!=1){
$endtime=$_SESSION['hot_starttime'];
if($endtime){
$where.=" and starttime < {$endtime}";
}
}
}
$configpri=getConfigPri();
$result=DI()->notorm->users_live
->select("uid,title,city,stream,pull,thumb,isvideo,type,type_val,game_action,goodnum,anyway")
->where($where)
->order('hotvotes desc,starttime desc')
->limit($start,$pnum)
->fetchAll();
$result=DI()->notorm->users_live
->select("uid,title,city,stream,pull,thumb,isvideo,type,type_val,game_action,goodnum,anyway")
->where($where)
->order('hotvotes desc,starttime desc')
->limit($start,$pnum)
->fetchAll();
foreach($result as $k=>$v){
$nums=DI()->redis->zSize('user_'.$v['stream']);
$v['nums']=(string)$nums;
foreach($result as $k=>$v){
$nums=DI()->redis->zSize('user_'.$v['stream']);
$v['nums']=(string)$nums;
$userinfo=getUserInfo($v['uid']);
$v['avatar']=$userinfo['avatar'];
$v['avatar_thumb']=$userinfo['avatar_thumb'];
$v['user_nicename']=$userinfo['user_nicename'];
$v['sex']=$userinfo['sex'];
$v['level']=$userinfo['level'];
$v['level_anchor']=$userinfo['level_anchor'];
$v['game']=getGame($v['game_action']);
if(!$v['thumb']){
$v['thumb']=$v['avatar'];
}
if($v['isvideo']==0 && $configpri['cdn_switch']!=5){
$v['pull']=PrivateKeyA('rtmp',$v['stream'],0);
}
if($v['type']==1){
$v['type_val']='';
}
$v['avatar']=$userinfo['avatar'];
$v['avatar_thumb']=$userinfo['avatar_thumb'];
$v['user_nicename']=$userinfo['user_nicename'];
$v['sex']=$userinfo['sex'];
$v['level']=$userinfo['level'];
$v['level_anchor']=$userinfo['level_anchor'];
$v['game']=getGame($v['game_action']);
if(!$v['thumb']){
$v['thumb']=$v['avatar'];
}
if($v['isvideo']==0 && $configpri['cdn_switch']!=5){
$v['pull']=PrivateKeyA('rtmp',$v['stream'],0);
}
if($v['type']==1){
$v['type_val']='';
}
$result[$k]=$v;
}
if($result){
$last=end($result);
$_SESSION['hot_starttime']=$last['starttime'];
}
}
if($result){
$last=end($result);
$_SESSION['hot_starttime']=$last['starttime'];
}
return $result;
return $result;
}
......@@ -175,7 +175,7 @@ class Model_Home extends PhalApi_Model_NotORM {
return $data;
}
/* 关注列表 */
/* 关注列表 */
public function getFollow($uid,$p) {
$rs=array(
'title'=>'你还没有关注任何主播',
......@@ -185,16 +185,16 @@ class Model_Home extends PhalApi_Model_NotORM {
if($p<1){
$p=1;
}
$result=array();
$pnum=50;
$start=($p-1)*$pnum;
$configpri=getConfigPri();
$touid=DI()->notorm->users_attention
->select("touid")
->where('uid=?',$uid)
->fetchAll();
if($touid){
$result=array();
$pnum=50;
$start=($p-1)*$pnum;
$configpri=getConfigPri();
$touid=DI()->notorm->users_attention
->select("touid")
->where('uid=?',$uid)
->fetchAll();
if($touid){
$rs['title']='你关注的主播没有开播';
$rs['des']='赶快去看看其他主播的直播吧~';
$where=" islive='1' ";
......@@ -206,51 +206,51 @@ class Model_Home extends PhalApi_Model_NotORM {
}
}
$touids=array_column($touid,"touid");
$touidss=implode(",",$touids);
$where.=" and uid in ({$touidss})";
$result=DI()->notorm->users_live
->select("uid,title,city,stream,pull,thumb,isvideo,type,type_val,game_action,goodnum,anyway,starttime")
->where($where)
->order("starttime desc")
->limit($start,$pnum)
->fetchAll();
}
foreach($result as $k=>$v){
$nums=DI()->redis->zSize('user_'.$v['stream']);
$v['nums']=(string)$nums;
$userinfo=getUserInfo($v['uid']);
$v['avatar']=$userinfo['avatar'];
$v['avatar_thumb']=$userinfo['avatar_thumb'];
$v['user_nicename']=$userinfo['user_nicename'];
$v['sex']=$userinfo['sex'];
$v['level']=$userinfo['level'];
$v['level_anchor']=$userinfo['level_anchor'];
$v['game']=getGame($v['game_action']);
if(!$v['thumb']){
$v['thumb']=$v['avatar'];
}
if($v['isvideo']==0 && $configpri['cdn_switch']!=5){
$v['pull']=PrivateKeyA('rtmp',$v['stream'],0);
}
if($v['type']==1){
$v['type_val']='';
}
$touids=array_column($touid,"touid");
$touidss=implode(",",$touids);
$where.=" and uid in ({$touidss})";
$result=DI()->notorm->users_live
->select("uid,title,city,stream,pull,thumb,isvideo,type,type_val,game_action,goodnum,anyway,starttime")
->where($where)
->order("starttime desc")
->limit($start,$pnum)
->fetchAll();
}
foreach($result as $k=>$v){
$nums=DI()->redis->zSize('user_'.$v['stream']);
$v['nums']=(string)$nums;
$userinfo=getUserInfo($v['uid']);
$v['avatar']=$userinfo['avatar'];
$v['avatar_thumb']=$userinfo['avatar_thumb'];
$v['user_nicename']=$userinfo['user_nicename'];
$v['sex']=$userinfo['sex'];
$v['level']=$userinfo['level'];
$v['level_anchor']=$userinfo['level_anchor'];
$v['game']=getGame($v['game_action']);
if(!$v['thumb']){
$v['thumb']=$v['avatar'];
}
if($v['isvideo']==0 && $configpri['cdn_switch']!=5){
$v['pull']=PrivateKeyA('rtmp',$v['stream'],0);
}
if($v['type']==1){
$v['type_val']='';
}
$result[$k]=$v;
}
}
if($result){
$last=end($result);
$_SESSION['follow_starttime']=$last['starttime'];
}
if($result){
$last=end($result);
$_SESSION['follow_starttime']=$last['starttime'];
}
$rs['list']=$result;
return $rs;
return $rs;
}
/**
......@@ -325,102 +325,102 @@ class Model_Home extends PhalApi_Model_NotORM {
/* 最新 */
/* 最新 */
public function getNew($lng,$lat,$p) {
if($p<1){
$p=1;
}
$pnum=50;
$start=($p-1)*$pnum;
$where=" islive='1' ";
$pnum=50;
$start=($p-1)*$pnum;
$where=" islive='1' ";
if($p!=1){
$endtime=$_SESSION['new_starttime'];
if($p!=1){
$endtime=$_SESSION['new_starttime'];
if($endtime){
$where.=" and starttime < {$endtime}";
}
}
$configpri=getConfigPri();
$result=DI()->notorm->users_live
->select("uid,title,city,stream,lng,lat,pull,thumb,isvideo,type,type_val,game_action,goodnum,anyway,starttime")
->where($where)
->order("starttime desc")
->limit($start,$pnum)
->fetchAll();
foreach($result as $k=>$v){
$nums=DI()->redis->zSize('user_'.$v['stream']);
$v['nums']=(string)$nums;
$userinfo=getUserInfo($v['uid']);
}
$configpri=getConfigPri();
$result=DI()->notorm->users_live
->select("uid,title,city,stream,lng,lat,pull,thumb,isvideo,type,type_val,game_action,goodnum,anyway,starttime")
->where($where)
->order("starttime desc")
->limit($start,$pnum)
->fetchAll();
foreach($result as $k=>$v){
$nums=DI()->redis->zSize('user_'.$v['stream']);
$v['nums']=(string)$nums;
$userinfo=getUserInfo($v['uid']);
$v['avatar']=$userinfo['avatar'];
$v['avatar_thumb']=$userinfo['avatar_thumb'];
$v['user_nicename']=$userinfo['user_nicename'];
$v['sex']=$userinfo['sex'];
$v['level']=$userinfo['level'];
$v['level_anchor']=$userinfo['level_anchor'];
$v['game']=getGame($v['game_action']);
if(!$v['thumb']){
$v['thumb']=$v['avatar'];
}
if($v['isvideo']==0 && $configpri['cdn_switch']!=5){
$v['pull']=PrivateKeyA('rtmp',$v['stream'],0);
}
if($v['type']==1){
$v['type_val']='';
}
$distance='好像在火星';
if($lng!='' && $lat!='' && $v['lat']!='' && $v['lng']!=''){
$distance=getDistance($lat,$lng,$v['lat'],$v['lng']);
}else if($v['city']){
$distance=$v['city'];
}
$v['distance']=$distance;
unset($v['lng']);
unset($v['lat']);
$v['avatar_thumb']=$userinfo['avatar_thumb'];
$v['user_nicename']=$userinfo['user_nicename'];
$v['sex']=$userinfo['sex'];
$v['level']=$userinfo['level'];
$v['level_anchor']=$userinfo['level_anchor'];
$v['game']=getGame($v['game_action']);
if(!$v['thumb']){
$v['thumb']=$v['avatar'];
}
if($v['isvideo']==0 && $configpri['cdn_switch']!=5){
$v['pull']=PrivateKeyA('rtmp',$v['stream'],0);
}
if($v['type']==1){
$v['type_val']='';
}
$distance='好像在火星';
if($lng!='' && $lat!='' && $v['lat']!='' && $v['lng']!=''){
$distance=getDistance($lat,$lng,$v['lat'],$v['lng']);
}else if($v['city']){
$distance=$v['city'];
}
$v['distance']=$distance;
unset($v['lng']);
unset($v['lat']);
$result[$k]=$v;
}
if($result){
$last=end($result);
$_SESSION['new_starttime']=$last['starttime'];
}
}
if($result){
$last=end($result);
$_SESSION['new_starttime']=$last['starttime'];
}
return $result;
return $result;
}
/* 搜索 */
/* 搜索 */
public function search($uid,$key,$p,$type) {
if($p<1){
$p=1;
}
$pnum=50;
$start=($p-1)*$pnum;
$where=' user_type="2" and ( id=? or user_nicename like ? or goodnum like ? ) and id!=?';
if($p!=1){
$id=$_SESSION['search'];
$pnum=50;
$start=($p-1)*$pnum;
$where=' user_type="2" and ( id=? or user_nicename like ? or goodnum like ? ) and id!=?';
if($p!=1){
$id=$_SESSION['search'];
if($id){
$where.=" and id < {$id}";
}
}
$result=DI()->notorm->users
->select("id,user_nicename,avatar,sex,signature,consumption,votestotal")
->where($where,$key,'%'.$key.'%','%'.$key.'%',$uid)
->order("id desc")
->limit($start,$pnum)
->fetchAll();
foreach($result as $k=>$v){
$v['level']=(string)getLevel($v['consumption']);
$v['level_anchor']=(string)getLevelAnchor($v['votestotal']);
$v['isattention']=(string)isAttention($uid,$v['id']);
$v['avatar']=get_upload_path($v['avatar']);
unset($v['consumption']);
}
$result=DI()->notorm->users
->select("id,user_nicename,avatar,sex,signature,consumption,votestotal")
->where($where,$key,'%'.$key.'%','%'.$key.'%',$uid)
->order("id desc")
->limit($start,$pnum)
->fetchAll();
foreach($result as $k=>$v){
$v['level']=(string)getLevel($v['consumption']);
$v['level_anchor']=(string)getLevelAnchor($v['votestotal']);
$v['isattention']=(string)isAttention($uid,$v['id']);
$v['avatar']=get_upload_path($v['avatar']);
unset($v['consumption']);
$touids=DI()->notorm->users_attention
->where('touid=?',$v['id'])
->count();
......@@ -435,14 +435,14 @@ class Model_Home extends PhalApi_Model_NotORM {
$v['type']=$type;
}
$result[$k]=$v;
}
}
if($result){
$last=end($result);
$_SESSION['search']=$last['id'];
}
if($result){
$last=end($result);
$_SESSION['search']=$last['id'];
}
return $result;
return $result;
}
/**
......@@ -498,116 +498,154 @@ class Model_Home extends PhalApi_Model_NotORM {
return $rs;
}
/* 附近 */
/* 附近 */
public function getNearby($lng,$lat,$p) {
if($p<1){
$p=1;
}
$pnum=50;
$start=($p-1)*$pnum;
$where=" islive='1' and lng!='' and lat!='' ";
$configpri=getConfigPri();
$result=DI()->notorm->users_live
->select("uid,title,province,city,stream,lng,lat,pull,isvideo,thumb,islive,type,type_val,game_action,goodnum,anyway,getDistance('{$lat}','{$lng}',lat,lng) as distance")
->where($where)
->order("distance asc")
->limit($start,$pnum)
->fetchAll();
foreach($result as $k=>$v){
$nums=DI()->redis->zSize('user_'.$v['stream']);
$v['nums']=(string)$nums;
$pnum=50;
$start=($p-1)*$pnum;
$where=" islive='1' and lng!='' and lat!='' ";
$configpri=getConfigPri();
$result=DI()->notorm->users_live
->select("uid,title,province,city,stream,lng,lat,pull,isvideo,thumb,islive,type,type_val,game_action,goodnum,anyway,getDistance('{$lat}','{$lng}',lat,lng) as distance")
->where($where)
->order("distance asc")
->limit($start,$pnum)
->fetchAll();
foreach($result as $k=>$v){
$nums=DI()->redis->zSize('user_'.$v['stream']);
$v['nums']=(string)$nums;
$userinfo=getUserInfo($v['uid']);
$userinfo=getUserInfo($v['uid']);
$v['avatar']=$userinfo['avatar'];
$v['avatar_thumb']=$userinfo['avatar_thumb'];
$v['user_nicename']=$userinfo['user_nicename'];
$v['sex']=$userinfo['sex'];
$v['level']=$userinfo['level'];
$v['level_anchor']=$userinfo['level_anchor'];
$v['game']=getGame($v['game_action']);
if(!$v['thumb']){
$v['thumb']=$v['avatar'];
}
if($v['isvideo']==0 && $configpri['cdn_switch']!=5){
$v['pull']=PrivateKeyA('rtmp',$v['stream'],0);
}
if($v['type']==1){
$v['type_val']='';
}
$v['avatar_thumb']=$userinfo['avatar_thumb'];
$v['user_nicename']=$userinfo['user_nicename'];
$v['sex']=$userinfo['sex'];
$v['level']=$userinfo['level'];
$v['level_anchor']=$userinfo['level_anchor'];
$v['game']=getGame($v['game_action']);
if(!$v['thumb']){
$v['thumb']=$v['avatar'];
}
if($v['isvideo']==0 && $configpri['cdn_switch']!=5){
$v['pull']=PrivateKeyA('rtmp',$v['stream'],0);
}
if($v['type']==1){
$v['type_val']='';
}
if($v['distance']>1000){
$v['distance']=1000;
}
$v['distance']=$v['distance'].'km';
$result[$k]=$v;
}
}
return $result;
return $result;
}
/* 推荐 */
public function getRecommend(){
/* 推荐 */
public function getRecommend(){
$configpri=getConfigPri();
$where=" isrecommend = '1' and islive= '1' and ishot='1' ";
$result=DI()->notorm->users_live
->select("uid,title,city,stream,pull,thumb,isvideo,type,type_val,game_action,goodnum,anyway")
->where($where)
->order('starttime desc')
->limit(50)
->fetchAll();
foreach($result as $k=>$v){
$nums=DI()->redis->zSize('user_'.$v['stream']);
$v['nums']=(string)$nums;
$userinfo=getUserInfo($v['uid']);
$v['avatar']=$userinfo['avatar'];
$v['avatar_thumb']=$userinfo['avatar_thumb'];
$v['user_nicename']=$userinfo['user_nicename'];
$v['sex']=$userinfo['sex'];
$v['level']=$userinfo['level'];
$v['level_anchor']=$userinfo['level_anchor'];
$v['game']=getGame($v['game_action']);
if(!$v['thumb']){
$v['thumb']=$v['avatar'];
}
if($v['isvideo']==0 && $configpri['cdn_switch']!=5){
$v['pull']=PrivateKeyA('rtmp',$v['stream'],0);
}
$result=DI()->notorm->users
->select("id,user_nicename,avatar,avatar_thumb")
->where("isrecommend='1'")
->order("votestotal desc")
->limit(50)
->fetchAll();
foreach($result as $k=>$v){
$v['avatar']=get_upload_path($v['avatar']);
$v['avatar_thumb']=get_upload_path($v['avatar_thumb']);
$fans=getFans($v['id']);
$v['fans']='粉丝 · '.$fans;
if($v['type']==1){
$v['type_val']='';
}
$v['ifpk'] = DI()->redis -> hGet('LiveConnect',$v['uid']) ? 1 : 0;
$result[$k]=$v;
}
return $result;
}
/* 关注推荐 */
public function attentRecommend($uid,$touids){
//$users=$this->getRecommend();
//$users=explode(',',$touids);
}
// $result=DI()->notorm->users
// ->select("id,user_nicename,avatar,avatar_thumb")
// ->where("isrecommend='1'")
// ->order("votestotal desc")
// ->limit(50)
// ->fetchAll();
// foreach($result as $k=>$v){
// $v['avatar']=get_upload_path($v['avatar']);
// $v['avatar_thumb']=get_upload_path($v['avatar_thumb']);
// $fans=getFans($v['id']);
// $v['fans']='粉丝 · '.$fans;
//
// $result[$k]=$v;
// }
return $result;
}
/* 关注推荐 */
public function attentRecommend($uid,$touids){
//$users=$this->getRecommend();
//$users=explode(',',$touids);
file_put_contents('./attentRecommend.txt',date('Y-m-d H:i:s').' 提交参数信息 touids:'.$touids."\r\n",FILE_APPEND);
$users=preg_split('/,|,/',$touids);
foreach($users as $k=>$v){
$touid=$v;
foreach($users as $k=>$v){
$touid=$v;
file_put_contents('./attentRecommend.txt',date('Y-m-d H:i:s').' 提交参数信息 touid:'.$touid."\r\n",FILE_APPEND);
if($touid && !isAttention($uid,$touid)){
DI()->notorm->users_black
->where('uid=? and touid=?',$uid,$touid)
->delete();
DI()->notorm->users_attention
->insert(array("uid"=>$uid,"touid"=>$touid));
}
if($touid && !isAttention($uid,$touid)){
DI()->notorm->users_black
->where('uid=? and touid=?',$uid,$touid)
->delete();
DI()->notorm->users_attention
->insert(array("uid"=>$uid,"touid"=>$touid));
}
}
return 1;
}
}
return 1;
}
/*获取收益排行榜*/
/*获取收益排行榜*/
public function profitList($uid,$type,$p){
public function profitList($uid,$type,$p){
if($p<1){
$p=1;
}
$pnum=50;
$start=($p-1)*$pnum;
$pnum=50;
$start=($p-1)*$pnum;
switch ($type) {
case 'day':
//获取今天开始结束时间
$dayStart=strtotime(date("Y-m-d"));
$dayEnd=strtotime(date("Y-m-d 23:59:59"));
$where=" addtime >={$dayStart} and addtime<={$dayEnd} and ";
switch ($type) {
case 'day':
//获取今天开始结束时间
$dayStart=strtotime(date("Y-m-d"));
$dayEnd=strtotime(date("Y-m-d 23:59:59"));
$where=" addtime >={$dayStart} and addtime<={$dayEnd} and ";
break;
break;
case 'week':
case 'week':
$w=date('w');
//获取本周开始日期,如果$w是0,则表示周日,减去 6 天
$first=1;
......@@ -619,11 +657,11 @@ class Model_Home extends PhalApi_Model_NotORM {
//周天
$week_end=strtotime("{$week} +1 week")-1;
$where=" addtime >={$week_start} and addtime<={$week_end} and ";
$where=" addtime >={$week_start} and addtime<={$week_end} and ";
break;
break;
case 'month':
case 'month':
//本月第一天
$month=date('Y-m-d',strtotime(date("Ym").'01'));
$month_start=strtotime(date("Ym").'01');
......@@ -631,25 +669,25 @@ class Model_Home extends PhalApi_Model_NotORM {
//本月最后一天
$month_end=strtotime("{$month} +1 month")-1;
$where=" addtime >={$month_start} and addtime<={$month_end} and ";
$where=" addtime >={$month_start} and addtime<={$month_end} and ";
break;
break;
case 'total':
$where=" ";
break;
case 'total':
$where=" ";
break;
default:
//获取今天开始结束时间
$dayStart=strtotime(date("Y-m-d"));
$dayEnd=strtotime(date("Y-m-d 23:59:59"));
$where=" addtime >={$dayStart} and addtime<={$dayEnd} and ";
break;
}
default:
//获取今天开始结束时间
$dayStart=strtotime(date("Y-m-d"));
$dayEnd=strtotime(date("Y-m-d 23:59:59"));
$where=" addtime >={$dayStart} and addtime<={$dayEnd} and ";
break;
}
$where.=" type='expend' and action in ('sendgift','sendbarrage')";
$where.=" type='expend' and action in ('sendgift','sendbarrage')";
$result=DI()->notorm->users_coinrecord
$result=DI()->notorm->users_coinrecord
->select('sum(totalcoin) as totalcoin,touid as uid')
->where($where)
->group('touid')
......@@ -657,23 +695,23 @@ class Model_Home extends PhalApi_Model_NotORM {
->limit($start,$pnum)
->fetchAll();
foreach ($result as $k => $v) {
foreach ($result as $k => $v) {
$userinfo=getUserInfo($v['uid']);
$v['avatar']=$userinfo['avatar'];
$v['avatar_thumb']=$userinfo['avatar_thumb'];
$v['user_nicename']=$userinfo['user_nicename'];
$v['sex']=$userinfo['sex'];
$v['level']=$userinfo['level'];
$v['level_anchor']=$userinfo['level_anchor'];
$v['avatar_thumb']=$userinfo['avatar_thumb'];
$v['user_nicename']=$userinfo['user_nicename'];
$v['sex']=$userinfo['sex'];
$v['level']=$userinfo['level'];
$v['level_anchor']=$userinfo['level_anchor'];
$v['isAttention']=isAttention($uid,$v['uid']);//判断当前用户是否关注了该主播
$result[$k]=$v;
}
}
return $result;
}
return $result;
}
public function star($type)
{
......@@ -904,21 +942,21 @@ class Model_Home extends PhalApi_Model_NotORM {
}
/*获取消费排行榜*/
public function consumeList($uid,$type,$p){
/*获取消费排行榜*/
public function consumeList($uid,$type,$p){
if($p<1){
$p=1;
}
$pnum=50;
$start=($p-1)*$pnum;
$pnum=50;
$start=($p-1)*$pnum;
switch ($type) {
case 'day':
//获取今天开始结束时间
$dayStart=strtotime(date("Y-m-d"));
$dayEnd=strtotime(date("Y-m-d 23:59:59"));
$where=" addtime >={$dayStart} and addtime<={$dayEnd} and ";
break;
switch ($type) {
case 'day':
//获取今天开始结束时间
$dayStart=strtotime(date("Y-m-d"));
$dayEnd=strtotime(date("Y-m-d 23:59:59"));
$where=" addtime >={$dayStart} and addtime<={$dayEnd} and ";
break;
case 'week':
$w=date('w');
......@@ -932,11 +970,11 @@ class Model_Home extends PhalApi_Model_NotORM {
//周天
$week_end=strtotime("{$week} +1 week")-1;
$where=" addtime >={$week_start} and addtime<={$week_end} and ";
$where=" addtime >={$week_start} and addtime<={$week_end} and ";
break;
break;
case 'month':
case 'month':
//本月第一天
$month=date('Y-m-d',strtotime(date("Ym").'01'));
$month_start=strtotime(date("Ym").'01');
......@@ -944,23 +982,23 @@ class Model_Home extends PhalApi_Model_NotORM {
//本月最后一天
$month_end=strtotime("{$month} +1 month")-1;
$where=" addtime >={$month_start} and addtime<={$month_end} and ";
$where=" addtime >={$month_start} and addtime<={$month_end} and ";
break;
break;
case 'total':
$where=" ";
break;
case 'total':
$where=" ";
break;
default:
//获取今天开始结束时间
$dayStart=strtotime(date("Y-m-d"));
$dayEnd=strtotime(date("Y-m-d 23:59:59"));
$where=" addtime >={$dayStart} and addtime<={$dayEnd} and ";
break;
}
default:
//获取今天开始结束时间
$dayStart=strtotime(date("Y-m-d"));
$dayEnd=strtotime(date("Y-m-d 23:59:59"));
$where=" addtime >={$dayStart} and addtime<={$dayEnd} and ";
break;
}
$where.=" type='expend' and action in ('sendgift','sendbarrage')";
$where.=" type='expend' and action in ('sendgift','sendbarrage')";
$result=DI()->notorm->users_coinrecord
->select('sum(totalcoin) as totalcoin, uid')
......@@ -970,22 +1008,22 @@ class Model_Home extends PhalApi_Model_NotORM {
->limit($start,$pnum)
->fetchAll();
foreach ($result as $k => $v) {
foreach ($result as $k => $v) {
$userinfo=getUserInfo($v['uid']);
$v['avatar']=$userinfo['avatar'];
$v['avatar_thumb']=$userinfo['avatar_thumb'];
$v['user_nicename']=$userinfo['user_nicename'];
$v['sex']=$userinfo['sex'];
$v['level']=$userinfo['level'];
$v['level_anchor']=$userinfo['level_anchor'];
$v['avatar_thumb']=$userinfo['avatar_thumb'];
$v['user_nicename']=$userinfo['user_nicename'];
$v['sex']=$userinfo['sex'];
$v['level']=$userinfo['level'];
$v['level_anchor']=$userinfo['level_anchor'];
$v['isAttention']=isAttention($uid,$v['uid']);//判断当前用户是否关注了该主播
$result[$k]=$v;
}
}
return $result;
}
return $result;
}
/* 分类下直播 */
// public function getClassLive($liveclassid,$p) {
......@@ -1170,7 +1208,7 @@ class Model_Home extends PhalApi_Model_NotORM {
case 1:
$start = ' 00:00:00';
$end = ' 02:59:59';
break;
break;
case 2:
$start = ' 03:00:00';
$end = ' 05:59:59';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment