getUserId(); $message = ''; // 消息字段在当前proto定义中不存在 // 参数验证 if (empty($targetId)) { // 由于ResponseFriendApply没有code和message字段,我们只能返回空响应 return $response; } // 调用服务发送好友申请 $result = FriendService::sendFriendRequest($this->user_id, $targetId, $message); // 如果成功,设置申请ID if ($result['code'] === ERROR_CODE::SUCCESS && isset($result['data']['id'])) { $response->setApplyId($result['data']['id']); } return $response; } }