优化均价提醒脚本
This commit is contained in:
@@ -29,10 +29,6 @@ def get_district(city):
|
||||
for dis in fangjia.get_collection("fangjia", "seaweed", config.get_seaweed_host()).find({"cat": "district", "status": 0, "city": city}, keys):
|
||||
dis["weekend"] = weekend
|
||||
seaweeds.append(dis)
|
||||
# if "region" in dis and not has_price(dis["city"], dis["region"], dis['name']):
|
||||
# seaweeds.append(dis)
|
||||
# else:
|
||||
# logger.info(str(dis) + "放弃")
|
||||
return seaweeds
|
||||
|
||||
|
||||
@@ -61,6 +57,24 @@ def send_district_calc_cmd():
|
||||
send_cmd(seaweed)
|
||||
|
||||
|
||||
def count_district_stat(weekend):
|
||||
district_stat = fangjia.get_collection("fangjia", "district_stat", config.get_district_stat_host(),
|
||||
config.get_district_stat_port())
|
||||
return district_stat.count({"weekend": weekend})
|
||||
|
||||
|
||||
def count_district_stat(weekend):
|
||||
district_stat = fangjia.get_collection("fangjia", "district_stat", config.get_district_stat_host(),
|
||||
config.get_district_stat_port())
|
||||
return district_stat.count({"weekend": weekend})
|
||||
|
||||
|
||||
def count_city_stat(weekend):
|
||||
region_stat = fangjia.get_collection("fangjia", "region_stat", config.get_district_stat_host(),
|
||||
config.get_district_stat_port())
|
||||
return region_stat.count({"weekend": weekend, "region": None, "block": None})
|
||||
|
||||
|
||||
def save_city_calc_command(city, region, weekend):
|
||||
calc_command = fangjia.get_collection("fangjia_log", "calc_command", config.get_log_mongodb_host(),
|
||||
config.get_log_mongodb_port())
|
||||
@@ -113,8 +127,11 @@ def all_calc_cmd_finish(start_time):
|
||||
time.sleep(10)
|
||||
time_format = "%Y-%m-%d %H:%M:%S"
|
||||
|
||||
weekend = fangjia.get_weekend()
|
||||
|
||||
msg = "均价计算完成,开始时间:" + start_time.strftime(time_format) \
|
||||
+ ", 结束时间:" + datetime.datetime.utcnow().strftime(time_format)
|
||||
+ ", 结束时间:" + datetime.datetime.utcnow().strftime(time_format) + ", 小区均价数量:" \
|
||||
+ str(count_district_stat(weekend)) + ", 城市均价数量:" + str(count_city_stat(weekend))
|
||||
fangjia.send_ding_msg(msg)
|
||||
|
||||
|
||||
|
||||
+37
-34
@@ -1,45 +1,48 @@
|
||||
import datetime
|
||||
import fangjia
|
||||
import pytz
|
||||
import pymongo
|
||||
#fangjia.send_dingding_msg("测试")
|
||||
#
|
||||
import time
|
||||
|
||||
import sell_price.zhuge0118A as sellPrice
|
||||
|
||||
def get_weekend(tt):
|
||||
|
||||
from dateutil.parser import parse
|
||||
bb=parse(tt)
|
||||
pacific = pytz.timezone('Asia/Shanghai')
|
||||
return pacific.localize(bb)
|
||||
|
||||
weekend = get_weekend('20180527')
|
||||
|
||||
|
||||
s = time.time()
|
||||
|
||||
|
||||
ct='上海'
|
||||
rl='长宁'
|
||||
lk='江苏北路105弄小区'
|
||||
'''
|
||||
'深圳', 'region': '福田', 'name': '东方银座'$ 上海长宁江苏北路105弄小区
|
||||
|
||||
'''
|
||||
|
||||
#杨浦凤城四村闵行上海康城厦门同安大唐世家二期青岛市北东方小区合肥庐阳海亮红玺台青岛市北东方小区
|
||||
|
||||
#深圳龙岗浪背村宝安吉祥公寓门头沟 泷悦长安北京上海闵行金盛小区江苏昆山象屿珑庭###浦东交通新村
|
||||
|
||||
#for i in range(0, 100):深圳福田世纪豪庭北京海淀前沙涧襄阳樊城国色天襄上海闵行虹凯小区徐汇前进大楼黄浦伊时代酒店式公寓
|
||||
#北区济南章丘朝阳南区上海奉贤嘉安公寓上海宝山水岸蓝桥上海宝山水上新村青浦 馨浦苑太原小店兴武小区
|
||||
|
||||
sellPrice.out_put_price(ct, rl, lk, weekend)
|
||||
e = time.time()
|
||||
|
||||
print(e - s)
|
||||
|
||||
#
|
||||
# def get_weekend(tt):
|
||||
#
|
||||
# from dateutil.parser import parse
|
||||
# bb=parse(tt)
|
||||
# pacific = pytz.timezone('Asia/Shanghai')
|
||||
# return pacific.localize(bb)
|
||||
#
|
||||
# weekend = get_weekend('20180527')
|
||||
#
|
||||
#
|
||||
# s = time.time()
|
||||
#
|
||||
#
|
||||
# ct='上海'
|
||||
# rl='长宁'
|
||||
# lk='江苏北路105弄小区'
|
||||
# '''
|
||||
# '深圳', 'region': '福田', 'name': '东方银座'$ 上海长宁江苏北路105弄小区
|
||||
#
|
||||
# '''
|
||||
#
|
||||
# #杨浦凤城四村闵行上海康城厦门同安大唐世家二期青岛市北东方小区合肥庐阳海亮红玺台青岛市北东方小区
|
||||
#
|
||||
# #深圳龙岗浪背村宝安吉祥公寓门头沟 泷悦长安北京上海闵行金盛小区江苏昆山象屿珑庭###浦东交通新村
|
||||
#
|
||||
# #for i in range(0, 100):深圳福田世纪豪庭北京海淀前沙涧襄阳樊城国色天襄上海闵行虹凯小区徐汇前进大楼黄浦伊时代酒店式公寓
|
||||
# #北区济南章丘朝阳南区上海奉贤嘉安公寓上海宝山水岸蓝桥上海宝山水上新村青浦 馨浦苑太原小店兴武小区
|
||||
#
|
||||
# sellPrice.out_put_price(ct, rl, lk, weekend)
|
||||
# e = time.time()
|
||||
#
|
||||
# print(e - s)
|
||||
client105 = pymongo.MongoClient('114.80.150.198', 27777)
|
||||
for s in client105.fangjia.seawater.find({"city": "上海", "cat": "sell", "region":"长宁", "district_name": "新泾三村"}):
|
||||
print(s)
|
||||
|
||||
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user