feat(pugongying): 将粉丝年龄分布拆分为独立列导出
将 fansProfile.ages 从单个汇总字段拆分为 5 个独立年龄段列 (<18、18-24、25-34、35-44、>44),每列对应该年龄段的粉丝占比。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
33d6aeb495
commit
0875e20a89
@ -31,7 +31,11 @@
|
|||||||
const FIELD_LABEL_MAP = {
|
const FIELD_LABEL_MAP = {
|
||||||
id: "ID",
|
id: "ID",
|
||||||
fansProfile: "粉丝画像",
|
fansProfile: "粉丝画像",
|
||||||
"fansProfile.ages": "粉丝年龄分布",
|
"fansProfile.ages.<18": "18岁以下粉丝占比",
|
||||||
|
"fansProfile.ages.18-24": "18-24岁粉丝占比",
|
||||||
|
"fansProfile.ages.25-34": "25-34岁粉丝占比",
|
||||||
|
"fansProfile.ages.35-44": "35-44岁粉丝占比",
|
||||||
|
"fansProfile.ages.>44": "44岁以上粉丝占比",
|
||||||
"fansProfile.gender.male": "粉丝男性占比",
|
"fansProfile.gender.male": "粉丝男性占比",
|
||||||
"fansProfile.gender.female": "粉丝女性占比",
|
"fansProfile.gender.female": "粉丝女性占比",
|
||||||
userId: "达人ID",
|
userId: "达人ID",
|
||||||
@ -142,7 +146,19 @@
|
|||||||
const value = record[key];
|
const value = record[key];
|
||||||
|
|
||||||
if (Array.isArray(value)) {
|
if (Array.isArray(value)) {
|
||||||
|
if (
|
||||||
|
value.length &&
|
||||||
|
value.every(
|
||||||
|
(item) =>
|
||||||
|
isPlainObject(item) && "group" in item && "percent" in item,
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
for (const item of value) {
|
||||||
|
baseTarget[`${nextPath}.${item.group}`] = item.percent;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
baseTarget[nextPath] = summarizeArray(value);
|
baseTarget[nextPath] = summarizeArray(value);
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user