def insert_xw_nrxy(**kwargs): try: # insertDBtime = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()) # sql = f"insert into xw_nr (prid,shengfen,dijishi,fabutime,url,biaoti,tianjiatime,zt) values ({kwargs['prid']},{kwargs['shengfen']},{kwargs['dijishi']},{kwargs['fabutime']},{kwargs['url']},{kwargs['biaoti']},{kwargs['tianjiatime']},'0')" sql = "insert into xw_nr (prid,shengfen,dijishi,fabutime,url,biaoti,tianjiatime,zt,xz,jtxz,xy) value ('%s','%s','%s','%s','%s','%s','%s','%s','0','0','1');" % (kwargs['prid'], kwargs['shengfen'],kwargs['dijishi'], kwargs['fabutime'],kwargs['url'], kwargs['biaoti'],kwargs['tianjiatime'], kwargs['zt']) sql = sql.replace('\\', '-').replace('\n', '').replace('\r', '').replace('\t', '') dbmysql.execute(sql=sql) # print(sql) except Exception as e: return 404
def insert_qyzz(**kwargs): try: # insertDBtime = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()) # sql = f"insert into xw_nr (prid,shengfen,dijishi,fabutime,url,biaoti,tianjiatime,zt) values ({kwargs['prid']},{kwargs['shengfen']},{kwargs['dijishi']},{kwargs['fabutime']},{kwargs['url']},{kwargs['biaoti']},{kwargs['tianjiatime']},'0')" sql = "insert into tbl_qy_zz (qyid,zzlx,zsh,zzmc,fzrq,zsyxq,fzjg,zzfw) value ('%s','%s','%s','%s','%s','%s','%s','%s');" % (kwargs['qyid'], kwargs['zzlx'],kwargs['zsh'], kwargs['zzmc'],kwargs['fzrq'], kwargs['zsyxq'],kwargs['fzjg'], kwargs['zzfw']) sql = sql.replace('\\', '-').replace('\n', '').replace('\r', '').replace('\t', '') dbmysql.execute(sql=sql) # print(sql) except Exception as e: return 404
def insert_qycookie(**kwargs): try: # insertDBtime = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()) uid = uuid.uuid4() # sql = f"insert into xw_nr (prid,shengfen,dijishi,fabutime,url,biaoti,tianjiatime,zt) values ({kwargs['prid']},{kwargs['shengfen']},{kwargs['dijishi']},{kwargs['fabutime']},{kwargs['url']},{kwargs['biaoti']},{kwargs['tianjiatime']},'0')" sql = "insert into ipo_title (uid,cookie,zt) value ('%s','%s','%s');" % ( uid, kwargs['cookie'], '0') sql = sql.replace('\\', '-').replace('\n', '').replace('\r', '').replace('\t', '') dbmysql.execute(sql=sql) # print(sql) except Exception as e: return 404
def insert_fj(**kwargs): try: # insertDBtime = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()) uid = uuid.uuid4() sql = "insert into tbl_fj (uid,qyname,shxydm,qyurl,zzlx,zt) value ('%s','%s','%s','%s','%s','0');" % ( uid, kwargs['qyname'], kwargs['shxydm'], kwargs['qyurl'], kwargs['zzlx']) sql = sql.replace('\\', '-').replace('\n', '').replace('\r', '').replace('\t', '') dbmysql.execute(sql=sql) # print(sql) except Exception as e: return 404
def fxh(): try: for i in range(1,26): print(i) url = "https://dncapi.feixiaohao.com/api/coin/web-coinrank?page=%s&type=0&pagesize=100&webp=1"%i a = requests.get(url=url).content.decode() b = json.loads(a) c = b["data"] for cc in c: fullname = "%s-%s"%(cc["name"],cc["fullname"]) print(fullname) price = cc["current_price"] inserttime = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())) opentime = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())) sql = "SELECT * FROM feixiaohao where fullname ='%s'"%fullname a = dbmysql.first(sql) if a == None: sql = "INSERT INTO feixiaohao(fullname,price,inserttime,opentime) VALUES ('%s','%s','%s','%s')"%(fullname,price,inserttime,opentime) dbmysql.execute(sql) else: sql = "UPDATE feixiaohao SET price = '%s',opentime = '%s' WHERE fullname = '%s'"%(price,opentime,fullname) dbmysql.execute(sql) except Ellipsis as e: print(e)