123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412 |
- #!/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': """
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title></title>
- <meta charset="utf-8" />
- </head>
- <body>
- <div class="qmbox qm_con_body_content qqmail_webmail_only" id="mailContentContainer" style="">
- <style type="text/css">
- .qmbox body {
- margin: 0;
- padding: 0;
- background: #fff;
- font-family: "Verdana, Arial, Helvetica, sans-serif";
- font-size: 14px;
- line-height: 24px;
- }
- .qmbox div, .qmbox p, .qmbox span, .qmbox img {
- margin: 0;
- padding: 0;
- }
- .qmbox img {
- border: none;
- }
- .qmbox .contaner {
- margin: 0 auto;
- }
- .qmbox .title {
- margin: 0 auto;
- background: url() #CCC repeat-x;
- height: 30px;
- text-align: center;
- font-weight: bold;
- padding-top: 12px;
- font-size: 16px;
- }
- .qmbox .content {
- margin: 4px;
- }
- .qmbox .biaoti {
- padding: 6px;
- color: #000;
- }
- .qmbox .xtop, .qmbox .xbottom {
- display: block;
- font-size: 1px;
- }
- .qmbox .xb1, .qmbox .xb2, .qmbox .xb3, .qmbox .xb4 {
- display: block;
- overflow: hidden;
- }
- .qmbox .xb1, .qmbox .xb2, .qmbox .xb3 {
- height: 1px;
- }
- .qmbox .xb2, .qmbox .xb3, .qmbox .xb4 {
- border-left: 1px solid #BCBCBC;
- border-right: 1px solid #BCBCBC;
- }
- .qmbox .xb1 {
- margin: 0 5px;
- background: #BCBCBC;
- }
- .qmbox .xb2 {
- margin: 0 3px;
- border-width: 0 2px;
- }
- .qmbox .xb3 {
- margin: 0 2px;
- }
- .qmbox .xb4 {
- height: 2px;
- margin: 0 1px;
- }
- .qmbox .xboxcontent {
- display: block;
- border: 0 solid #BCBCBC;
- border-width: 0 1px;
- }
- .qmbox .line {
- margin-top: 6px;
- border-top: 1px dashed #B9B9B9;
- padding: 4px;
- }
- .qmbox .neirong {
- padding: 6px;
- color: #666666;
- }
- .qmbox .foot {
- padding: 6px;
- color: #777;
- }
- .qmbox .font_darkblue {
- color: #006699;
- font-weight: bold;
- }
- .qmbox .font_lightblue {
- color: #008BD1;
- font-weight: bold;
- }
- .qmbox .font_gray {
- color: #888;
- font-size: 12px;
- }
- </style>
- <div class="contaner">
- <div class="title">注册信息</div>
- <div class="content">
- <p class="biaoti"><b>亲爱的用户,你好!</b></p>
- <b class="xtop"><b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"></b></b>
- <div class="xboxcontent">
- <div class="neirong">
- <p><b>请核对你的用户名:</b><span id="userName" class="font_darkblue">{username}</span></p>
- <p><b>验证码:</b><span class="font_lightblue"><span id="yzm" data="{captcha}" onclick="return false;" t="7" style="border-bottom: 1px dashed rgb(204, 204, 204); z-index: 1; position: static;">{captcha}</span></span><br><span class="font_gray">(请输入该验证码完成验证,验证码10分钟内有效!)</span></p>
- <div class="line">如果你未申请注册服务,请忽略该邮件。</div>
- </div>
- </div>
- <b class="xbottom"><b class="xb4"></b><b class="xb3"></b><b class="xb2"></b><b class="xb1"></b></b>
- </div>
- </div>
- <style type="text/css">
- .qmbox style, .qmbox script, .qmbox head, .qmbox link, .qmbox meta {
- display: none !important;
- }
- </style>
- </div>
- </body>
- </html>
- """,
- },
- 'en': {
- 'title': 'Registration code Email',
- # 'body': 'Hello! Congratulations to ansjer company networking system, the registration code you have obtained is:',
- 'body': """
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title></title>
- <meta charset="utf-8" />
- </head>
- <body>
- <div class="qmbox qm_con_body_content qqmail_webmail_only" id="mailContentContainer" style="">
- <style type="text/css">
- .qmbox body {
- margin: 0;
- padding: 0;
- background: #fff;
- font-family: "Verdana, Arial, Helvetica, sans-serif";
- font-size: 14px;
- line-height: 24px;
- }
- .qmbox div, .qmbox p, .qmbox span, .qmbox img {
- margin: 0;
- padding: 0;
- }
- .qmbox img {
- border: none;
- }
- .qmbox .contaner {
- margin: 0 auto;
- }
- .qmbox .title {
- margin: 0 auto;
- background: url() #CCC repeat-x;
- height: 30px;
- text-align: center;
- font-weight: bold;
- padding-top: 12px;
- font-size: 16px;
- }
- .qmbox .content {
- margin: 4px;
- }
- .qmbox .biaoti {
- padding: 6px;
- color: #000;
- }
- .qmbox .xtop, .qmbox .xbottom {
- display: block;
- font-size: 1px;
- }
- .qmbox .xb1, .qmbox .xb2, .qmbox .xb3, .qmbox .xb4 {
- display: block;
- overflow: hidden;
- }
- .qmbox .xb1, .qmbox .xb2, .qmbox .xb3 {
- height: 1px;
- }
- .qmbox .xb2, .qmbox .xb3, .qmbox .xb4 {
- border-left: 1px solid #BCBCBC;
- border-right: 1px solid #BCBCBC;
- }
- .qmbox .xb1 {
- margin: 0 5px;
- background: #BCBCBC;
- }
- .qmbox .xb2 {
- margin: 0 3px;
- border-width: 0 2px;
- }
- .qmbox .xb3 {
- margin: 0 2px;
- }
- .qmbox .xb4 {
- height: 2px;
- margin: 0 1px;
- }
- .qmbox .xboxcontent {
- display: block;
- border: 0 solid #BCBCBC;
- border-width: 0 1px;
- }
- .qmbox .line {
- margin-top: 6px;
- border-top: 1px dashed #B9B9B9;
- padding: 4px;
- }
- .qmbox .neirong {
- padding: 6px;
- color: #666666;
- }
- .qmbox .foot {
- padding: 6px;
- color: #777;
- }
- .qmbox .font_darkblue {
- color: #006699;
- font-weight: bold;
- }
- .qmbox .font_lightblue {
- color: #008BD1;
- font-weight: bold;
- }
- .qmbox .font_gray {
- color: #888;
- font-size: 12px;
- }
- </style>
- <div class="contaner">
- <div class="title">Registration information</div>
- <div class="content">
- <p class="biaoti"><b>Dear,{username}!</b></p>
- <b class="xtop"><b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"></b></b>
- <div class="xboxcontent">
- <div class="neirong">
- <p><b>Please check your username:</b><span id="userName" class="font_darkblue">{username}</span></p>
- <p><b>Your validation code:</b><span class="font_lightblue"><span id="yzm" data="{captcha}" onclick="return false;" t="7" style="border-bottom: 1px dashed rgb(204, 204, 204); z-index: 1; position: static;">{captcha}</span></span><br><span class="font_gray">(Please input the verification code to complete the verification. The verification code is valid in 10 minutes!)</span></p>
- <div class="line">If you have not applied for registration, please ignore the email.</div>
- </div>
- </div>
- <b class="xbottom"><b class="xb4"></b><b class="xb3"></b><b class="xb2"></b><b class="xb1"></b></b>
- </div>
- </div>
- <style type="text/css">
- .qmbox style, .qmbox script, .qmbox head, .qmbox link, .qmbox meta {
- display: none !important;
- }
- </style>
- </div>
- </body>
- </html>
- """
- }
- }
- elif type == 'register':
- data = {
- 'cn': {
- 'title': '注册激活链接',
- 'body': '<br>尊敬的用户{username},您好!<br>恭喜您已经成功注册珠海安士佳物联网系统的用户,欢迎您使用该系统!<br>为确保您能即时收到本站的各项邮件通知,并及时获取相关信息,请您点击一下连接验证您的邮箱,忘记账号密码时您可使用该邮箱重新找回哟.' +
- '<br><p>'
- '<a href="{domain}/account/activate/{token}">{domain}/account/activate/{token}</a>'
- '<p>'
- },
- 'en': {
- 'title': 'Registration activation link',
- 'body': 'Dear user {username}, Hello!' +
- '<br>' + 'Congratulations, you have successfully registered users of the Zhuhai Internet security system, welcome you to use the system!' +
- '<br>' + '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.' +
- '<br>' + '<p><a href="{domain}/account/activate/{token}">{domain}/account/activate/{token}</a><p>'
- }
- }
- elif type == 'forget':
- data = {
- 'cn': {
- 'title': '重置密码信息',
- 'body': '您好{username}\n' + '您已经请求了重置密码,可以点击下面的链接来重置密码\n' + '<p><a href="{reset_link}">{reset_link}</a></p>\n' + '更改后的密码为: {reset_pwd}\n如果你没有请求重置密码,请忽略这封邮件.\n在你点击上面链接修改密码之前,你的密码将会保持不变\n'
- },
- 'en': {
- 'title': 'Reset the password information',
- 'body': 'Hello! Dear {username}.<br>You have asked to reset the password, and you can click the link below to reset the password.<br>' + '<p><a href="{reset_link}">{reset_link}</a></p><br>' + 'The new password is: {reset_pwd}<br>If you do not request to reset the password, please ignore this mail.',
- }
- }
- return data[language]
|