def get_last_myhead_info(self, dc): db = DbLib() m = Mongo() if dc.find('#') != -1: dc = dc.split('#')[0] mid = m.get_mid(dc) head_info = db.get_last_head_info_by_db(mid) return head_info
def get_user_paper_info(self, dc): from mongo import Mongo m = Mongo() mid = m.get_mid(dc) self.connect() sql_str = 'select telmid from timelimit where mid=%s order by telmid desc' % ( str(mid)) print sql_str r = self.do(sql_str) self.disconn() return r
def get_vcode_by_dc(self, phone, dc, tid='a_imei000000000000000'): m = Mongo() vcode = False if dc.find('#') != -1: dc = dc.split('#')[0] try: mid = m.get_mid(dc) vcode = self.get_vcode(str(mid), str(phone)) except Exception as e: print e finally: self.clear_vcode_count(tid) return vcode
def get_subchnl_by_db(self, dc, ec=420000000010000, cc=420100): from mongo import Mongo m = Mongo() if dc.find('#') != -1: dc = dc.split('#')[0] mid = m.get_mid(dc) self.connect() #sql_str = 'select rechid FROM subscribed where mid=%s and z in (%s,%s)' % (str(mid),str(ec),str(cc)) sql_str = 'select rechid FROM subscribed where mid=%s ' % (str(mid)) r = self.do(sql_str) self.disconn() ret = [x.get('rechid') for x in r] return ret
def get_vcode_by_redis(phone, dc, tid='a_imei000000000000000'): r = RedisHandler() m = Mongo() vcode = False if dc.find('#') != -1: dc = dc.split('#')[0] try: mid = m.get_mid(dc) vcode = r.get_vcode(str(mid), str(phone)) except Exception as e: print e finally: r.clear_vcode_count(tid) return vcode
def set_user_charge_for_newspapar(self, dc, spuid, last=-1): from mongo import Mongo m = Mongo() mid = m.get_mid(dc) creat_time = datetime.now() - timedelta(days=1) end_time = datetime.now() + timedelta(hours=int(last)) creat_time = creat_time.strftime('%Y-%m-%d %H:%M:%S') end_time = end_time.strftime('%Y-%m-%d %H:%M:%S') print creat_time self.connect() sql_str = 'update timelimit set mid= %s,createTime=\'%s\',endTime=\'%s\',spuid=%s ' \ 'limit 1' % (str(mid),str(creat_time),str(end_time),str(spuid)) print sql_str r = self.do(sql_str) self.disconn() return True