def dump_goods(self): if self.chooseDict: iurls = Curls() for k, (goods, url) in self.chooseDict.items(): iurls.update(f'url={url}', setting=1, goods=goods, origin_time=datetime.datetime.now()) self.labelList[k % 8].configure(bg=self.bgcolor[k % 8 % 4 % 2]) self.chooseDict = {} self.chooseV.set("已选择:0")
def get_detail(): iurls = Curls() urls = self.text.get(1.0, tk.END) urls = urls.split('\n')[:-1] if urls == ['']: tk.messagebox.showinfo('提示', '不能为空') else: for i in range(len(urls)): iurls.update(f'url={urls[i]}', setting=1, goods='') self.crawl_goods(urls) tk.messagebox.showinfo('提示', '导入成功') bulk_win.destroy()
def insert_url(): iurls = Curls() url = v.get() if url == "": tk.messagebox.showinfo('提示', '不能为空') else: iurls.update( f'url={url}', setting=1, ) self.crawl_goods(urls=[url]) tk.messagebox.showinfo('提示', '导入成功')
class GoodsPipe(Pipeline): def __init__(self, **kwargs): super().__init__() self.iurls = Curls() def itemProcess(self, rsp): if rsp is not None: insert_time = datetime.datetime.now() # 存入数据库 self.iurls.update(f'url={rsp["href"] }', goods=rsp['goods'], origin_time=insert_time)
def modify(self): iurls = Curls() for k,vals in self.table.model.data.items(): if self.data[k] != vals: iurls.update(f'id={self.goodsId[k][0]}',**vals)