---
metadata:
  - name: generator
    content: Diplodoc Platform v5.54.4
alternate:
  - https://yandex.com/dev/games/doc/en/sdk/sdk-review.md
  - https://yandex.com/dev/games/doc/hi/sdk/sdk-review.md
  - https://yandex.com/dev/games/doc/ko/sdk/sdk-review.md
  - https://yandex.com/dev/games/doc/ru/sdk/sdk-review.md
  - https://yandex.com/dev/games/doc/tr/sdk/sdk-review.md
  - https://yandex.com/dev/games/doc/vi/sdk/sdk-review.md
  - https://yandex.com/dev/games/doc/zh/sdk/sdk-review.md
  - href: zh/sdk/sdk-review.md
    type: text/markdown
    title: Markdown version
  - href: ../llms.txt
    type: text/markdown
    title: llms.txt
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.com/dev/games/doc/zh/llms.txt

# 游戏评分

<!-- source: zh/_includes/script-common.md -->
<!-- source: zh/_includes/script/index-js.md -->

<!-- endsource: zh/_includes/script/index-js.md -->

<!-- source: zh/_includes/script/requirements-js.md -->

<!-- endsource: zh/_includes/script/requirements-js.md -->

<!-- source: zh/_includes/script/image-modal-js.md -->

<!-- endsource: zh/_includes/script/image-modal-js.md -->
<!-- endsource: zh/_includes/script-common.md -->

您可以通过弹出窗口请用户对游戏进行评级并撰写评价。该窗口在请求评级时出现。

在请求游戏评级前，请确保该选项对此用户可用：用户需要已登录且之前未对游戏评级。

有关使用评分的更多信息，请参阅[评论](https://yandex.com/dev/games/doc/zh/console/reviews.md)页面。

## 检查是否能够请求评级 {#can-review}

要检查是否能够请求游戏评级，请使用 `ysdk.feedback.canReview()` 方法。

该方法会返回其状态更改为 `resolved` 的 `Promise<Object>`。返回的对象包含带 `true/false` 值的 `value` 关键字。使用该关键字来检查是否能够请求评级：


#|
|| **值** | **描述** ||
|| `value: true` | 可以请求。 ||
||::{align="center"} `value: false` | 不能请求。

不能请求的原因以字符串值的形式在 `reason` 关键字中给出：
- `NO_AUTH` —— 用户未登录。
- `GAME_RATED` —— 用户已对游戏评级。
- `REVIEW_ALREADY_REQUESTED` —— 请求已发送，现在等待用户操作。
- `REVIEW_WAS_REQUESTED` —— 请求已发送，并且用户已执行操作：给出评级或关闭了弹出窗口。
- `UNKNOWN` —— 未发送请求，因为 Yandex 端发生了错误。 ||
|#

## 请求评级 {#request-review}


{% note alert %}

每次会话只能请求一次游戏评级。您在执行该请求前必须使用 [`ysdk.feedback.canReview()`](#can-review) 方法。

{% endnote %}


要邀请用户对游戏评级并撰写评价，请使用 `ysdk.feedback.requestReview()` 方法。

该方法会返回其状态更改为 `resolved` 的 `Promise<Object>`。返回的对象包含带 `true/false` 值的 `feedbackSent` 关键字。使用该关键字可以确定用户的操作：

#|
|| **值**| **描述** ||
|| `feedbackSent: true` | 用户对游戏进行了评级。 ||
|| `feedbackSent: false` | 用户关闭了弹出窗口。 ||
|#

如果您在执行请求前未使用 `ysdk.feedback.canReview()` 方法，则 `feedbackSent: false` 值可能伴随着 `use canReview before requestReview` 错误出现。

#### 示例 {#request-review-example}

```javascript showLineNumbers
const ysdk = await YaGames.init();

const { value, reason } = await ysdk.feedback.canReview();

if (value) {
    const { sentFeedback } = ysdk.feedback.requestReview();
} else {
    console.log(reason);
}
```


---

<!-- source: zh/_includes/sdk-support.md -->
{% note info %}

技术支持团队将协助您将已完成的游戏发布到 Yandex 游戏平台。关于开发和测试方面的具体问题，其他开发人员将在[Discord 频道](https://discord.com/invite/wU4p3whr4T){.external}中进行回答。

{% endnote %}

如果您遇到 Yandex Games SDK 方面的问题或有其他问题想要咨询，请联系支持部门：

<!-- source: zh/_includes/button-chat.md -->
<a href="https://yandex.com/chat/#/user/a4fa5c06-75db-9b38-6eea-b1673785f7d5">
  <span class="button">写入聊天信息</span>
</a>
<!-- endsource: zh/_includes/button-chat.md -->
<!-- endsource: zh/_includes/sdk-support.md -->
