当前位置: 首页 > article >正文

DiscuzX3.5发帖json api

参考文章:PHP实现独立Discuz站外发帖(直连操作数据库)_discuz 发帖api-CSDN博客

简单改造了一下,适配我自己的需求

有一个站点存在多个采集站,我想通过主站拿标题,采集站拿内容

使用到的sql如下

CREATE TABLE `pre_forum_post_sync`  (`id` int(0) NOT NULL AUTO_INCREMENT,`foreign_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,`foreign2_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,`foreign3_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,`tid` int(0) NOT NULL,`pid` int(0) NOT NULL,`update_time` int(0) NULL DEFAULT NULL,PRIMARY KEY (`id`) USING BTREE,UNIQUE INDEX `foreign_id`(`foreign_id`) USING BTREE
) ENGINE = InnoDB  CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;CREATE TABLE `pre_wechat_push_log` (`id` BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,`tid` INT NOT NULL COMMENT '主题ID',`pid` INT NOT NULL COMMENT '帖子ID',`push_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '推送时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

php api代码

同步主站标题api

topic_only.php

<?php
date_default_timezone_set('Asia/Shanghai');
header('Content-Type: application/json');// 定义允许的 accesskey 和 accesssecret
define('ACCESS_KEY', 'my-access-key');
define('ACCESS_SECRET', 'my-access-secret');// 获取并统一转换请求头为小写
$headers = array_change_key_case(getallheaders(), CASE_LOWER);// 检查 accesskey 和 accesssecret 是否存在且匹配
if (!isset($headers['accesskey']) || !isset($headers['accesssecret'])) {http_response_code(403);echo json_encode(['status' => 'error', 'message' => 'Missing AccessKey or AccessSecret']);exit;
}if ($headers['accesskey'] !== ACCESS_KEY || $headers['accesssecret'] !== ACCESS_SECRET) {http_response_code(403);echo json_encode(['status' => 'error', 'message' => 'Invalid AccessKey or AccessSecret']);exit;
}// 接收并解析 JSON 输入
$input = file_get_contents('php://input');
$data = json_decode($input, true);// 检查必要字段
if (!isset($data['fid'], $data['title'], $data['content'], $data['foreign_id'])) {echo json_encode(['status' => 'error', 'message' => 'Missing required parameters']);exit;
}$fid = $data['fid'];
$title = $data['title'];
$content = $data['content'];
$foreign_id = $data['foreign_id'];
$post_time = isset($data['post_time']) ? strtotime($data['post_time']) : time(); // 新增行try {$test = new insert_content('1', 'admin', $post_time); // 使用传入时间$result = $test->sync_post($fid, $title, $content, $foreign_id);echo json_encode(['status' => 'success', 'data' => $result]);
} catch (Exception $e) {echo json_encode(['status' => 'error', 'message' => $e->getMessage()]);
}class insert_content {private $_prefix = 'pre'; // Discuz 表前缀private $_con;private $_tid;private $_fid;private $_pid;private $_authorid;private $_author;private $_time;private $_title;private $_content;public function __construct($authorid, $author, $time = null) {$this->_authorid = $authorid;$this->_author = $author;$this->_time = $time ?? time();$this->_con = mysqli_connect('mysql', 'root', 'pass', 'ultrax', 3306);if (!$this->_con) {throw new Exception("Database connection failed");}}/*** 同步发帖方法** @param $fid* @param $title* @param $content* @param $foreign_id* @return array* @throws Exception*/public function sync_post($fid, $title, $content, $foreign_id) {$this->_fid = $fid;$this->_title = $title;$this->_content = $content;// 先检查是否已同步$sql = "SELECT tid, pid FROM {$this->_prefix}_forum_post_sync WHERE foreign_id='{$foreign_id}'";$res = mysqli_query($this->_con, $sql);if ($row = mysqli_fetch_assoc($res)) {// 已存在,仅更新标题$this->_tid = $row['tid'];$this->_pid = $row['pid'];// 仅更新主题表中的标题$sql = "UPDATE {$this->_prefix}_forum_thread SET subject='{$this->_title}', lastpost='{$this->_time}' WHERE tid='{$this->_tid}'";if (!mysqli_query($this->_con, $sql)) {throw new Exception("Update thread failed: " . mysqli_error($this->_con));}// 可选:更新同步记录时间$sql = "UPDATE {$this->_prefix}_forum_post_sync SET update_time='{$this->_time}' WHERE foreign_id='{$foreign_id}'";if (!mysqli_query($this->_con, $sql)) {throw new Exception("Update sync record failed: " . mysqli_error($this->_con));}return ['action' => 'updated','tid' => $this->_tid,'pid' => $this->_pid];} else {// 不存在,新建帖子和主题return $this->insert_new_post($foreign_id);}}private function insert_new_post($foreign_id) {// 第一步:插入主题表$sql = "INSERT INTO {$this->_prefix}_forum_thread SETfid='{$this->_fid}',authorid='{$this->_authorid}',author='{$this->_author}',subject='{$this->_title}',dateline='{$this->_time}', lastpost='{$this->_time}',lastposter='{$this->_author}'";if (!mysqli_query($this->_con, $sql)) {throw new Exception("Insert thread failed: " . mysqli_error($this->_con));}$this->_tid = mysqli_insert_id($this->_con);// 第二步:插入分表协调表if (!mysqli_query($this->_con, "INSERT INTO {$this->_prefix}_forum_post_tableid VALUES ()")) {throw new Exception("Insert post tableid failed: " . mysqli_error($this->_con));}$this->_pid = mysqli_insert_id($this->_con);// 第三步:获取 position 并插入帖子表$res = mysqli_query($this->_con, "SELECT MAX(position) AS max_pos FROM {$this->_prefix}_forum_post WHERE tid='{$this->_tid}'");$row = mysqli_fetch_assoc($res);$position = $row['max_pos'] ? $row['max_pos'] + 1 : 1;$sql = "INSERT INTO {$this->_prefix}_forum_post SETpid='{$this->_pid}',fid='{$this->_fid}',tid='{$this->_tid}',author='{$this->_author}',authorid='{$this->_authorid}',subject='{$this->_title}',dateline='{$this->_time}',message='{$this->_content}',premsg='',position={$position}";if (!mysqli_query($this->_con, $sql)) {throw new Exception("Insert post failed: " . mysqli_error($this->_con));}// 第四步:更新版块统计$sql = "UPDATE {$this->_prefix}_forum_forum SET posts=posts+1, threads=threads+1 WHERE fid='{$this->_fid}'";if (!mysqli_query($this->_con, $sql)) {throw new Exception("Update forum stats failed: " . mysqli_error($this->_con));}// 第五步:更新用户统计$sql = "UPDATE {$this->_prefix}_common_member_count SET posts=posts+1, threads=threads+1 WHERE uid='{$this->_authorid}'";if (!mysqli_query($this->_con, $sql)) {throw new Exception("Update user stats failed: " . mysqli_error($this->_con));}// 插入同步记录$sql = "INSERT INTO {$this->_prefix}_forum_post_sync SETforeign_id='{$foreign_id}',tid='{$this->_tid}',pid='{$this->_pid}',update_time='{$this->_time}'";if (!mysqli_query($this->_con, $sql)) {throw new Exception("Insert sync record failed: " . mysqli_error($this->_con));}return ['action' => 'created','tid' => $this->_tid,'pid' => $this->_pid];}public function __destruct() {if ($this->_con instanceof mysqli) {$this->_con->close();}}
}

