|
@@ -1,16 +1,3 @@
|
|
|
-#!/usr/bin/env python3
|
|
|
-# -*- coding: utf-8 -*-
|
|
|
-"""
|
|
|
-@Copyright (C) ansjer cop Video Technology Co.,Ltd.All rights reserved.
|
|
|
-@AUTHOR: ASJRD018
|
|
|
-@NAME: AnsjerFormal
|
|
|
-@software: PyCharm
|
|
|
-@DATE: 2018/9/11 15:08
|
|
|
-@Version: python3.6
|
|
|
-@MODIFY DECORD:ansjer dev
|
|
|
-@file: UserController.py
|
|
|
-@Contact: chanjunkai@163.com
|
|
|
-"""
|
|
|
import datetime
|
|
|
import time
|
|
|
import oss2
|
|
@@ -25,7 +12,7 @@ from django.views.generic import TemplateView
|
|
|
from Ansjer.config import SERVER_DOMAIN, OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET
|
|
|
from Controller.CheckUserData import DataValid, RandomStr
|
|
|
from Model.models import Device_User, Role, UserExModel, CountryModel, MenuModel, FeedBackModel, StatResModel, \
|
|
|
- SysMassModel, App_Info, SysMsgModel, DeviceSuperPassword
|
|
|
+ SysMassModel, App_Info, SysMsgModel, DeviceSuperPassword, CustomizedPush
|
|
|
from Object.RedisObject import RedisObject
|
|
|
from Object.ResponseObject import ResponseObject
|
|
|
from Object.TokenObject import TokenObject
|
|
@@ -312,14 +299,17 @@ class UserManagement(View):
|
|
|
return self.collectFeedBack(request_dict, response)
|
|
|
elif operation == 'exportFeedBack':
|
|
|
return self.exportFeedBack(request_dict, response)
|
|
|
- if operation == 'customerServiceManagement': # 审核用户请求/生成超级密码
|
|
|
+ elif operation == 'customerServiceManagement': # 审核用户请求/生成超级密码
|
|
|
return self.customerServiceManagement(request_dict, response)
|
|
|
- if operation == 'getDeviceSuperPassword': # 查询超级密码请求表
|
|
|
+ elif operation == 'getDeviceSuperPassword': # 查询超级密码请求表
|
|
|
return self.getDeviceSuperPassword(request_dict, response)
|
|
|
- if operation == 'deleteInformation': # 删除超级密码请求表
|
|
|
+ elif operation == 'deleteInformation': # 删除超级密码请求表
|
|
|
return self.deleteInformation(request_dict, response)
|
|
|
+ # 定制推送
|
|
|
+ elif operation == 'getCustomizedPushList': # 查询定制推送列表
|
|
|
+ return self.getCustomizedPushList(request_dict, response)
|
|
|
else:
|
|
|
- return response.json(404)
|
|
|
+ return response.json(414)
|
|
|
|
|
|
def getUserInfo(self, userID, request_dict, response):
|
|
|
"""
|
|
@@ -890,3 +880,45 @@ class UserManagement(View):
|
|
|
return response.json(173)
|
|
|
device_super_password_qs.delete()
|
|
|
return response.json(0)
|
|
|
+
|
|
|
+ @staticmethod
|
|
|
+ def getCustomizedPushList(request_dict, response):
|
|
|
+ page = request_dict.get('pageNo', None)
|
|
|
+ line = request_dict.get('pageSize', None)
|
|
|
+
|
|
|
+ if not all([page, line]):
|
|
|
+ return response.json(444)
|
|
|
+
|
|
|
+ page = int(page)
|
|
|
+ line = int(line)
|
|
|
+
|
|
|
+ try:
|
|
|
+ customized_push_qs = CustomizedPush.objects.filter()
|
|
|
+ total = customized_push_qs.count()
|
|
|
+ customized_push_qs = customized_push_qs.\
|
|
|
+ values('id', 'title', 'msg', 'link', 'icon_link', 'country', 'device_type', 'register_period',
|
|
|
+ 'time_zone', 'push_time', 'push_app', 'push_satus')
|
|
|
+ customized_push_qs = customized_push_qs[(page - 1) * line:page * line]
|
|
|
+ customized_push_list = []
|
|
|
+ for customized_push in customized_push_qs:
|
|
|
+ # 格式化数据
|
|
|
+ device_type_list = customized_push['device_type'].split(',')
|
|
|
+ register_period = customized_push['register_period'] + '年'
|
|
|
+ time_zone = 'UTC ' + customized_push['time_zone']
|
|
|
+
|
|
|
+ customized_push_list.append({
|
|
|
+ 'customized_push_id': customized_push['id'],
|
|
|
+ 'title': customized_push['title'],
|
|
|
+ 'link': customized_push['link'],
|
|
|
+ 'icon_link': customized_push['icon_link'],
|
|
|
+ 'country': customized_push['country'],
|
|
|
+ 'device_type_list': device_type_list,
|
|
|
+ 'register_period': register_period,
|
|
|
+ 'time_zone': time_zone,
|
|
|
+ 'push_time': customized_push['push_time'],
|
|
|
+ 'push_app': customized_push['push_app'],
|
|
|
+ 'push_satus': customized_push['push_satus']
|
|
|
+ })
|
|
|
+ return response.json(0, {'list': customized_push_list, 'total': total})
|
|
|
+ except Exception as e:
|
|
|
+ return response.json(500, 'error_line:{}, error_msg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
|