Esempio n. 1
0
    def increase_click_num(self, media_id):
        """
            点击量加1
        :param media_id: 媒体ID
        :return: null
        """
        self.logger.info("进入increase_click_num")

        sql_sentence = sql_statement.info_message.increase_click_num(media_id)
        try:
            sql_operations.SQL().excute_one(sql_sentence)
        except Exception, e:
            self.logger.error(traceback.format_exc())
            self.logger.error("数据库点击量字段加1失败")
            raise e
Esempio n. 2
0
 def judge_exist_user(self, user_name, user_pass):
     """
         检查是否存在用户
     :param user_name: 用户名
     :param user_pass: 密码
     :return: 存在返回user_id、nick_name ,不存在返回False
     """
     self.logger.info("进入judge_exist_user方法")
     # 1.检查是否存在相同用户
     sql_sentence = sql_statement.info_user.search_user(
         user_name, user_pass)
     try:
         result_record = sql_operations.SQL().fetch_one(sql_sentence)
     except Exception, e:
         self.logger.error(traceback.format_exc())
         self.logger.error("数据库检查是否存在相同用户失败")
         raise e
Esempio n. 3
0
 def get_hot_media(self):
     """
         获取当前热点媒体图片及相应message_id
     :return:
             [
                 {'pic': 'pic_url', 'message_id': 'message_id', 'headline': '', 'tags':''},...
             ]
     """
     self.logger.info("进入get_hot_media方法")
     # 1.获取图片路径及相应媒体ID
     sql_sentence = sql_statement.info_message.select_hot_media()
     try:
         result_record = sql_operations.SQL().fetch_all(sql_sentence)
     except Exception, e:
         self.logger.error(traceback.format_exc())
         self.logger.error("从数据库获取热点媒体失败")
         raise e
Esempio n. 4
0
 def add_user(self, user_name, user_pass, nick_name):
     """
         添加新用户
     :param user_name: 用户名
     :param user_pass: 密码
     :param nick_name: 昵称
     :return:
     """
     self.logger.info("进入add_user方法")
     # 1.添加用户
     sql_sentence = sql_statement.info_user.add_user(
         user_name, user_pass, nick_name)
     try:
         sql_operations.SQL().excute_one(sql_sentence)
     except Exception, e:
         self.logger.error(traceback.format_exc())
         self.logger.error("数据库添加用户失败")
         raise e
Esempio n. 5
0
    def get_media_content(self, media_id):
        """
            获取媒体具体信息
        :param media_id: 媒体ID
        :return:
                {
                'content': '',
                'source': '',
                'click_num':'',
                'gmt_created':''
                'download_addr': ''
            }
        """
        self.logger.info("进入get_media_content方法")

        # 1.获取媒体具体信息
        sql_sentence = sql_statement.info_message.select_media_content(media_id)
        try:
            result_record = sql_operations.SQL().fetch_one(sql_sentence)
        except Exception, e:
            self.logger.error(traceback.format_exc())
            self.logger.error("从数据库获取媒体具体信息失败")
            raise e