使用方法

curl --location 'http://d.example.com/topic_only.php' \
--header 'AccessKey: my-access-key' \
--header 'AccessSecret: my-access-secret' \
--header 'Content-Type: application/json' \
--data '{"fid": "2","title": "测试标题0816","content": "这是一个测试内容。","foreign_id": "9966","post_time": "2024-08-16 10:00:00"
}
'

跟参考的代码相比,这里做了一个简单的鉴权,AccessKey AccessSecret与php代码里保持一致才可调用。本来像参考oss写个签名方法,还是先不搞这么复杂了。

由于采集站没有源站帖子id,则写一个根据标题更新内容的api

update_by_title.php

<?php
date_default_timezone_set('Asia/Shanghai');
header('Content-Type: application/json');// 定义允许的 accesskey 和 accesssecret
define('ACCESS_KEY', 'my-access-key');
define('ACCESS_SECRET', 'my-access-secret');// 获取并统一转换请求头为小写
$headers = array_change_key_case(getallheaders(), CASE_LOWER);// 检查 accesskey 和 accesssecret 是否存在且匹配
if (!isset($headers['accesskey']) || !isset($headers['accesssecret'])) {http_response_code(403);echo json_encode(['status' => 'error', 'message' => 'Missing AccessKey or AccessSecret']);exit;
}if ($headers['accesskey'] !== ACCESS_KEY || $headers['accesssecret'] !== ACCESS_SECRET) {http_response_code(403);echo json_encode(['status' => 'error', 'message' => 'Invalid AccessKey or AccessSecret']);exit;
}// 接收并解析 JSON 输入
$input = file_get_contents('php://input');
$data = json_decode($input, true);// 检查必要字段if (!isset($data['fid'], $data['title'], $data['content']) ||(!isset($data['foreign2_id']) && !isset($data['foreign3_id']))) {echo json_encode(['status' => 'error', 'message' => 'Missing required parameters: fid, title, content, and either foreign2_id or foreign3_id']);exit;}$fid = $data['fid'];
$title = $data['title'];
$content = $data['content'];
$foreign2_id = $data['foreign2_id'] ?? null;
$foreign3_id = $data['foreign3_id'] ?? null;try {// 初始化数据库连接$con = mysqli_connect('mysql', 'root', 'pass', 'ultrax', 3306);if (!$con) {throw new Exception("Database connection failed");}// 查找 title 对应的主题 ID(tid)$sql = "SELECT tid FROM pre_forum_thread WHERE subject = '{$title}' AND fid = '{$fid}' LIMIT 1";$res = mysqli_query($con, $sql);if (!$res || mysqli_num_rows($res) === 0) {throw new Exception("No thread found with the given title and fid");}$row = mysqli_fetch_assoc($res);$tid = $row['tid'];// 获取主帖 pid(通常 position = 1)$sql = "SELECT pid FROM pre_forum_post WHERE tid = '{$tid}' AND position = 1 ORDER BY dateline DESC LIMIT 1";$res = mysqli_query($con, $sql);if (!$res || mysqli_num_rows($res) === 0) {throw new Exception("Main post not found for the thread");}$row = mysqli_fetch_assoc($res);$pid = $row['pid'];// 更新帖子内容$sql = "UPDATE pre_forum_post SET message = '{$content}' WHERE pid = '{$pid}'";if (!mysqli_query($con, $sql)) {throw new Exception("Update post content failed: " . mysqli_error($con));}// 更新同步记录表中的 foreign2_idif (isset($data['foreign2_id'])) {// 更新 foreign2_id 字段$sql = "UPDATE pre_forum_post_syncSET foreign2_id = '{$foreign2_id}'WHERE tid = '{$tid}' AND pid = '{$pid}'";} elseif (isset($data['foreign3_id'])) {// 新增 foreign3_id 字段更新逻辑$sql = "UPDATE pre_forum_post_syncSET foreign3_id = '{$foreign3_id}'WHERE tid = '{$tid}' AND pid = '{$pid}'";}if (!mysqli_query($con, $sql)) {throw new Exception("Update sync record failed: " . mysqli_error($con));}$updateFields = [];if (isset($data['foreign2_id'])) {$updateFields[] = 'foreign2_id';}if (isset($data['foreign3_id'])) {$updateFields[] = 'foreign3_id';}echo json_encode(['status' => 'success','data' => ['tid' => $tid,'pid' => $pid,'updated_fields' => $updateFields,'message' => 'Post updated successfully']]);} catch (Exception $e) {echo json_encode(['status' => 'error', 'message' => $e->getMessage()]);
}

