diff --git a/spider/main.py b/spider/main.py index bf4033e..77e0149 100644 --- a/spider/main.py +++ b/spider/main.py @@ -188,7 +188,7 @@ class Auto: # 随机实物 - def get_random_food(self, shop: str) -> list[str]: + def get_random_food(self,city: str, shop: str) -> list[str]: """ 随机选择 1~2 种食物类别,并为每个类别至少选择 1 个具体产品 @@ -247,7 +247,7 @@ class Auto: pick_count = random.randint(1, max_pick) selected_products.extend(random.sample(cat, k=pick_count)) logger.debug(f"随机选择的产品: {selected_products}") - text = f'{shop} buy: ' + text = f'{shop}, {city} buy: ' for p in selected_products: text += f'{p} * {random.randint(1, 3)}, ' text = text[:-2] @@ -291,7 +291,7 @@ class Auto: street = shop.get('street') if street is None: return None - text = self.get_random_food(street) + text = self.get_random_food(shop.get('city'), street) # 人数 person_count = str(random.randint(3, 5)) logger.debug("填写问卷")