{"size": 785, "ext": "js", "max_stars_repo_path": "lib/plugin/egg-dora-mailtemplate/app/utils/siteFunc.js", "max_stars_repo_name": "ThinkZ/DoraCMS", "max_stars_repo_stars_event_min_datetime": "2015-10-20T10:00:07.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-28T14:17:19.000Z", "max_issues_repo_path": "lib/plugin/egg-dora-mailtemplate/app/utils/siteFunc.js", "max_issues_repo_name": "ThinkZ/DoraCMS", "max_issues_repo_issues_event_min_datetime": "2015-10-22T02:42:13.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-19T12:51:52.000Z", "max_forks_repo_path": "lib/plugin/egg-dora-mailtemplate/app/utils/siteFunc.js", "max_forks_repo_name": "ThinkZ/DoraCMS", "max_forks_repo_forks_event_min_datetime": "2015-10-21T01:21:40.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T01:02:51.000Z"}
{"max_stars_count": 3588, "max_issues_count": 235, "max_forks_count": 1218, "avg_line_length": 21.2162162162, "max_line_length": 46, "alphanum_fraction": 0.5350318471}
/*
 * @Author: doramart
 * @Date: 2019-09-25 14:16:44
 * @Last Modified by: doramart
 * @Last Modified time: 2021-04-17 23:22:01
 */
'use strict';
const siteFunc = {
  // 定义模板类型
  emailTypeKey() {
    return {
      0: '找回密码',
      // 1: '注册激活',
      // 2: '管理员留言提醒',
      // 3: '联系管理员',
      // 4: '联系用户',
      // 5: 'Bug提醒',
      6: '留言提醒',
      // 7: '注册成功',
      8: '邮箱验证码', // 发送邮箱验证码
    };
  },
  renderHtmlByKey(html, dataSource, keysStr) {
    let renderHtml = html;
    const keyArr = keysStr.split(',');
    for (const aliasKey of keyArr) {
      const targetKey = 'tempkey_' + aliasKey;
      renderHtml = renderHtml.replace(
        new RegExp(targetKey, 'gi'),
        dataSource[aliasKey]
      );
    }
    return renderHtml;
  },
};
module.exports = siteFunc;
