|
@@ -1,34 +1,19 @@
|
|
|
-#!/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: 2019/1/18 10:45
|
|
|
-@Version: python3.6
|
|
|
-@MODIFY DECORD:ansjer dev
|
|
|
-@file: SysMsg.py
|
|
|
-@Contact: chanjunkai@163.com
|
|
|
-"""
|
|
|
-
|
|
|
import json
|
|
|
import time
|
|
|
|
|
|
-import boto3
|
|
|
import oss2
|
|
|
from django.db import transaction
|
|
|
from django.views.generic.base import View
|
|
|
|
|
|
+from Ansjer.config import CONFIG_TEST, CONFIG_CN, CONFIG_INFO, AWS_IOT_SES_ACCESS_CHINA_REGION, \
|
|
|
+ AWS_SES_ACCESS_REGION
|
|
|
from Ansjer.config import OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
|
|
|
from Model.models import FeedBackModel, StatResModel, PushInaccurateFeedback
|
|
|
+from Object.AWS.AmazonS3Util import AmazonS3Util
|
|
|
from Object.ResponseObject import ResponseObject
|
|
|
from Object.TokenObject import TokenObject
|
|
|
from Service.CommonService import CommonService
|
|
|
from Service.ModelService import ModelService
|
|
|
-from Object.AWS.AmazonS3Util import AmazonS3Util
|
|
|
-from Ansjer.config import CONFIG_TEST, CONFIG_CN, CONFIG_US, CONFIG_EUR, CONFIG_INFO, AWS_IOT_SES_ACCESS_CHINA_REGION, \
|
|
|
- AWS_SES_ACCESS_REGION
|
|
|
|
|
|
|
|
|
class FeedBackView(View):
|
|
@@ -62,8 +47,10 @@ class FeedBackView(View):
|
|
|
return self.do_delete_by_admin(userID, request_dict, response)
|
|
|
elif operation == 'deleteImage':
|
|
|
return self.do_delete_image(userID, request_dict, response)
|
|
|
- elif operation == 'pushInaccurate':
|
|
|
- return self.ai_recognition(userID, request_dict, response)
|
|
|
+ elif operation == 'submitted': # 查询是否已提交过推送图片反馈
|
|
|
+ return self.submitted(userID, request_dict, response)
|
|
|
+ elif operation == 'pushInaccurate': # 用户反馈推送不准确
|
|
|
+ return self.push_inaccurate(userID, request_dict, response)
|
|
|
else:
|
|
|
return response.json(414)
|
|
|
else:
|
|
@@ -307,7 +294,26 @@ class FeedBackView(View):
|
|
|
return response.json(0)
|
|
|
|
|
|
@staticmethod
|
|
|
- def ai_recognition(user_id, request_dict, response):
|
|
|
+ def submitted(user_id, request_dict, response):
|
|
|
+ equipment_info_id = request_dict.get('equipment_info_id', None)
|
|
|
+ uid = request_dict.get('uid', None)
|
|
|
+ is_st = request_dict.get('is_st', None)
|
|
|
+ event_type = request_dict.get('event_type', None)
|
|
|
+ event_time = request_dict.get('event_time', None)
|
|
|
+ channel = request_dict.get('channel', None)
|
|
|
+ if not all([equipment_info_id, uid, is_st, event_type, event_time, channel]):
|
|
|
+ return response.json(444)
|
|
|
+ is_st, event_type, channel = int(is_st), int(event_type), int(channel)
|
|
|
+ push_inaccurate_feedback_qs = PushInaccurateFeedback.objects.filter(equipment_info_id=equipment_info_id,
|
|
|
+ user_id=user_id, uid=uid, channel=channel,
|
|
|
+ event_type=event_type, event_time=event_time,
|
|
|
+ is_st=is_st)
|
|
|
+ if push_inaccurate_feedback_qs.exists():
|
|
|
+ return response.json(174)
|
|
|
+ return response.json(0)
|
|
|
+
|
|
|
+ @staticmethod
|
|
|
+ def push_inaccurate(user_id, request_dict, response):
|
|
|
equipment_info_id = request_dict.get('equipment_info_id', None)
|
|
|
uid = request_dict.get('uid', None)
|
|
|
is_st = request_dict.get('is_st', None)
|