Exemplo n.º 1
0
 def fetch_all_lessons(self, page):
     sql = '''select d.id, subject_name, username, from_unixtime(createtime) as createtime,
             date(from_unixtime(start_time)) as start_time, date(from_unixtime(end_time)) as end_time,
             d.actived from md_diy_subject d left join md_member m on d.member_id = m.id
             order by createtime desc'''
     sql = Pagination.add_limit_clause(sql, page)
     return self.db.query(sql)
Exemplo n.º 2
0
 def fetch_all_lessons(self, page):
     sql = '''select d.id, subject_name, username, from_unixtime(createtime) as createtime,
             date(from_unixtime(start_time)) as start_time, date(from_unixtime(end_time)) as end_time,
             d.actived from md_diy_subject d left join md_member m on d.member_id = m.id
             order by createtime desc'''
     sql = Pagination.add_limit_clause(sql, page)
     return self.db.query(sql)
Exemplo n.º 3
0
 def query_salons(self, salon_name, province_id, city_id, domain_id, page):
     '''查询沙龙'''
     sql = '''
         select * from md_salon
     '''
     sql, params = self.gen_query_str(sql, salon_name, province_id, city_id, domain_id)
     sql = Pagination.add_limit_clause(sql, page)
     return self.db.query(sql, *params)
Exemplo n.º 4
0
 def query_salons(self, salon_name, province_id, city_id, domain_id, page):
     '''查询沙龙'''
     sql = '''
         select * from md_salon
     '''
     sql, params = self.gen_query_str(sql, salon_name, province_id, city_id,
                                      domain_id)
     sql = Pagination.add_limit_clause(sql, page)
     return self.db.query(sql, *params)
Exemplo n.º 5
0
 def query_users(self, **args):
     sql = '''
         select m.id, m.username, m.email, m.member_type, m.regtime, m.recommend,
             m.province_id, m.city_id, m.recommend_talent,
             m.actived, s.works_count, s.lastlogintime, s.twitter_num, s.emotion_num,
             from_unixtime(m.regtime) as regtime_str,
             from_unixtime(s.lastlogintime) as lastlogintime_str
         from md_member m left outer join md_member_statistics s on m.id = s.member_id
     '''
     query_str, params = self.query_users_where_clause(**args)
     sql = sql + query_str
     sql = sql + " order by m.id desc "
     sql = Pagination.add_limit_clause(sql, args["page"])
     return self.db.query(sql, *params)
Exemplo n.º 6
0
 def query_users(self, **args):
     sql = '''
         select m.id, m.username, m.email, m.member_type, m.regtime, m.recommend,
             m.province_id, m.city_id, m.recommend_talent,
             m.actived, s.works_count, s.lastlogintime, s.twitter_num, s.emotion_num,
             from_unixtime(m.regtime) as regtime_str,
             from_unixtime(s.lastlogintime) as lastlogintime_str
         from md_member m left outer join md_member_statistics s on m.id = s.member_id
     '''
     query_str, params = self.query_users_where_clause(**args)
     sql = sql + query_str
     sql = sql + " order by m.id desc "
     sql = Pagination.add_limit_clause(sql, args["page"])
     return self.db.query(sql, *params)
Exemplo n.º 7
0
    def query_twitters(self, **args):
        sql = '''
            select m.id, m.share_type, m.createtime, from_unixtime(m.createtime) as createtime_str,
                m.actived, s.description, s.comment_num,
                p.id as pic_id, p.pic_url, p.img_path, p.img_type,
                u.id as uid, u.username, u.member_type
            from md_twitter m, md_twitter_show s, md_twitter_picture p, md_member u
            where m.id = s.tid and s.pic_id = p.id and m.member_id = u.id
        '''
        sql, params = self.gen_query_str(sql, **args)
        sql = sql + " order by m.createtime desc"

        page = args.get("page", [1])[0]
        sql = Pagination.add_limit_clause(sql, page)

        return self.db.query(sql, *params)
Exemplo n.º 8
0
 def fetch_all_seasons(self, page):
     sql = '''select *, date(from_unixtime(createtime)) as createtime_str
             from md_season_period order by createtime desc'''
     sql = Pagination.add_limit_clause(sql, page)
     return self.db.query(sql)
Exemplo n.º 9
0
 def fetch_all_seasons(self, page):
     sql = '''select *, date(from_unixtime(createtime)) as createtime_str
             from md_season_period order by createtime desc'''
     sql = Pagination.add_limit_clause(sql, page)
     return self.db.query(sql)