UserNoticeService.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace App\Http\Services\V1;
  3. use App\Generated\V1\Messages\UserNotice\SysnoticeListMessage;
  4. use App\Generated\V1\Messages\UserNotice\SysnoticeDescMessage;
  5. use App\Http\Controllers\Controller;
  6. use App\Http\Controllers\Core\Auth;
  7. use App\Managers\UserNoticeManager;
  8. use App\Models\QQ\FormIdModel;
  9. use App\Models\User\AuthKey;
  10. use App\Models\User\Openid;
  11. use App\Services\User\NoticeService;
  12. use App\Services\Vendor\GeTui\ApiService;
  13. use Illuminate\Http\Request;
  14. class UserNoticeService
  15. {
  16. protected $userNoticeManager;
  17. public function __construct(UserNoticeManager $userNoticeManager)
  18. {
  19. $this->userNoticeManager = $userNoticeManager;
  20. }
  21. public function sysnoticeList(SysnoticeListMessage $message)
  22. {
  23. $page = $message->getPage() ?: 1;
  24. $unread = $message->getUnread() ?: 0;
  25. $uid = Auth::auth();
  26. $pages = array(
  27. 'page' => $page,
  28. 'limit' => 20
  29. );
  30. $data = $this->userNoticeManager->systemList($uid, $pages, $unread);
  31. if ($pages['page'] == 1) {
  32. $likemeOverView = $this->userNoticeManager->likeMeOverView($uid);
  33. $inviteOverView = $this->userNoticeManager->inviteOverView($uid);
  34. }
  35. $message->setResponse([
  36. 'likeme_overview' => $likemeOverView ?? null,
  37. 'invite_overview' => $inviteOverView ?? null,
  38. 'system' => $data
  39. ]);
  40. }
  41. public function sysnoticeDesc(SysnoticeDescMessage $message)
  42. {
  43. $uid = Auth::auth();
  44. $data = $this->userNoticeManager->systemListDesc($uid);
  45. $message->setResponse($data);
  46. }
  47. }