ShareService.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace App\Http\Services\V1;
  3. use App\Generated\V1\Messages\Share\PairVipCheckMessage;
  4. use App\Generated\V1\Messages\Share\PairGetMessage;
  5. use App\Managers\LikeManager;
  6. use App\Managers\SharePairManager;
  7. use App\Http\Controllers\Core\Auth;
  8. use App\Generated\V1\Messages\Share\LikeMeMessage;
  9. use App\Generated\V1\Messages\Share\LikeMeCheckMessage;
  10. use App\Generated\V1\Messages\Share\LikeMeHistoryMessage;
  11. class ShareService
  12. {
  13. protected $sharePairManager;
  14. protected $likeManager;
  15. public function __construct(SharePairManager $sharePairManager, LikeManager $likeManager)
  16. {
  17. $this->sharePairManager = $sharePairManager;
  18. $this->likeManager = $likeManager;
  19. }
  20. public function pairVipCheck(PairVipCheckMessage $message)
  21. {
  22. $inviteId = $message->getInviteId();
  23. $uid = Auth::auth();
  24. $data = $this->sharePairManager->vipCheck($uid, $inviteId);
  25. $message->setResponse($data);
  26. }
  27. public function pairGet(PairGetMessage $message)
  28. {
  29. $listId = $message->getListId();
  30. $data = $this->sharePairManager->get($listId);
  31. $message->setResponse($data);
  32. }
  33. public function likeMe(LikeMeMessage $message)
  34. {
  35. $praiseId = $message->getPraiseId();
  36. $data = $this->likeManager->get($praiseId);
  37. $message->setResponse($data);
  38. }
  39. public function likeMeCheck(LikeMeCheckMessage $message)
  40. {
  41. $praiseId = $message->getPraiseId();
  42. $uid = Auth::auth();
  43. $data = $this->likeManager->check($uid, $praiseId);
  44. $message->setResponse($data);
  45. }
  46. public function likeMeHistory(LikeMeHistoryMessage $message)
  47. {
  48. $praiseId = $message->getPraiseId();
  49. $data = $this->likeManager->history($praiseId);
  50. $message->setResponse($data);
  51. }
  52. }