|
@@ -6,13 +6,15 @@ from django.db import transaction
|
|
from django.views.generic.base import View
|
|
from django.views.generic.base import View
|
|
|
|
|
|
from Ansjer.config import ACCESS_KEY_ID, SECRET_ACCESS_KEY, REGION_NAME, PUSH_BUCKET, PUSH_INACCURATE_BUCKET
|
|
from Ansjer.config import ACCESS_KEY_ID, SECRET_ACCESS_KEY, REGION_NAME, PUSH_BUCKET, PUSH_INACCURATE_BUCKET
|
|
-from Ansjer.config import OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET, LOGGER
|
|
|
|
|
|
+from Ansjer.config import OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET
|
|
from Model.models import FeedBackModel, StatResModel, PushInaccurateFeedback
|
|
from Model.models import FeedBackModel, StatResModel, PushInaccurateFeedback
|
|
from Object.AWS.AmazonS3Util import AmazonS3Util
|
|
from Object.AWS.AmazonS3Util import AmazonS3Util
|
|
from Object.ResponseObject import ResponseObject
|
|
from Object.ResponseObject import ResponseObject
|
|
from Object.TokenObject import TokenObject
|
|
from Object.TokenObject import TokenObject
|
|
|
|
+from Object.utils import LocalDateTimeUtil
|
|
from Service.CommonService import CommonService
|
|
from Service.CommonService import CommonService
|
|
from Service.ModelService import ModelService
|
|
from Service.ModelService import ModelService
|
|
|
|
+from Service.EquipmentInfoService import EquipmentInfoService
|
|
|
|
|
|
|
|
|
|
class FeedBackView(View):
|
|
class FeedBackView(View):
|
|
@@ -341,10 +343,16 @@ class FeedBackView(View):
|
|
tag = request_dict.get('tag', '')
|
|
tag = request_dict.get('tag', '')
|
|
if not all([equipment_info_id, uid, is_st, event_type, event_time, channel]):
|
|
if not all([equipment_info_id, uid, is_st, event_type, event_time, channel]):
|
|
return response.json(444)
|
|
return response.json(444)
|
|
- LOGGER.info('push_inaccurate参数:{}'.format(request_dict))
|
|
|
|
|
|
+
|
|
now_time = int(time.time())
|
|
now_time = int(time.time())
|
|
is_st = int(is_st)
|
|
is_st = int(is_st)
|
|
try:
|
|
try:
|
|
|
|
+ # 默认查询近七天内数据
|
|
|
|
+ start_time = LocalDateTimeUtil.get_before_days_timestamp(now_time, 7)
|
|
|
|
+ uid_list = uid.split(',')
|
|
|
|
+ equipment_info_qs, count = EquipmentInfoService. \
|
|
|
|
+ union_equipment_info(user_id, uid_list, event_type, start_time, now_time, 1, 10, event_time)
|
|
|
|
+ identify_type = 1 if equipment_info_qs[0]['event_tag'] else 0
|
|
s3 = AmazonS3Util(
|
|
s3 = AmazonS3Util(
|
|
aws_access_key_id=ACCESS_KEY_ID,
|
|
aws_access_key_id=ACCESS_KEY_ID,
|
|
secret_access_key=SECRET_ACCESS_KEY,
|
|
secret_access_key=SECRET_ACCESS_KEY,
|
|
@@ -365,7 +373,8 @@ class FeedBackView(View):
|
|
s3.copy_obj(PUSH_BUCKET, PUSH_INACCURATE_BUCKET, file_path)
|
|
s3.copy_obj(PUSH_BUCKET, PUSH_INACCURATE_BUCKET, file_path)
|
|
PushInaccurateFeedback.objects.create(equipment_info_id=equipment_info_id, user_id=user_id,
|
|
PushInaccurateFeedback.objects.create(equipment_info_id=equipment_info_id, user_id=user_id,
|
|
event_type=event_type, uid=uid, channel=channel,
|
|
event_type=event_type, uid=uid, channel=channel,
|
|
- add_time=now_time, tag=tag, is_st=is_st, event_time=event_time)
|
|
|
|
|
|
+ add_time=now_time, tag=tag, is_st=is_st, event_time=event_time,
|
|
|
|
+ identify_type=identify_type)
|
|
return response.json(0)
|
|
return response.json(0)
|
|
except Exception as e:
|
|
except Exception as e:
|
|
return response.json(500, repr(e))
|
|
return response.json(500, repr(e))
|