Commit 093e6e07 by Leo Zheng

更新了一些返回格式

parent d562e619
......@@ -12,15 +12,15 @@ export default class merchantBusinessStatisticsStrategy extends abstractMerchant
const result = [
{
key: 'totalBusinesses',
key: '营业商家数',
value: totalBusinesses
},
{
key: 'totalShops',
key: '营业店铺数',
value: totalShops
},
{
key: 'businessActivityRate',
key: '商家动销率',
value: businessActivityRate
}
];
......
......@@ -27,10 +27,14 @@ export default class visitorGenderProfileStrategy extends abstractCustomerProfil
femaleCount = total - maleCount;
}
const result = {
total: total,
maleCount: maleCount,
femaleCount: femaleCount
const result = type === 'ticket' ?{
总游客数: total,
男性游客: maleCount,
女性游客: femaleCount
} : {
总会员数: total,
男性会员: maleCount,
女性会员: femaleCount
}
return Object.entries(result).map(([key, value]) => ({key, value}));
......
......@@ -28,18 +28,14 @@ export default class visitorHomeProfileStrategy extends abstractCustomerProfileS
const scaledCount = Math.floor(count * scaleFactor);
return {
key,
value: {
count: scaledCount,
percent: ((scaledCount / total) * 100).toFixed(2) + '%'
}
value: scaledCount
};
});
const currentTotal = result.reduce((sum, city) => sum + city.value.count, 0);
const currentTotal = result.reduce((sum, city) => sum + city.value, 0);
if (currentTotal !== total) {
const difference = total - currentTotal;
result[0].value.count += difference;
result[0].value.percent = ((result[0].value.count / total) * 100).toFixed(2) + '%';
result[0].value += difference;
}
return result;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment