123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- <?php
- namespace App\Http\Controllers\Deed;
- use App\Http\Controllers\Controller;
- use App\Http\Controllers\Core\Auth;
- use App\Managers\DeedFriendManager;
- use App\Services\Deed\FriendService;
- use Illuminate\Http\Request;
- class FriendController extends Controller
- {
- public function overview()
- {
- $uid = Auth::auth();
- $fs = new FriendService();
- $data = $fs->overview($uid);
- return array(
- 'code' => 200,
- 'message' => 'success',
- 'data' => $data
- );
- }
- /**
- * 好友列表未读概览
- */
- public function getListCnt()
- {
- $uid = Auth::auth();
- $fs = new FriendService();
- $data = $fs->getListCnt($uid);
- return array(
- 'code' => 200,
- 'message' => 'success',
- 'data' => $data
- );
- }
- /**
- * 全部好友列表
- * @param Request $request
- * @return array
- */
- public function getAllList(Request $request)
- {
- $uid = Auth::auth();
- $pages = array(
- 'limit' => 20,
- 'page' => $request->get('page', 1)
- );
- $fs = new FriendService();
- $data = $fs->getAllList($uid, $pages);
- return array(
- 'code' => 200,
- 'message' => 'success',
- 'data' => $data
- );
- }
- /**
- * 相互喜欢列表
- * @param Request $request
- * @return array
- */
- public function getEachLikeList(Request $request)
- {
- $uid = Auth::auth();
- $pages = array(
- 'limit' => 20,
- 'page' => $request->get('page', 1)
- );
- $fs = new FriendService();
- $data = $fs->getEachLikeList($uid, $pages);
- return array(
- 'code' => 200,
- 'message' => 'success',
- 'data' => $data
- );
- }
- /**
- * 星标好友列表
- * @param Request $request
- * @return array
- */
- public function getStarList(Request $request)
- {
- $uid = Auth::auth();
- $pages = array(
- 'limit' => 20,
- 'page' => $request->get('page', 1)
- );
- $fs = new FriendService();
- $data = $fs->getStarList($uid, $pages);
- return array(
- 'code' => 200,
- 'message' => 'success',
- 'data' => $data
- );
- }
- /**
- * 星标某个好友
- * @param int $friend_uid
- * @return array
- * @deprecated DeedFriend/StarFriend
- */
- public function starFriend(int $friend_uid)
- {
- $uid = Auth::auth();
- $fs = new DeedFriendManager();
- $fs->starFriend($uid, $friend_uid);
- return array(
- 'code' => 200,
- 'message' => 'success'
- );
- }
- /**
- * 隐藏某个好友
- * @param int $friend_uid
- * @return array
- * @deprecated DeedFriend/HideFriend
- */
- public function hideFriend(int $friend_uid)
- {
- $uid = Auth::auth();
- $fs = new DeedFriendManager();
- $fs->hideFriend($uid, $friend_uid);
- return array(
- 'code' => 200,
- 'message' => 'success'
- );
- }
- /**
- * 聊天历史
- * @param $friend_uid
- * @return \Illuminate\Contracts\Routing\ResponseFactory|\Symfony\Component\HttpFoundation\Response
- */
- public function history($friend_uid)
- {
- $uid = Auth::auth();
- $friend_service = new FriendService();
- $data = $friend_service->history($uid, $friend_uid);
- return response([
- 'code' => 200,
- 'message' => 'OK',
- 'data' => $data,
- ]);
- }
- }
|