使用方法

curl --location 'https://d.example.com/update_by_title.php' \
--header 'AccessKey: my-access-key' \
--header 'AccessSecret: my-access-secret' \
--header 'Content-Type: application/json' \
--data '{"fid": "2","title": "测试标题","content": "这是一个测试内容8888872","foreign3_id": "123456"
}
'

 这里 "foreign3_id": "123456"也可以改成  "foreign2_id": "123456",当有多个采集站时扩充数据库字段修改代码即可。

推送新帖到企微群api

wechat_pusher.php

<?php
date_default_timezone_set('Asia/Shanghai');
header('Content-Type: application/json');// 获取并统一转换请求头为小写
$headers = array_change_key_case(getallheaders(), CASE_LOWER);// 检查 accesskey 和 accesssecret 是否存在且匹配
if (!isset($headers['accesskey']) || !isset($headers['accesssecret'])) {http_response_code(403);die(json_encode(['status' => 'error', 'message' => 'Missing AccessKey or AccessSecret']));
}define('ACCESS_KEY', 'my-access-key');
define('ACCESS_SECRET', 'my-access-secret');if ($headers['accesskey'] !== ACCESS_KEY || $headers['accesssecret'] !== ACCESS_SECRET) {http_response_code(403);die(json_encode(['status' => 'error', 'message' => 'Invalid AccessKey or AccessSecret']));
}// 微信机器人 Webhook 地址(替换为你的)
$webhook_url = 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=youruuid';// 数据库连接配置
$con = mysqli_connect('mysql', 'root', 'pass', 'ultrax', 3306);
if (!$con) {die(json_encode(['status' => 'error', 'message' => 'Database connection failed']));
}// 获取当前时间和30分钟前的时间
$now = date('Y-m-d H:i:s');
$thirty_minutes_ago = date('Y-m-d H:i:s', strtotime('-30 minutes'));// 查询最近30分钟发布的帖子(只取主帖 position = 1)
$sql = "SELECTp.tid,p.pid,t.subject AS title,p.message AS contentFROMpre_forum_post pJOINpre_forum_thread t ON p.tid = t.tidWHEREp.dateline >= UNIX_TIMESTAMP('$thirty_minutes_ago')AND p.position = 1AND NOT EXISTS (SELECT 1 FROM pre_wechat_push_log lWHERE l.tid = p.tid AND l.pid = p.pid)
";$res = mysqli_query($con, $sql);if (!$res) {die(json_encode(['status' => 'error', 'message' => 'Query failed: ' . mysqli_error($con)]));
}while ($row = mysqli_fetch_assoc($res)) {$title = trim($row['title']);$content = trim($row['content']);// 屏蔽以“这是主题内容:”开头的帖子if (mb_strpos($content, '这是主题内容:') === 0) {continue; // 跳过该帖子}// 替换由反引号包裹的 [img] 标签,并转换为 [图片1](url) 的 Markdown 链接格式$imgCount = 0;$content = preg_replace_callback('/`\[img\](.+?)\[\/img\]`/is',  // 匹配反引号内的 [img]标签[/img]function ($matches) use (&$imgCount) {$imgCount++;$url = htmlspecialchars($matches[1]);return "[图片{$imgCount}]({$url})";},$content);// 构造微信消息体(Markdown 格式)$message = "### 新帖子通知\n\n**标题:** {$title}\n\n**内容预览:**\n\n" . mb_substr($content, 0, 200);$postData = json_encode(['msgtype' => 'markdown','markdown' => ['content' => $message]]);// 发送请求$ch = curl_init();curl_setopt($ch, CURLOPT_URL, $webhook_url);curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);$response = curl_exec($ch);curl_close($ch);// 记录推送日志$insert_sql = "INSERT INTO pre_wechat_push_log (tid, pid)VALUES ({$row['tid']}, {$row['pid']})";if (!mysqli_query($con, $insert_sql)) {error_log("Failed to log push record for tid={$row['tid']} pid={$row['pid']}: " . mysqli_error($con));}
}echo json_encode(['status' => 'success', 'message' => 'Push job completed']);
?>

