def selectre(self, tmpsql): if self.env == 'test': res, filed = db.selectsqlnew('testquanyi', tmpsql) res = self.dubtolist(res) else: res, filed = db.selectsqlnew('devquanyi', tmpsql) res = self.dubtolist(res) return res, filed
def getindb(self, tmpsql): # tmpsql='''SELECT operation_content,operator,create_time # from voyager.um_operation_log where create_time>'{begintime}' and create_time<'{endtime}' and operation_content LIKE '%{adzoneid}%' # AND operation_target='广告位修改' ORDER BY create_time ;'''.format(begintime=begintime,endtime=endtime,adzoneid=adzoneid) # print tmpsql if self.env == 'test': res, filed = db.selectsqlnew('testvoyager', tmpsql) if self.env == 'dev': res, filed = db.selectsqlnew('devvoyager', tmpsql) return res, filed
def get_pig_selected_table_cfg(self,selected_table): sql = "select * from yijifen.{} order by id desc;".format(selected_table) sql2= """select COLUMN_NAME '字段',COLUMN_TYPE '类型',COLUMN_COMMENT '备注' from information_schema.columns where table_schema = 'yijifen' and table_name = '{}' ;""".format(selected_table) print sql,sql2 re1=db.selectsqlnew(self.db_env, sql) re2=db.selectsqlnew(self.db_env,sql2) if isinstance(re1,str): return re1 elif isinstance(re1,tuple) and isinstance(re2,tuple): return db.selectsqlnew(self.db_env, sql), db.selectsqlnew(self.db_env,sql2) else: return "没有查询到结果"
def get_pig_act_game_cfgs(self): #查询养成活动的表信息 # sql1 = """use information_schema;""" sql2 = """ SELECT TABLE_NAME '表名',TABLE_COMMENT '表备注' FROM information_schema.`TABLES` WHERE `TABLE_SCHEMA` = 'yijifen' AND `TABLE_NAME` LIKE 'pig%';""" print self.db_env # db.selectsqlnew(self.db_env, sql1) re=db.selectsqlnew(self.db_env, sql2) if re: return db.selectsqlnew(self.db_env, sql2) else: return "没有查询到结果"
def get_other_cfgs(self): #查询其他配置表信息 # sql1 = """use information_schema;""" sql2 = """SELECT TABLE_NAME '表名',TABLE_COMMENT '表备注' FROM information_schema.`TABLES` WHERE `TABLE_SCHEMA` = 'voyager' AND (`TABLE_NAME` LIKE '%cfg%' or `TABLE_NAME` LIKE '%config%') AND `TABLE_NAME` not LIKE '%act_game%';""" # db.selectsqlnew(self.db_env, sql1) re=db.selectsqlnew(self.db_env, sql2) if re: return db.selectsqlnew(self.db_env, sql2) else: return "没有查询到结果"
def get_yijifen_cfgs(self): #查询其他配置表信息 # sql1 = """use information_schema;""" sql2 = """SELECT TABLE_NAME '表名',TABLE_COMMENT '表备注' FROM information_schema.`TABLES` WHERE `TABLE_SCHEMA` = 'yijifen' AND (`TABLE_NAME` LIKE '%cfg%' or `TABLE_NAME` LIKE '%config%') AND `TABLE_NAME` not LIKE '%pigs_%' or `TABLE_NAME` = 'yjf_app_media';""" # db.selectsqlnew(self.db_env, sql1) re=db.selectsqlnew(self.db_env, sql2) if re: return db.selectsqlnew(self.db_env, sql2) else: return "没有查询到结果"
net_b = self.ip_into_int('172.31.255.255') >> 20 net_c = self.ip_into_int('192.168.255.255') >> 16 return ip >> 24 == net_a or ip >> 20 == net_b or ip >> 16 == net_c if __name__ == '__main__': print 1 x = login(username='******', otppass=116846) # path=x.otppic() # x.otppic1() # print x.otpverify() tmp = 'test_760cae49c5e27063cfde241d0f0f35bf' tmp = base64.b64encode(tmp) print tmp tmp = base64.b64decode(tmp) print tmp tmp = ''' SELECT picul from pic where id >217 limit 30000 ''' re, file = db.selectsqlnew('testtest', tmp) # tmp='http://image.yiqifa.com/img/campaignfile/20205/24/26/58/15896087948497663.png' # tmp='http://image.yiqifa.com/img/campaignfile/20205/24/26/58/15896087948497663' for picurl in re: tmp = '' tmp = 'http:' + picurl[0] picname = picurl[0].split('image.yiqifa.com')[1].split('.')[0][ -17:] + '.' + picurl[0].split('image.yiqifa.com')[1].split('.')[1] print picname # r=requests.get(tmp) # with open(picname,'wb') as f: # f.write(r.content)