Пример #1
0
    def GET(self):
        data = SinaDao.getmyinfo()
        # print data
        repost_count = SinaDao.getfriendinfo()
        # print repost_count
        idstr = data['idstr']
        screen_name = data['screen_name']
        allrepost=0
        for i in repost_count:
            allrepost+=i['Repost_Intimacy']
        #把reposts的值存在oldcontroller中  不过这个坏处就是需要每次点击这个方法才会好使
        Ie = data['friends_count']*data['statuses_count']
        Ic = allrepost*data['friends_count']
        Ia = Ie + Ic
        Ib = 1

        # influence = '{u"Ie":'+str(Ie)+',u"Ic":'+str(Ic)+',u"Ia":'+str(Ia)+',u"I":'+str(I)+'}'
        SinaDao.old_save_info(idstr,screen_name,Ie,Ic,Ia,Ib)
        influences = SinaDao.get_old_info()
        data=[]
        
        for influence in influences:
            print "====="
            print influence
            data.append({"screen_name":unicode(str(influence['screen_name']), "utf-8"),
                "Ie":str(influence['Ie']),
                "Ic":str(influence['Ic']),
                "Ia":str(influence['Ia']),
                "I":str(influence["Ib"])})
        # print data
        result={}
        result['data']=data
        return result
Пример #2
0
 def GET(self):
     loc_lists = SinaDao.getfriendlocinfo()
     result = '['
     for i in loc_lists:
         result += "['"+ i + "'," + str(loc_lists[i])+ "],"
     result=result[:-1] + ']'
     return result
Пример #3
0
    def GET(self):
        now_time = datetime.now()
        week_ago = now_time - timedelta(7)
        weibo_lists = SinaDao.getweibo()
        time = str(week_ago).split(' ')[0].split('-')
        new_weibo_lists = []
        for weibo_list in weibo_lists:
            weibo_time = weibo_list['create_time'].split(' ')

            #weibo_time[5] is year weibo_time[1] is month weibo_time[2] is day
            if int(weibo_time[5]) == int(time[0]) and StringUtil.converttime(
                    weibo_time[1]) == int(
                        time[1]) and int(weibo_time[2]) >= int(time[2]):
                new_weibo_lists.append(weibo_list)
            elif int(weibo_time[5]) > int(time[0]):
                new_weibo_lists.append(weibo_list)
            elif int(weibo_time[5]) == int(time[0]) and StringUtil.converttime(
                    weibo_time[1]) > int(time[1]):
                new_weibo_lists.append(weibo_list)
        result = []
        result.append([len(new_weibo_lists)])
        result.append(jiebafenci(new_weibo_lists))
        result.append(WeiboUtil.trends_weekly())
        result = str(result).replace("u'", "'")

        return result
Пример #4
0
 def GET(self):
     loc_lists = SinaDao.getfriendlocinfo()
     result = '['
     for i in loc_lists:
         result += "['" + i + "'," + str(loc_lists[i]) + "],"
     result = result[:-1] + ']'
     return result
Пример #5
0
    def GET(self):
        weibo_id = SinaDao.get_newest_repost()
        r = WeiboUtil.statuses_count(weibo_id)[0]
       
        # r = WeiboUtil.statuses_count('3706902724217725')[0]
        comments = int(r['comments'])
        reposts = int(r['reposts'])

        data = [[comments],[reposts]]
        return data
Пример #6
0
    def GET(self):
        weibo_id = SinaDao.get_newest_repost()
        r = WeiboUtil.statuses_count(weibo_id)[0]

        # r = WeiboUtil.statuses_count('3706902724217725')[0]
        comments = int(r['comments'])
        reposts = int(r['reposts'])

        data = [[comments], [reposts]]
        return data
Пример #7
0
    def GET(self):
        data = SinaDao.getmyinfo()
        # print data
        repost_count = SinaDao.getfriendinfo()
        # print repost_count
        idstr = data['idstr']
        screen_name = data['screen_name']
        allrepost = 0
        for i in repost_count:
            allrepost += i['Repost_Intimacy']
        #把reposts的值存在oldcontroller中  不过这个坏处就是需要每次点击这个方法才会好使
        Ie = data['friends_count'] * data['statuses_count']
        Ic = allrepost * data['friends_count']
        Ia = Ie + Ic
        Ib = 1

        # influence = '{u"Ie":'+str(Ie)+',u"Ic":'+str(Ic)+',u"Ia":'+str(Ia)+',u"I":'+str(I)+'}'
        SinaDao.old_save_info(idstr, screen_name, Ie, Ic, Ia, Ib)
        influences = SinaDao.get_old_info()
        data = []

        for influence in influences:
            print "====="
            print influence
            data.append({
                "screen_name":
                unicode(str(influence['screen_name']), "utf-8"),
                "Ie":
                str(influence['Ie']),
                "Ic":
                str(influence['Ic']),
                "Ia":
                str(influence['Ia']),
                "I":
                str(influence["Ib"])
            })
        # print data
        result = {}
        result['data'] = data
        return result
Пример #8
0
    def GET(self):
        data = SinaDao.getmyinfo()
        if data['verified']:
            data['verified'] = u'是'
        else:
            data['verified'] = u'否'

        stime = data['created_at'].split(" ")
        

        data['created_at'] = str(stime[5])+u"年"+str(StringUtil.converttime(stime[1]))+u"月"+str(stime[2])+u"日"+StringUtil.convertweek(stime[0])+stime[3]
        print data
        result = {}
        for i in data:
            result[str(i)]=data[i]
        return str(result).replace('\'','\"')
