@befly-addon/admin 1.1.6 → 1.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,11 @@
1
1
  export default {
2
2
  name: '获取邮件配置',
3
3
  handler: async (befly, ctx) => {
4
- const config = befly.email.getConfig();
4
+ if (!(befly as any).addon_admin_email) {
5
+ return befly.tool.No('邮件插件未加载,请检查配置');
6
+ }
7
+
8
+ const config = (befly as any).addon_admin_email.getConfig();
5
9
 
6
10
  return befly.tool.Yes('获取成功', {
7
11
  host: config.host,
@@ -21,7 +21,11 @@ export default {
21
21
  },
22
22
  required: ['to', 'subject', 'content'],
23
23
  handler: async (befly, ctx) => {
24
- const result = await befly.email.sendAndLog({
24
+ if (!(befly as any).addon_admin_email) {
25
+ return befly.tool.No('邮件插件未加载,请检查配置');
26
+ }
27
+
28
+ const result = await (befly as any).addon_admin_email.sendAndLog({
25
29
  adminId: ctx.user?.id || 0,
26
30
  username: ctx.user?.username || '',
27
31
  nickname: ctx.user?.nickname || '',
@@ -1,7 +1,11 @@
1
1
  export default {
2
2
  name: '验证邮件配置',
3
3
  handler: async (befly, ctx) => {
4
- const isValid = await befly.email.verify();
4
+ if (!(befly as any).addon_admin_email) {
5
+ return befly.tool.No('邮件插件未加载,请检查配置');
6
+ }
7
+
8
+ const isValid = await (befly as any).addon_admin_email.verify();
5
9
 
6
10
  if (isValid) {
7
11
  return befly.tool.Yes('邮件服务配置正常');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@befly-addon/admin",
3
- "version": "1.1.6",
3
+ "version": "1.1.7",
4
4
  "title": "管理后台",
5
5
  "description": "Befly - 管理后台功能组件",
6
6
  "type": "module",
@@ -43,7 +43,7 @@
43
43
  "url": "https://github.com/chenbimo/befly.git",
44
44
  "directory": "packages/addon-admin"
45
45
  },
46
- "gitHead": "58cd1c7adf8222e8b38464acfff8795e3a9580fc",
46
+ "gitHead": "22acaff4fd6df6a25093a497fe68ad1b551bc839",
47
47
  "dependencies": {
48
48
  "befly": "3.9.21",
49
49
  "befly-shared": "^1.2.3",