Esempio n. 1
0
    def execute(self):
        date2 = datetime.datetime.now()-datetime.timedelta(days=2)
        date1 = date2 - datetime.timedelta(days=1)

        cursor = mysql_conn.cursor()
        cursor.execute('select count(0) from dish where create_time>"%s" \
            and create_time<"%s" and status="A" and recipe_id>1000000' % (date1, date2))
        local = cursor.fetchone()[0]

        cursor.execute('select count(0) from dish where create_time>"%s" \
            and create_time<"%s" and status="A" and recipe_id<1000000' % (date1, date2))
        foreign = cursor.fetchone()[0]

        print "dish_follow_local_recipes.value %s" % local
        print "dish_follow_foreign_recipes.value %s" % foreign
        print "dish_follow_total.value %s" % (foreign + local)

        # for realtime
        today = datetime.datetime.now()
        yesterday = today - datetime.timedelta(days=1)

        cursor.execute('select count(0) from dish where create_time>"%s" \
            and create_time<"%s" and status="A"' % (yesterday, today))
        total = cursor.fetchone()[0]
        print "dish_follow_total_realtime.value %s" % (total)
Esempio n. 2
0
    def execute(self):
        date2 = datetime.datetime.now()-datetime.timedelta(days=2)
        date1 = date2 - datetime.timedelta(days=1)

        cursor = mysql_conn.cursor()

        total = cursor.execute('select count(0) from user_auth where time>"%s" and time<"%s"' % (date1, date2))
        total = cursor.fetchone()[0]

        cursor.execute('select count(0) from user_oauth2 where create_time>"%s"\
            and create_time<"%s" and service_provider=0' % (date1, date2))
        douban = cursor.fetchone()[0]

        cursor.execute('select count(0) from user_oauth2 where create_time>"%s"\
            and create_time<"%s" and service_provider=1' % (date1, date2))
        weibo = cursor.fetchone()[0]

        cursor.execute('select count(0) from user_oauth2 where create_time>"%s"\
            and create_time<"%s" and service_provider=3' % (date1, date2))
        qq = cursor.fetchone()[0]

        print "user_auth_total.value %s" % total
        print "user_auth_douban.value %s" % douban
        print "user_auth_weibo.value %s" % weibo
        print "user_auth_QQ.value %s" % qq
Esempio n. 3
0
    def execute(self):
        date2 = datetime.datetime.now()-datetime.timedelta(days=2)
        date1 = date2 - datetime.timedelta(days=1)

        cursor = mysql_conn.cursor()
        cursor.execute('select count(0) from collect where create_time>"%s" and create_time<"%s"' % (date1, date2))
        collects = cursor.fetchone()[0]
        print "recipe_collect_total.value %s" % collects
Esempio n. 4
0
    def execute(self):
        date2 = datetime.datetime.now()-datetime.timedelta(days=2)
        date1 = date2 - datetime.timedelta(days=1)

        cursor = mysql_conn.cursor()
        cursor.execute('select count(0) from event where create_time>"%s" \
            and create_time<"%s"' % (date1, date2))
        event = cursor.fetchone()[0]

        cursor.execute('select count(0) from event_target where create_time>"%s" \
            and create_time<"%s"' % (date1, date2))
        event_item = cursor.fetchone()[0]
        print "event_total.value %s" % event
        print "event_item_total.value %s" % event_item
Esempio n. 5
0
    def execute(self):
        date2 = datetime.datetime.now()-datetime.timedelta(days=2)
        date1 = date2 - datetime.timedelta(days=1)

        cursor = mysql_conn.cursor()
        cursor.execute('select count(0) from follow where create_time>"%s" and create_time<"%s"' % (date1, date2))
        follows = cursor.fetchone()[0]

        cursor.execute('select count(distinct(from_id)) from follow where create_time>"%s"\
            and create_time<"%s"' % (date1, date2))
        following_users = cursor.fetchone()[0]

        cursor.execute('select count(distinct(to_id)) from follow where create_time>"%s"\
            and create_time<"%s"' % (date1, date2))
        followed_users = cursor.fetchone()[0]

        print "follows_total.value %s" % follows
        print "following_users_total.value %s" % following_users
        print "followed_users_total.value %s" % followed_users
Esempio n. 6
0
    def execute(self):
        date2 = datetime.datetime.now()-datetime.timedelta(days=2)
        date1 = date2 - datetime.timedelta(days=1)

        cursor = mysql_conn.cursor()
        cursor.execute('select count(0) from digg where create_time>"%s" \
            and create_time<"%s"' % (date1, date2))
        diggs = cursor.fetchone()[0]

        cursor.execute('select count(distinct(user_id)) from digg where create_time>"%s"\
            and create_time<"%s"' % (date1, date2))
        digging_users = cursor.fetchone()[0]

        cursor.execute('select count(distinct(dish_id)) from digg where create_time>"%s"\
            and create_time<"%s"' % (date1, date2))
        digged_dishes = cursor.fetchone()[0]
        print "diggs_total.value %s" % diggs
        print "digging_users_total.value %s" % digging_users
        print "digged_dishes_total.value %s" % digged_dishes
Esempio n. 7
0
    def execute(self):
        date2 = datetime.datetime.now()-datetime.timedelta(days=2)
        date1 = date2 - datetime.timedelta(days=1)

        cursor = mysql_conn.cursor()
        cursor.execute('select count(0) from recipe_list where create_time>"%s" \
            and create_time<"%s" and status="A"' % (date1, date2))
        rl = cursor.fetchone()[0]

        rl_items = cursor.execute('select count(0) from recipe_list_item where time>"%s"\
            and time<"%s"' % (date1, date2))
        rl_items = cursor.fetchone()[0]
        print "recipe_list_total.value %s" % rl
        print "recipe_list_item_total.value %s" % rl_items

        # for realtime
        today = datetime.datetime.now()
        yesterday = today - datetime.timedelta(days=1)
        cursor.execute('select count(0) from recipe_list where create_time>"%s" and \
            create_time<"%s" and status="A"' % (yesterday, today))
        total = cursor.fetchone()[0]
        print "recipe_list_total_realtime.value %s" % (total)