Commit 7db55a2d by 陈森彬

新增空库存空价格率大于90的提示

parent 10418f09
Showing with 9 additions and 7 deletions
......@@ -117,7 +117,7 @@ class MongoOperator:
def get_platform_none_data_rate(self):
msg = '空数据预警 过去3小时内:\n'
demo1 = '平台:{} 第一次运行,库存空数据率为{:.2f}%,价格空数据率为{:.2f}%'
demo2 = '平台:{} 相比上一次监控库存空数据率变化为{:.2f}%,价格空数据率变化为{:.2f}%'
demo2 = '平台:{} 相比上一次监控库存空数据率变化为{:.2f}%,价格空数据率变化为{:.2f}%,当前空库存率为{:.2f}%,当前空价格率为{:.2f}%,'
msgs = []
for plat in self.colls:
coll = self.db[plat]
......@@ -137,13 +137,15 @@ class MongoOperator:
, "空库存率", stock_rate, "空价格率", tiered_rate, )
msg_line = demo1.format(plat, stock_rate, tiered_rate)
else:
stock__ontrast_ratio = stock_rate - old_stock_rate
tiered__ontrast_ratio = tiered_rate - old_tiered_rate
if not -3 < stock__ontrast_ratio < 3 or not -3 < tiered__ontrast_ratio < 3:
msg_line = demo2.format(plat, stock__ontrast_ratio, tiered__ontrast_ratio)
stock_ontrast_ratio = stock_rate - old_stock_rate
tiered_ontrast_ratio = tiered_rate - old_tiered_rate
if not -3 < stock_ontrast_ratio < 3 or not -3 < tiered_ontrast_ratio < 3 or stock_rate > 90 or tiered_rate > 90:
msg_line = demo2.format(plat, stock_ontrast_ratio, tiered_ontrast_ratio, stock_rate,
tiered_rate)
print(plat, "空库存数量", stock_num, "空价格数量", stock_num, "总量", total, "空库存率",
stock_rate, "空价格率", tiered_rate, "空库存变化率", stock__ontrast_ratio,
"空价格变化率", tiered__ontrast_ratio, )
stock_rate, "空价格率", tiered_rate, "空库存变化率", stock_ontrast_ratio,
"空价格变化率", tiered_ontrast_ratio, )
glo.set_value(plat, {"stock": stock_rate, "tiered": tiered_rate})
if msg_line:
msgs.append(msg_line)
......
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 sign in to comment