Commit ab12e838 by Leo Zheng

修改sightVisitorFlowByDay的返回格式

parent 9c5ed632
<config> <config>
<port>30016</port> <port>30017</port>
<host>192.168.0.132</host> <host>192.168.0.132</host>
</config> </config>
\ No newline at end of file
...@@ -67,10 +67,12 @@ export class sightVisitorFlowByDayStrategy extends abstractDataStrategyLeft { ...@@ -67,10 +67,12 @@ export class sightVisitorFlowByDayStrategy extends abstractDataStrategyLeft {
}); });
} }
// Convert the map to the desired format // Convert the map to the desired format with "01时" format for hours
const result: Array<{ key: string, count: number, status: string }> = []; const result: Array<{ key: string, count: number, status: string }> = [];
visitorCount.forEach((value, key) => { visitorCount.forEach((value, key) => {
result.push({ key, count: value.count, status: value.status }); const formattedKey = key.toString().padStart(2, '0') + "时";
result.push({ key: formattedKey, count: value.count, status: value.status });
console.log("here!");
}); });
return result; return result;
......
/**
* Checks if any value in the object is zero and replaces it with a random value.
* @param obj - The object to check.
* @param min - The minimum value for the random number.
* @param max - The maximum value for the random number.
*/
function replaceZeroValuesWithRandom(obj: { [key: string]: number }, min: number, max: number) {
for (let key in obj) {
if (obj[key] === 0) {
obj[key] = Math.floor(Math.random() * (max - min + 1)) + min;
}
}
}
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