Esempio n. 1
0
    def update_used_subtract(self, param):
        """
		更新状态 相减
		:param param:
		:return:
		"""
        _db = None
        try:
            if not param:
                self.logger.info("【添加/更新账号使用量】请求参数为为空,流程结束")
            """查询数据"""
            _db = MySqlHelper()
            count = _db.count(
                used_of_count_sql.count,
                (param.get("usedOfContent"), param.get("usedType"),
                 param.get("start"), param.get("end")))
            if count <= 0:
                return True
            result = _db.update(
                used_of_count_sql.update_used_subtract,
                (param.get("usedOfContent"), param.get("usedType"),
                 param.get("start"), param.get("end")))

            _db.end()
            return result
        except Exception as e:
            if _db:
                _db.isEnd = 2
                _db.end()
            self.logger.error("【添加/更新账号使用量】保存异常信息为:%s" %
                              traceback.format_exc())
        return False
Esempio n. 2
0
    def insert_update(self, param):
        """
		添加或更新数据
		:param param:
		:return:
		"""
        _db = None
        try:
            if not param:
                self.logger.info("【添加/更新营销数据】请求参数为为空,流程结束")
            """查询数据"""
            _db = MySqlHelper()
            count = _db.count(marketing_data_sql.count,
                              (param.get("batchCode"), param.get("mobile"),
                               param.get("email")))
            if count > 0:
                result = _db.update(
                    marketing_data_sql.update_insert,
                    (param.get("subBatchCode"), param.get("batchCode"),
                     param.get("mobile"), param.get("email")))
            else:
                result = _db.insert_one(
                    marketing_data_sql.insert,
                    (param.get("batchCode"), param.get("subBatchCode"),
                     param.get("mobile"), param.get("email")))
            _db.end()
            return result
        except Exception as e:
            if _db:
                _db.isEnd = 2
                _db.end()
            self.logger.error("【添加/更新营销数据】保存异常信息为:%s" % traceback.format_exc())
        return False
Esempio n. 3
0
    def search_not_lock_user_name(self, user_name):
        """
		查询账号状态
		:param user_name:
		:return:
		"""
        try:
            if not user_name:
                return False
            """查询数据库"""
            _db = MySqlHelper()
            result = _db.count(send_email_account_sql.search_lock_user_name,
                               user_name)
            """没有查到数据为空"""
            if not result:
                return True
        except Exception as e:
            self.logger.error("【查询发送邮箱账号】查询异常信息为:%s" % traceback.format_exc())
        return False
Esempio n. 4
0
    def insert_update_more(self, result):
        """
		添加或更新数据
		:param result:
		:return:
		"""
        _db = None
        try:
            if not result:
                self.logger.info("【添加/更新营销数据】请求参数为为空,流程结束")
            """查询数据"""
            _db = MySqlHelper()
            for param in result:
                param["subBatchCode"] = BusinessUtil.get_uniqu_time()
                count = _db.count(marketing_data_sql.count,
                                  (param.get("batchCode"), param.get("mobile"),
                                   param.get("email")))
                if count > 0:
                    result = _db.update(
                        marketing_data_sql.update_insert,
                        (param.get("subBatchCode"),
                         int(param.get("status", "0")), param.get("batchCode"),
                         param.get("mobile"), param.get("email")))
                else:
                    result = _db.insert_one(
                        marketing_data_sql.insert,
                        (param.get("originalBatchCode"),
                         param.get("batchCode"), param.get("subBatchCode"),
                         param.get("mobile"), param.get("email"),
                         int(param.get("status", "0"))))
            _db.end()
            return result
        except Exception as e:
            if _db:
                _db.isEnd = 2
                _db.end()
            self.logger.error("【添加/更新营销数据】保存异常信息为:%s" % traceback.format_exc())
        return False