Пример #9
0
    def GET(self):
        data = SinaDao.getmyinfo()
        if data['verified']:
            data['verified'] = u'是'
        else:
            data['verified'] = u'否'

        stime = data['created_at'].split(" ")

        data['created_at'] = str(stime[5]) + u"年" + str(
            StringUtil.converttime(stime[1])) + u"月" + str(
                stime[2]) + u"日" + StringUtil.convertweek(stime[0]) + stime[3]
        print data
        result = {}
        for i in data:
            result[str(i)] = data[i]
        return str(result).replace('\'', '\"')
Пример #10
0
    def GET(self):
        print '+++++++='
        friend_infos = SinaDao.getfriendinfo()
        print friend_infos
        name = '['
        reports = '['
        commites = '['

        for i in friend_infos:
            print i
            # if i['Repost_Intimacy']+i['Req']
            name += "'" + str(i['screen_name']) + "',"
            reports += str(i['Repost_Intimacy']) + ","
            commites += str(i['Comment_Intimacy']) + ","
            # result += "{'screen_name':i['screen_name'],'reposts_count':i['Repost_Intimacy'],'comments_count':i['Comment_Intimacy']},"
        name = name[:-1] + ']'
        reports = reports[:-1] + ']'
        commites = commites[:-1] + ']'
        result = '[' + name + ',' + reports + ',' + commites + ']'
        print result
        return result
Пример #11
0
    def GET(self):
        now_time = datetime.now()
        week_ago = now_time - timedelta(7)
        weibo_lists = SinaDao.getweibo()
        time = str(week_ago).split(' ')[0].split('-')
        new_weibo_lists=[]
        for weibo_list in weibo_lists:
            weibo_time = weibo_list['create_time'].split(' ')

            #weibo_time[5] is year weibo_time[1] is month weibo_time[2] is day
            if  int(weibo_time[5])==int(time[0]) and StringUtil.converttime(weibo_time[1])==int(time[1]) and int(weibo_time[2])>=int(time[2]) :
                new_weibo_lists.append(weibo_list)
            elif int(weibo_time[5])>int(time[0]) :
                    new_weibo_lists.append(weibo_list)
            elif int(weibo_time[5])==int(time[0]) and StringUtil.converttime(weibo_time[1])>int(time[1]):
                new_weibo_lists.append(weibo_list)
        result=[]
        result.append([len(new_weibo_lists)])
        result.append(jiebafenci(new_weibo_lists))
        result.append(WeiboUtil.trends_weekly())
        result = str(result).replace("u'","'")
        
        return result
Пример #12
0
 def GET(self):
     print '+++++++='
     friend_infos = SinaDao.getfriendinfo()
     print friend_infos
     name = '['
     reports = '['
     commites = '['
     
     
     
     for i in friend_infos:
         print i
         # if i['Repost_Intimacy']+i['Req']
         name += "'"+str(i['screen_name']) +"',"
         reports += str(i['Repost_Intimacy'])+","
         commites += str(i['Comment_Intimacy'])+","
         # result += "{'screen_name':i['screen_name'],'reposts_count':i['Repost_Intimacy'],'comments_count':i['Comment_Intimacy']},"
     name=name[:-1] + ']'
     reports=reports[:-1] + ']'
     commites=commites[:-1] + ']'
     result='['+name+','+reports+','+commites+']'
     print result
     return result
Пример #13
0
    def POST(self):
        i = web.input()
        settings.LOGIN_INFO['USERID'] = i.userid
        settings.LOGIN_INFO['PASSWD'] = i.passwd
        SinaDao.clean_info_db()
        userinfo = WeiboUtil.get_userinfo_by_screen_name(i.screen_name)
        SinaDao.user_info(userinfo)

        SinaDao.clean_use_db()
        r = WeiboUtil.get_weibo_by_user_id(userinfo['idstr'])
        SinaDao.save_weibo_info(r)
        weibo_id = WeiboUtil.get_weibo_id(r)
        
        SinaDao.clean_newest_db()
        newest_weibo_id = weibo_id[0]
        
        SinaDao.save_newest_repost(newest_weibo_id)
        
        repost = WeiboUtil.get_repost_by_weiboid(weibo_id)
        comment = WeiboUtil.get_comment_by_weiboid(weibo_id)
        SinaDao.repost_user_info(repost)
        SinaDao.comment_user_info(comment)
        
        SinaDao.clean_location_db()
        friend_location = WeiboUtil.get_friend_location_by_screen_name(i.screen_name)
        print friend_location
        SinaDao.friend_location(friend_location)

        return render.userinfo()
Пример #14
0
    def POST(self):
        i = web.input()
        settings.LOGIN_INFO['USERID'] = i.userid
        settings.LOGIN_INFO['PASSWD'] = i.passwd
        SinaDao.clean_info_db()
        userinfo = WeiboUtil.get_userinfo_by_screen_name(i.screen_name)
        SinaDao.user_info(userinfo)

        SinaDao.clean_use_db()
        r = WeiboUtil.get_weibo_by_user_id(userinfo['idstr'])
        SinaDao.save_weibo_info(r)
        weibo_id = WeiboUtil.get_weibo_id(r)

        SinaDao.clean_newest_db()
        newest_weibo_id = weibo_id[0]

        SinaDao.save_newest_repost(newest_weibo_id)

        repost = WeiboUtil.get_repost_by_weiboid(weibo_id)
        comment = WeiboUtil.get_comment_by_weiboid(weibo_id)
        SinaDao.repost_user_info(repost)
        SinaDao.comment_user_info(comment)

        SinaDao.clean_location_db()
        friend_location = WeiboUtil.get_friend_location_by_screen_name(
            i.screen_name)
        print friend_location
        SinaDao.friend_location(friend_location)

        return render.userinfo()