Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx-serivce
/
glsk-analysis-admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit d81a56f6
authored
Jun 05, 2025
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
添加邮件发送
1 parent
90699bc4
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
426 additions
and
67 deletions
src/dto/email.dto.ts
src/email/email.controller.ts
src/email/email.service.ts
src/email/templates/function.point.ejs
src/main.ts
views/template.ejs
src/dto/email.dto.ts
View file @
d81a56f
...
...
@@ -26,6 +26,8 @@ export class EmailQueryDto {
sales_content
?:
string
;
training_materials
?:
string
;
scene_market
?:
string
;
reportData
?:
string
;
template
?:
string
;
}
class
MentorshipPage
{
count
:
number
;
...
...
src/email/email.controller.ts
View file @
d81a56f
...
...
@@ -21,4 +21,9 @@ export class EmailController {
return
'Email sending failed: '
+
error
;
}
}
@
Post
(
'preview'
)
@
Render
(
'template'
)
getIndex
(@
Body
()
query
:
EmailQueryDto
)
{
return
{
...
query
};
}
}
\ No newline at end of file
src/email/email.service.ts
View file @
d81a56f
...
...
@@ -19,35 +19,8 @@ export class EmailService {
// });
// }
async
sendMail
(
query
:
EmailQueryDto
):
Promise
<
void
>
{
const
{
to
,
subject
,
mentorship_page
,
supervisor_daily_page
,
extraction
,
sales_content
,
training_materials
,
scene_market
}
=
query
const
{
to
,
subject
,
mentorship_page
,
supervisor_daily_page
,
extraction
,
reportData
,
template
,
sales_content
,
training_materials
,
scene_market
}
=
query
Logger
.
log
(
supervisor_daily_page
,
'supervisor_daily_page'
)
// 模拟数据
const
weeklyData
=
[
{
date
:
'5.20 - 5.26'
,
totalPeople
:
11
,
validClicks
:
2
,
clickCount
:
2
,
activeItems
:
8
,
createdTasks
:
1
,
peakDay
:
'5.21、5.23 / 1'
,
highlight
:
true
},
];
const
reportData
=
[
{
title
:
'区域运营考核模版'
,
content
:
'用于提交督导当天店面的业绩、招聘、培训、客户接待和工作小结情况。'
,
discript
:
'每日提交份数(与店面上班人数有关) / 填报人数(所有关联该模版的员工数,包括当天请假或者休息的员工)(数据如下①)'
,
time
:
'2025/1/21'
},
{
title
:
'督导培训日报模版'
,
content
:
'用于提交督导给新员工培训记录(通过腾讯会议进行培训,然后填写该模版,模版内容包括培训类型、主题、人员、形式、腾讯会议连接、照片)。'
,
discript
:
'5.6-5.11,有 0 份提交记录。 / 填报人数(所有关联该模版的员工数,包括当天请假或者休息的员工)(数据如下①)'
,
time
:
'2025/2025/04/16/21'
}
]
const
assessmentList
=
[
{
date
:
'5.20(周二)'
,
...
...
@@ -83,15 +56,21 @@ export class EmailService {
code
:
1
,
//验证码
date
:
'2025-05-28'
,
//日期
sign
:
'系统邮件,回复无效。'
,
//发送的签名,当然也可以不要
weeklyData
,
reportData
,
assessmentList
,
mentorship_page
:
JSON
.
parse
(
mentorship_page
),
supervisor_daily_page
:
JSON
.
parse
(
supervisor_daily_page
),
extraction
:
JSON
.
parse
(
extraction
),
sales_content
:
JSON
.
parse
(
sales_content
),
training_materials
:
JSON
.
parse
(
training_materials
),
scene_market
:
JSON
.
parse
(
scene_market
)
mentorship_page
,
supervisor_daily_page
,
extraction
,
sales_content
,
training_materials
,
scene_market
,
reportData
,
template
// mentorship_page: mentorship_page,
// supervisor_daily_page: JSON.parse(supervisor_daily_page),
// extraction: JSON.parse(extraction),
// sales_content: JSON.parse(sales_content),
// training_materials: JSON.parse(training_materials),
// scene_market: JSON.parse(scene_market)
}
};
...
...
src/email/templates/function.point.ejs
View file @
d81a56f
...
...
@@ -10,7 +10,7 @@
border-collapse
:
collapse
;
width
:
100%
;
max-width
:
1200px
;
margin
:
20px
auto
;
margin
:
20px
0
;
}
th
,
...
...
@@ -39,7 +39,7 @@
<body>
<div>
<p>
各位领导、同事:
</p>
<p
style=
"text-indent: 2em;"
>
以下是重点功能上线后的使用情况,邮件中仅展示
5/20-5/26
的数据。
</p>
<p
style=
"text-indent: 2em;"
>
以下是重点功能上线后的使用情况,邮件中仅展示
<
%= locals.mentorship_page[0].formattedStart + ' 至 ' + locals.mentorship_page[0].formattedEnd %>
的数据。
</p>
<p
style=
"text-indent: 2em;"
>
所有的数据汇总文档:
<a
href=
"https://mcnywc2tcye7.feishu.cn/wiki/IOxow8gSUijONfkntpVcp7Wbnph"
>
所有数据汇总在线文档
</a></p>
...
...
@@ -59,10 +59,10 @@
<
% locals.mentorship_page.forEach(row=> { %>
<tr
class=
"highlight"
>
<td>
<
%= row.
date
%>
<
%= row.
formattedStart + ' 至 ' + row.formattedEnd
%>
</td>
<td>
<
%= row.
count
%>
<
%= row.
totalPopulation
%>
</td>
<td>
<
%= row.uniqueAccounts %>
...
...
@@ -71,7 +71,7 @@
<
%= row.count %>
</td>
<td>
<
%= row.peakDay
.date + ' / ' + row.peakDay.count
%>
<
%= row.peakDay
&&
row.peakDay.date
&&
row.peakDay.count ? `${row.peakDay.date} / ${row.peakDay.count}` : '-'
%>
</td>
</tr>
<
% }); %>
...
...
@@ -94,10 +94,10 @@
<
% locals.supervisor_daily_page.forEach(row=> { %>
<tr
class=
"highlight"
>
<td>
<
%= row.
date
%>
<
%= row.
formattedStart + ' 至 ' + row.formattedEnd
%>
</td>
<td>
<
%= row.
count
%>
<
%= row.
totalPopulation
%>
</td>
<td>
<
%= row.uniqueAccounts %>
...
...
@@ -116,6 +116,7 @@
</tbody>
</table>
<br
/>
<
% if (locals.reportData
&&
locals.reportData.length > 0) { %>
<p>
pc数据分析如下:
</p>
<p>
目前,建了三种日报模版(区域运营考核模版,督导培训日报模版,导师培训日报模版)。
</p>
<table>
...
...
@@ -124,6 +125,7 @@
<th></th>
<th>
模版内容
</th>
<th>
填写情况
</th>
<th>
填报人数
</th>
<th>
上线时间
</th>
</tr>
</thead>
...
...
@@ -131,22 +133,27 @@
<
% locals.reportData.forEach(row=> { %>
<tr>
<td>
<
%= row.t
itl
e %>
<
%= row.t
emplateNam
e %>
</td>
<td>
<
%= row.
c
ontent %>
<
%= row.
templateC
ontent %>
</td>
<td>
<
%= row.
discript
%>
<
%= row.
total
%>
</td>
<td>
<
%= row.time %>
<
%= row.descript %>
</td>
<td>
<
%= row.oinlineTime %>
</td>
</tr>
<
% }); %>
</tbody>
</table>
<br
/>
<
% } %>
<
% if (locals.template
&&
locals.template.length > 0) { %>
<p>
① 区域运营考核模版数据计算
</p>
<table>
<thead>
...
...
@@ -158,19 +165,19 @@
</tr>
</thead>
<tbody>
<
% locals.
assessmentList
.forEach(row=> { %>
<
% locals.
template
.forEach(row=> { %>
<tr
class=
"highlight"
>
<td>
<
%= row.date %>
</td>
<td>
<
%= row.
submi
t %>
<
%= row.
finishCoun
t %>
</td>
<td>
<
%= row.
fill
%>
<
%= row.
totalCount
%>
</td>
<td>
<
%= row.
submitRate %>%
<
%= row.
rate %>
</td>
</tr>
<
% }); %>
...
...
@@ -178,6 +185,7 @@
</table>
<p>
导师模版 上线时间(4.16) - 目前,业务端没开始用
</p>
<br
/>
<
% } %>
<h3>
2、
<span
style=
"text-decoration: underline;"
>
话术萃取 上线时间(4.16)
</span></h3>
<p>
数据库统计(浏览时长得是 60s以上 才会记录)
</p>
<table>
...
...
@@ -193,7 +201,7 @@
<
% locals.extraction.forEach(row=> { %>
<tr>
<td>
<
%= row.
title
%>
<
%= row.
formattedStart + ' - ' + row.formattedEnd
%>
</td>
<td>
<
%= row.count %>
...
...
@@ -228,7 +236,7 @@
<
% locals.sales_content.forEach(row=> { %>
<tr
class=
"highlight"
>
<td>
<
%= row.
date
%>
<
%= row.
formattedStart + ' - ' + row.formattedEnd
%>
</td>
<td>
<
%= row.count %>
...
...
@@ -237,9 +245,13 @@
<
%= row.uniqueAccounts %>
</td>
<td>
<
% row.remark.forEach(i=> { %>
<div>
<
%= i.name + ': ' + i.count %>
</div>
<
% }); %>
<
% if (row.remark
&&
row.remark.length > 0) { %>
<
% row.remark.forEach(i=> { %>
<div>
<
%= i.name + ': ' + i.count %>
</div>
<
% }); %>
<
% } else { %>
-
<
% } %>
</td>
</tr>
<
% }); %>
...
...
@@ -260,7 +272,7 @@
<
% locals.scene_market.forEach(row=> { %>
<tr
class=
"highlight"
>
<td>
<
%= row.
date
%>
<
%= row.
formattedStart + ' - ' + row.formattedEnd
%>
</td>
<td>
<
%= row.count %>
...
...
@@ -269,9 +281,13 @@
<
%= row.uniqueAccounts %>
</td>
<td>
<
% row.remark.forEach(i=> { %>
<div>
<
%= i.name + ': ' + i.count %>
</div>
<
% }); %>
<
% if (row.remark
&&
row.remark.length > 0) { %>
<
% row.remark.forEach(i=> { %>
<div>
<
%= i.name + ': ' + i.count %>
</div>
<
% }); %>
<
% } else { %>
-
<
% } %>
</td>
</tr>
<
% }); %>
...
...
@@ -292,7 +308,7 @@
<
% locals.training_materials.forEach(row=> { %>
<tr
class=
"highlight"
>
<td>
<
%= row.
date
%>
<
%= row.
formattedStart + ' - ' + row.formattedEnd
%>
</td>
<td>
<
%= row.count %>
...
...
@@ -301,9 +317,13 @@
<
%= row.uniqueAccounts %>
</td>
<td>
<
% row.remark.forEach(i=> { %>
<div>
<
%= i.name + ': ' + i.count %>
</div>
<
% }); %>
<
% if (row.remark
&&
row.remark.length > 0) { %>
<
% row.remark.forEach(i=> { %>
<div>
<
%= i.name + ': ' + i.count %>
</div>
<
% }); %>
<
% } else { %>
-
<
% } %>
</td>
</tr>
<
% }); %>
...
...
@@ -317,7 +337,7 @@
<li>
2、表格中底色的用于标识当天提问最高人次、当天提问最高次数
</li>
<li>
3、表格中空白处代表 0人、0次
</li>
</ul>
<table
class=
"last-bg"
>
<
!-- <
table class="last-bg">
<thead>
<tr>
<th></th>
...
...
@@ -334,7 +354,7 @@
<% locals.assessmentList.forEach(row=> { %>
<tr>
<td>
<
%= row.
date
%>
<%= row.
formattedStart + ' - ' + row.formattedEnd
%>
</td>
<td>
<%= row.submit %>
...
...
@@ -360,7 +380,7 @@
</tr>
<% }); %>
</tbody>
</table>
</table>
-->
</div>
</body>
...
...
src/main.ts
View file @
d81a56f
...
...
@@ -2,9 +2,18 @@ import { NestFactory } from '@nestjs/core'
import
{
AppModule
}
from
'./app.module'
import
{
NestExpressApplication
}
from
'@nestjs/platform-express'
import
Initializer
from
'./initor'
import
*
as
ejs
from
'ejs'
;
async
function
bootstrap
()
{
const
app
=
await
NestFactory
.
create
<
NestExpressApplication
>
(
AppModule
)
app
.
useStaticAssets
(
'public'
,
{
prefix
:
"/static/"
//设置虚拟路径
});
app
.
setBaseViewsDir
(
'views'
);
app
.
setViewEngine
(
'ejs'
);
app
.
engine
(
'ejs'
,
ejs
.
renderFile
);
app
.
set
(
'view engine'
,
'ejs'
);
await
Initializer
.
use
(
app
)
await
app
.
listen
(
process
.
env
.
APP_PORT
)
}
bootstrap
()
views/template.ejs
0 → 100644
View file @
d81a56f
<!DOCTYPE html>
<html
lang=
"zh-CN"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<title>
数据统计表格
</title>
<style>
table
{
border-collapse
:
collapse
;
width
:
100%
;
max-width
:
1200px
;
margin
:
20px
0
;
}
th
,
td
{
border
:
1px
solid
#ddd
;
padding
:
10px
15px
;
text-align
:
center
;
}
th
{
font-weight
:
bold
;
}
tr
.highlight
{
background-color
:
#e8f5e9
;
}
.last-bg
td
:last-child
{
background-color
:
#f1f4fe
;
}
.last-bg
tr
td
:last-child
{
background-color
:
#f1f4fe
;
}
</style>
</head>
<body>
<div>
<p>
各位领导、同事:
</p>
<p
style=
"text-indent: 2em;"
>
以下是重点功能上线后的使用情况,邮件中仅展示
<
%= locals.mentorship_page[0].formattedStart + ' 至 ' + locals.mentorship_page[0].formattedEnd %> 的数据。
</p>
<p
style=
"text-indent: 2em;"
>
所有的数据汇总文档:
<a
href=
"https://mcnywc2tcye7.feishu.cn/wiki/IOxow8gSUijONfkntpVcp7Wbnph"
>
所有数据汇总在线文档
</a></p>
<h3>
1、
<span
style=
"text-decoration: underline;"
>
带教管理
&
填写带教任务
&
飞行督导工作日报
&
群推送
</span></h3>
<h4>
带教管理 上线时间(4.16)小程序(入口埋点)
</h4>
<table>
<thead>
<tr>
<th>
日期
</th>
<th>
总数(人)
</th>
<th>
有效点击人员数(人)
</th>
<th>
点击量(次)
</th>
<th>
最高点击日 / 次数(原因)
</th>
</tr>
</thead>
<tbody>
<
% locals.mentorship_page.forEach(row=> { %>
<tr
class=
"highlight"
>
<td>
<
%= row.formattedStart + ' 至 ' + row.formattedEnd %>
</td>
<td>
<
%= row.totalPopulation %>
</td>
<td>
<
%= row.uniqueAccounts %>
</td>
<td>
<
%= row.count %>
</td>
<td>
<
%= row.peakDay
&&
row.peakDay.date
&&
row.peakDay.count ? `${row.peakDay.date} / ${row.peakDay.count}` : '-' %>
</td>
</tr>
<
% }); %>
</tbody>
</table>
<br
/>
<h4>
工作日报(督导) 上线时间(4.16)小程序(入口埋点)
</h4>
<table>
<thead>
<tr>
<th>
日期
</th>
<th>
总数(人)
</th>
<th>
有效点击人员数(人)
</th>
<th>
点击量(次)
</th>
<th>
精品升级入口(次)
</th>
<th>
会员权益入口(次)
</th>
</tr>
</thead>
<tbody>
<
% locals.supervisor_daily_page.forEach(row=> { %>
<tr
class=
"highlight"
>
<td>
<
%= row.formattedStart + ' 至 ' + row.formattedEnd %>
</td>
<td>
<
%= row.totalPopulation %>
</td>
<td>
<
%= row.uniqueAccounts %>
</td>
<td>
<
%= row.count %>
</td>
<td>
<
%= row.equityCount %>
</td>
<td>
<
%= row.upgradeCount %>
</td>
</tr>
<
% }); %>
</tbody>
</table>
<br
/>
<
% if (locals.reportData
&&
locals.reportData.length > 0) { %>
<p>
pc数据分析如下:
</p>
<p>
目前,建了三种日报模版(区域运营考核模版,督导培训日报模版,导师培训日报模版)。
</p>
<table>
<thead>
<tr>
<th></th>
<th>
模版内容
</th>
<th>
填写情况
</th>
<th>
填报人数
</th>
<th>
上线时间
</th>
</tr>
</thead>
<tbody>
<
% locals.reportData.forEach(row=> { %>
<tr>
<td>
<
%= row.templateName %>
</td>
<td>
<
%= row.templateContent %>
</td>
<td>
<
%= row.total %>
</td>
<td>
<
%= row.descript %>
</td>
<td>
<
%= row.oinlineTime %>
</td>
</tr>
<
% }); %>
</tbody>
</table>
<br
/>
<
% } %>
<
% if (locals.template
&&
locals.template.length > 0) { %>
<p>
① 区域运营考核模版数据计算
</p>
<table>
<thead>
<tr>
<th>
日期
</th>
<th>
每日提交份数
</th>
<th>
填报人数(所有关联该模版的督导人数,包括当天请假或者休息的员工)
</th>
<th>
提交率
</th>
</tr>
</thead>
<tbody>
<
% locals.template.forEach(row=> { %>
<tr
class=
"highlight"
>
<td>
<
%= row.date %>
</td>
<td>
<
%= row.finishCount %>
</td>
<td>
<
%= row.totalCount %>
</td>
<td>
<
%= row.rate %>
</td>
</tr>
<
% }); %>
</tbody>
</table>
<p>
导师模版 上线时间(4.16) - 目前,业务端没开始用
</p>
<br
/>
<
% } %>
<h3>
2、
<span
style=
"text-decoration: underline;"
>
话术萃取 上线时间(4.16)
</span></h3>
<p>
数据库统计(浏览时长得是 60s以上 才会记录)
</p>
<table>
<thead>
<tr>
<th>
日期
</th>
<th>
总浏览次数(次)①
</th>
<th>
总浏览人数(人)②
</th>
<th>
总浏览批次(次)③
</th>
</tr>
</thead>
<tbody>
<
% locals.extraction.forEach(row=> { %>
<tr>
<td>
<
%= row.formattedStart + ' - ' + row.formattedEnd %>
</td>
<td>
<
%= row.count %>
</td>
<td>
<
%= row.peopleTotal %>
</td>
<td>
<
%= row.batchTotal %>
</td>
</tr>
<
% }); %>
</tbody>
</table>
<p>
① 总浏览次数:在时间周期内,所有话术的总浏览次数。
</p>
<p>
② 总浏览人次:在时间周期内,浏览话术的所有人次。
</p>
<p>
③ 总浏览批次:在时间周期内,批量浏览话术的总次数,即一次性批量浏览多条话术。
</p>
<p>
话术萃取推送已关闭(4月21停止推送 )
</p>
<br
/>
<h3>
3、
<span
style=
"text-decoration: underline;"
>
营销素材 上线时间(3.12)
</span></h3>
<p>
数据库统计(点击素材浏览算一次点击)
</p>
<table>
<thead>
<tr>
<th>
日期
</th>
<th>
有效点击(次)
</th>
<th>
点击人数(人)
</th>
<th>
备注
</th>
</tr>
</thead>
<tbody>
<
% locals.sales_content.forEach(row=> { %>
<tr
class=
"highlight"
>
<td>
<
%= row.formattedStart + ' - ' + row.formattedEnd %>
</td>
<td>
<
%= row.count %>
</td>
<td>
<
%= row.uniqueAccounts %>
</td>
<td>
<
% if (row.remark
&&
row.remark.length > 0) { %>
<
% row.remark.forEach(i=> { %>
<div>
<
%= i.name + ': ' + i.count %>
</div>
<
% }); %>
<
% } else { %>
-
<
% } %>
</td>
</tr>
<
% }); %>
</tbody>
</table>
<br
/>
<h3>
4、
<span
style=
"text-decoration: underline;"
>
场景集市 上线时间(4.16)
</span></h3>
<table>
<thead>
<tr>
<th>
日期
</th>
<th>
有效点击(次)
</th>
<th>
点击人数(人)
</th>
<th>
备注
</th>
</tr>
</thead>
<tbody>
<
% locals.scene_market.forEach(row=> { %>
<tr
class=
"highlight"
>
<td>
<
%= row.formattedStart + ' - ' + row.formattedEnd %>
</td>
<td>
<
%= row.count %>
</td>
<td>
<
%= row.uniqueAccounts %>
</td>
<td>
<
% if (row.remark
&&
row.remark.length > 0) { %>
<
% row.remark.forEach(i=> { %>
<div>
<
%= i.name + ': ' + i.count %>
</div>
<
% }); %>
<
% } else { %>
-
<
% } %>
</td>
</tr>
<
% }); %>
</tbody>
</table>
<br
/>
<h3>
5、
<span
style=
"text-decoration: underline;"
>
培训资料
</span></h3>
<table>
<thead>
<tr>
<th>
日期
</th>
<th>
有效点击(次)
</th>
<th>
点击人数(人)
</th>
<th>
备注
</th>
</tr>
</thead>
<tbody>
<
% locals.training_materials.forEach(row=> { %>
<tr
class=
"highlight"
>
<td>
<
%= row.formattedStart + ' - ' + row.formattedEnd %>
</td>
<td>
<
%= row.count %>
</td>
<td>
<
%= row.uniqueAccounts %>
</td>
<td>
<
% if (row.remark
&&
row.remark.length > 0) { %>
<
% row.remark.forEach(i=> { %>
<div>
<
%= i.name + ': ' + i.count %>
</div>
<
% }); %>
<
% } else { %>
-
<
% } %>
</td>
</tr>
<
% }); %>
</tbody>
</table>
<br
/>
<h3>
6、
<span
style=
"text-decoration: underline;"
>
AI助手 上线时间(5.16)
</span></h3>
<h4>
智能体使用情况
</h4>
<ul>
<li>
1、表格中统计的数据为:提问人数(人)、提问次数(次)
</li>
<li>
2、表格中底色的用于标识当天提问最高人次、当天提问最高次数
</li>
<li>
3、表格中空白处代表 0人、0次
</li>
</ul>
</div>
</body>
</html>
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment