方维系统,仿知美网的效果,添加相互关注的功能,如下图所示:
这个框框是在tip.htm里面,要增加互相关注的功能,牵扯到以下文件:
base.js 里面 #USER_INFO_TIP ;
services/service.php?m=user&a=tip ,这个里面判断是否是互相关注;
解决方法:
/core/dynamic/user.dynamic.php
// updata by wangtongphp 增加我的粉丝和相互关注的功能,分别判断$_fans和$is_follow_fans即可 function getTipUserFollow($uid) { global $_FANWE; $is_follow = false; if($_FANWE['uid'] > 0 && $_FANWE['uid'] != $uid) { $is_follow = FS('User')->getIsFollowUId($uid); //add by wangtongphp 判断是否相互关注 $is_fans = FDB::resultFirst("select * from ".FDB::table('user_follow')." where f_uid=".$uid." and uid=".$_FANWE['uid']);if($is_fans && $is_follow){ $is_follow_fans = true; } } $args = array( 'uid'=>$uid, 'is_follow'=>$is_follow, 'is_fans' => $is_fans, 'is_follow_fans'=>$is_follow_fans ); return tplFetch('services/user/tip_follow',$args); }
/tpl/pink2/services/user/tip_follow.htm
<!--{if $uid == $_FANWE['uid']}--> 自己都不认识了? <!--{else}--> <!--{if $is_follow_fans}--> <span class="fl icrad_add">已相互关注</span> <!--{elseif $is_follow}--> <span class="fl icrad_add">已关注T</span> <a class="follow_del" href="javascript:;" onclick="$.User_Follow({$uid},this,UserTipFollowHandler);">取消</a> <!--{else}--> <a class="green_button" onclick="$.User_Follow({$uid},this,UserTipFollowHandler);" href="javascript:;">+加关注</a> <!--{/if}--> <!--{/if}-->
效果如图: