实现后台游戏评价管理
Project CI / Backend tests (pull_request) Has been cancelled
Project CI / Native shell tests (pull_request) Has been cancelled
Project CI / Frontend tests (pull_request) Has been cancelled
Project CI / Repository checks (pull_request) Has been cancelled
Project CI / AI game creator shell web tests (pull_request) Has been cancelled
Project CI / AI game creator shell Rust crates (pull_request) Has been cancelled
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Has been cancelled
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Has been cancelled
Project CI / AI game creator shell Rust smoke (pull_request) Has been cancelled
Project CI / Backend tests (pull_request) Has been cancelled
Project CI / Native shell tests (pull_request) Has been cancelled
Project CI / Frontend tests (pull_request) Has been cancelled
Project CI / Repository checks (pull_request) Has been cancelled
Project CI / AI game creator shell web tests (pull_request) Has been cancelled
Project CI / AI game creator shell Rust crates (pull_request) Has been cancelled
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Has been cancelled
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Has been cancelled
Project CI / AI game creator shell Rust smoke (pull_request) Has been cancelled
新增后台评价查询分页、详情和独立页面权限 支持管理员隐藏、恢复和删除评价,隐藏删除必须填写原因 新增私有操作记录及幂等重试保护,兼容升级评价隐藏字段 同步网站隐藏提示、公开评价列表和评分统计 补充定向测试、运行时验证脚本及方案验收证据
This commit is contained in:
@@ -14,6 +14,8 @@ import fs from 'node:fs';
|
||||
|
||||
const RUST_FILE = 'server-rs/crates/shared-contracts/src/game_distribution.rs';
|
||||
const TS_FILE = 'packages/shared/src/contracts/gameDistribution.ts';
|
||||
const ADMIN_RUST_FILE = 'server-rs/crates/shared-contracts/src/admin.rs';
|
||||
const ADMIN_TS_FILE = 'apps/admin-web/src/api/adminApiTypes.ts';
|
||||
const API_MODULE_FILE =
|
||||
'server-rs/crates/api-server/src/modules/game_distribution.rs';
|
||||
|
||||
@@ -48,6 +50,17 @@ const PAIRS = [
|
||||
'GameDistributionCreateVersionRequest',
|
||||
],
|
||||
['GameDistributionPrivateVersion', 'GameDistributionPrivateVersion'],
|
||||
['AdminGameReviewGamesQuery', 'AdminGameReviewGamesQuery'],
|
||||
['AdminGameReviewGame', 'AdminGameReviewGame'],
|
||||
['AdminGameReviewGamesResponse', 'AdminGameReviewGamesResponse'],
|
||||
['AdminGameReviewsQuery', 'AdminGameReviewsQuery'],
|
||||
['AdminGameReviewGameInfo', 'AdminGameReviewGameInfo'],
|
||||
['AdminGameReview', 'AdminGameReview'],
|
||||
['AdminGameReviewOperation', 'AdminGameReviewOperation'],
|
||||
['AdminGameReviewsResponse', 'AdminGameReviewsResponse'],
|
||||
['AdminGameReviewDetailResponse', 'AdminGameReviewDetailResponse'],
|
||||
['AdminGameReviewModerationRequest', 'AdminGameReviewModerationRequest'],
|
||||
['AdminGameReviewModerationResponse', 'AdminGameReviewModerationResponse'],
|
||||
];
|
||||
|
||||
// 服务端逐字段手拼 JSON 的响应/请求(`public_game_payload` / `game_payload` 等),TS 里这些类型
|
||||
@@ -107,7 +120,7 @@ function renamedMember(value, kind, rename) {
|
||||
function rustDefinitions(source) {
|
||||
const result = new Map();
|
||||
const pattern =
|
||||
/\n(?<attrs>(?:#\[[^\n]*\]\n)*)pub (?<kind>struct|enum) (?<name>GameDistribution\w+)(?<body>[\s\S]*?)\n\}/g;
|
||||
/\n(?<attrs>(?:#\[[^\n]*\]\n)*)pub (?<kind>struct|enum) (?<name>GameDistribution\w+|AdminGameReview\w*)(?<body>[\s\S]*?)\n\}/g;
|
||||
let match;
|
||||
while ((match = pattern.exec(source))) {
|
||||
const { attrs, kind, name, body } = match.groups;
|
||||
@@ -128,7 +141,7 @@ function rustDefinitions(source) {
|
||||
function tsDefinitions(source) {
|
||||
const result = new Map();
|
||||
const objectPattern =
|
||||
/export type (GameDistribution\w+) = \{([\s\S]*?)\n\};/g;
|
||||
/export (?:type|interface) (GameDistribution\w+|AdminGameReview\w*)(?: =)? \{([\s\S]*?)\n\};?/g;
|
||||
let match;
|
||||
while ((match = objectPattern.exec(source))) {
|
||||
const members = [];
|
||||
@@ -141,7 +154,8 @@ function tsDefinitions(source) {
|
||||
}
|
||||
result.set(match[1], { kind: 'struct', members, required });
|
||||
}
|
||||
const unionPattern = /export type (GameDistribution\w+) =\s*([^;]+);/g;
|
||||
const unionPattern =
|
||||
/export type (GameDistribution\w+|AdminGameReview\w*) =\s*([^;]+);/g;
|
||||
while ((match = unionPattern.exec(source))) {
|
||||
if (result.has(match[1])) continue;
|
||||
result.set(match[1], {
|
||||
@@ -303,8 +317,16 @@ function insertedKeys(body) {
|
||||
);
|
||||
}
|
||||
|
||||
const rust = rustDefinitions(fs.readFileSync(RUST_FILE, 'utf8'));
|
||||
const ts = tsDefinitions(fs.readFileSync(TS_FILE, 'utf8'));
|
||||
const rust = rustDefinitions(
|
||||
fs.readFileSync(RUST_FILE, 'utf8') +
|
||||
'\n' +
|
||||
fs.readFileSync(ADMIN_RUST_FILE, 'utf8'),
|
||||
);
|
||||
const ts = tsDefinitions(
|
||||
fs.readFileSync(TS_FILE, 'utf8') +
|
||||
'\n' +
|
||||
fs.readFileSync(ADMIN_TS_FILE, 'utf8'),
|
||||
);
|
||||
const failures = [];
|
||||
const mappedRust = new Set(PAIRS.map(([rustName]) => rustName));
|
||||
const mappedTs = new Set(PAIRS.map(([, tsName]) => tsName));
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user