调用

curl --location --request POST 'https://d.example.com/wechat_pusher.php' \
--header 'AccessKey: my-access-key' \
--header 'AccessSecret: my-access-secret' \
--header 'Content-Type: application/json'

这里用post get都可以。

把这3个php文件防弹discuz安装目录下,后续就可以通过调用API实现帖子同步和新帖通知操作了。

相关文章:

DiscuzX3.5发帖json api

参考文章&#xff1a;PHP实现独立Discuz站外发帖(直连操作数据库)_discuz 发帖api-CSDN博客 简单改造了一下&#xff0c;适配我自己的需求 有一个站点存在多个采集站&#xff0c;我想通过主站拿标题&#xff0c;采集站拿内容 使用到的sql如下 CREATE TABLE pre_forum_post_…...

第一篇:Liunx环境下搭建PaddlePaddle 3.0基础环境(Liunx Centos8.5安装Python3.10+pip3.10)

第一篇&#xff1a;Liunx环境下搭建PaddlePaddle 3.0基础环境&#xff08;Liunx Centos8.5安装Python3.10pip3.10&#xff09; 一&#xff1a;前言二&#xff1a;安装编译依赖二&#xff1a;安装Python3.10三&#xff1a;安装PIP3.10四&#xff1a;安装Paddlepaddle基础框架4.1…...

