Beispiel #1
0
 def getByFilmName(self, filmName):
     baseDao = BaseDao()
     db = baseDao.getDB()
     # 使用cursor()方法获取操作游标
     cursor = baseDao.getDictCursor(db)
     num = cursor.execute(
         "select * from tf_merge_film where film_name ='%s' " % (filmName))
     if (num == 0):
         return None
     rows = cursor.fetchall()
     row = rows[0]
     filmMergeItem = FilmMergeItem()
     filmMergeItem.id = row['id']
     filmMergeItem.filmName = row['film_name']
     filmMergeItem.grade = row['grade']
     filmMergeItem.showTime = row['show_time']
     filmMergeItem.showState = row['show_state']
     filmMergeItem.img = row['img']
     filmMergeItem.filmType = row['film_type']
     filmMergeItem.ver = row['ver']
     filmMergeItem.actor = row['actor']
     filmMergeItem.country = row['country']
     filmMergeItem.direct = row['direct']
     filmMergeItem.initDate = row['init_date']
     filmMergeItem.duration = row['duration']
     filmMergeItem.state = row['state']
     baseDao.commitCloseDb(db)
     return filmMergeItem
Beispiel #2
0
 def getByWebsiteFilmId(self, websiteFilmId):
     baseDao = BaseDao()
     db = baseDao.getDB()
     # 使用cursor()方法获取操作游标
     cursor = baseDao.getDictCursor(db)
     num = cursor.execute(
         "select * from tf_film where website_film_id = '%s' ",
         websiteFilmId)
     rows = cursor.fetchall()
     row = rows[0]
     filmItem = FilmItem()
     filmItem.id = row['id']
     filmItem.filmName = row['film_name']
     filmItem.websiteId = row['website_id']
     filmItem.websiteFilmId = row['website_film_id']
     filmItem.grade = row['grade']
     filmItem.showTime = row['show_time']
     filmItem.showState = row['show_state']
     filmItem.img = row['img']
     filmItem.filmType = row['film_type']
     filmItem.ver = row['ver']
     filmItem.actor = row['actor']
     filmItem.country = row['country']
     filmItem.direct = row['direct']
     filmItem.initDate = row['init_date']
     filmItem.clob = row['clob']
     filmItem.duration = row['duration']
     filmItem.mergeId = row['merge_id']
     baseDao.commitCloseDb(db)
     return filmItem
Beispiel #3
0
 def getNoMergeFilm(self):
     filmItems = []
     baseDao = BaseDao()
     db = baseDao.getDB()
     # 使用cursor()方法获取操作游标
     cursor = baseDao.getDictCursor(db)
     num = cursor.execute(
         "select * from tf_film where merge_id is null and state=1 ")
     rows = cursor.fetchall()
     for row in rows:
         filmItem = FilmItem()
         filmItem.id = row['id']
         filmItem.filmName = row['film_name']
         filmItem.websiteId = row['website_id']
         filmItem.websiteFilmId = row['website_film_id']
         filmItem.grade = row['grade']
         filmItem.showTime = row['show_time']
         filmItem.showState = row['show_state']
         filmItem.img = row['img']
         filmItem.filmType = row['film_type']
         filmItem.ver = row['ver']
         filmItem.actor = row['actor']
         filmItem.country = row['country']
         filmItem.direct = row['direct']
         filmItem.initDate = row['init_date']
         filmItem.clob = row['clob']
         filmItem.duration = row['duration']
         filmItem.mergeId = row['merge_id']
         filmItems.append(filmItem)
     baseDao.commitCloseDb(db)
     return filmItems
Beispiel #4
0
 def deleteOneDay(self, dateNo, msType):
     baseDao = BaseDao()
     db = baseDao.getDB()
     # 使用cursor()方法获取操作游标
     cursor = baseDao.getDictCursor(db)
     sql = "delete from tf_message where date_no='%s' and ms_type='%s'" % (
         dateNo, msType)
     print(sql)
     num = cursor.execute(sql)
     baseDao.commitCloseDb(db)
Beispiel #5
0
 def getPersonName(self, sendType):
     personNames = []
     baseDao = BaseDao()
     db = baseDao.getDB()
     # 使用cursor()方法获取操作游标
     cursor = baseDao.getDictCursor(db)
     sql = "select * from tf_message_send where state=1 and send_type='%s' order by id desc" % (
         sendType)
     print(sql)
     num = cursor.execute(sql)
     rows = cursor.fetchall()
     for row in rows:
         personNames.append(row['person_name'])
     baseDao.commitCloseDb(db)
     return personNames
Beispiel #6
0
 def getGradeHiFilm(self, dateNo):
     mergeFilmIds = []
     baseDao = BaseDao()
     db = baseDao.getDB()
     # 使用cursor()方法获取操作游标
     cursor = baseDao.getDictCursor(db)
     sql = "select  distinct(b.merge_id) merge_film_id from  \
          tf_daily_film_cinema a left join tf_film b on a.website_film_id=b.website_film_id \
          left join tf_merge_film c on b.merge_id=c.id \
         where a.date_no='%s'  \
         order by a.grade desc limit 3" % (dateNo)
     print(sql)
     num = cursor.execute(sql)
     rows = cursor.fetchall()
     for row in rows:
         mergeFilmIds.append(row['merge_film_id'])
     baseDao.commitCloseDb(db)
     return mergeFilmIds
