emailTemplate.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766
  1. const sendEmail = require('./Email')
  2. class emailTemplate {
  3. stramptoTime(time) {
  4. if (time < 10)
  5. return '';
  6. return new Date(+time).toLocaleString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit' });
  7. }
  8. async checkEmail(email, code) {
  9. const time = new Date().getTime()
  10. await sendEmail(email, '哪吒乐跑 - 邮箱验证码',
  11. `<html lang="zh-CN">
  12. <head>
  13. <meta charset="UTF-8">
  14. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  15. <title>哪吒乐跑 - 邮箱验证码</title>
  16. <style>
  17. body {
  18. font-family: Arial, sans-serif;
  19. background-color: #f4f4f4;
  20. margin: 0;
  21. padding: 0;
  22. }
  23. .container {
  24. width: 80%;
  25. margin: 20px auto;
  26. background-color: #fff;
  27. padding: 20px;
  28. border-radius: 8px;
  29. box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  30. }
  31. .head {
  32. display: flex;
  33. justify-content: center;
  34. align-items: center;
  35. gap:10px;
  36. color: #2c3e50;
  37. }
  38. p {
  39. font-size: 16px;
  40. color: #34495e;
  41. line-height: 1.6;
  42. text-indent: 2em;
  43. }
  44. .code {
  45. margin: 20px 0;
  46. font-size: 1.5em;
  47. text-align: center;
  48. font-weight: bold;
  49. }
  50. .important {
  51. color: #e74c3c;
  52. font-weight: bold;
  53. }
  54. .footer {
  55. font-size: 14px;
  56. text-align: center;
  57. color: #7f8c8d;
  58. margin-top: 50px;
  59. }
  60. </style>
  61. </head>
  62. <body>
  63. <div class="container">
  64. <div class="head">
  65. <h2>哪吒乐跑 - 邮箱验证码</h2>
  66. </div>
  67. <p>尊敬的用户:</p>
  68. <p>您正在本站进行邮箱验证操作,如非您本人操作,请忽略此邮件。</p>
  69. <p>您的验证码为:</p>
  70. <div class="code">
  71. ${code}
  72. </div>
  73. <p class="important">验证码5分钟内有效,超时请重新获取</p>
  74. <p class="footer">Copyright © 2025 哪吒乐跑</p>
  75. </div>
  76. </body>
  77. </html>`
  78. )
  79. }
  80. async registerSuccess(email, username) {
  81. const time = new Date().getTime()
  82. await sendEmail(email, '您已成功注册哪吒乐跑账号',
  83. `<html lang="zh-CN">
  84. <head>
  85. <meta charset="UTF-8">
  86. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  87. <title>哪吒乐跑 - 注册成功提醒</title>
  88. <style>
  89. body {
  90. font-family: Arial, sans-serif;
  91. background-color: #f4f4f4;
  92. margin: 0;
  93. padding: 0;
  94. }
  95. .container {
  96. width: 80%;
  97. margin: 20px auto;
  98. background-color: #fff;
  99. padding: 20px;
  100. border-radius: 8px;
  101. box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  102. }
  103. .head {
  104. display: flex;
  105. justify-content: center;
  106. align-items: center;
  107. gap: 10px;
  108. color: #2c3e50;
  109. }
  110. p {
  111. font-size: 16px;
  112. color: #34495e;
  113. line-height: 1.6;
  114. text-indent: 2em;
  115. }
  116. .info {
  117. background-color: #ecf0f1;
  118. padding: 15px;
  119. border-radius: 5px;
  120. margin: 20px 0;
  121. }
  122. .info p {
  123. margin: 5px 0;
  124. }
  125. .important {
  126. color: #e74c3c;
  127. font-weight: bold;
  128. }
  129. .footer {
  130. font-size: 14px;
  131. text-align: center;
  132. color: #7f8c8d;
  133. margin-top: 50px;
  134. }
  135. </style>
  136. </head>
  137. <body>
  138. <div class="container">
  139. <div class="head">
  140. <h2>哪吒乐跑 - 注册成功提醒</h2>
  141. </div>
  142. <p>尊敬的 ${username}:</p>
  143. <p>您已成功注册哪吒乐跑账号:</p>
  144. <div class="info">
  145. <p><strong>用户名:</strong> ${username}</p>
  146. <p><strong>注册时间:</strong> ${this.stramptoTime(time)}</p>
  147. </div>
  148. <p class="footer">Copyright © 2025 哪吒乐跑</p>
  149. </div>
  150. </body>
  151. </html>`
  152. )
  153. }
  154. async updateSuccess(email, data) {
  155. await sendEmail(email, '乐跑账号更新成功提醒',
  156. `<html lang="zh-CN">
  157. <head>
  158. <meta charset="UTF-8">
  159. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  160. <title>乐跑账号更新成功提醒</title>
  161. <style>
  162. body {
  163. font-family: Arial, sans-serif;
  164. background-color: #f4f4f4;
  165. margin: 0;
  166. padding: 0;
  167. }
  168. .container {
  169. width: 80%;
  170. margin: 20px auto;
  171. background-color: #fff;
  172. padding: 20px;
  173. border-radius: 8px;
  174. box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  175. }
  176. .head {
  177. display: flex;
  178. justify-content: center;
  179. align-items: center;
  180. gap: 10px;
  181. color: #2c3e50;
  182. }
  183. p {
  184. font-size: 16px;
  185. color: #34495e;
  186. line-height: 1.6;
  187. text-indent: 2em;
  188. }
  189. .info {
  190. background-color: #ecf0f1;
  191. padding: 15px;
  192. border-radius: 5px;
  193. margin: 20px 0;
  194. }
  195. .info p {
  196. margin: 5px 0;
  197. }
  198. .important {
  199. color: #e74c3c;
  200. font-weight: bold;
  201. }
  202. .footer {
  203. font-size: 14px;
  204. text-align: center;
  205. color: #7f8c8d;
  206. margin-top: 50px;
  207. }
  208. </style>
  209. </head>
  210. <body>
  211. <div class="container">
  212. <div class="head">
  213. <h2>乐跑账号更新好啦,宝宝快看看~ 🎉💖✨</h2>
  214. </div>
  215. <p>亲爱的 ${data.name} 宝宝 🌸:</p>
  216. <p>嘻嘻~ 你已经成功更新了乐跑账号的登录信息啦 🥰💌:</p>
  217. <div class="info">
  218. <p><strong>学号:</strong> ${data.account} 🎓</p>
  219. <p><strong>年级:</strong> ${data.grade_id} 📚</p>
  220. <p><strong>学院:</strong> ${data.academy_name} 🏫</p>
  221. <p><strong>更新时间:</strong> ${this.stramptoTime(new Date().getTime())} ⏰</p>
  222. </div>
  223. <p class="important">
  224. ${data.auto_run === 0
  225. ? '现在还没有帮宝宝开启自动乐跑呢 🐾💦 如果想要开始跑跑的话,记得登录后去哪吒乐跑手动点一下哦~ 🌈💕'
  226. : '已经为宝宝开启了自动乐跑啦 🏃‍♀️✨ 登录后系统会乖乖替你完成乐跑 💖 记得留意邮箱提醒哟~ 📬'}
  227. </p>
  228. <p class="important">宝宝要记得不要在其他设备上登录“智慧体育”小程序哦 🚫📱,不然会失效,到时候又要重新登录啦 😢💦~</p>
  229. <p class="important">有问题随时喊哪吒乐跑客服小可爱呀 💕💌 我们都会耐心陪宝宝解决的哟 ✨🥰</p>
  230. <p class="footer">Copyright © 2025 哪吒乐跑 🌟</p>
  231. </div>
  232. </body>
  233. </html>`
  234. )
  235. }
  236. async lepaoOver(email, data) {
  237. await sendEmail(email, '🎉乐跑完成祝贺',
  238. `<!DOCTYPE html>
  239. <html lang="zh-CN">
  240. <head>
  241. <meta charset="UTF-8">
  242. <title>🎉 哪吒乐跑 - 乐跑完成祝贺</title>
  243. <style>
  244. body {
  245. background-color: #fffaf4;
  246. margin: 0;
  247. padding: 0;
  248. font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  249. }
  250. .container {
  251. max-width: 620px;
  252. margin: 40px auto;
  253. padding: 30px;
  254. background-color: #fff;
  255. border-radius: 14px;
  256. box-shadow: 0 8px 25px rgba(255, 183, 77, 0.2);
  257. border: 2px dashed #ffe0b2;
  258. }
  259. .head {
  260. text-align: center;
  261. margin-bottom: 30px;
  262. }
  263. .head h2 {
  264. color: #ff7043;
  265. font-size: 26px;
  266. margin: 0;
  267. }
  268. p {
  269. color: #444;
  270. font-size: 16px;
  271. line-height: 1.8;
  272. }
  273. .info {
  274. background-color: #fff3e0;
  275. border-left: 5px solid #ffb74d;
  276. padding: 15px 20px;
  277. margin: 25px 0;
  278. border-radius: 10px;
  279. }
  280. .info p {
  281. margin: 8px 0;
  282. }
  283. .footer {
  284. text-align: center;
  285. color: #bbb;
  286. font-size: 14px;
  287. margin-top: 40px;
  288. }
  289. .highlight {
  290. color: #ff5722;
  291. font-weight: bold;
  292. }
  293. </style>
  294. </head>
  295. <body>
  296. <div class="container">
  297. <div class="head">
  298. <h2>乐跑目标完成🎉</h2>
  299. </div>
  300. <p>亲爱的 <span class="highlight">${data.name}</span> 宝宝 ꒰。•ᴗ•。꒱:</p>
  301. <p>
  302. ✨恭喜恭喜~你已经火力全开地完成了本月设定的乐跑目标啦!🎊<br>
  303. 不得不说,你就是我们心中的 <strong>小跑神</strong> 🌟💨,坚持到最后真的超级棒!💪( •̀ᄇ• ́)و
  304. </p>
  305. <p>
  306. 跑过的风,晒过的阳,每一步都是你努力的见证!🌤️🍃<br>
  307. 我们在远程为你打Call中 📣📣📣 ~真的好佩服佩服你!
  308. </p>
  309. <p>
  310. 这一学期和你一起“并肩作战”,我们感到非常幸运!🧡<br>
  311. 希望你收获了健康,也收获了快乐~o(≧▽≦)o
  312. </p>
  313. <p>
  314. 📬 如果有任何问题,随时给我们戳小窗~我们在线等你哟 (´▽`)ノ♪
  315. </p>
  316. <div class="info">
  317. <p><strong>本月目标里程:</strong> ${(Number(data.target_km) || 0).toFixed(2)} Km 🎉</p>
  318. <p><strong>本月累计里程:</strong> ${(Number(data.month_km) || 0).toFixed(2)} Km 🎉</p>
  319. </div>
  320. <p>
  321. 🥳 祝你假期躺赢、学习加buff、每天都开心到冒泡泡!✧*。٩(ˊᗜˋ*)و✧*。<br>
  322. 📚 新学期我们一起继续加速奔跑吧~Let's gooo!🔥🔥
  323. </p>
  324. <p>
  325. 🧡我们已经为您关闭了自动乐跑功能,如您需要继续乐跑,还可前往哪吒乐跑自行开启哦!
  326. </p>
  327. <p class="footer">Copyright © 2025 哪吒乐跑</p>
  328. </div>
  329. </body>
  330. </html>
  331. `
  332. )
  333. }
  334. async lepaoSuccess(email, data) {
  335. await sendEmail(email, '乐跑成功提醒',
  336. `<html lang="zh-CN">
  337. <head>
  338. <meta charset="UTF-8">
  339. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  340. <title>乐跑成功提醒</title>
  341. <style>
  342. body {
  343. font-family: Arial, sans-serif;
  344. background-color: #f4f4f4;
  345. margin: 0;
  346. padding: 0;
  347. }
  348. .container {
  349. width: 80%;
  350. margin: 20px auto;
  351. background-color: #fff;
  352. padding: 20px;
  353. border-radius: 8px;
  354. box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  355. }
  356. .head {
  357. display: flex;
  358. justify-content: center;
  359. align-items: center;
  360. gap: 10px;
  361. color: #2c3e50;
  362. }
  363. p {
  364. font-size: 16px;
  365. color: #34495e;
  366. line-height: 1.6;
  367. text-indent: 2em;
  368. }
  369. .info {
  370. background-color: #ecf0f1;
  371. padding: 15px;
  372. border-radius: 5px;
  373. margin: 20px 0;
  374. }
  375. .info p {
  376. margin: 5px 0;
  377. }
  378. .important {
  379. color: #e74c3c;
  380. font-weight: bold;
  381. }
  382. .footer {
  383. font-size: 14px;
  384. text-align: center;
  385. color: #7f8c8d;
  386. margin-top: 50px;
  387. }
  388. </style>
  389. </head>
  390. <body>
  391. <div class="container">
  392. <div class="head">
  393. <h2>乐跑成功啦 🎉💖</h2>
  394. </div>
  395. <p>亲爱的 ${data.name} 宝宝:</p>
  396. <p>耶耶耶~ 我们已经乖乖帮你完成了一次乐跑啦 ✨🏃‍♀️💨</p>
  397. <div class="info">
  398. <p><strong>学号:</strong> ${data.account}</p>
  399. <p><strong>跑区:</strong> ${data.run_zone_name ?? data.pass_tit ?? '—'} 🌈</p>
  400. <p><strong>跑步时间:</strong> ${this.formatSecondsToMinSec(data.time)} ⏱️</p>
  401. <p><strong>平均配速:</strong> ${this.calculatePace(data.time, data.distance)} 🐇</p>
  402. <p><strong>跑步距离:</strong> ${data.distance} Km 💕</p>
  403. <p><strong>本月累计:</strong> ${(Number(data.month_km) || 0).toFixed(2)} Km ✨</p>
  404. <p><strong>本月目标:</strong> ${Number(data.target_km) === 0 ? '不限' : `${(Number(data.target_km) || 0).toFixed(2)} Km`} 🎯</p>
  405. <p><strong>累计总里程:</strong> ${(Number(data.total_km) || 0).toFixed(2)} Km 🧾</p>
  406. </div>
  407. <p class="important">如果宝宝开启了自动乐跑,要记得不要在其他设备上登录“智慧体育”小程序哦 🚫📱,不然登录就会失效,要重新来一次啦~</p>
  408. <p class="important">有问题随时找哪吒乐跑客服小可爱呀 💌 我们会陪你耐心解决的~</p>
  409. <p class="footer">Copyright © 2025 哪吒乐跑 ✨</p>
  410. </div>
  411. </body>
  412. </html>`
  413. )
  414. }
  415. async lepaoFail(email, data) {
  416. const time = new Date().getTime()
  417. await sendEmail(email, '乐跑失败提醒',
  418. `<html lang="zh-CN">
  419. <head>
  420. <meta charset="UTF-8">
  421. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  422. <title>乐跑失败提醒</title>
  423. <style>
  424. body {
  425. font-family: Arial, sans-serif;
  426. background-color: #f4f4f4;
  427. margin: 0;
  428. padding: 0;
  429. }
  430. .container {
  431. width: 80%;
  432. margin: 20px auto;
  433. background-color: #fff;
  434. padding: 20px;
  435. border-radius: 8px;
  436. box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  437. }
  438. .head {
  439. display: flex;
  440. justify-content: center;
  441. align-items: center;
  442. gap: 10px;
  443. color: #2c3e50;
  444. }
  445. p {
  446. font-size: 16px;
  447. color: #34495e;
  448. line-height: 1.6;
  449. text-indent: 2em;
  450. }
  451. .info {
  452. background-color: #ecf0f1;
  453. padding: 15px;
  454. border-radius: 5px;
  455. margin: 20px 0;
  456. }
  457. .info p {
  458. margin: 5px 0;
  459. }
  460. .important {
  461. color: #e74c3c;
  462. font-weight: bold;
  463. }
  464. .footer {
  465. font-size: 14px;
  466. text-align: center;
  467. color: #7f8c8d;
  468. margin-top: 50px;
  469. }
  470. </style>
  471. </head>
  472. <body>
  473. <div class="container">
  474. <div class="head">
  475. <h2>乐跑没有成功呢 😢💦</h2>
  476. </div>
  477. <p>亲爱的 ${data.name ?? data.account} 宝宝 🌸:</p>
  478. <p>我们刚刚尝试帮你完成乐跑的时候,遇到了一点小意外呢 💔💦:</p>
  479. <div class="info">
  480. <p><strong>学号:</strong> ${data.account} 🎓</p>
  481. <p><strong>时间:</strong> ${this.stramptoTime(time)} ⏰</p>
  482. <p><strong>失败原因:</strong> ${data.reason} 😭</p>
  483. </div>
  484. <p class="important">宝宝如果是登录失效的话 🥺✨,要记得重新启动哪吒乐跑乐跑登录器,再登录“智慧体育”小程序就可以啦 💕</p>
  485. <p class="important">如果还是不懂,随时可以来找哪吒乐跑客服小可爱哟 💌 我们会耐心陪宝宝解决问题的 🌈🥰</p>
  486. <p class="footer">Copyright © 2025 哪吒乐跑 💖</p>
  487. </div>
  488. </body>
  489. </html>`
  490. )
  491. }
  492. async orderNewReply(email, data) {
  493. await sendEmail(email, '哪吒乐跑 - 工单状态更新提醒',
  494. `<html lang="zh-CN">
  495. <head>
  496. <meta charset="UTF-8">
  497. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  498. <title>工单状态更新提醒</title>
  499. <style>
  500. body {
  501. font-family: Arial, sans-serif;
  502. background-color: #f4f4f4;
  503. margin: 0;
  504. padding: 0;
  505. }
  506. .container {
  507. width: 80%;
  508. margin: 20px auto;
  509. background-color: #fff;
  510. padding: 20px;
  511. border-radius: 8px;
  512. box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  513. }
  514. .head {
  515. display: flex;
  516. justify-content: center;
  517. align-items: center;
  518. gap: 10px;
  519. color: #2c3e50;
  520. }
  521. p {
  522. font-size: 16px;
  523. color: #34495e;
  524. line-height: 1.6;
  525. text-indent: 2em;
  526. }
  527. .info {
  528. background-color: #ecf0f1;
  529. padding: 15px;
  530. border-radius: 5px;
  531. margin: 20px 0;
  532. }
  533. .info p {
  534. margin: 5px 0;
  535. }
  536. .important {
  537. color: #e74c3c;
  538. font-weight: bold;
  539. }
  540. .footer {
  541. font-size: 14px;
  542. text-align: center;
  543. color: #7f8c8d;
  544. margin-top: 50px;
  545. }
  546. </style>
  547. </head>
  548. <body>
  549. <div class="container">
  550. <div class="head">
  551. <h2>工单状态更新提醒</h2>
  552. </div>
  553. <p>尊敬的用户:</p>
  554. <p>您编号为${data.id}的工单有新的回复:</p>
  555. <div class="info">
  556. <p><strong>回复内容:</strong> ${data.content}</p>
  557. <p><strong>回复时间:</strong> ${this.stramptoTime(new Date().getTime())}</p>
  558. </div>
  559. <p class="important">${data.files.length > 0 ? '当前回复内含有附件,前往哪吒乐跑官网内查看' : ''}</p>
  560. <p class="important">请前往哪吒乐跑官网回复工单,请勿直接回复邮件。</p>
  561. <p class="footer">Copyright © 2025 哪吒乐跑</p>
  562. </div>
  563. </body>
  564. </html>`
  565. )
  566. }
  567. async powerCheck(email, data) {
  568. await sendEmail(email, '宿舍电费提醒',
  569. `<html lang="zh-CN">
  570. <head>
  571. <meta charset="UTF-8">
  572. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  573. <title>宿舍电费提醒</title>
  574. <style>
  575. body {
  576. font-family: Arial, sans-serif;
  577. background-color: #f4f4f4;
  578. margin: 0;
  579. padding: 0;
  580. }
  581. .container {
  582. width: 80%;
  583. margin: 20px auto;
  584. background-color: #fff;
  585. padding: 20px;
  586. border-radius: 8px;
  587. box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  588. }
  589. .head {
  590. display: flex;
  591. justify-content: center;
  592. align-items: center;
  593. gap: 10px;
  594. color: #2c3e50;
  595. }
  596. p {
  597. font-size: 16px;
  598. color: #34495e;
  599. line-height: 1.6;
  600. text-indent: 2em;
  601. }
  602. .info {
  603. background-color: #ecf0f1;
  604. padding: 15px;
  605. border-radius: 5px;
  606. margin: 20px 0;
  607. }
  608. .info p {
  609. margin: 5px 0;
  610. }
  611. .important {
  612. color: #e74c3c;
  613. font-weight: bold;
  614. }
  615. .footer {
  616. font-size: 14px;
  617. text-align: center;
  618. color: #7f8c8d;
  619. margin-top: 50px;
  620. }
  621. </style>
  622. </head>
  623. <body>
  624. <div class="container">
  625. <div class="head">
  626. <h2>宿舍电费提醒</h2>
  627. </div>
  628. <p>尊敬的用户:</p>
  629. <p>${data.building}${data.room}宿舍电费已低于预设提醒阈值,请留意:</p>
  630. <div class="info">
  631. <p><strong>校区:</strong> ${data.area}</p>
  632. <p><strong>楼栋:</strong> ${data.building}</p>
  633. <p><strong>寝室号:</strong> ${data.room}</p>
  634. <p><strong>当前余额:</strong> ¥${data.now_balance}</p>
  635. <p><strong>提醒阈值:</strong> ¥${data.lowest}</p>
  636. <p><strong>扣费时间:</strong> ${data.now_change_time}</p>
  637. </div>
  638. <p class="important">当前电费已低于预设提醒阈值${Number(data.lowest - data.now_balance).toFixed(2)}元,请及时充值</p>
  639. <p class="footer">Copyright © 2025 哪吒乐跑 ✨</p>
  640. </div>
  641. </body>
  642. </html>`
  643. )
  644. }
  645. // 时长计算
  646. formatSecondsToMinSec(totalSeconds) {
  647. const minutes = Math.floor(totalSeconds / 60);
  648. const seconds = totalSeconds % 60;
  649. return `${minutes}分${seconds.toString().padStart(2, '0')}秒`;
  650. }
  651. // 配速计算
  652. calculatePace(seconds, kilometers) {
  653. const paceInSeconds = seconds / kilometers;
  654. const minutes = Math.floor(paceInSeconds / 60);
  655. const remainingSeconds = Math.round(paceInSeconds % 60);
  656. return `${minutes}'${remainingSeconds.toString().padStart(2, '0')}''`;
  657. }
  658. }
  659. const EmailTemplate = new emailTemplate()
  660. module.exports = EmailTemplate