自然语言处理——文本分类

文本分类 传统机器学习方法文本表示向量空间模型 特征选择文档频率互信息信息增益&#xff08;IG&#xff09; 分类器设计贝叶斯理论&#xff1a;线性判别函数 文本分类性能评估P-R曲线ROC曲线 将文本文档或句子分类为预定义的类或类别&#xff0c; 有单标签多类别文本分类和多…...

高考志愿填报管理系统---开发介绍

高考志愿填报管理系统是一款专为教育机构、学校和教师设计的学生信息管理和志愿填报辅助平台。系统基于Django框架开发&#xff0c;采用现代化的Web技术&#xff0c;为教育工作者提供高效、安全、便捷的学生管理解决方案。 ## &#x1f4cb; 系统概述 ### &#x1f3af; 系统定…...

使用SSE解决获取状态不一致问题

使用SSE解决获取状态不一致问题 1. 问题描述2. SSE介绍2.1 SSE 的工作原理2.2 SSE 的事件格式规范2.3 SSE与其他技术对比2.4 SSE 的优缺点 3. 实战代码 1. 问题描述 目前做的一个功能是上传多个文件&#xff0c;这个上传文件是整体功能的一部分&#xff0c;文件在上传的过程中…...

【安全篇】金刚不坏之身:整合 Spring Security + JWT 实现无状态认证与授权

摘要 本文是《Spring Boot 实战派》系列的第四篇。我们将直面所有 Web 应用都无法回避的核心问题&#xff1a;安全。文章将详细阐述认证&#xff08;Authentication) 与授权&#xff08;Authorization的核心概念&#xff0c;对比传统 Session-Cookie 与现代 JWT&#xff08;JS…...

软件工程 期末复习

瀑布模型&#xff1a;计划 螺旋模型&#xff1a;风险低 原型模型: 用户反馈 喷泉模型:代码复用 高内聚 低耦合&#xff1a;模块内部功能紧密 模块之间依赖程度小 高内聚&#xff1a;指的是一个模块内部的功能应该紧密相关。换句话说&#xff0c;一个模块应当只实现单一的功能…...

spring Security对RBAC及其ABAC的支持使用

RBAC (基于角色的访问控制) RBAC (Role-Based Access Control) 是 Spring Security 中最常用的权限模型&#xff0c;它将权限分配给角色&#xff0c;再将角色分配给用户。 RBAC 核心实现 1. 数据库设计 users roles permissions ------- ------…...

【FTP】ftp文件传输会丢包吗?批量几百个文件传输,有一些文件没有传输完整,如何解决?

FTP&#xff08;File Transfer Protocol&#xff09;本身是一个基于 TCP 的协议&#xff0c;理论上不会丢包。但 FTP 文件传输过程中仍可能出现文件不完整、丢失或损坏的情况&#xff0c;主要原因包括&#xff1a; ✅ 一、FTP传输可能“丢包”或文件不完整的原因 原因描述网络…...

es6+和css3新增的特性有哪些

一&#xff1a;ECMAScript 新特性&#xff08;ES6&#xff09; ES6 (2015) - 革命性更新 1&#xff0c;记住的方法&#xff0c;从一个方法里面用到了哪些技术 1&#xff0c;let /const块级作用域声明2&#xff0c;**默认参数**&#xff1a;函数参数可以设置默认值。3&#x…...

