#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @Copyright (C) ansjer cop Video Technology Co.,Ltd.All rights reserved. @AUTHOR: ASJRD018 @NAME: Ansjer @software: PyCharm @DATE: 2018/7/3 11:11 @Version: python3.6 @MODIFY DECORD:ansjer dev @file: TemplateService.py @Contact: chanjunkai@163.com """ class TemplateService: @staticmethod def log_api(): apiList = [ 'account/showUserMore', 'account/perfectUserInfo', 'account/getAvatar', 'account/delUser', 'account/setUserValid', 'account/showAllUser', 'account/help', 'account/searchUser', 'account/unsharedUserEquipment', 'account/success', 'equipment/queryUserEquipment', 'equipment/addNewUserEquipment', 'equipment/delUserEquipment', 'equipment/modifyUserEquipment', 'equipment/showAllUserEquipment', 'accessLog/findEquipmentInfo', 'OTA/uploads', 'OTA/download', 'OTA/downloads', 'OTA/getEquipmentVersion', 'OTA/getUpdataFileUrl', 'OTA/addNewEquipmentVersion', 'OTA/showAllEquipmentVersion', 'OTA/getUpdataFileUrl', 'mobile/uploadlogFile', 'roles/addNewRole', 'roles/queryRole', 'roles/delRole', 'roles/modifyRole', 'perms/addNewPerms', 'perms/delPerms', 'perms/queryPerms', 'perms/modifyPerms', 'permsManager/queryRolePerms', 'uploads/upgrade', 'upgrade/download', 'downloads/upgrade', 'getOTAurl/getUpdataFileUrl', 'equipment/sensor', 'equipment/info', 'adminManage/manage', 'equipment/OTA', 'feedbackInfo', 'appInfo', ] return apiList @staticmethod def email_message(type, language): if language is None: language = 'en' if type == 'register_code': data = { 'cn': { 'title': '注册码获取邮件', 'body': """
注册信息

亲爱的用户,你好!

请核对你的用户名:{username}

验证码:{captcha}
(请输入该验证码完成验证,验证码10分钟内有效!)

如果你未申请注册服务,请忽略该邮件。
""", }, 'en': { 'title': 'Registration code Email', # 'body': 'Hello! Congratulations to ansjer company networking system, the registration code you have obtained is:', 'body': """
Registration information

Dear,{username}!

Please check your username:{username}

Your validation code:{captcha}
(Please input the verification code to complete the verification. The verification code is valid in 10 minutes!)

If you have not applied for registration, please ignore the email.
""" } } elif type == 'register': data = { 'cn': { 'title': '注册激活链接', 'body': '
尊敬的用户{username},您好!
恭喜您已经成功注册珠海安士佳物联网系统的用户,欢迎您使用该系统!
为确保您能即时收到本站的各项邮件通知,并及时获取相关信息,请您点击一下连接验证您的邮箱,忘记账号密码时您可使用该邮箱重新找回哟.' + '

' '{domain}/account/activate/{token}' '

' }, 'en': { 'title': 'Registration activation link', 'body': 'Dear user {username}, Hello!' + '
' + 'Congratulations, you have successfully registered users of the Zhuhai Internet security system, welcome you to use the system!' + '
' + 'In order to ensure that you can receive timely notification of the site, and timely access to relevant information.Please click on the following open link to verify your mailbox, and you can use the mailbox to retrieve it when you forget your account password.' + '
' + '

{domain}/account/activate/{token}

' } } elif type == 'forget': data = { 'cn': { 'title': '重置密码信息', 'body': '您好{username}\n' + '您已经请求了重置密码,可以点击下面的链接来重置密码\n' + '

{reset_link}

\n' + '更改后的密码为: {reset_pwd}\n如果你没有请求重置密码,请忽略这封邮件.\n在你点击上面链接修改密码之前,你的密码将会保持不变\n' }, 'en': { 'title': 'Reset the password information', 'body': 'Hello! Dear {username}.
You have asked to reset the password, and you can click the link below to reset the password.
' + '

{reset_link}


' + 'The new password is: {reset_pwd}
If you do not request to reset the password, please ignore this mail.', } } return data[language]