123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- <?php
- namespace App\Http\Services\V1;
- use App\Generated\V1\Messages\Friend\GetApplyAllListMessage;
- use App\Generated\V1\Messages\Friend\GetApplyReceiveListMessage;
- use App\Generated\V1\Messages\Friend\GetApplySendListMessage;
- use App\Generated\V1\Messages\Friend\GetEachLikeListMessage;
- use App\Generated\V1\Messages\Friend\GetStarListMessage;
- use App\Generated\V1\Messages\Friend\GetChatHistoryMessage;
- use App\Generated\V1\Messages\Friend\GetUnreadCountMessage;
- use App\Generated\V1\Messages\Friend\AgreeApplyMessage;
- use App\Generated\V1\Messages\Friend\GetAllListMessage;
- use App\Http\Controllers\Core\Auth;
- use App\Managers\FriendManager;
- use App\Services\V2_17_3\Friends\ApplyService;
- class FriendService
- {
- protected $friendManager;
- public function __construct(FriendManager $friendManager)
- {
- $this->friendManager = $friendManager;
- }
- public function getAllList(GetAllListMessage $message)
- {
- $page = $message->getPage();
- $uid = Auth::auth();
- $data = $this->friendManager->getAllList($uid, [
- 'limit' => 20,
- 'page' => $page,
- ]);
- $message->setResponse($data);
- }
- public function getApplyAllList(GetApplyAllListMessage $message)
- {
- $page = $message->getPage() ?: 1;
- $uid = Auth::auth();
- $pages = array(
- 'limit' => 20,
- 'page' => $page,
- );
- $data = $this->friendManager->getApplyAllList($uid, $pages);
- $message->setResponse($data);
- }
- public function getApplyReceiveList(GetApplyReceiveListMessage $message)
- {
- $page = $message->getPage() ?: 1;
- $uid = Auth::auth();
- $pages = array(
- 'limit' => 20,
- 'page' => $page
- );
- $data = $this->friendManager->getReceiveList($uid, $pages);
- $message->setResponse($data);
- }
- public function getApplySendList(GetApplySendListMessage $message)
- {
- $page = $message->getPage() ?: 1;
- $uid = Auth::auth();
- $pages = array(
- 'limit' => 20,
- 'page' => $page
- );
- $data = $this->friendManager->getSendList($uid, $pages);
- $message->setResponse($data);
- }
- public function getEachLikeList(GetEachLikeListMessage $message)
- {
- $page = $message->getPage() ?: 1;
- $uid = Auth::auth();
- $pages = array(
- 'limit' => 20,
- 'page' => $page
- );
- $data = $this->friendManager->getEachLikeList($uid, $pages);
- $message->setResponse($data);
- }
- public function getStarList(GetStarListMessage $message)
- {
- $page = $message->getPage() ?: 1;
- $uid = Auth::auth();
- $pages = array(
- 'limit' => 20,
- 'page' => $page
- );
- $data = $this->friendManager->getStarList($uid, $pages);
- $message->setResponse($data);
- }
- public function getChatHistory(GetChatHistoryMessage $message)
- {
- $page = $message->getPage() ?: 1;
- $friendUid = $message->getFriendUid();
- $uid = Auth::auth();
- $pages = array(
- 'limit' => 20,
- 'page' => $page
- );
- $data = $this->friendManager->getHistory($uid, $friendUid, $pages);
- $message->setResponse($data);
- }
- public function getUnreadCount(GetUnreadCountMessage $message)
- {
- $uid = Auth::auth();
- $data = $this->friendManager->getUnreadCount($uid);
- $message->setResponse($data);
- }
- public function agreeApply(AgreeApplyMessage $message)
- {
- $uid = Auth::auth();
- $applyUid = $message->getApplyUid();
- $as = new ApplyService();
- $as->agree($uid, $applyUid);
- }
- }
|