diff --git a/PriceSystem/CalcCmdSender.py b/PriceSystem/CalcCmdSender.py index 4d9bee0..9bb2632 100644 --- a/PriceSystem/CalcCmdSender.py +++ b/PriceSystem/CalcCmdSender.py @@ -32,11 +32,26 @@ 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 - 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 +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) diff --git a/PriceSystem/config/__init__.py b/PriceSystem/config/__init__.py index 16be5f6..20e21a6 100644 --- a/PriceSystem/config/__init__.py +++ b/PriceSystem/config/__init__.py @@ -3,7 +3,7 @@ def get_worker_num(): 获取进行均价计算的进程数 :return: """ - return 20 + return 40 diff --git a/PriceSystem/sell_price/.zhuge0118A.py.swo b/PriceSystem/sell_price/.zhuge0118A.py.swo deleted file mode 100644 index 5234bc0..0000000 Binary files a/PriceSystem/sell_price/.zhuge0118A.py.swo and /dev/null differ diff --git a/PriceSystem/sell_price/.zhuge0118A.py.swp b/PriceSystem/sell_price/.zhuge0118A.py.swp deleted file mode 100644 index f98eca9..0000000 Binary files a/PriceSystem/sell_price/.zhuge0118A.py.swp and /dev/null differ