def create_account_active_cdkey(): count = -1 AccountCDkeyobj = AccountCDkeyModel() for i in range(count+1): str = '' for j in range(12): str += random.choice('0123456789') str += random.choice('abcdefghijkmnpqrstuvwxyz') AccountCDkeyobj.cdkey = str AccountCDkeyobj.create()
def get_cdkey(cdkey): tableName = "table_account_cdkey" fields = "`id`, `cdkey`, `is_use`, `usedtime`, `use_udid`" data = db_Manager.selectDataFromTable(tableName,fields, "cdkey='%s'" %cdkey) if data: obj = AccountCDkeyModel() obj.id = data[0][0] obj.cdkey = data[0][1] obj.is_use = bool(data[0][2]) obj.usedtime = data[0][3] obj.use_udid = data[0][4] return obj else: return False