|
@@ -313,6 +313,8 @@ class UserManagement(View):
|
|
|
return self.getCustomizedPushList(request_dict, response)
|
|
|
elif operation == 'addOrEditCustomizedPush': # 新增/编辑推送内容
|
|
|
return self.addOrEditCustomizedPush(request, request_dict, response)
|
|
|
+ elif operation == 'delCustomizedPush': # 删除定制推送
|
|
|
+ return self.delCustomizedPush(request_dict, response)
|
|
|
else:
|
|
|
return response.json(414)
|
|
|
|
|
@@ -1001,7 +1003,7 @@ class UserManagement(View):
|
|
|
return response.json(444)
|
|
|
customized_push_data['push_satus'] = False
|
|
|
CustomizedPush.objects.filter(id=customized_push_id).update(**customized_push_data)
|
|
|
- apscheduler_obj.del_job('customizedPushId_{}'.format(customized_push_id)) # 删除旧定时任务
|
|
|
+ apscheduler_obj.del_job('customized_push_id_{}'.format(customized_push_id)) # 删除旧定时任务
|
|
|
else: # 新增
|
|
|
customized_push = CustomizedPush.objects.create(**customized_push_data)
|
|
|
customized_push_id = customized_push.id
|
|
@@ -1025,6 +1027,20 @@ class UserManagement(View):
|
|
|
url = DETECT_PUSH_DOMAINS + 'customized_push/start'
|
|
|
req = requests.post(url=url, data=data, timeout=8)
|
|
|
|
|
|
+ @staticmethod
|
|
|
+ def delCustomizedPush(request_dict, response):
|
|
|
+ customized_push_id = request_dict.get('customizedPushId', None)
|
|
|
+ if not customized_push_id:
|
|
|
+ return response.json(444)
|
|
|
+ try:
|
|
|
+ CustomizedPush.objects.filter(id=customized_push_id).delete()
|
|
|
+ # 删除定时任务
|
|
|
+ apscheduler_obj = ApschedulerObject()
|
|
|
+ apscheduler_obj.del_job('customized_push_id_{}'.format(customized_push_id))
|
|
|
+ return response.json(0)
|
|
|
+ except Exception as e:
|
|
|
+ return response.json(500, 'error_line:{}, error_msg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
|
|
|
+
|
|
|
@staticmethod
|
|
|
def getCountryList(response):
|
|
|
try:
|