|
@@ -92,11 +92,11 @@ class DetectControllerView(View):
|
|
qr = qs[(page - 1) * line:page * line]
|
|
qr = qs[(page - 1) * line:page * line]
|
|
res = []
|
|
res = []
|
|
import oss2
|
|
import oss2
|
|
- auth = oss2.Auth('LTAIyMkGfEdogyL9', '71uIjpsqVOmF7DAITRyRuc259jHOjO')
|
|
|
|
- bucket = oss2.Bucket(auth, 'oss-cn-shenzhen.aliyuncs.com', 'apg')
|
|
|
|
|
|
+ auth = oss2.Auth(OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET)
|
|
|
|
+ img_bucket = oss2.Bucket(auth, 'oss-cn-shenzhen.aliyuncs.com', 'apg')
|
|
for p in qr:
|
|
for p in qr:
|
|
if p['is_st'] == 1:
|
|
if p['is_st'] == 1:
|
|
- p['img'] = bucket.sign_url('GET','{uid}/{channel}/{time}.jpeg'.
|
|
|
|
|
|
+ p['img'] = img_bucket.sign_url('GET','{uid}/{channel}/{time}.jpeg'.
|
|
format(uid=p['devUid'], channel=p['Channel'], time=p['eventTime']), 300)
|
|
format(uid=p['devUid'], channel=p['Channel'], time=p['eventTime']), 300)
|
|
elif p['is_st'] == 2:
|
|
elif p['is_st'] == 2:
|
|
# img_list = []
|
|
# img_list = []
|
|
@@ -106,7 +106,6 @@ class DetectControllerView(View):
|
|
if p['devUid'] in uid_type_dict.keys():
|
|
if p['devUid'] in uid_type_dict.keys():
|
|
uid_type_s = uid_type_dict[p['devUid']]
|
|
uid_type_s = uid_type_dict[p['devUid']]
|
|
p['uid_type'] = uid_type_s
|
|
p['uid_type'] = uid_type_s
|
|
-
|
|
|
|
res.append(p)
|
|
res.append(p)
|
|
return response.json(0, {'datas': res, 'count': count})
|
|
return response.json(0, {'datas': res, 'count': count})
|
|
|
|
|
|
@@ -126,8 +125,7 @@ class DetectControllerView(View):
|
|
if status == '0':
|
|
if status == '0':
|
|
if not all([app_type, appBundleId, uid, m_code]):
|
|
if not all([app_type, appBundleId, uid, m_code]):
|
|
return response.json(444, 'app_type,appBundleId,uid,m_code')
|
|
return response.json(444, 'app_type,appBundleId,uid,m_code')
|
|
- uid_app_qs = UID_App.objects.filter(appBundleId=appBundleId, userID_id=userID, m_code=m_code,
|
|
|
|
- uid=uid, app_type=app_type)
|
|
|
|
|
|
+ uid_app_qs = UID_App.objects.filter(appBundleId=appBundleId, userID_id=userID, m_code=m_code,uid=uid, app_type=app_type)
|
|
if uid_app_qs.exists():
|
|
if uid_app_qs.exists():
|
|
uid_app_qs.update(status=0)
|
|
uid_app_qs.update(status=0)
|
|
return response.json(0)
|
|
return response.json(0)
|
|
@@ -399,11 +397,9 @@ class NotificationView(View):
|
|
'receiveTime': n_time
|
|
'receiveTime': n_time
|
|
}
|
|
}
|
|
qs_list.append(Equipment_Info(**add_data))
|
|
qs_list.append(Equipment_Info(**add_data))
|
|
- if qs_list:
|
|
|
|
- print(1)
|
|
|
|
- Equipment_Info.objects.bulk_create(qs_list)
|
|
|
|
- return True
|
|
|
|
- else:
|
|
|
|
- return False
|
|
|
|
|
|
+ if qs_list:
|
|
|
|
+ print(1)
|
|
|
|
+ Equipment_Info.objects.bulk_create(qs_list)
|
|
|
|
+ return True
|
|
else:
|
|
else:
|
|
return False
|
|
return False
|