Beispiel #7
0
 def getByCinemaName(self,cinemaName):
     baseDao = BaseDao()
     db = baseDao.getDB()
     # 使用cursor()方法获取操作游标 
     cursor = baseDao.getDictCursor(db)
     num = cursor.execute("select * from tf_merge_cinema where cinema_name ='%s' " % (cinemaName))
     if(num == 0):
         return None
     rows = cursor.fetchall()
     row = rows[0]
     cinemaMergeItem = CinemaMergeItem()
     cinemaMergeItem.id = row['id']
     cinemaMergeItem.cinemaName = row['cinema_name']
     cinemaMergeItem.area = row['area']
     cinemaMergeItem.addr = row['addr']
     cinemaMergeItem.state = row['state']
     baseDao.commitCloseDb(db)
     return cinemaMergeItem
Beispiel #8
0
 def getMostRoundFilms(self, dateNo):
     mergerFilmIds = []
     baseDao = BaseDao()
     db = baseDao.getDB()
     # 使用cursor()方法获取操作游标
     cursor = baseDao.getDictCursor(db)
     sql = "select b.merge_id merge_id\
         from tf_daily_film_round a left join tf_film b on a.website_film_id=b.website_film_id \
             left join tf_merge_film c on b.merge_id = c.id \
         where a.date_no='%s' \
         group by b.merge_id \
         order by (a.show_round_num) desc limit 3" % (dateNo)
     print(sql)
     num = cursor.execute(sql)
     rows = cursor.fetchall()
     for row in rows:
         mergerFilmIds.append(row['merge_id'])
     baseDao.commitCloseDb(db)
     return mergerFilmIds
Beispiel #9
0
 def doSelect(self,sql):
     baseDao = BaseDao()
     db = baseDao.getDB()
     # 使用cursor()方法获取操作游标 
     cursor = baseDao.getDictCursor(db)
     print(sql)
     num = cursor.execute(sql)
     rows = cursor.fetchall()
     cinemaMergeItems = []
     for row in rows:
         cinemaMergeItem = CinemaMergeItem()
         cinemaMergeItem.id = row['id']
         cinemaMergeItem.cinemaName = row['cinema_name']
         cinemaMergeItem.area = row['area']
         cinemaMergeItem.addr = row['addr']
         cinemaMergeItem.state = row['state']
         cinemaMergeItems.append(cinemaMergeItem)
     baseDao.commitCloseDb(db)
     return cinemaMergeItems
Beispiel #10
0
 def doSelect(self, sql):
     baseDao = BaseDao()
     db = baseDao.getDB()
     # 使用cursor()方法获取操作游标
     cursor = baseDao.getDictCursor(db)
     print(sql)
     num = cursor.execute(sql)
     rows = cursor.fetchall()
     items = []
     for row in rows:
         item = MessageItem()
         item.id = row['id']
         item.dateNo = row['date_no']
         item.msType = row['ms_type']
         item.content = row['content']
         item.state = row['state']
         item.initDate = row['init_date']
         items.append(item)
     baseDao.commitCloseDb(db)
     return items
Beispiel #11
0
 def doSelect(self, sql):
     items = []
     baseDao = BaseDao()
     db = baseDao.getDB()
     # 使用cursor()方法获取操作游标
     cursor = baseDao.getDictCursor(db)
     print(sql)
     num = cursor.execute(sql)
     rows = cursor.fetchall()
     for row in rows:
         item = CalcItem()
         item.id = row['id']
         item.dateNo = row['date_no']
         item.calcType = row['calc_type']
         item.websiteId = row['website_id']
         item.websiteCinemaId = row['website_cinema_id']
         item.websiteFilmId = row['website_film_id']
         item.initDate = row['init_date']
         items.append(item)
     baseDao.commitCloseDb(db)
     return items
Beispiel #12
0
 def getCheapCimane(self, filmMergeId, dateNo):
     calcItems = []
     baseDao = BaseDao()
     db = baseDao.getDB()
     # 使用cursor()方法获取操作游标
     cursor = baseDao.getDictCursor(db)
     sql = "select a.website_id website_id, b.merge_id cinema_merge_id,d.merge_id film_merge_id \
             from tf_daily_film_cinema a left join tf_cinema b on a.website_cinema_id = b.website_cinema_id  \
             left join tf_film d on a.website_film_id = d.website_film_id left join tf_merge_cinema f on b.merge_id=f.id \
             where d.merge_id='%s' and a.date_no='%s' and f.area in ('红桥区','南开区') \
             order by a.price limit 1" % (str(filmMergeId), str(dateNo))
     print(sql)
     num = cursor.execute(sql)
     rows = cursor.fetchall()
     for row in rows:
         calcItem = CalcItem()
         calcItem.dateNo = dateNo
         calcItem.websiteId = row['website_id']
         calcItem.mergeCinemaId = row['cinema_merge_id']
         calcItem.mergeFilmId = row['film_merge_id']
         calcItems.append(calcItem)
     baseDao.commitCloseDb(db)
     return calcItems
Beispiel #13
0
 def getCalcMessage(self, dateNo, calcType):
     baseDao = BaseDao()
     db = baseDao.getDB()
     # 使用cursor()方法获取操作游标
     cursor = baseDao.getDictCursor(db)
     sql = "select b.film_name,c.cinema_name,d.website_name,b.film_type,b.actor \
         from tf_calc a left join tf_merge_film b on a.merge_film_id=b.id left join tf_merge_cinema c on a.merge_cinema_id=c.id \
             left join tf_website d on a.website_id=d.id \
         where a.date_no='%s' and a.calc_type='%s'" % (dateNo, calcType)
     print(sql)
     num = cursor.execute(sql)
     rows = cursor.fetchall()
     items = []
     for row in rows:
         messageContentItem = MessageContentItem()
         messageContentItem.filmName = row['film_name']
         messageContentItem.cinemaName = row['cinema_name']
         messageContentItem.websiteName = row['website_name']
         messageContentItem.filmType = row['film_type']
         messageContentItem.actor = row['actor']
         items.append(messageContentItem)
     baseDao.commitCloseDb(db)
     return items