feat: 新增单独计算近半年均价的接口
This commit is contained in:
@@ -12,7 +12,8 @@ from commons.models.material import Material
|
||||
|
||||
class Collector:
|
||||
|
||||
def __init__(self, year, month, force=True):
|
||||
def __init__(self, year, month, force=True, only_avg=0):
|
||||
self.only_avg = only_avg
|
||||
self.year = year
|
||||
self.month = month
|
||||
self.force = True # todo-2 已发布的价格不在覆盖计算
|
||||
@@ -120,9 +121,11 @@ class Collector:
|
||||
|
||||
def run(self):
|
||||
# 当月价
|
||||
# self.get_from_survey()
|
||||
self.get_from_result()
|
||||
if not self.only_avg:
|
||||
PricePublish.clean(self.year, self.month, type=1) # 清空当月价
|
||||
self.get_from_result()
|
||||
# 近半年平均价
|
||||
PricePublish.clean(self.year, self.month, type=2) # 清空近半年平均价
|
||||
self.get_avg()
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user