重算均价
This commit is contained in:
@@ -32,11 +32,24 @@ def get_district(city):
|
||||
keys = {"city": 1, "region": 1, "name": 1, "_id": 0}
|
||||
for dis in fangjia.get_collection("fangjia", "seaweed", config.get_seaweed_host()).find({"cat": "district", "status": 0, "city": city}, keys):
|
||||
dis["weekend"] = weekend
|
||||
if not has_price(dis.city, dis.region, dis.name):
|
||||
seaweeds.append(dis)
|
||||
|
||||
else:
|
||||
logger.info(str(dis) + "放弃")
|
||||
return seaweeds
|
||||
|
||||
|
||||
def has_price(city, region, name):
|
||||
weekend = fangjia.get_weekend()
|
||||
district_stat = fangjia.get_collection("fangjia", "district_stat", config.get_district_stat_host(), config.get_district_stat_port())
|
||||
query = {
|
||||
"city": city,
|
||||
"region": region,
|
||||
"district_name": name,
|
||||
"weekend": weekend
|
||||
}
|
||||
return district_stat.find_one(query) is not None
|
||||
|
||||
def send_cmd(seaweed):
|
||||
json_cmd = json.dumps(seaweed, ensure_ascii=False, cls=CJsonEncoder)
|
||||
client.rpush(QUEUE, json_cmd)
|
||||
|
||||
Reference in New Issue
Block a user