UserHomeService.php 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?php
  2. namespace App\Http\Services\V1_1;
  3. use App\Generated\V1_1\Messages\UserHome\GetPopularityMessage;
  4. use App\Generated\V1_1\Messages\UserHome\GetVisitorListMessage;
  5. use App\Generated\V1_1\Messages\UserHome\GetLikeMeListMessage;
  6. use App\Generated\V1_1\Messages\UserHome\GetMyLikeListMessage;
  7. use App\Generated\V1_1\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. }