算法打卡第18天

从中序与后序遍历序列构造二叉树 (力扣106题) 给定两个整数数组 inorder 和 postorder &#xff0c;其中 inorder 是二叉树的中序遍历&#xff0c; postorder 是同一棵树的后序遍历&#xff0c;请你构造并返回这颗 二叉树 。 示例 1: 输入&#xff1a;inorder [9,3,15,20,7…...

Visual Studio Code 扩展

Visual Studio Code 扩展 change-case 大小写转换EmmyLua for VSCode 调试插件Bookmarks 书签 change-case 大小写转换 https://marketplace.visualstudio.com/items?itemNamewmaurer.change-case 选中单词后&#xff0c;命令 changeCase.commands 可预览转换效果 EmmyLua…...

Kubernetes 节点自动伸缩(Cluster Autoscaler)原理与实践

在 Kubernetes 集群中&#xff0c;如何在保障应用高可用的同时有效地管理资源&#xff0c;一直是运维人员和开发者关注的重点。随着微服务架构的普及&#xff0c;集群内各个服务的负载波动日趋明显&#xff0c;传统的手动扩缩容方式已无法满足实时性和弹性需求。 Cluster Auto…...

【深度学习新浪潮】什么是credit assignment problem?

Credit Assignment Problem(信用分配问题) 是机器学习,尤其是强化学习(RL)中的核心挑战之一,指的是如何将最终的奖励或惩罚准确地分配给导致该结果的各个中间动作或决策。在序列决策任务中,智能体执行一系列动作后获得一个最终奖励,但每个动作对最终结果的贡献程度往往…...

阿里云Ubuntu 22.04 64位搭建Flask流程(亲测)

cd /home 进入home盘 安装虚拟环境&#xff1a; 1、安装virtualenv pip install virtualenv 2.创建新的虚拟环境&#xff1a; virtualenv myenv 3、激活虚拟环境&#xff08;激活环境可以在当前环境下安装包&#xff09; source myenv/bin/activate 此时&#xff0c;终端…...

面试高频问题

文章目录 &#x1f680; 消息队列核心技术揭秘&#xff1a;从入门到秒杀面试官1️⃣ Kafka为何能"吞云吐雾"&#xff1f;性能背后的秘密1.1 顺序写入与零拷贝&#xff1a;性能的双引擎1.2 分区并行&#xff1a;数据的"八车道高速公路"1.3 页缓存与批量处理…...

xmind转换为markdown

文章目录 解锁思维导图新姿势&#xff1a;将XMind转为结构化Markdown 一、认识Xmind结构二、核心转换流程详解1.解压XMind文件&#xff08;ZIP处理&#xff09;2.解析JSON数据结构3&#xff1a;递归转换树形结构4&#xff1a;Markdown层级生成逻辑 三、完整代码 解锁思维导图新…...

【WebSocket】SpringBoot项目中使用WebSocket

1. 导入坐标 如果springboot父工程没有加入websocket的起步依赖&#xff0c;添加它的坐标的时候需要带上版本号。 <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-websocket</artifactId> </dep…...

恶补电源:1.电桥

一、元器件的选择 搜索并选择电桥&#xff0c;再multisim中选择FWB&#xff0c;就有各种型号的电桥: 电桥是用来干嘛的呢&#xff1f; 它是一个由四个二极管搭成的“桥梁”形状的电路&#xff0c;用来把交流电&#xff08;AC&#xff09;变成直流电&#xff08;DC&#xff09;。…...

论文阅读:Matting by Generation

今天介绍一篇关于 matting 抠图的文章&#xff0c;抠图也算是计算机视觉里面非常经典的一个任务了。从早期的经典算法到如今的深度学习算法&#xff0c;已经有很多的工作和这个任务相关。这两年 diffusion 模型很火&#xff0c;大家又开始用 diffusion 模型做各种 CV 任务了&am…...

Neko虚拟浏览器远程协作方案:Docker+内网穿透技术部署实践

