Friends.php 956 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: Friends.php 25693 2011-11-18 02:21:03Z zhengqingpeng $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. class Cloud_Service_Server_Friends extends Cloud_Service_Server_Restful {
  12. protected static $_instance;
  13. public static function getInstance() {
  14. if (!(self::$_instance instanceof self)) {
  15. self::$_instance = new self();
  16. }
  17. return self::$_instance;
  18. }
  19. public function onFriendsGet($uIds, $friendNum = MY_FRIEND_NUM_LIMIT) {
  20. $result = array();
  21. if ($uIds) {
  22. foreach($uIds as $uId) {
  23. $result[$uId] = $this->_getFriends($uId, $friendNum);
  24. }
  25. }
  26. return $result;
  27. }
  28. public function onFriendsAreFriends($uId1, $uId2) {
  29. $friend = C::t('home_friend')->fetch_all_by_uid_fuid($uId1, $uId2);
  30. $result = false;
  31. if($friend = $friend[0]) {
  32. $result = true;
  33. }
  34. return $result;
  35. }
  36. }