|
@@ -161,21 +161,34 @@ class DetectControllerViewV2(View):
|
|
|
|
|
|
# 初始化UidPushModel推送表
|
|
|
if electricity_status:
|
|
|
- uid_push_create_dict = {
|
|
|
- 'uid_set_id': uid_set_id,
|
|
|
- 'userID_id': userID,
|
|
|
- 'appBundleId': appBundleId,
|
|
|
- 'app_type': app_type,
|
|
|
- 'push_type': push_type,
|
|
|
- 'token_val': token_val,
|
|
|
- 'm_code': m_code,
|
|
|
- 'addTime': nowTime,
|
|
|
- 'updTime': nowTime,
|
|
|
- 'lang': lang,
|
|
|
- 'tz': tz
|
|
|
- }
|
|
|
- # 绑定设备推送
|
|
|
- UidPushModel.objects.create(**uid_push_create_dict)
|
|
|
+ uid_push_qs = UidPushModel.objects.filter(userID_id=userID, m_code=m_code, uid_set__uid=uid)
|
|
|
+ if uid_push_qs.exists():
|
|
|
+ uid_push_update_dict = {
|
|
|
+ 'appBundleId': appBundleId,
|
|
|
+ 'app_type': app_type,
|
|
|
+ 'push_type': push_type,
|
|
|
+ 'token_val': token_val,
|
|
|
+ 'updTime': nowTime,
|
|
|
+ 'lang': lang,
|
|
|
+ 'tz': tz
|
|
|
+ }
|
|
|
+ uid_push_qs.update(**uid_push_update_dict)
|
|
|
+ else:
|
|
|
+ uid_push_create_dict = {
|
|
|
+ 'uid_set_id': uid_set_id,
|
|
|
+ 'userID_id': userID,
|
|
|
+ 'appBundleId': appBundleId,
|
|
|
+ 'app_type': app_type,
|
|
|
+ 'push_type': push_type,
|
|
|
+ 'token_val': token_val,
|
|
|
+ 'm_code': m_code,
|
|
|
+ 'addTime': nowTime,
|
|
|
+ 'updTime': nowTime,
|
|
|
+ 'lang': lang,
|
|
|
+ 'tz': tz
|
|
|
+ }
|
|
|
+ # 绑定设备推送
|
|
|
+ UidPushModel.objects.create(**uid_push_create_dict)
|
|
|
return response.json(0)
|
|
|
|
|
|
if status == 0:
|