Commit 2e4d5a7b by 冷斌

踢人

parent a5f6eaa0
...@@ -271,6 +271,12 @@ class Api_User extends PhalApi_Api { ...@@ -271,6 +271,12 @@ class Api_User extends PhalApi_Api {
'uid' => array('name' => 'uid', 'type' => 'int', 'min' => 1, 'require' => true, 'desc' => '用户ID'), 'uid' => array('name' => 'uid', 'type' => 'int', 'min' => 1, 'require' => true, 'desc' => '用户ID'),
'token' => array('name' => 'token', 'type' => 'string', 'require' => true, 'desc' => '用户token'), 'token' => array('name' => 'token', 'type' => 'string', 'require' => true, 'desc' => '用户token'),
), ),
'familyList' => array(
'uid' => array('name' => 'uid', 'type' => 'int', 'min' => 1, 'require' => true, 'desc' => '用户ID'),
'token' => array('name' => 'token', 'type' => 'string', 'require' => true, 'desc' => '用户token'),
'type' => array('name' => 'type', 'type' => 'int', 'min' => 1, 'require' => true, 'desc' => '类型,1今日签约,2今日直播,3全部主播'),
),
); );
} }
/** /**
...@@ -2181,7 +2187,6 @@ class Api_User extends PhalApi_Api { ...@@ -2181,7 +2187,6 @@ class Api_User extends PhalApi_Api {
return $rs; return $rs;
} }
public function inviteList() public function inviteList()
{ {
$rs = array('code' => 0, 'msg' => '', 'info' => array()); $rs = array('code' => 0, 'msg' => '', 'info' => array());
...@@ -2200,4 +2205,28 @@ class Api_User extends PhalApi_Api { ...@@ -2200,4 +2205,28 @@ class Api_User extends PhalApi_Api {
$rs['info'][0]=$result; $rs['info'][0]=$result;
return $rs; return $rs;
} }
public function familyList()
{
$rs = array('code' => 0, 'msg' => '', 'info' => array());
$uid=checkNull($this->uid);
$token=checkNull($this->token);
$checkToken=checkToken($uid,$token);
if($checkToken==700){
$rs['code'] = $checkToken;
$rs['msg'] = '您的登陆状态失效,请重新登陆!';
return $rs;
}
$domain = new Domain_User();
$result = $domain->familyList($uid, $this->type);
if (in_array($result, [0, 3])) {
$rs['code'] = 10001;
$rs['msg'] = '无权访问!';
return $rs;
}
$rs['info'][0]=$result;
return $rs;
}
} }
...@@ -317,4 +317,11 @@ class Domain_User { ...@@ -317,4 +317,11 @@ class Domain_User {
$rs = $model->inviteList($uid); $rs = $model->inviteList($uid);
return $rs; return $rs;
} }
public function familyList($uid, $type)
{
$model = new Model_User();
$rs = $model->familyList($uid, $type);
return $rs;
}
} }
...@@ -1051,4 +1051,50 @@ class Model_User extends PhalApi_Model_NotORM ...@@ -1051,4 +1051,50 @@ class Model_User extends PhalApi_Model_NotORM
return $users; return $users;
} }
public function familyList($uid, $type)
{
list($role, $familyId) = $this->getFamilyRole($uid);
if (in_array($role, [0, 3])) {
return $role;
}
$start = strtotime(date('Y-m-d 00:00:00'));
$end = strtotime(date('Y-m-d 23:59:59'));
$where = "familyid={$familyId} and state=2";
if ($type == 1) {
$where .= " and between addtime {$start} and {$end} ";
$list=DI()->notorm->users_family->select('id, uid')->where($where)->fetchAll();
}
if (in_array($type, [2, 3])) {
$list=DI()->notorm->users_family->select('id, uid')->where($where)->fetchAll();
}
foreach($list as $k=>$v){
$result=DI()->notorm->users_live
->select("uid")
->where("islive= '1' and uid={$v['uid']} ")
->fetchOne();
if ($type == 2 && !$result) {
unset($list[$k]);
continue;
}
$userinfo=getUserInfo($v['uid']);
$v['user_nicename']=$userinfo['user_nicename'];
$v['avatar']=$userinfo['avatar'];
$v['avatar_thumb']=$userinfo['avatar_thumb'];
$v['sex']=$userinfo['sex'];
$v['level']=$userinfo['level'];
$v['level_anchor'] = $userinfo['level_anchor'];
$v['isLive'] = $result ? 1 : 0;
$list[$k]=$v;
}
return [
'list' => $list,
'count' => count($list)
];
}
} }
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