Commit e4a20796 by 冷斌

踢人

parent 098d597d
......@@ -17,6 +17,7 @@ class Api_Home extends PhalApi_Api
'getFollow' => [
'uid' => ['name' => 'uid', 'type' => 'int', 'min' => 1, 'require' => true, 'desc' => '用户ID'],
'p' => ['name' => 'p', 'type' => 'int', 'default' => '1', 'desc' => '页数'],
'name' => ['name' => 'name', 'type' => 'string', 'default' => '', 'desc' => '搜索'],
],
'randomAnchor' => [
......@@ -330,7 +331,7 @@ class Api_Home extends PhalApi_Api
$rs = ['code' => 0, 'msg' => '', 'info' => []];
$domain = new Domain_Home();
$info = $domain->getFollow($this->uid, $this->p);
$info = $domain->getFollow($this->uid, $this->p, $this->name);
$rs['info'][0] = $info;
......
......@@ -28,11 +28,11 @@ class Domain_Home {
return $rs;
}
public function getFollow($uid,$p) {
public function getFollow($uid,$p, $name) {
$rs = array();
$model = new Model_Home();
$rs = $model->getFollow($uid,$p);
$rs = $model->getFollow($uid,$p,$name);
return $rs;
}
......
......@@ -184,7 +184,7 @@ class Model_Home extends PhalApi_Model_NotORM {
}
/* 关注列表 */
public function getFollow($uid,$p) {
public function getFollow($uid,$p,$name) {
$rs=array(
'title'=>'你还没有关注任何主播',
'des'=>'赶快去关注自己喜欢的主播吧~',
......@@ -205,24 +205,33 @@ class Model_Home extends PhalApi_Model_NotORM {
if($touid){
$rs['title']='你关注的主播没有开播';
$rs['des']='赶快去看看其他主播的直播吧~';
$where=" islive='1' ";
$where=" ul.islive='1' ";
if($p!=1){
$endtime=$_SESSION['follow_starttime'];
if($endtime){
$start=0;
$where.=" and starttime < {$endtime}";
$where.=" and ul.starttime < {$endtime}";
}
}
$touids=array_column($touid,"touid");
$touidss=implode(",",$touids);
$where.=" and uid in ({$touidss})";
$where.=" and ul.uid in ({$touidss})";
if (!empty($name)) {
$where .= " and u.user_nicename like '%".$name."%'";
}
$sql = "select ul.uid,ul.title,ul.city,ul.stream,ul.pull,ul.thumb,ul.isvideo,ul.type,ul.type_val,ul.game_action,ul.goodnum,ul.anyway,ul.starttime from cmf_users_live as ul left join cmf_users as u on u.id = ul.uid where {$where}";
$sql .= " order by ul.starttime desc ";
$sql .= " limit {$start}, {$pnum} ";
$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();
->queryAll($sql);
// ->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']);
......
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