前言&#xff1a;本文将向开发者介绍一款创新性协作工具——Neko虚拟浏览器。在数字化协作场景中&#xff0c;跨地域的团队常需面对实时共享屏幕、协同编辑文档等需求。通过本指南&#xff0c;你将掌握在Ubuntu系统中使用容器化技术部署该工具的具体方案&#xff0c;并结合内网…...

实战设计模式之模板方法模式

概述 模板方法模式定义了一个操作中的算法骨架&#xff0c;并将某些步骤延迟到子类中实现。模板方法使得子类可以在不改变算法结构的前提下&#xff0c;重新定义算法中的某些步骤。简单来说&#xff0c;就是在一个方法中定义了要执行的步骤顺序或算法框架&#xff0c;但允许子类…...

【Linux】Linux安装并配置RabbitMQ

目录 1. 安装 Erlang 2. 安装 RabbitMQ 2.1.添加 RabbitMQ 仓库 2.2.安装 RabbitMQ 3.配置 3.1.启动和管理服务 4. 访问管理界面 5.安装问题 6.修改密码 7.修改端口 7.1.找到文件 7.2.修改文件 1. 安装 Erlang 由于 RabbitMQ 是用 Erlang 编写的&#xff0c;需要先安…...

Python训练营-Day26-函数专题1:函数定义与参数

题目1&#xff1a;计算圆的面积 任务&#xff1a; 编写一个名为 calculate_circle_area 的函数&#xff0c;该函数接收圆的半径 radius 作为参数&#xff0c;并返回圆的面积。圆的面积 π * radius (可以使用 math.pi 作为 π 的值)要求&#xff1a;函数接收一个位置参数 radi…...

【Kafka】Kafka从入门到实战:构建高吞吐量分布式消息系统

Kafka从入门到实战:构建高吞吐量分布式消息系统 一、Kafka概述 Apache Kafka是一个分布式流处理平台,最初由LinkedIn开发,后成为Apache顶级项目。它被设计用于高吞吐量、低延迟的消息处理,能够处理来自多个生产者的海量数据,并将这些数据实时传递给消费者。 Kafka核心特…...

Android写一个捕获全局异常的工具类

项目开发和实际运行过程中难免会遇到异常发生&#xff0c;系统提供了一个可以捕获全局异常的工具Uncaughtexceptionhandler&#xff0c;它是Thread的子类&#xff08;就是package java.lang;里线程的Thread&#xff09;。本文将利用它将设备信息、报错信息以及错误的发生时间都…...

人工智能 - 在Dify、Coze、n8n、FastGPT和RAGFlow之间做出技术选型

在Dify、Coze、n8n、FastGPT和RAGFlow之间做出技术选型。这些平台各有侧重&#xff0c;适用场景差异显著。下面我将从核心功能定位、典型应用场景、真实体验痛点、选型决策关键点进行拆解&#xff0c;并提供具体场景下的推荐方案。 一、核心功能定位速览 平台核心定位技术栈亮…...

绕过 Xcode?使用 Appuploader和主流工具实现 iOS 上架自动化

iOS 应用的发布流程一直是开发链路中最“苹果味”的环节&#xff1a;强依赖 Xcode、必须使用 macOS、各种证书和描述文件配置……对很多跨平台开发者来说&#xff0c;这一套流程并不友好。 特别是当你的项目主要在 Windows 或 Linux 下开发&#xff08;例如 Flutter、React Na…...

C++_哈希表

本篇文章是对C学习的哈希表部分的学习分享 相信一定会对你有所帮助~ 那咱们废话不多说&#xff0c;直接开始吧&#xff01; 一、基础概念 1. 哈希核心思想&#xff1a; 哈希函数的作用&#xff1a;通过此函数建立一个Key与存储位置之间的映射关系。理想目标&#xff1a;实现…...

WEB3全栈开发——面试专业技能点P7前端与链上集成

一、Next.js技术栈 ✅ 概念介绍 Next.js 是一个基于 React 的 服务端渲染&#xff08;SSR&#xff09;与静态网站生成&#xff08;SSG&#xff09; 框架&#xff0c;由 Vercel 开发。它简化了构建生产级 React 应用的过程&#xff0c;并内置了很多特性&#xff1a; ✅ 文件系…...