unknown 3 years ago
commit 3ece2bc20a

2
.gitignore vendored

@ -96,5 +96,5 @@ iOSInjectionProject/
*.xlsx
*.log
*.txt
# *.txt
!src/recommendLists/*.txt

@ -0,0 +1,5 @@
界面设计评审:
1. 界面交互性还需要进行完善,即增加动画以及响应效果。
2. 各个界面之间的关系,主要是界面之间的跳转,回跳的关系应该更加清晰完整一点(目前只展示了主要逻辑跳转关系)。
3. 所有的界面需要共同实现一个导航栏的接口,导航栏在每一个界面上都是存在的。
4.设计缺少对于错误处理的界面,即错误重定向界面的设计。

Binary file not shown.

Binary file not shown.

@ -0,0 +1,9 @@
numpy==1.19.3
requests==2.21.0
selenium==3.141.0
lxml==4.3.2
PyMySQL==0.10.1
matplotlib==3.0.3
SQLAlchemy==1.3.1
pandas==0.24.2
beautifulsoup4==4.9.3

@ -1,252 +0,0 @@
CREATE DATABASE IF NOT EXISTS test;
USE test;
DROP TABLE IF EXISTS `cpu`;
CREATE TABLE `cpu` (
`id` int(11) DEFAULT 0,
`name` varchar(255) DEFAULT NULL,
`comment_num` INT DEFAULT 100,
`praise_rate` INT DEFAULT 90,
`shop_name` varchar(255) DEFAULT NULL,
`price` INT DEFAULT 0,
`link` varchar(255) NOT NULL,
`brand` varchar(255) DEFAULT NULL,
`tags` varchar(255) DEFAULT NULL,
`clock_speed` varchar(255) DEFAULT NULL,
`core_num` varchar(255) DEFAULT NULL,
`TDP` INT DEFAULT 0,
`socket` varchar(255) DEFAULT NULL,
`have_core_graphics_card` varchar(255) DEFAULT NULL,
`have_cpu_fan` varchar(255) DEFAULT NULL,
`generation` INT DEFAULT 0,
`introduction` JSON,
`Ptable_params` JSON,
`title_name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`link`)
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8mb4, COLLATE=utf8mb4_general_ci;
truncate cpu;
DROP TABLE IF EXISTS `motherboard`;
CREATE TABLE `motherboard` (
`id` int(11) DEFAULT 0,
`name` varchar(255) DEFAULT NULL,
`comment_num` INT DEFAULT 100,
`praise_rate` INT DEFAULT 90,
`shop_name` varchar(255) DEFAULT NULL,
`price` INT DEFAULT 0,
`link` varchar(255) NOT NULL,
`brand` varchar(255) DEFAULT NULL,
`tags` varchar(255) DEFAULT NULL,
`form_factor` varchar(255) DEFAULT NULL,
`platform` varchar(255) DEFAULT NULL,
`cpu_socket` varchar(255) DEFAULT NULL,
`m2_num` INT DEFAULT 0,
`slot_num` INT DEFAULT 0,
`ddr_gen` varchar(255) DEFAULT NULL,
`max_memory` INT DEFAULT 0,
`introduction` JSON,
`Ptable_params` JSON,
`title_name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`link`)
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8mb4, COLLATE=utf8mb4_general_ci;
truncate motherboard;
DROP TABLE IF EXISTS `graphics_card`;
CREATE TABLE `graphics_card` (
`id` int(11) DEFAULT 0,
`name` varchar(255) DEFAULT NULL,
`comment_num` INT DEFAULT 100,
`praise_rate` INT DEFAULT 90,
`shop_name` varchar(255) DEFAULT NULL,
`price` INT DEFAULT 0,
`link` varchar(255) NOT NULL,
`brand` varchar(255) DEFAULT NULL,
`tags` varchar(255) DEFAULT NULL,
`card_length` float DEFAULT 0,
`rgb` varchar(255) DEFAULT NULL,
`card_type` varchar(255) DEFAULT NULL,
`generation` INT DEFAULT 0,
`introduction` JSON,
`Ptable_params` JSON,
`title_name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`link`)
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8mb4, COLLATE=utf8mb4_general_ci;
truncate graphics_card;
DROP TABLE IF EXISTS `memory`;
CREATE TABLE `memory` (
`id` int(11) DEFAULT 0,
`name` varchar(255) DEFAULT NULL,
`comment_num` INT DEFAULT 100,
`praise_rate` INT DEFAULT 90,
`shop_name` varchar(255) DEFAULT NULL,
`price` INT DEFAULT 0,
`link` varchar(255) NOT NULL,
`brand` varchar(255) DEFAULT NULL,
`frequency` varchar(255) DEFAULT NULL,
`total_capacity` INT DEFAULT 0,
`memory_num` varchar(255) DEFAULT NULL,
`appearance` varchar(255) DEFAULT NULL,
`ddr_gen` varchar(255) DEFAULT NULL,
`introduction` JSON,
`Ptable_params` JSON,
`title_name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`link`)
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8mb4, COLLATE=utf8mb4_general_ci;
truncate memory;
DROP TABLE IF EXISTS `cpu_radiator`;
CREATE TABLE `cpu_radiator` (
`id` int(11) DEFAULT 0,
`name` varchar(255) DEFAULT NULL,
`comment_num` INT DEFAULT 100,
`praise_rate` INT DEFAULT 90,
`shop_name` varchar(255) DEFAULT NULL,
`price` INT DEFAULT 0,
`link` varchar(255) NOT NULL,
`brand` varchar(255) DEFAULT NULL,
`height` INT DEFAULT 0,
`socket` varchar(255) DEFAULT NULL,
`radiator_size` INT DEFAULT 0,
`rgb` varchar(255) DEFAULT NULL,
`introduction` JSON,
`Ptable_params` JSON,
`title_name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`link`)
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8mb4, COLLATE=utf8mb4_general_ci;
truncate cpu_radiator;
DROP TABLE IF EXISTS `ssd`;
CREATE TABLE `ssd` (
`id` int(11) DEFAULT 0,
`name` varchar(255) DEFAULT NULL,
`comment_num` INT DEFAULT 100,
`praise_rate` INT DEFAULT 90,
`shop_name` varchar(255) DEFAULT NULL,
`price` INT DEFAULT 0,
`link` varchar(255) NOT NULL,
`brand` varchar(255) DEFAULT NULL,
`interface` varchar(255) DEFAULT NULL,
`total_capacity` FLOAT DEFAULT 0,
`introduction` JSON,
`Ptable_params` JSON,
`title_name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`link`)
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8mb4, COLLATE=utf8mb4_general_ci;
truncate ssd;
DROP TABLE IF EXISTS `hdd`;
CREATE TABLE `hdd` (
`id` int(11) DEFAULT 0,
`name` varchar(255) DEFAULT NULL,
`comment_num` INT DEFAULT 100,
`praise_rate` INT DEFAULT 90,
`shop_name` varchar(255) DEFAULT NULL,
`price` INT DEFAULT 0,
`link` varchar(255) NOT NULL,
`brand` varchar(255) DEFAULT NULL,
`size` varchar(255) DEFAULT NULL,
`rotating_speed` varchar(255) DEFAULT NULL,
`total_capacity` FLOAT DEFAULT 0,
`introduction` JSON,
`Ptable_params` JSON,
`title_name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`link`)
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8mb4, COLLATE=utf8mb4_general_ci;
truncate hdd;
DROP TABLE IF EXISTS `power_supply`;
CREATE TABLE `power_supply` (
`id` int(11) DEFAULT 0,
`name` varchar(255) DEFAULT NULL,
`comment_num` INT DEFAULT 100,
`praise_rate` INT DEFAULT 90,
`shop_name` varchar(255) DEFAULT NULL,
`price` INT DEFAULT 0,
`link` varchar(255) NOT NULL,
`brand` varchar(255) DEFAULT NULL,
`tags` varchar(255) DEFAULT NULL,
`power` INT DEFAULT 0,
`size` varchar(255) DEFAULT NULL,
`modularization` varchar(255) DEFAULT NULL,
`transfer_efficiency` varchar(255) DEFAULT NULL,
`introduction` JSON,
`Ptable_params` JSON,
`title_name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`link`)
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8mb4, COLLATE=utf8mb4_general_ci;
truncate power_supply;
DROP TABLE IF EXISTS `computer_case`;
CREATE TABLE `computer_case` (
`id` int(11) DEFAULT 0,
`name` varchar(255) DEFAULT NULL,
`comment_num` INT DEFAULT 100,
`praise_rate` INT DEFAULT 90,
`shop_name` varchar(255) DEFAULT NULL,
`price` INT DEFAULT 0,
`link` varchar(255) NOT NULL,
`brand` varchar(255) DEFAULT NULL,
`max_form_factor` varchar(255) DEFAULT NULL,
`max_card_len` INT DEFAULT 0,
`max_radiator_height` INT DEFAULT 0,
`supported_radiator` varchar(255) DEFAULT NULL,
`has_transparent_side_panel` INT DEFAULT 0,
`introduction` JSON,
`Ptable_params` JSON,
`title_name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`link`)
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8mb4, COLLATE=utf8mb4_general_ci;
truncate computer_case;
DROP TABLE IF EXISTS `board_u_suit`;
CREATE TABLE `board_u_suit` (
`id` int(11) DEFAULT 0,
`name` varchar(255) DEFAULT NULL,
`board` varchar(255) DEFAULT NULL,
`cpu` varchar(255) DEFAULT NULL,
`shop_name` varchar(255) DEFAULT NULL,
`price` INT DEFAULT 0,
`link` varchar(255) NOT NULL,
`introduction` JSON,
`Ptable_params` JSON,
`title_name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`link`)
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8mb4, COLLATE=utf8mb4_general_ci;
truncate board_u_suit;
DROP TABLE IF EXISTS `trendings`;
CREATE TABLE `trendings` (
`id` varchar(255) NOT NULL,
`frequency` int(11) DEFAULT 0,
`cpu` varchar(255) NOT NULL,
`cpu_price` int(11) DEFAULT 0,
`cpu_link` varchar(255) NOT NULL,
`motherboard` varchar(255) NOT NULL,
`motherboard_price` int(11) DEFAULT 0,
`motherboard_link` varchar(255) NOT NULL,
`GPU` varchar(255) NOT NULL,
`GPU_price` int(11) DEFAULT 0,
`GPU_link` varchar(255) NOT NULL,
`memory` varchar(255) NOT NULL,
`memory_price` int(11) DEFAULT 0,
`memory_link` varchar(255) NOT NULL,
`CPURadiator` varchar(255) NOT NULL,
`CPURadiator_price` int(11) DEFAULT 0,
`CPURadiator_link` varchar(255) NOT NULL,
`ssd` varchar(255) NOT NULL,
`ssd_price` int(11) DEFAULT 0,
`ssd_link` varchar(255) NOT NULL,
`hdd` varchar(255) NOT NULL,
`hdd_price` int(11) DEFAULT 0,
`hdd_link` varchar(255) NOT NULL,
`powerSupply` varchar(255) NOT NULL,
`powerSupply_price` int(11) DEFAULT 0,
`powerSupply_link` varchar(255) NOT NULL,
`case` varchar(255) NOT NULL,
`case_price` int(11) DEFAULT 0,
`case_link` varchar(255) NOT NULL,
`totalPrice` int(11) DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8mb4, COLLATE=utf8mb4_general_ci;
truncate trendings;

File diff suppressed because it is too large Load Diff

@ -6,9 +6,8 @@ Description:
shop_name 店铺名
评论数和好评率不爬因为都是0
Author: Fishermanykx
Date: 2020-12-11 14:25:04
LastEditors: Fishermanykx
LastEditTime: 2021-05-28 11:12:07
LastEditTime: 2021-07-12 16:26:41
'''
import re
import json

@ -3,9 +3,8 @@ Description:
introduction 商品介绍的 .json
Ptable_params 规格与包装的 .json
Author: Fishermanykx
Date: 2020-12-08 20:45:47
LastEditors: Fishermanykx
LastEditTime: 2021-05-28 11:12:00
LastEditTime: 2021-07-12 16:14:17
'''
import json

@ -1,7 +1,6 @@
'''
Description: Data Base Configuration
Author: Fishermanykx
Date: 2020-12-30 15:33:37
LastEditors: Fishermanykx
LastEditTime: 2021-05-28 11:11:42
'''

@ -1,16 +1,15 @@
'''
Description:
Author: Fishermanykx
Date: 2020-12-29 08:21:41
LastEditors: Fishermanykx
LastEditTime: 2021-05-28 11:11:28
LastEditTime: 2021-07-13 10:04:13
'''
import re
import json
import time
import pymysql
from pymysql.converters import escape_string
# from pymysql.converters import escape_string
from selenium.common.exceptions import ElementNotInteractableException
from selenium.common.exceptions import ElementClickInterceptedException
@ -659,7 +658,7 @@ class CPUSpider(JDSpider):
page_num = 1
start_page = 1
# self.productSpider(cpu_link, page_num, start_page)
self.productSpider(cpu_link, page_num, start_page)
self.cleanCPU()
print("Successfully get CPU data!")
@ -824,7 +823,7 @@ class MotherboardSpider(JDSpider):
# 判定是否为板-U套装
record = data[i]
if record['comment_num'] == 100: # 抓到板-U套装了
continue
continue
try:
if '套装' in record['title_name']:
continue
@ -852,10 +851,10 @@ class MotherboardSpider(JDSpider):
def main(self):
motherboard_link = "https://list.jd.com/list.html?cat=670%2C677%2C681&psort=3&psort=3&pvid=e726d0ee460448b6a16cf24950c1dabb&page="
# 爬取数据
# page_num = 26 # 一共爬了26页
page_num = 1 # for testing
page_num = 26 # 一共爬了26页
# page_num = 1 # for testing
start_page = 1
# self.productSpider(motherboard_link, page_num, start_page)
self.productSpider(motherboard_link, page_num, start_page)
# 清洗数据
self.cleanMotherboard()
print("Successfully get Motherboard data!")
@ -959,7 +958,7 @@ class GraphicsCardSpider(JDSpider):
else:
generation = 1
else:
if ('6900' in name) or ('6800' in name):
if ('6900' in name) or ('6800' in name) or ('6700' in name):
generation = 3
elif ('5700' in name) or ('5600' in name) or ('5500' in name):
generation = 2
@ -1016,10 +1015,10 @@ class GraphicsCardSpider(JDSpider):
def main(self):
graphics_card_link = "https://list.jd.com/list.html?cat=670%2C677%2C679&psort=3&psort=3&pvid=e726d0ee460448b6a16cf24950c1dabb&page="
# 爬取数据
# page_num = 30
page_num = 1
page_num = 30
# page_num = 1
start_page = 1
# self.productSpider(graphics_card_link, page_num, start_page)
self.productSpider(graphics_card_link, page_num, start_page)
# 清洗数据
self.cleanGraphicsCard()
print("Successfully get Graphics Card data!")
@ -1187,7 +1186,7 @@ class MemorySpider(JDSpider):
"Ptable_params, title_name) VALUES (%(id)s, %(name)s, %(comment_num)s, %(praise_rate)s, %(shop_name)s, %(price)s"\
", %(link)s, %(brand)s, %(frequency)s, %(total_capacity)s, %(memory_num)s, %(appearance)s, "\
"%(ddr_gen)s, %(introduction)s, %(Ptable_params)s, %(title_name)s)"
# sql_insert = escape_string(sql_insert)
# sql_insert = pymysql.escape_string(sql_insert)
# cursor.executemany(sql_insert, new_data)
for i in range(len(new_data)):
cursor.execute(sql_insert, new_data[i])
@ -1197,10 +1196,10 @@ class MemorySpider(JDSpider):
def main(self):
memory_link = "https://list.jd.com/list.html?cat=670%2C677%2C680&psort=3&ev=210_1558%5E&psort=3&page="
# 爬取数据
# page_num = 40
page_num = 1
page_num = 40
# page_num = 1
start_page = 1
# self.productSpider(memory_link, page_num, start_page)
self.productSpider(memory_link, page_num, start_page)
# 清洗数据
self.cleanMemory()
print("Successfully get Memory data!")
@ -1385,8 +1384,8 @@ class CPURadiatorSpider(JDSpider):
def main(self):
radiator_link = "https://list.jd.com/list.html?cat=670%2C677%2C682&psort=3&ev=3680_97402%7C%7C97403%7C%7C106254%7C%7C106255%5E&psort=3&page="
# 爬取数据
# page_num = 27
page_num = 1
page_num = 27
# page_num = 1
start_page = 1
self.productSpider(radiator_link, page_num, start_page)
# 清洗数据
@ -1558,10 +1557,10 @@ class SSDSpider(JDSpider):
def main(self):
ssd_link = "https://list.jd.com/list.html?cat=670%2C677%2C11303&psort=3&psort=3&page="
# page_num = 36 # 一共爬了36页
page_num = 1 # 一共爬了36页
page_num = 36 # 一共爬了36页
# page_num = 1 # 一共爬了36页
start_page = 1
# self.productSpider(ssd_link, page_num, start_page)
self.productSpider(ssd_link, page_num, start_page)
self.cleanSSD()
print("Successfully get SSD data!")
@ -1736,10 +1735,10 @@ class HDDSpider(JDSpider):
def main(self):
hdd_link = "https://list.jd.com/list.html?cat=670%2C677%2C683&psort=3&psort=3&page="
# page_num = 11
page_num = 1
page_num = 11
# page_num = 1
start_page = 1
# self.productSpider(hdd_link, page_num, start_page)
self.productSpider(hdd_link, page_num, start_page)
self.cleanHDD()
print("Successfully get HDD data!")
@ -1893,10 +1892,10 @@ class PowerSupplySpider(JDSpider):
def main(self):
power_supply_link = "https://list.jd.com/list.html?cat=670%2C677%2C691&psort=3&psort=3&page="
# page_num = 25 # 抓25页
page_num = 1
page_num = 25 # 抓25页
# page_num = 1
start_page = 1
# self.productSpider(power_supply_link, page_num, start_page)
self.productSpider(power_supply_link, page_num, start_page)
self.cleanPowerSupply()
print("Successfully get Power Supply data!")
@ -2079,10 +2078,10 @@ class CaseSpider(JDSpider):
def main(self):
case_link = "https://list.jd.com/list.html?cat=670%2C677%2C687&psort=3&psort=3&page="
# page_num = 36
page_num = 1
page_num = 36
# page_num = 1
start_page = 1
# self.productSpider(case_link, page_num, start_page)
self.productSpider(case_link, page_num, start_page)
self.cleanCase()
print("Successfully get Computer Case data!")
@ -2090,7 +2089,7 @@ class CaseSpider(JDSpider):
if __name__ == "__main__":
accessory_type = 'all'
accessory_type = 'motherboard'
# accessory_type = 'graphics_card'
if accessory_type == 'cpu':
cpu_spider = CPUSpider('cpu')
cpu_spider.main()

@ -1 +1 @@
{"flag": 0, "errorList": ["\u6240\u9009\u5185\u5b58\u5bb9\u91cf\u5927\u4e8e\u4e3b\u677f\u652f\u6301\u7684\u6700\u5927\u5185\u5b58\u5bb9\u91cf", "\u6240\u9009\u5185\u5b58\u6570\u91cf\u5927\u4e8e\u6240\u9009\u4e3b\u677f\u4e0a\u7684\u63d2\u69fd\u6570\u91cf", "\u6240\u9009\u4e3b\u677f\u677f\u578b\u5927\u4e8e\u6240\u9009\u673a\u7bb1\u80fd\u5bb9\u7eb3\u7684\u6700\u5927\u4e3b\u677f\u5927\u5c0f", "\u6240\u9009\u6c34\u51b7\u5c3a\u5bf8\u5927\u4e8e\u6240\u9009\u673a\u7bb1\u652f\u6301\u7684\u6700\u5927\u5c3a\u5bf8", "\u6240\u9009\u673a\u7bb1\u65e0\u6cd5\u5bb9\u7eb3\u6240\u9009\u7535\u6e90"]}
{"flag": 1}

@ -12,9 +12,12 @@ import pymysql
from pprint import pprint
MYSQL_HOSTS = "192.168.136.129"
MYSQL_USER = "root"
MYSQL_PASSWORD = "1213800"
# 设置连接配置
with open("../dbConfig.json", 'r', encoding='UTF-8') as conf:
dbConfig = json.load(conf)
MYSQL_HOSTS = dbConfig["hostname"]
MYSQL_USER = dbConfig["username"]
MYSQL_PASSWORD = dbConfig["password"]
MYSQL_PORT = 3306
MYSQL_DB = "computer_accessories"

@ -1 +1 @@
{"l1":"https:\/\/item.jd.com\/100006391078.html","l2":"https:\/\/item.jd.com\/100003809901.html","l3":"https:\/\/item.jd.com\/100009115115.html","l4":"https:\/\/item.jd.com\/100012759442.html","l5":"https:\/\/item.jd.com\/100005926991.html","l6":"https:\/\/item.jd.com\/675971.html","l7":"https:\/\/item.jd.com\/100011674030.html","l8":"https:\/\/item.jd.com\/6828141.html","l9":"https:\/\/item.jd.com\/100007000176.html"}
{"l1":"https:\/\/item.jd.com\/100006391078.html","l2":"https:\/\/item.jd.com\/100003809901.html","l3":"https:\/\/item.jd.com\/100009115115.html","l4":"https:\/\/item.jd.com\/100005116786.html","l5":"https:\/\/item.jd.com\/100005926991.html","l6":"https:\/\/item.jd.com\/675971.html","l7":"https:\/\/item.jd.com\/100011674030.html","l8":"https:\/\/item.jd.com\/6828141.html","l9":"https:\/\/item.jd.com\/100002404996.html"}

@ -1 +1 @@
{"version":"primary","Q1":["5000","7000"],"Q2":"1","Q3":"1","Q4":"4","Q5":"1"}
{"version":"advanced","Q1":["6000","10000"],"Q2":["1","2"],"Q3":"2","Q4":"","Q5":"2","Q6":"","Q7":"","Q8":"","Q9":"","Q10":"","Q11":"","Q12":"","Q13":"4","Q14":"1","Q15":"2","Q16":"2","Q17":"2","Q18":"2","Q19":"1","Q20":"1","Q21":"3"}

@ -34,6 +34,13 @@ class AccessoriesList:
self.powerSupply = Accessories('powerSupply')
self.CPURadiator = Accessories('CPURadiator')
# 设置连接配置
with open("../dbConfig.json", 'r', encoding='UTF-8') as conf:
dbConfig = json.load(conf)
HOSTNAME = dbConfig["hostname"]
USERNAME = dbConfig["username"]
PASSWORD = dbConfig["password"]
DATABASE = "computer_accessories"
def parse(questionAnswersData):
res = {}
@ -105,8 +112,7 @@ def check(questionAnswers):
elif(questionAnswers['version'] == 'advanced'):
# 连接数据库
db = pymysql.connect("192.168.136.129", "root",
"1213800", "computer_accessories")
db = pymysql.connect(HOSTNAME, USERNAME, PASSWORD, DATABASE)
# 使用cursor()方法创建一个游标对象
cursor = db.cursor()
@ -334,8 +340,7 @@ def preferParse(preDict, questionAnswers):
def suggest(listX, preDict):
# 连接数据库
db = pymysql.connect("192.168.136.129", "root",
"1213800", "computer_accessories")
db = pymysql.connect(HOSTNAME, USERNAME, PASSWORD, DATABASE)
# 使用cursor()方法创建一个游标对象
cursor = db.cursor()
errorInf = {'type': 0, 'flag': 1, 'errorList': []}
@ -385,7 +390,7 @@ def suggest(listX, preDict):
if((item[7] in preDict['MBBrand'] or preDict['MBBrand'] == []) and (item[9] == preDict['MBSize'] or preDict['MBSize'] == None) and item[11] == listX.CPU.socket and abs(item[5] - listX.motherboard.budget) <= 100):
itemList.append(item)
##print(preDict['MBSize'], item[9])
##print(listX.CPU.socket, item[11])
##print(listX.CPU.socket, item[11])cvon
##print(abs(item[5] - listX.motherboard.budget))
# #print('\n-------------------------------\n')
if(itemList == []):

@ -1 +1 @@
{"type": 0, "flag": 0, "count": 3, "result": [{"CPU": ["英特尔i5-10400F", "https://item.jd.com/100006897507.html", 1199], "motherboard": ["华擎H410M-ITX/ac主板", "https://item.jd.com/100013507418.html", 699], "memory": ["美商海盗船复仇者LPX DDR4 2666 16GB(8G×2)", "https://item.jd.com/100004590445.html", 539], "SSD": ["朗科N530S", "https://item.jd.com/100001985502.html", 439], "GPU": ["微星GeForce GTX 1650 GAMING X 4G", "https://item.jd.com/100005114232.html", 1299], "case": ["PHANTEKSPH-ES215PTG_BK", "https://item.jd.com/6306346.html", 399], "powerSupply": ["鑫谷M450B电源", "https://item.jd.com/100000254386.html", 299], "CPURadiator": ["ThermalrightTL-AS120 PLUS", "https://item.jd.com/100006880794.html", 169], "HDD": ["noneed", "", 0], "totalPrice": 5042, "hash": "8138058853"}, {"CPU": ["AMDR5 3600X", "https://item.jd.com/100003815415.html", 1499], "motherboard": ["技嘉B450 I AORUS PRO WIFI", "https://item.jd.com/100000205431.html", 949], "memory": ["美商海盗船复仇者LPX DDR4 2666 16GB(8G×2)", "https://item.jd.com/100004590445.html", 539], "SSD": ["七彩虹SL500 1TB", "https://item.jd.com/100005444250.html", 599], "GPU": ["蓝宝石RX 5500XT 白金版OC", "https://item.jd.com/100010515956.html", 1649], "case": ["PHANTEKSPH-ES215PTG_BK", "https://item.jd.com/6306346.html", 399], "powerSupply": ["银欣ST30SF", "https://item.jd.com/3945819.html", 369], "CPURadiator": ["ThermalrightTL-AS120 PLUS", "https://item.jd.com/100006880794.html", 169], "HDD": ["noneed", "", 0], "totalPrice": 6172, "hash": "20571650032"}, {"CPU": ["AMDR5 3600X", "https://item.jd.com/100003815415.html", 1499], "motherboard": ["技嘉B450 I AORUS PRO WIFI", "https://item.jd.com/100000205431.html", 949], "memory": ["美商海盗船复仇者LPX DDR4 3600 16GB(8G×2)", "https://item.jd.com/100003383025.html", 639], "SSD": ["西部数据WDS100T2G0A", "https://item.jd.com/100005145074.html", 669], "GPU": ["华擎Radeon RX 5500XT Challenger D 8G OC", "https://item.jd.com/100010501414.html", 1839], "case": ["PHANTEKSPH-ES215PTG_BK", "https://item.jd.com/6306346.html", 399], "powerSupply": ["银欣SST-ST45SF", "https://item.jd.com/3979099.html", 469], "CPURadiator": ["ThermalrightAK120MINI", "https://item.jd.com/100006722267.html", 199], "HDD": ["noneed", "", 0], "totalPrice": 6662, "hash": "15307189858"}]}
{"type": 0, "flag": 0, "count": 3, "result": [{"CPU": ["AMDR5 3600X", "https://item.jd.com/100003815415.html", 1499], "motherboard": ["华擎A320M-ITX 主板", "https://item.jd.com/8790449.html", 669], "memory": ["美商海盗船复仇者LPX DDR4 2666 16GB(8G×2)", "https://item.jd.com/100004590445.html", 539], "SSD": ["朗科N530S", "https://item.jd.com/100001985502.html", 439], "GPU": ["华擎RX 5500XT Phantom Gaming D 8G OC", "https://item.jd.com/100010501424.html", 1899], "case": ["乔思伯V10侧透版", "https://item.jd.com/100016086972.html", 379], "powerSupply": ["全汉FSP450-50SD", "https://item.jd.com/100007255048.html", 419], "CPURadiator": ["超频三巨浪120", "https://item.jd.com/3762171.html", 199], "HDD": ["noneed", "", 0], "totalPrice": 6042, "hash": "2396870787"}, {"CPU": ["AMD锐龙5 5600X 处理器", "https://item.jd.com/100016046824.html", 2129], "motherboard": ["技嘉B450 I AORUS PRO WIFI", "https://item.jd.com/100000205431.html", 949], "memory": ["美商海盗船复仇者LPX DDR4 3600 16GB(8G×2)", "https://item.jd.com/100003383025.html", 639], "SSD": ["西部数据WDS100T2G0A", "https://item.jd.com/100005145074.html", 669], "GPU": ["华硕TUF 3-RX5600XT-T6G-EVO-GAMING", "https://item.jd.com/100009264203.html", 2499], "case": ["乔思伯V10侧透版", "https://item.jd.com/100016086972.html", 379], "powerSupply": ["全汉FSP450-50SD", "https://item.jd.com/100007255048.html", 419], "CPURadiator": ["酷冷至尊海魔120 水冷散热器", "https://item.jd.com/1025469.html", 279], "HDD": ["noneed", "", 0], "totalPrice": 7962, "hash": "2347804812"}, {"CPU": ["AMDR7 3700X", "https://item.jd.com/100006391078.html", 2449], "motherboard": ["玩家国度ROG STRIX B450-I GAMING", "https://item.jd.com/100010049592.html", 999], "memory": ["美商海盗船DDR4 3200 16GB(8Gx2条)", "https://item.jd.com/2810173.html", 819], "SSD": ["三星870 QVO 1TB MZ-77Q1T0B", "https://item.jd.com/100007847303.html", 739], "GPU": ["蓝宝石RX 5700XT 8G D6 超白金PRO OC", "https://item.jd.com/100008245245.html", 3299], "case": ["PHANTEKSPH-ES215PTG_BK", "https://item.jd.com/6306346.html", 399], "powerSupply": ["全汉FSP500-50SD", "https://item.jd.com/100006670405.html", 529], "CPURadiator": ["酷冷至尊RL-SB24-20PK-R1", "https://item.jd.com/4567820.html", 369], "HDD": ["noneed", "", 0], "totalPrice": 9602, "hash": "29056291413"}]}

@ -1,5 +1,12 @@
<?php
$con = mysqli_connect("192.168.136.129", "root", "1213800", "webData");
// 数据库连接
$dbConfig = json_decode(file_get_contents('../dbConfig.json'), true);
$hostname = $dbConfig["hostname"];
$username = $dbConfig["username"];
$password = $dbConfig["password"];
$database = "webData";
$con = mysqli_connect($hostname, $username, $password, $database);
if (!$con) {
die('Could not connect: ' . mysqli_error($con));
}

@ -1,9 +1,12 @@
<?php
$hostname = "192.168.136.129";
$username = "root";
$password = "1213800";
// 数据库连接
$dbConfig = json_decode(file_get_contents('../dbConfig.json'), true);
$hostname = $dbConfig["hostname"];
$username = $dbConfig["username"];
$password = $dbConfig["password"];
$database = "webData";
$con = mysqli_connect($hostname, $username, $password, $database);
if (!$con)
{
die('Could not connect: ' . mysqli_error($con));

@ -1,5 +1,12 @@
<?php
$con = mysqli_connect("192.168.136.129","root","1213800", "computer_accessories");
// 数据库连接
$dbConfig = json_decode(file_get_contents('../dbConfig.json'), true);
$hostname = $dbConfig["hostname"];
$username = $dbConfig["username"];
$password = $dbConfig["password"];
$database = "computer_accessories";
$con = mysqli_connect($hostname, $username, $password, $database);
if (!$con)
{
die('Could not connect: ' . mysqli_error($con));

@ -0,0 +1,5 @@
{
"hostname": "192.168.136.129",
"username" : "root",
"password" : "1213800"
}

@ -1,7 +1,7 @@
function primary_recommend() {
console.log("enter primary_recommend!!!");
let pfloor = document.getElementById('u285_input').value;
let pceiling = document.getElementById('u288_input').value;
let pfloor = Number(document.getElementById('u285_input').value);
let pceiling = Number(document.getElementById('u288_input').value);
let Q1 = Array(pfloor, pceiling);
let Q2 = $('input:radio[name=q2]:checked').val();
let Q3 = $('input:radio[name=q3]:checked').val();

@ -1,7 +1,7 @@
function advanced_recommend() {
console.log("enter advanced_recommend!!!");
let pfloor = document.getElementById('u365_input').value;
let pceiling = document.getElementById('u368_input').value;
let pfloor = Number(document.getElementById('u365_input').value);
let pceiling = Number(document.getElementById('u368_input').value);
let Q1 = Array(pfloor, pceiling);
var Q2 = [];//定义一个空数组
$("input:checkbox[name='q2']:checked").each(function(i){//把所有被选中的复选框的值存入数组

@ -0,0 +1,10 @@
配置单:(总价格为8811)
CPU: 英特尔i7-10700 https://item.jd.com/100011978542.html 2399
主板: 微星Z490M-S01 https://item.jd.com/100016138818.html 999
显卡: 磐镭RX5500XT 8G https://item.jd.com/10023854458115.html 2698
内存: 威刚XPG Z1 DDR4 3200 16GB×2 https://item.jd.com/100004409761.html 899
固态硬盘: 三星870 QVO 1TB MZ-77Q1T0B https://item.jd.com/100007847303.html 739
机械硬盘: noneed 0
电源: 航嘉HYPER650G https://item.jd.com/7510306.html 539
CPU散热器: ThermalrightFS140 https://item.jd.com/100010498068.html 259
机箱: 乔思伯C3-PLUS银色 https://item.jd.com/6060198.html 279

@ -0,0 +1,10 @@
配置单:(总价格为9863)
CPU: 英特尔英特尔Intel i7 9700K https://item.jd.com/100000634417.html 2499
主板: 华硕PRIME Z390M-PLUS https://item.jd.com/100000542139.html 1199
显卡: 影驰影驰GalaxyGeForce RTX 3060 Ti 金属大师 OC N卡/电竞专业游戏显卡 https://item.jd.com/100015887008.html 3199
内存: 十铨科技TDZRD432G3600HC18JDC01 https://item.jd.com/100006930551.html 1049
固态硬盘: 三星870 QVO 1TB MZ-77Q1T0B https://item.jd.com/100007847303.html 739
机械硬盘: noneed 0
电源: 长城G6 GW-ATX650BL https://item.jd.com/7299684.html 599
CPU散热器: noctuaNH-L9i https://item.jd.com/2247748.html 300
机箱: 先马小黑洞 https://item.jd.com/7377918.html 279

@ -0,0 +1,10 @@
配置单:(总价格为6172)
CPU: AMDR5 3600X https://item.jd.com/100003815415.html 1499
主板: 技嘉B450 I AORUS PRO WIFI https://item.jd.com/100000205431.html 949
显卡: 迪兰RX 5500 XT X战将 https://item.jd.com/100010515954.html 1599
内存: 十铨科技TF1D416G3200HC16CDC01 https://item.jd.com/4756685.html 599
固态硬盘: 七彩虹SL500 1TB https://item.jd.com/100005444250.html 599
机械硬盘: noneed 0
电源: 银欣ST30SF https://item.jd.com/3945819.html 369
CPU散热器: 九州风神玄冰GT CPU散热器 风扇 https://item.jd.com/5194354.html 159
机箱: PHANTEKSPH-ES215PTG_BK https://item.jd.com/6306346.html 399

@ -0,0 +1,10 @@
配置单:(总价格为7962)
CPU: AMD锐龙5 5600X 处理器 https://item.jd.com/100016046824.html 2129
主板: 技嘉B450 I AORUS PRO WIFI https://item.jd.com/100000205431.html 949
显卡: 华硕TUF 3-RX5600XT-T6G-EVO-GAMING https://item.jd.com/100009264203.html 2499
内存: 美商海盗船复仇者LPX DDR4 3600 16GB(8G×2) https://item.jd.com/100003383025.html 639
固态硬盘: 西部数据WDS100T2G0A https://item.jd.com/100005145074.html 669
机械硬盘: noneed 0
电源: 全汉FSP450-50SD https://item.jd.com/100007255048.html 419
CPU散热器: 酷冷至尊海魔120 水冷散热器 https://item.jd.com/1025469.html 279
机箱: 乔思伯V10侧透版 https://item.jd.com/100016086972.html 379

@ -0,0 +1,10 @@
配置单:(总价格为6042)
CPU: AMDR5 3600X https://item.jd.com/100003815415.html 1499
主板: 华擎A320M-ITX 主板 https://item.jd.com/8790449.html 669
显卡: 华擎RX 5500XT Phantom Gaming D 8G OC https://item.jd.com/100010501424.html 1899
内存: 美商海盗船复仇者LPX DDR4 2666 16GB(8G×2) https://item.jd.com/100004590445.html 539
固态硬盘: 朗科N530S https://item.jd.com/100001985502.html 439
机械硬盘: noneed 0
电源: 全汉FSP450-50SD https://item.jd.com/100007255048.html 419
CPU散热器: 超频三巨浪120 https://item.jd.com/3762171.html 199
机箱: 乔思伯V10侧透版 https://item.jd.com/100016086972.html 379

@ -0,0 +1,10 @@
配置单:(总价格为37341)
CPU: 英特尔i9-10980XE https://item.jd.com/100009217918.html 7999
主板: 技嘉X299X AORUS MASTER https://item.jd.com/100005344671.html 4998
显卡: 微星微星MSI万图师 GeForce RTX 3090 VENTUS 3X 24G OC https://item.jd.com/100008550223.html 12999
内存: 金士顿HX448C19PB3K2/16 https://item.jd.com/100008221219.html 3899
固态硬盘: 创见TranscendJetDrive系列 https://item.jd.com/48074077942.html 2999
机械硬盘: noneed 0
电源: SEASONICPRIME TX-1000 https://item.jd.com/100008214846.html 2249
CPU散热器: 酷冷至尊V8GTS多平台CPU散热器 https://item.jd.com/1058207.html 599
机箱: 酷冷至尊MCM-SL600M-SGNN-S00 https://item.jd.com/100002407768.html 1599

@ -0,0 +1,10 @@
配置单:(总价格为4852)
CPU: 英特尔i5-10400F https://item.jd.com/100006897507.html 1199
主板: 华擎H410M-ITX/ac主板 https://item.jd.com/100013507418.html 699
显卡: 七彩虹iGame GeForce GTX 1650 AD Special OC 4GD6 https://item.jd.com/100012348148.html 1199
内存: 阿斯加特洛极系列W2-PC-DDR4-16GB8GB*2)-3200MHz-RGB https://item.jd.com/100004542166.html 459
固态硬盘: 朗科N530S https://item.jd.com/100001985502.html 439
机械硬盘: noneed 0
电源: 鑫谷M450B电源 https://item.jd.com/100000254386.html 299
CPU散热器: 九州风神玄冰GT CPU散热器 风扇 https://item.jd.com/5194354.html 159
机箱: PHANTEKSPH-ES215PTG_BK https://item.jd.com/6306346.html 399

@ -0,0 +1,10 @@
配置单:(总价格为9602)
CPU: AMDR7 3700X https://item.jd.com/100006391078.html 2449
主板: 玩家国度ROG STRIX B450-I GAMING https://item.jd.com/100010049592.html 999
显卡: 蓝宝石RX 5700XT 8G D6 超白金PRO OC https://item.jd.com/100008245245.html 3299
内存: 美商海盗船DDR4 3200 16GB(8Gx2条) https://item.jd.com/2810173.html 819
固态硬盘: 三星870 QVO 1TB MZ-77Q1T0B https://item.jd.com/100007847303.html 739
机械硬盘: noneed 0
电源: 全汉FSP500-50SD https://item.jd.com/100006670405.html 529
CPU散热器: 酷冷至尊RL-SB24-20PK-R1 https://item.jd.com/4567820.html 369
机箱: PHANTEKSPH-ES215PTG_BK https://item.jd.com/6306346.html 399

@ -0,0 +1,10 @@
配置单:(总价格为5572)
CPU: AMDAMD 锐龙5 3500X https://item.jd.com/100004995955.html 1099
主板: 华擎A320M-ITX 主板 https://item.jd.com/8790449.html 669
显卡: 华擎RX 5500XT Phantom Gaming D 8G OC https://item.jd.com/100010501424.html 1899
内存: 金士顿HX426C16FB3A/16 https://item.jd.com/100004445215.html 499
固态硬盘: 朗科N530S https://item.jd.com/100001985502.html 439
机械硬盘: noneed 0
电源: 银欣ST30SF https://item.jd.com/3945819.html 369
CPU散热器: 酷冷至尊MAP-D6PN-216PR-C1 https://item.jd.com/100004885974.html 199
机箱: PHANTEKSPH-ES215PTG_BK https://item.jd.com/6306346.html 399

@ -0,0 +1,10 @@
配置单:(总价格为7792)
CPU: 英特尔i7-10700F https://item.jd.com/100013163656.html 2099
主板: 微星Z490M-S01 https://item.jd.com/100016138818.html 999
显卡: 蓝宝石RX 5600 XT 6G D6 白金版 PRO OC 游戏显卡 https://item.jd.com/100007967097.html 2399
内存: 金百达黑爵系列 DDR4 3200 32GB(16GBX2) 台式机内存 https://item.jd.com/100007177599.html 769
固态硬盘: 西部数据WDS100T2G0A https://item.jd.com/100005145074.html 669
机械硬盘: noneed 0
电源: 航嘉HYPER550G https://item.jd.com/100003124886.html 439
CPU散热器: 九州风神大霜塔 https://item.jd.com/689273.html 219
机箱: 爱国者爱国者aigoYOGO M2白色 游戏药丸MINI玻璃机箱 https://item.jd.com/100004999652.html 199

@ -0,0 +1,10 @@
配置单:(总价格为3153)
CPU: 英特尔i3-10100F https://item.jd.com/100008667325.html 699
主板: 华擎H410TM-ITX https://item.jd.com/100008461229.html 599
显卡: 盈通盈通RX550-2G D5 极速版 https://item.jd.com/100001648474.html 499
内存: 金士顿HX426C16FB3A/8 https://item.jd.com/100007698730.html 299
固态硬盘: 朗科N530S https://item.jd.com/100001985502.html 439
机械硬盘: noneed 0
电源: 先马330M https://item.jd.com/3770571.html 129
CPU散热器: 九州风神玄冰400 https://item.jd.com/598827.html 90
机箱: 华硕RS200 ROG RISER CABLE https://item.jd.com/100010678492.html 399

@ -0,0 +1,10 @@
配置单:(总价格为8022)
CPU: AMDR5 3600X https://item.jd.com/100003815415.html 1499
主板: 技嘉B450 I AORUS PRO WIFI https://item.jd.com/100000205431.html 949
显卡: 铭瑄MS-GeForce RTX2060 iCraft 6G https://item.jd.com/100004061149.html 2899
内存: 金士顿HX436C17FB3A/16 https://item.jd.com/100011529698.html 699
固态硬盘: 三星870 QVO 1TB MZ-77Q1T0B https://item.jd.com/100007847303.html 739
机械硬盘: noneed 0
电源: 银欣SST-ST45SF https://item.jd.com/3979099.html 469
CPU散热器: 酷冷至尊RL-SB24-20PK-R1 https://item.jd.com/4567820.html 369
机箱: PHANTEKSPH-ES215PTG_BK https://item.jd.com/6306346.html 399
Loading…
Cancel
Save