|
@@ -19,6 +19,20 @@ class PhoneQueryApp:
|
|
|
self.is_loading_cycles = False
|
|
self.is_loading_cycles = False
|
|
|
self.collected_items = []
|
|
self.collected_items = []
|
|
|
|
|
|
|
|
|
|
+ # 状况标签映射(tagId -> 名称)
|
|
|
|
|
+ self.condition_tags = {
|
|
|
|
|
+ 10: "屏幕完美",
|
|
|
|
|
+ 11: "机身无痕",
|
|
|
|
|
+ 12: "功能完好",
|
|
|
|
|
+ 17: "电池效率95%+",
|
|
|
|
|
+ 20: "原厂在保",
|
|
|
|
|
+ 19: "无维修",
|
|
|
|
|
+ 15: "官方在保",
|
|
|
|
|
+ 13: "原厂电池",
|
|
|
|
|
+ 14: "原厂屏幕",
|
|
|
|
|
+ 21: "原厂部件"
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
# 从文件读取cookie
|
|
# 从文件读取cookie
|
|
|
self.cookie = self.load_cookie()
|
|
self.cookie = self.load_cookie()
|
|
|
|
|
|
|
@@ -48,16 +62,16 @@ class PhoneQueryApp:
|
|
|
"content-type": "application/json;charset=UTF-8",
|
|
"content-type": "application/json;charset=UTF-8",
|
|
|
"ahs-app-version": "7.49.3",
|
|
"ahs-app-version": "7.49.3",
|
|
|
"Ahs-Timestamp": str(int(datetime.now().timestamp())),
|
|
"Ahs-Timestamp": str(int(datetime.now().timestamp())),
|
|
|
- "Ahs-Token": "601cbf5a87f04ab78f4e7a75703027d0",
|
|
|
|
|
|
|
+ "Ahs-Token": "dccf18b052ef46d78d4feb796182d5df",
|
|
|
"Ahs-Session-Id": str(uuid.uuid4()),
|
|
"Ahs-Session-Id": str(uuid.uuid4()),
|
|
|
"Ahs-App-Id": "10007",
|
|
"Ahs-App-Id": "10007",
|
|
|
- "Ahs-Device-Id": "cdf81407-32a7-4aa1-8900-d9fed9c930f8",
|
|
|
|
|
- "Ahs-Sign": "5c3478fe911b5eadfb38fb5e92626fb1",
|
|
|
|
|
|
|
+ "Ahs-Device-Id": "3166e003-4ba7-4b57-8158-30859d81c7d5",
|
|
|
|
|
+ "Ahs-Sign": "9ea25fcfcda37585065244ed271f1b0d",
|
|
|
"User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 26_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.74(0x18004a2c) NetType/WIFI Language/zh_CN",
|
|
"User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 26_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.74(0x18004a2c) NetType/WIFI Language/zh_CN",
|
|
|
"Referer": "https://servicewechat.com/wx7e490492b4c23e98/1055/page-frame.html",
|
|
"Referer": "https://servicewechat.com/wx7e490492b4c23e98/1055/page-frame.html",
|
|
|
"Accept": "*/*",
|
|
"Accept": "*/*",
|
|
|
"Accept-Encoding": "gzip, deflate, br",
|
|
"Accept-Encoding": "gzip, deflate, br",
|
|
|
- "Cookie": self.cookie
|
|
|
|
|
|
|
+ # "Cookie": self.cookie
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
def create_widgets(self):
|
|
def create_widgets(self):
|
|
@@ -87,6 +101,7 @@ class PhoneQueryApp:
|
|
|
filter_frame = ttk.LabelFrame(main_frame, text="筛选条件", padding="10")
|
|
filter_frame = ttk.LabelFrame(main_frame, text="筛选条件", padding="10")
|
|
|
filter_frame.grid(row=1, column=0, sticky=(tk.W, tk.E), pady=(0, 10))
|
|
filter_frame.grid(row=1, column=0, sticky=(tk.W, tk.E), pady=(0, 10))
|
|
|
|
|
|
|
|
|
|
+ # 第一行:价格区间 和 成色
|
|
|
# 价格区间
|
|
# 价格区间
|
|
|
price_frame = ttk.LabelFrame(filter_frame, text="价格区间", padding="5")
|
|
price_frame = ttk.LabelFrame(filter_frame, text="价格区间", padding="5")
|
|
|
price_frame.grid(row=0, column=0, sticky=(tk.W, tk.E), padx=5, pady=5)
|
|
price_frame.grid(row=0, column=0, sticky=(tk.W, tk.E), padx=5, pady=5)
|
|
@@ -111,6 +126,21 @@ class PhoneQueryApp:
|
|
|
cb = ttk.Checkbutton(fineness_frame, text=option, variable=var)
|
|
cb = ttk.Checkbutton(fineness_frame, text=option, variable=var)
|
|
|
cb.grid(row=0, column=i, sticky=tk.W, padx=10, pady=2)
|
|
cb.grid(row=0, column=i, sticky=tk.W, padx=10, pady=2)
|
|
|
|
|
|
|
|
|
|
+ # 第二行:状况标签(占满整行)
|
|
|
|
|
+ condition_frame = ttk.LabelFrame(filter_frame, text="状况标签", padding="5")
|
|
|
|
|
+ condition_frame.grid(row=1, column=0, columnspan=2, sticky=(tk.W, tk.E), padx=5, pady=5)
|
|
|
|
|
+
|
|
|
|
|
+ self.condition_vars = {}
|
|
|
|
|
+ # 将状况标签分成两行显示,每行5个
|
|
|
|
|
+ condition_items = list(self.condition_tags.items())
|
|
|
|
|
+ for i, (tag_id, tag_name) in enumerate(condition_items):
|
|
|
|
|
+ var = tk.BooleanVar()
|
|
|
|
|
+ self.condition_vars[tag_id] = var
|
|
|
|
|
+ row = i // 5 # 每行5个
|
|
|
|
|
+ col = i % 5
|
|
|
|
|
+ cb = ttk.Checkbutton(condition_frame, text=tag_name, variable=var)
|
|
|
|
|
+ cb.grid(row=row, column=col, sticky=tk.W, padx=10, pady=2)
|
|
|
|
|
+
|
|
|
filter_frame.columnconfigure(0, weight=1)
|
|
filter_frame.columnconfigure(0, weight=1)
|
|
|
filter_frame.columnconfigure(1, weight=1)
|
|
filter_frame.columnconfigure(1, weight=1)
|
|
|
|
|
|
|
@@ -200,6 +230,14 @@ class PhoneQueryApp:
|
|
|
selected.append(fineness_map[option])
|
|
selected.append(fineness_map[option])
|
|
|
return selected if selected else [99, 100, 111, 95, 90, 80, 70]
|
|
return selected if selected else [99, 100, 111, 95, 90, 80, 70]
|
|
|
|
|
|
|
|
|
|
+ def get_selected_condition_tags(self):
|
|
|
|
|
+ """获取选中的状况标签ID列表"""
|
|
|
|
|
+ selected = []
|
|
|
|
|
+ for tag_id, var in self.condition_vars.items():
|
|
|
|
|
+ if var.get():
|
|
|
|
|
+ selected.append(tag_id)
|
|
|
|
|
+ return selected
|
|
|
|
|
+
|
|
|
def search_products(self):
|
|
def search_products(self):
|
|
|
keyword = self.model_entry.get().strip()
|
|
keyword = self.model_entry.get().strip()
|
|
|
if not keyword:
|
|
if not keyword:
|
|
@@ -225,6 +263,7 @@ class PhoneQueryApp:
|
|
|
try:
|
|
try:
|
|
|
min_price, max_price = self.get_selected_prices()
|
|
min_price, max_price = self.get_selected_prices()
|
|
|
fineness_ids = self.get_selected_fineness()
|
|
fineness_ids = self.get_selected_fineness()
|
|
|
|
|
+ condition_tags = self.get_selected_condition_tags()
|
|
|
|
|
|
|
|
request_data = {
|
|
request_data = {
|
|
|
"minPrice": min_price,
|
|
"minPrice": min_price,
|
|
@@ -232,7 +271,7 @@ class PhoneQueryApp:
|
|
|
"sortValue": "sort_composite",
|
|
"sortValue": "sort_composite",
|
|
|
"gaeaPricePpvIds": {},
|
|
"gaeaPricePpvIds": {},
|
|
|
"gaeaFinenessIds": fineness_ids,
|
|
"gaeaFinenessIds": fineness_ids,
|
|
|
- "conditionTagList": [],
|
|
|
|
|
|
|
+ "conditionTagList": condition_tags, # 使用选中的状况标签
|
|
|
"scene": "search",
|
|
"scene": "search",
|
|
|
"keyword": keyword,
|
|
"keyword": keyword,
|
|
|
"sirReq": False,
|
|
"sirReq": False,
|