Files
jj2/test_fund_monitor_email.php
LL 0cfefbebd8 feat: 添加基金监控系统基础功能
添加基金监控系统相关文件,包括邮件发送功能、基金数据配置、测试脚本等。主要包含以下内容:

1. 添加PHPMailer库及相关语言文件
2. 添加基金配置数据文件(fund_config.json, fund_names.json等)
3. 添加邮件发送测试脚本(test_email.php, test_fund_email.php等)
4. 添加.gitignore文件忽略不必要的文件
5. 添加composer.json配置依赖

Signed-off-by: LL <LL>
2025-12-12 14:14:07 +08:00

25 lines
690 B
PHP

<?php
require_once 'api.php';
// 创建API实例
$api = new FundMonitorAPI();
// 获取当前基金数据
$fundData = $api->getFundData();
// 使用API中已有的格式化方法生成邮件内容
$subject = "当前基金监控邮件 - " . date('Y年m月d日 H:i');
// 创建一个反射对象来访问私有方法
$reflection = new ReflectionClass($api);
$formatMethod = $reflection->getMethod('formatFundEmailContent');
$formatMethod->setAccessible(true);
$body = $formatMethod->invoke($api, $fundData);
// 发送监控邮件
if ($api->testEmail($subject, $body)) {
echo "当前基金监控邮件发送成功!";
} else {
echo "当前基金监控邮件发送失败!";
}
?>