UserHomeService.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. namespace App\Http\Services\V1;
  3. use App\Generated\V1\Messages\UserHome\GetPopularityMessage;
  4. use App\Generated\V1\Messages\UserHome\GetVisitorListMessage;
  5. use App\Generated\V1\Messages\UserHome\GetLikeMeListMessage;
  6. use App\Generated\V1\Messages\UserHome\GetMyLikeListMessage;
  7. use App\Generated\V1\Messages\UserHome\RemindComplementCardMessage;
  8. use App\Http\Controllers\Core\Auth;
  9. use App\Managers\UserManager;
  10. use App\Services\Home\FeedService;
  11. use App\Services\User\HomeService;
  12. class UserHomeService
  13. {
  14. protected $userManager;
  15. public function __construct(UserManager $userManager)
  16. {
  17. $this->userManager = $userManager;
  18. }
  19. /**
  20. * 获取喜欢我的列表
  21. * @param GetLikeMeListMessage $message
  22. */
  23. public function getLikeMeList(GetLikeMeListMessage $message)
  24. {
  25. $uid = Auth::auth();
  26. $page = $message->getPage() ?? 1;
  27. $limit = $message->getLimit() ?? 20;
  28. $data = $this->userManager->getLikeMeList($uid, $page, $limit);
  29. $message->setResponse($data);
  30. }
  31. /**
  32. * 获取我喜欢的列表
  33. * @param GetMyLikeListMessage $message
  34. */
  35. public function getMyLikeList(GetMyLikeListMessage $message)
  36. {
  37. $uid = Auth::auth();
  38. $page = $message->getPage() ?? 1;
  39. $limit = $message->getLimit() ?? 20;
  40. $data = $this->userManager->getMyLikeList($uid, $page, $limit);
  41. $message->setResponse($data);
  42. }
  43. /**
  44. * 获取访客列表
  45. * @param GetVisitorListMessage $message
  46. */
  47. public function getVisitorList(GetVisitorListMessage $message)
  48. {
  49. $page = $message->getPage() ?? 1;
  50. $limit = $message->getLimit() ?? 20;
  51. $uid = $message->getUid() ?? Auth::auth();
  52. $data = $this->userManager->getVisitorList($uid, $page, $limit);
  53. $message->setResponse($data);
  54. }
  55. /**
  56. * 提醒TA补全信息
  57. * @param RemindComplementCardMessage $message
  58. */
  59. public function remindComplementCard(RemindComplementCardMessage $message)
  60. {
  61. $uid = Auth::auth();
  62. $type = $message->getType();
  63. $remind_uid = $message->getRemind_uid();
  64. $feedService = new FeedService();
  65. $feedService->remindType4($uid, $remind_uid, $type);
  66. }
  67. public function getPopularity(GetPopularityMessage $message)
  68. {
  69. $uid = Auth::auth();
  70. $hus = new HomeService();
  71. $data = $hus->getPopularity($uid);
  72. $message->setResponse(
  73. $data['popularity_share_end_at'],
  74. $data['popularity_sign_end_at'],
  75. $data['popularity_supvip_endat'],
  76. $data['popularity'],
  77. $data['base']
  78. );
  79. }
  80. }