| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248 |
- # @Author : Rocky
- # @File : ActivityService.py
- # @Time : 2025/11/19 16:16
- import time
- import pytz
- from datetime import datetime
- class ActivityObj:
- """
- 临时活动类
- """
- @staticmethod
- def is_in_discount_period(now_time=None):
- """
- 判断是否在优惠活动期间(东部时间 11.26-12.26)
- @param now_time: 当前时间戳(可选,默认为当前时间)
- @return: True 表示在活动期间,False 表示不在
- """
- if now_time is None:
- now_time = int(time.time())
- # 转换为东部时间(ET)
- eastern = pytz.timezone('America/New_York')
- current_dt = datetime.fromtimestamp(now_time, tz=eastern)
- # 活动开始时间:2025-11-26 00:00:00 ET
- start_dt = eastern.localize(datetime(2025, 11, 26, 0, 0, 0))
- # 活动结束时间:2025-12-26 23:59:59 ET
- end_dt = eastern.localize(datetime(2025, 12, 26, 23, 59, 59))
- return start_dt <= current_dt <= end_dt
- @staticmethod
- def get_discount_email_content(device_name, end_date, days_remaining):
- """
- 获取优惠活动期间的邮件内容
- @param device_name: 设备名称
- @param end_date: 到期日期
- @param days_remaining: 剩余天数(7 或 3)
- @return: {‘subject': 邮件主题, 'html_body': HTML正文}
- """
- # 根据剩余天数设定不同的紧迫性文案
- if days_remaining == 7:
- urgency_text = "Your cloud storage plan is expiring soon."
- else: # 3 天
- urgency_text = "Your plan expires in just 3 days - Act now!"
- subject = f"Reminder: Cloud Storage Plan Expiring Soon for {device_name}"
- html_body = f"""
- <html>
- <head>
- <style>
- body {{ font-family: Arial, sans-serif; line-height: 1.6; color: #333; background-color: #f5f5f5; }}
- .container {{ max-width: 650px; margin: 20px auto; background-color: #ffffff; }}
- .header {{ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 30px 20px; text-align: center; }}
- .header h1 {{ margin: 0; font-size: 24px; font-weight: 600; }}
- .content {{ padding: 30px 25px; }}
- .notice-box {{ background-color: #FFF3CD; border-left: 4px solid #FFC107; padding: 15px; margin: 20px 0; border-radius: 4px; }}
- .notice-box strong {{ color: #856404; }}
- .section-title {{ color: #667eea; font-size: 18px; font-weight: 600; margin-top: 25px; margin-bottom: 15px; }}
- .pricing-table {{ width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 13px; }}
- .pricing-table th {{ background-color: #667eea; color: white; padding: 12px 8px; text-align: center; font-weight: 600; border: 1px solid #ddd; }}
- .pricing-table td {{ padding: 10px 8px; text-align: center; border: 1px solid #ddd; }}
- .pricing-table tr:nth-child(even) {{ background-color: #f9f9f9; }}
- .original-price {{ text-decoration: line-through; color: #999; font-size: 12px; display: block; }}
- .discount-price {{ color: #e74c3c; font-weight: bold; font-size: 14px; }}
- .highlight {{ color: #667eea; font-weight: bold; }}
- .steps {{ background-color: #f8f9fa; padding: 15px; border-radius: 5px; margin: 15px 0; }}
- .steps ol {{ margin: 10px 0; padding-left: 20px; }}
- .steps li {{ margin: 8px 0; }}
- .contact-info {{ background-color: #e8f4f8; padding: 15px; border-radius: 5px; margin: 20px 0; }}
- .contact-info p {{ margin: 8px 0; }}
- .contact-info a {{ color: #667eea; text-decoration: none; }}
- .footer {{ background-color: #f8f9fa; padding: 20px; text-align: center; font-size: 12px; color: #666; border-top: 1px solid #ddd; }}
- .footer p {{ margin: 5px 0; }}
- .important-note {{ background-color: #d4edda; border-left: 4px solid #28a745; padding: 15px; margin: 20px 0; border-radius: 4px; }}
- </style>
- </head>
- <body>
- <div class="container">
- <div class="header">
- <h1>🔔 Cloud Storage Plan Expiration Reminder</h1>
- </div>
- <div class="content">
- <p>Dear Customer,</p>
-
- <div class="notice-box">
- <strong>⚠️ {urgency_text}</strong><br/>
- Your cloud storage package for device <strong>{device_name}</strong> will expire on <strong>{end_date}</strong>.
- If not renewed in time, your cloud storage service will be unavailable.
- </div>
-
- <p>To avoid data service interruption, we have prepared <span class="highlight">exclusive discounts on long-term plans</span> for you — much more cost-effective than monthly plans!</p>
-
- <h3 class="section-title">🎁 Plan Comparison - Choose What Fits Your Needs:</h3>
-
- <table class="pricing-table">
- <thead>
- <tr>
- <th style="width: 28%;">Plan Name</th>
- <th style="width: 18%;">1-Year Plan</th>
- <th style="width: 18%;">2-Year Plan</th>
- <th style="width: 18%;">3-Year Plan</th>
- <th style="width: 18%;">5-Year Plan</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td style="text-align: left; font-weight: 600;">Zosi Cloud standard Plan</td>
- <td>
- <span class="original-price">$47.88</span>
- <span class="discount-price">$39.99</span>
- <div style="font-size: 11px; color: #28a745;">Save $7.89</div>
- </td>
- <td>
- <span class="original-price">$95.76</span>
- <span class="discount-price">$69.99</span>
- <div style="font-size: 11px; color: #28a745;">Save $25.77</div>
- </td>
- <td>
- <span class="original-price">$143.64</span>
- <span class="discount-price">$103.99</span>
- <div style="font-size: 11px; color: #28a745;">Save $39.65</div>
- </td>
- <td>
- <span class="original-price">$239.4</span>
- <span class="discount-price">$169.99</span>
- <div style="font-size: 11px; color: #28a745;">Save $69.41</div>
- </td>
- </tr>
- <tr>
- <td style="text-align: left; font-weight: 600;">Zosi Cloud standard + Al Plan</td>
- <td>
- <span class="original-price">$71.88</span>
- <span class="discount-price">$59.99</span>
- <div style="font-size: 11px; color: #28a745;">Save $11.89</div>
- </td>
- <td>
- <span class="original-price">$143.76</span>
- <span class="discount-price">$106.99</span>
- <div style="font-size: 11px; color: #28a745;">Save $36.77</div>
- </td>
- <td>
- <span class="original-price">$215.64</span>
- <span class="discount-price">$149.99</span>
- <div style="font-size: 11px; color: #28a745;">Save $65.65</div>
- </td>
- <td>
- <span class="original-price">$359.4</span>
- <span class="discount-price">$229.99</span>
- <div style="font-size: 11px; color: #28a745;">Save $129.41</div>
- </td>
- </tr>
- <tr>
- <td style="text-align: left; font-weight: 600;">Zosi Cloud Premium Plan</td>
- <td>
- <span class="original-price">$107.88</span>
- <span class="discount-price">$89.99</span>
- <div style="font-size: 11px; color: #28a745;">Save $17.89</div>
- </td>
- <td>
- <span class="original-price">$215.76</span>
- <span class="discount-price">$139.99</span>
- <div style="font-size: 11px; color: #28a745;">Save $75.77</div>
- </td>
- <td>
- <span class="original-price">$323.64</span>
- <span class="discount-price">$203.99</span>
- <div style="font-size: 11px; color: #28a745;">Save $119.65</div>
- </td>
- <td>
- <span class="original-price">$539.4</span>
- <span class="discount-price">$335.99</span>
- <div style="font-size: 11px; color: #28a745;">Save $203.41</div>
- </td>
- </tr>
- <tr>
- <td style="text-align: left; font-weight: 600;">Zosi Cloud Premium + Al Plan</td>
- <td>
- <span class="original-price">$131.88</span>
- <span class="discount-price">$109.99</span>
- <div style="font-size: 11px; color: #28a745;">Save $21.89</div>
- </td>
- <td>
- <span class="original-price">$263.76</span>
- <span class="discount-price">$199.99</span>
- <div style="font-size: 11px; color: #28a745;">Save $63.77</div>
- </td>
- <td>
- <span class="original-price">$395.64</span>
- <span class="discount-price">$249.99</span>
- <div style="font-size: 11px; color: #28a745;">Save $145.65</div>
- </td>
- <td>
- <span class="original-price">$659.4</span>
- <span class="discount-price">$389.99</span>
- <div style="font-size: 11px; color: #28a745;">Save $269.41</div>
- </td>
- </tr>
- </tbody>
- </table>
-
- <h3 class="section-title">🚀 How to Renew Quickly?</h3>
- <div class="steps">
- <ol>
- <li>Log in to your <strong>Zosi App</strong></li>
- <li>Click on the <strong>Cloud Storage</strong> icon</li>
- <li>Select <strong>"Cloud Storage Plan"</strong></li>
- <li>Choose your preferred plan and complete the payment</li>
- </ol>
- </div>
-
- <h3 class="section-title">📞 Need Help?</h3>
- <div class="contact-info">
- <p>If you encounter any issues during the renewal process, feel free to contact our <strong>24/7 Customer Service</strong>:</p>
- <p>📧 <strong>Support Email:</strong> <a href="mailto:support@zosisecurity.com">support@zosisecurity.com</a></p>
- <p>👥 <strong>Facebook:</strong> <a href="https://www.facebook.com/ZosiTechnology/" target="_blank">https://www.facebook.com/ZosiTechnology/</a></p>
- <p>🎫 <strong>Support Center:</strong> <a href="mailto:support@zositechhelp.zendesk.com">support@zositechhelp.zendesk.com</a></p>
- </div>
-
- <div class="important-note">
- <h4 style="margin-top: 0; color: #155724;">✨ Important Notes:</h4>
- <ul style="margin: 10px 0; padding-left: 20px;">
- <li>If you have already renewed, you can ignore this email. Your plan validity will be automatically extended.</li>
- <li>This discount is a <strong>limited-time offer</strong>. Prices will return to normal after the promotion period, so act now!</li>
- </ul>
- </div>
-
- <p style="margin-top: 25px;">Thank you for trusting <strong>Zosi Cloud Storage Service</strong>. We will continue to provide you with secure, stable, and convenient file storage experience, keeping your data safe and uninterrupted!</p>
-
- <p style="margin-top: 20px;">
- <strong>Best regards,</strong><br/>
- <strong>Zosi Technology</strong>
- </p>
- </div>
- <div class="footer">
- <p>This is an automated reminder. Please do not reply to this email.</p>
- <p>© 2025 Zosi Technology. All rights reserved.</p>
- </div>
- </div>
- </body>
- </html>
- """
- return {'subject': subject, 'html_body': html_body}
|