Esempio n. 1
0
 def __init__(self, **kwargs):
     super().__init__()
     self.iprice = Cprice()
     self.iurls = Curls()
     self.sperator = '--'
     self.logger = kwargs.get('logger')
     self.alert_msg = ''
Esempio n. 2
0
 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")
Esempio n. 3
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()
Esempio n. 4
0
 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('提示', '导入成功')
Esempio n. 5
0
 def add_data(self):
     '''加载配置、数据'''
     iurls = Curls()
     self.data = {}
     data = {}
     for i,inst in enumerate(iurls.query()):
         self.goodsId[i] = (inst.id,inst.goods)
         dic = {}
         dic['goods'] = inst.goods
         dic['common_price'] = inst.common_price
         dic['expect_price'] = inst.expect_price
         dic['setting'] = inst.setting
         data[i] = dic
         self.data[i] = dic.copy()
     self.table.model.importDict(data)
Esempio n. 6
0
 def get_urls(self):
     iurls = Curls()
     urls = []
     for inst in iurls.query(setting=1):
         urls.append(inst.url)
     return urls
Esempio n. 7
0
 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)
Esempio n. 8
0
 def __init__(self, **kwargs):
     super().__init__()
     self.iurls = Curls()