async def update_auto_replay(self, **kwargs): state = kwargs.get('id') if not state: return { 'status': False, 'msg': '数据入参验证失败', "code": StatusCode.params_error.value } try: row = AuthReplyModel.by_id(kwargs.get('id')) for k, v in kwargs.items(): if k not in ['updateTime', 'createTime']: setattr(row, k, v) row.updateTime = datetime.now() self.db.commit() return { 'status': True, 'msg': '更新成功', "code": StatusCode.success.value } except Exception as e: logger.error(f"apply update Error: {str(e)}") self.db.rollback() return { 'status': False, 'msg': '更新失败', "code": StatusCode.db_error.value }
async def delete_auto_replay(self, _id): row = AuthReplyModel.by_id(_id) if row: try: self.db.delete(row) self.db.commit() return { 'status': True, 'msg': '删除成功', "code": StatusCode.success.value } except Exception as e: self.db.rollback() logger.error(f"news delete Error: {str(e)}") return { 'status': False, 'msg': '删除失败', "code": StatusCode.db_error.value } return { 'status': False, 'msg': '未找到该配置', "code": StatusCode.not_found_error.value }