示例#1
0
def an_come_from():
    print('an device')
    count_list = yield from orm.just_get_rs('SELECT come_from,COUNT(*) as num FROM weibos GROUP BY come_from')
    print("device len: %s" % len(count_list))
    print(count_list)
    count_result = []
    activity = {'num': 0, 'come_from': '活动'}
    for i in range(len(count_list)):
        come_from = count_list[i]['come_from']
        print('come from : %s' % come_from)
        find = come_from.find('href')
        print('find : %s' % find)
        if find > 0:
            activity['num']+=count_list[i]['num']
        else:
            count_result.append(count_list[i])
    count_result.append(activity)
    return count_result
示例#2
0
def an_location():
    count_list = yield from orm.just_get_rs('SELECT location,COUNT(*) AS num FROM weibo_users GROUP BY location')
    return count_list
示例#3
0
def an_sex_orientation():
    count_list = yield from orm.just_get_rs('SELECT sex_orientation,COUNT(*) AS num FROM weibo_users GROUP BY sex_orientation')
    return count_list
示例#4
0
def an_single_state():
    count_list = yield from orm.just_get_rs('SELECT single_state,COUNT(*) AS num FROM weibo_users GROUP BY single_state')
    return count_list
示例#5
0
def an_user_sex():
    count_list = yield from orm.just_get_rs('SELECT sex,COUNT(*) AS num FROM weibo_users GROUP BY sex')
    return count_list