Beispiel #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
Beispiel #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
Beispiel #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
Beispiel #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
Beispiel #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