|
@@ -11,14 +11,18 @@ require_once (BASE_ROOT_PATH . '/helper/model_helper.php');
|
|
|
|
|
|
class member_relationControl extends mbMemberControl
|
|
|
{
|
|
|
- //mem
|
|
|
+ //subscriber TEXT COMMENT '订阅我为好友的人。',
|
|
|
+ //follower TEXT COMMENT '我订阅别人成为好友通过的人。'
|
|
|
+
|
|
|
public function subscriberOp()
|
|
|
{
|
|
|
- $follower = relation_helper::follower($_SESSION['member_id']);
|
|
|
- $count = count($follower);
|
|
|
+ $iRelation = new \relation\mem_relation($_SESSION['member_id']);
|
|
|
+ $follower = $iRelation->follower();
|
|
|
|
|
|
- $desc = array();
|
|
|
+ $mem_desc = array();
|
|
|
$pages = 0;
|
|
|
+ $follower_infos = array();
|
|
|
+
|
|
|
if(!empty($follower))
|
|
|
{
|
|
|
$follower = self::separate_page($follower,$pages);
|
|
@@ -26,32 +30,56 @@ class member_relationControl extends mbMemberControl
|
|
|
|
|
|
foreach ($members as $val) {
|
|
|
$info = new member_info($val);
|
|
|
- array_push($desc,$info->filter());
|
|
|
+ array_push($mem_desc,$info->filter());
|
|
|
+ }
|
|
|
+
|
|
|
+ $f_infos = Model('member_relation')->getRelationList(array('member_id' => array('in',$follower)));
|
|
|
+ foreach ($f_infos as $val) {
|
|
|
+ $relation = new \relation\mem_relation($val);
|
|
|
+ $item = array('fcount' =>$relation->subscriber_count(),
|
|
|
+ 'member_id' => $relation->member_id(),
|
|
|
+ 'subscribed' => true);
|
|
|
+ array_push($follower_infos,$item);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return self::outsuccess(array('followers' => $follower,'count' => $count,'mem_desc' => $desc, 'mobile_page' => mobile_page($pages)));
|
|
|
+ return self::outsuccess(array('followers' => $follower_infos,
|
|
|
+ 'count' => $iRelation->follower_count(),
|
|
|
+ 'mem_desc' => $mem_desc,
|
|
|
+ 'mobile_page' => mobile_page($pages)));
|
|
|
}
|
|
|
|
|
|
+ //我的粉丝
|
|
|
public function followersOp()
|
|
|
{
|
|
|
- $follower = relation_helper::subscriber($_SESSION['member_id']);
|
|
|
- $count = count($follower);
|
|
|
+ $iRelation = new \relation\mem_relation($_SESSION['member_id']);
|
|
|
+ $follower = $iRelation->subscriber();
|
|
|
|
|
|
- $desc = array();
|
|
|
+ $mem_desc = array();
|
|
|
$pages = 0;
|
|
|
+ $follower_infos = array();
|
|
|
if(!empty($follower))
|
|
|
{
|
|
|
$follower = self::separate_page($follower,$pages);
|
|
|
$members = Model('member')->getMemberList(array('member_id' => array('in',$follower)));
|
|
|
-
|
|
|
foreach ($members as $val) {
|
|
|
$info = new member_info($val);
|
|
|
- array_push($desc,$info->filter());
|
|
|
+ array_push($mem_desc,$info->filter());
|
|
|
+ }
|
|
|
+ $f_infos = Model('member_relation')->getRelationList(array('member_id' => array('in',$follower)));
|
|
|
+ foreach ($f_infos as $val) {
|
|
|
+ $relation = new \relation\mem_relation($val);
|
|
|
+ $item = array('fcount' => $relation->subscriber_count(),
|
|
|
+ 'member_id' => $relation->member_id(),
|
|
|
+ 'subscribed' => $iRelation->is_follower($relation->member_id()));
|
|
|
+ array_push($follower_infos,$item);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return self::outsuccess(array('subscriber' => $follower,'count' => $count,'mem_desc' => $desc, 'mobile_page' => mobile_page($pages)));
|
|
|
+ return self::outsuccess(array('subscriber' => $follower,
|
|
|
+ 'count' => $iRelation->subscriber_count(),
|
|
|
+ 'mem_desc' => $mem_desc,
|
|
|
+ 'mobile_page' => mobile_page($pages)));
|
|
|
}
|
|
|
|
|
|
public function subscribeOp()
|