前言
WordPress文件密码下载,对接公众号 密码30分钟随机生成,30分钟内单篇文章密码相同,避免多次生成密码,密码失效太快,支持各平台ai大模型。此插件只适配了我目前用的主题Zaxu,程序无加密,自行修改样式即可。此程序对接微信号功能参考了 http://github.com/wangvsa/wechat-robot 和 https://github.com/shiheme/wechat-robot-guoqing
发一个之前的老版本,不对接公众号的版本 下载地址 https://www.123684.com/s/uXJuVv-mN4U3
演示图


功能介绍
- 输入密码下载附件
- 对接微信公众号随机密码
- 公众号推送文章
- 单篇文章密码30分钟自动切换
- 对接AI大模型实现自动聊天
使用方法
文章页
新建文章后,如果想在文章底部加上附件下载就在编辑器底部找到下图设置

填写对应内容即可,选项留空前台不显示该内容,显示选项 选择隐藏前台也不显示该内容。
对接微信公众号
找到下方代码
add_action('parse_request', 'wechat_robot_redirect', 4);
function wechat_robot_redirect($wp)
{
if (isset($_GET['wechat'])) {
// 将这些替换为您的appid和secret
$robot = new WechatRobot("wechat", "你的appid", "你的密钥", true);
$robot->run();
}
}

在这里输入你的微信公众号 开发者ID(AppID) 和 开发者密码(AppSecret)
如何获取?
登录微信公众号平台 mp.weixin.qq.com 登录账号 找到 设置与开发 点击 开发接口管理 如下图

复制appid粘贴到上面的位置,密钥点击重置,扫码后重新获取 记得把服务器ip设置为IP白名单。

服务器地址改为 https://你的域名/?wechat token填写wechat 消息加解密方式选择明文模式。
对接AI大模型

// Call AI API for general responses
$api_key = 'sk-f7be23fa953e4a4fa71793788dd7292f'; // Hardcoded API key for demonstration purposes
if (!$api_key) {
$response = "无法获取API密钥,请联系管理员。";
} else {
$url = "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions";
$headers = array(
'Content-Type: application/json',
'Authorization: Bearer ' . $api_key
);
$data = json_encode(array(
"model" => "qwen-max",
"messages" => array(
array(
"role" => "user",
"content" => $msg
)
),
"enable_enhancement" => true
));
这个适配的是openai的,大部分大模型都支持,所以改接口 改密钥 改模型代码 理论支持所有大模型,例如腾讯混元 阿里通义千问 DeepSeek等。
文件下载
奶狗附件下载插件