def updata_sql1(ids, cod_price_1, collection_time): try: man_db = mandb.DB() sql = "UPDATE tb_tm_pachong_data_1 set cod_price_1 = '" + cod_price_1 + "',collection_time = '" + collection_time + "' where pachong_data_id = " + ids + " ;" man_db.execute1(sql) print(" [ *** 更新商品信息 *** ] ") except Exception as e: print("error")
def get_tb_links1(): try: man_db = mandb.DB() sql = "SELECT pachong_data_id,cod_link from tb_tm_pachong_data_1 WHERE pingtai = '淘宝' ;" print(sql) return_datas = man_db.execute_seles1(sql) return return_datas except Exception as e: print("error")
def adddata(listss): try: man_db = mandb.DB() sql = "INSERT INTO timu_2 ( njtype, tmtype, urls, tmdata, daandata, jiexi) \ VALUES ('"+listss[0]+"', '"+listss[1]+"', '"+listss[2]+"', \ '"+str(listss[3]).replace("'","\"")+"', '"+str(listss[4]).replace("'","\"")+"', '"+str(listss[5]).replace("'","\"")+"' );" man_db.execute(sql) except Exception as e: print(e) return adddata(listss)
def get_allcount(): while True: man_db = mandb.DB() sql = "\ select count(sydata_id) from sydata_dzys where fenlei = '人群' ;\ " return_datas = man_db.execute_seles1(sql) if return_datas != False: return return_datas[0][0]
def get_rsc1(pgnumber): try: man_db = mandb.DB() sql = "\ select sydata_id,title,fenlei from sydata_dzys where fenlei = '人群' LIMIT " + str( pgnumber * 100) + ",100;\ " return_datas = man_db.execute_seles1(sql) return return_datas except Exception as e: return ""
def get_ttys_data1(pgnumber): print(pgnumber) print(type(pgnumber)) pgnumber = pgnumber * 20 man_db = mandb.DB() sql = "\ select tt.sydata_id, tt.fenlei, GROUP_CONCAT(ti.imgpath SEPARATOR '|') as link, tt.title \ from sydata_ttys tt INNER JOIN sydata_ttys_imgs ti ON tt.sydata_id=substring(ti.sydata_id,5) \ where tt.fenlei = '营养科普' \ GROUP BY tt.sydata_id LIMIT " + str(pgnumber) + ",20; " return_datas = man_db.execute_seles1(sql) if return_datas != False: return return_datas
def get_rsc(pgnumber): while True: try: man_db = mandb.DB() sql = "\ select sydata_id,title,fenlei from sydata_dzys where fenlei = '人群' LIMIT " + str( pgnumber * 100) + ",100;\ " return_datas = man_db.execute_seles1(sql) if return_datas != False: return return_datas except Exception as e: print("link Error")
def updata_sql(ids,cod_price_1,collection_time): man_db = mandb.DB() sql = "UPDATE tb_tm_pachong_data_1 set cod_price_1 = '"+cod_price_1+"',collection_time = '"+collection_time+"' where pachong_data_id = "+ids+" ;" man_db.execute(sql) print(" [ *** 更新商品信息 *** ] ") #for tbdata in get_tm_links(): # print(tbdata[0]) # print(tbdata[1]) '''
def get_ttys_data(pgnumber): while True: try: man_db = mandb.DB() sql = "\ select tt.sydata_id, tt.fenlei, GROUP_CONCAT(ti.imgpath SEPARATOR '|') as link, tt.title \ from sydata_ttys tt INNER JOIN sydata_ttys_imgs ti ON tt.sydata_id=substring(ti.sydata_id,5) \ where tt.fenlei = '养生食谱' \ GROUP BY tt.sydata_id \ LIMIT " + str(int(pgnumber) * 20) + ",20;" return_datas = man_db.execute_seles1(sql) if return_datas != False: return return_datas except Exception as e: print("link Error") get_ttys_data(pgnumber)
def wrapper(*args, **kwargs): man_db = mandb.DB() return func(man_db, *args, **kwargs)
def updata_sql(ids,cod_price_1,collection_time): man_db = mandb.DB() sql = "UPDATE jd_pachong_data_1 set cod_price_1 = '"+cod_price_1+"',collection_time = '"+collection_time+"' where pachong_data_id = "+ids+" ;" man_db.execute(sql) print(" [ *** 更新商品信息 *** ] ")
def get_jd_links(): man_db = mandb.DB() sql ="SELECT pachong_data_id,cod_link from jd_pachong_data_1 where substring(collection_time, 7, 1) != '8' LIMIT 100000;" print(sql) return_datas = man_db.execute_seles(sql) return return_datas
def get_tb_links(): man_db = mandb.DB() sql = "SELECT pachong_data_id,cod_link from tb_tm_pachong_data_1 WHERE pingtai = '淘宝' and substring(collection_time, 7, 1) != '7';" print(sql) return_datas = man_db.execute_seles1(sql) return return_datas
def get_tm_links(): man_db = mandb.DB() sql ="SELECT pachong_data_id,cod_link from tb_tm_pachong_data_1 WHERE pingtai = '天猫' LIMIT 50;" print(sql) return_datas = man_db.execute_seles(sql) return return_datas