|
@@ -97,11 +97,17 @@ class cloudTestView(View):
|
|
|
|
|
|
try:
|
|
|
# 查询两个UID是否在同一账号下
|
|
|
- old_deviceInfo_qs = Device_Info.objects.filter(userID_id=userID, UID=old_uid).values('isExist')
|
|
|
+ old_deviceInfo_qs = Device_Info.objects.filter(userID_id=userID, UID=old_uid).values('isExist','vodPrimaryUserID')
|
|
|
new_deviceInfo_qs = Device_Info.objects.filter(userID_id=userID, UID=new_uid).values('isExist')
|
|
|
if not (old_deviceInfo_qs.exists() and new_deviceInfo_qs.exists()):
|
|
|
return response.json(10010)
|
|
|
|
|
|
+ # 不是主用户无法转移
|
|
|
+ vodPrimaryUserID = old_deviceInfo_qs[0]['vodPrimaryUserID']
|
|
|
+ if vodPrimaryUserID != '' and vodPrimaryUserID != userID:
|
|
|
+ return response.json(10038)
|
|
|
+ vodPrimaryMaster = ModelService.get_user_name(userID)
|
|
|
+
|
|
|
new_isExist = new_deviceInfo_qs[0]['isExist']
|
|
|
if not new_isExist:
|
|
|
return response.json(10011)
|
|
@@ -121,12 +127,14 @@ class cloudTestView(View):
|
|
|
if payType == 10 or payType == 11:
|
|
|
return response.json(10012)
|
|
|
|
|
|
- # # 查询转入设备正在使用的套餐
|
|
|
+ # 查询转入设备正在使用的套餐
|
|
|
new_using_uid_bucket = UID_Bucket.objects.filter(uid=new_uid, endTime__gte=nowTime)
|
|
|
if new_using_uid_bucket.exists():
|
|
|
return response.json(10014)
|
|
|
|
|
|
with transaction.atomic():
|
|
|
+ # 更新新设备主用户信息
|
|
|
+ new_deviceInfo_qs.update(vodPrimaryUserID=vodPrimaryUserID, vodPrimaryMaster=vodPrimaryMaster)
|
|
|
# vod_uid_bucket表更新uid
|
|
|
old_using_uid_bucket_id = old_using_uid_bucket[0]['id']
|
|
|
UID_Bucket.objects.filter(id=old_using_uid_bucket_id).update(uid=new_uid)
|