|
@@ -332,12 +332,18 @@ class AppCampaignView(View):
|
|
|
|
|
|
def get_timezone_offset(self, tz):
|
|
|
"""
|
|
|
- UTC-8格式转化
|
|
|
+ 将 "+8:00" 格式的时区字符串转换为包含分钟偏移的时区。
|
|
|
"""
|
|
|
- sign = tz[3] # "+" 或 "-"
|
|
|
- hours = int(tz[4:]) # 时差小时数
|
|
|
- timezone_name = f"Etc/GMT{sign}{hours}" if sign == "-" else f"Etc/GMT+{hours}"
|
|
|
- return pytz.timezone(timezone_name)
|
|
|
+ sign = tz[0] # " " 或 "-"
|
|
|
+ hours, minutes = map(int, tz[1:].split(':')) # 分离小时和分钟
|
|
|
+
|
|
|
+ # 计算总分钟数
|
|
|
+ total_minutes = hours * 60 + minutes
|
|
|
+ if sign == '-':
|
|
|
+ total_minutes = -total_minutes
|
|
|
+
|
|
|
+ # 使用 pytz.FixedOffset 创建时区
|
|
|
+ return pytz.FixedOffset(total_minutes)
|
|
|
|
|
|
def app_get_campaigns(cls, request_dict, response):
|
|
|
"""
|
|
@@ -346,7 +352,7 @@ class AppCampaignView(View):
|
|
|
@param response: 响应对象
|
|
|
@return: 响应对象
|
|
|
"""
|
|
|
- tz = request_dict.get('tz', 'UTC+0')
|
|
|
+ tz = request_dict.get('tz', '+0:00')
|
|
|
token = request_dict.get('token', None)
|
|
|
if not token:
|
|
|
return response.json(444)
|