| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- namespace App\Module\AppGame\Handler\Friend;
- use App\Module\AppGame\Handler\BaseHandler;
- use App\Module\Friend\Enums\ERROR_CODE;
- use App\Module\Friend\Services\FriendService;
- use Google\Protobuf\Internal\Message;
- use Uraus\Kku\Request\RequestFriendApplyAgree;
- use Uraus\Kku\Response\ResponseFriendApplyAgree;
- /**
- * 处理同意好友申请请求
- */
- class ApplyAgreeHandler extends BaseHandler
- {
- /**
- * 是否需要登录
- * @var bool
- */
- protected bool $need_login = true;
- /**
- * 处理同意好友申请请求
- *
- * @param RequestFriendApplyAgree $data 同意好友申请请求数据
- * @return ResponseFriendApplyAgree 同意好友申请响应
- */
- public function handle(Message $data): Message
- {
- // 创建响应对象
- $response = new ResponseFriendApplyAgree();
- // 获取请求参数
- $applyId = $data->getApplyId();
- // 参数验证
- if (empty($applyId)) {
- // ResponseFriendApplyAgree没有错误码字段,只能返回空响应
- return $response;
- }
- // 调用服务同意好友申请
- $result = FriendService::acceptFriendRequest($this->user_id, $applyId);
- // ResponseFriendApplyAgree没有返回字段,无法设置结果
- // 客户端需要通过其他方式(如刷新好友列表)来确认操作结果
- return $response;
- }
- }
|