1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <?php
- namespace App\Http\Services\V1;
- use App\Generated\V1\Messages\Notice\UpdateNoticeByKeyMessage;
- use App\Generated\V1\Messages\Notice\GetNoticeByKeyToIntMessage;
- use App\Generated\V1\Messages\Notice\UpdateNoticeByGroupMessage;
- use App\Generated\V1\Messages\Notice\GetNoticeProfileListMessage;
- use App\Services\Notice\ManageService;
- use App\Http\Controllers\Core\Auth;
- class NoticeService
- {
- /**
- * 获取通知开关配置
- * @param GetNoticeProfileListMessage $message
- * @throws \App\Exceptions\ApiException
- */
- public function getNoticeProfileList(GetNoticeProfileListMessage $message)
- {
- $uid = Auth::auth();
- $ms = new ManageService();
- $data = $ms->getNoticeByUser($uid);
- $message->setResponse($data);
- }
- /**
- * 设置通知的开关
- * @param UpdateNoticeByKeyMessage $message
- * @throws \App\Exceptions\AlertException
- * @throws \App\Exceptions\ApiException
- */
- public function updateNoticeByKey(UpdateNoticeByKeyMessage $message)
- {
- $key = $message->getKey();
- $open = $message->getIsOpen();
- $uid = Auth::auth();
- $manageService = new ManageService();
- $manageService->updateNoticeByKey($uid, $key, $open);
- }
- /**
- * 设置群组通知的开关
- * @param UpdateNoticeByGroupMessage $message
- * @throws \App\Exceptions\AlertException
- * @throws \App\Exceptions\ApiException
- */
- public function updateNoticeByGroup(UpdateNoticeByGroupMessage $message)
- {
- $uid = Auth::auth();
- $group = $message->getGroup();
- $open = $message->getIsOpen();
- $manageService = new ManageService();
- $manageService->updateNoticeByGroup($uid, $group, $open);
- }
- /**
- * 获取通知开关
- * @param GetNoticeByKeyToIntMessage $message
- * @throws \App\Exceptions\AlertException
- * @throws \App\Exceptions\ApiException
- */
- public function getNoticeByKeyToInt(GetNoticeByKeyToIntMessage $message)
- {
- $key = $message->getKey();
- $uid = Auth::auth();
- $manageService = new ManageService();
- $open = $manageService->getNoticeByKey2Int($uid, $key);
- $message->setResponse([
- 'isopen' => $open
- ]);
- }
- }
|