修正了 property 直接取值的问题
This commit is contained in:
@@ -685,7 +685,7 @@ class KefuGetDashouListView(APIView):
|
||||
# 关键词筛选(用户ID或昵称)
|
||||
if keyword:
|
||||
dashou_qs = dashou_qs.filter(
|
||||
Q(user__yonghuid__icontains=keyword) |
|
||||
Q(user__UserUID__icontains=keyword) |
|
||||
Q(nicheng__icontains=keyword)
|
||||
)
|
||||
|
||||
@@ -693,7 +693,7 @@ class KefuGetDashouListView(APIView):
|
||||
total_dashou = dashou_qs.count()
|
||||
|
||||
# 6. 统计有效打手数(有会员且未过期)
|
||||
dashou_user_ids = dashou_qs.values_list('user__yonghuid', flat=True)
|
||||
dashou_user_ids = dashou_qs.values_list('user__UserUID', flat=True)
|
||||
now = timezone.now()
|
||||
valid_user_ids = Huiyuangoumai.query.filter(
|
||||
yonghu_id__in=dashou_user_ids,
|
||||
@@ -1395,7 +1395,7 @@ class KefuGetShangjiaListView(APIView):
|
||||
# 关键词筛选(用户ID或昵称)
|
||||
if keyword:
|
||||
shangjia_qs = shangjia_qs.filter(
|
||||
Q(user__yonghuid__icontains=keyword) |
|
||||
Q(user__UserUID__icontains=keyword) |
|
||||
Q(nicheng__icontains=keyword)
|
||||
)
|
||||
|
||||
@@ -3552,7 +3552,7 @@ class GetZuzhangListView(APIView):
|
||||
# 6. 应用筛选条件(使用 ORM 安全过滤)
|
||||
if keyword:
|
||||
queryset = queryset.filter(
|
||||
Q(user__yonghuid__icontains=keyword) |
|
||||
Q(user__UserUID__icontains=keyword) |
|
||||
Q(user__boss_profile__nickname__icontains=keyword)
|
||||
)
|
||||
|
||||
|
||||
@@ -320,6 +320,11 @@ class User(QModel):
|
||||
def is_authenticated(self):
|
||||
return self.IsAuthenticated
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
"""兼容旧代码的 id 属性,返回 UserUUID"""
|
||||
return self.UserUUID
|
||||
|
||||
@property
|
||||
def yonghuid(self):
|
||||
"""兼容旧代码的 yonghuid 属性"""
|
||||
|
||||
@@ -3033,10 +3033,10 @@ class DashouDingdanHuoquView(APIView):
|
||||
UserUID__in=zhiding_ids
|
||||
).select_related('dashou_profile').annotate(
|
||||
nicheng=F('dashou_profile__nicheng')
|
||||
).values('yonghuid', 'avatar', 'nicheng')
|
||||
).values('UserUID', 'Avatar', 'nicheng')
|
||||
zhiding_info = {
|
||||
item['yonghuid']: {
|
||||
'avatar': item['avatar'] or '',
|
||||
item['UserUID']: {
|
||||
'avatar': item['Avatar'] or '',
|
||||
'nicheng': item['nicheng'] or ''
|
||||
}
|
||||
for item in dashou_query
|
||||
@@ -3079,12 +3079,12 @@ class DashouDingdanHuoquView(APIView):
|
||||
if sj['shangjia_id']:
|
||||
yonghuid_set.add(sj['shangjia_id'])
|
||||
|
||||
# 将 yonghuid 字符串转换为 User 的主键 id
|
||||
# 将 yonghuid 字符串转换为 User 的主键 UserUUID
|
||||
user_id_map = {}
|
||||
if yonghuid_set:
|
||||
users = User.query.filter(UserUID__in=yonghuid_set).values('id', 'yonghuid')
|
||||
users = User.query.filter(UserUID__in=yonghuid_set).values('UserUUID', 'UserUID')
|
||||
for u in users:
|
||||
user_id_map[u['yonghuid']] = u['id']
|
||||
user_id_map[u['UserUID']] = u['UserUUID']
|
||||
|
||||
user_main_ids = list(user_id_map.values())
|
||||
user_tags_map = {}
|
||||
|
||||
@@ -5949,7 +5949,7 @@ class ZuzhangFenhongView(APIView):
|
||||
users = User.query.filter(UserUID__in=guanshi_ids).select_related(
|
||||
'boss_profile'
|
||||
).only(
|
||||
'yonghuid', 'avatar',
|
||||
'UserUID', 'Avatar',
|
||||
'boss_profile__nickname'
|
||||
)
|
||||
|
||||
|
||||
@@ -1490,7 +1490,7 @@ class GuanshiYaoqingDashouListView(APIView):
|
||||
# 5. 应用筛选条件
|
||||
if keyword:
|
||||
base_qs = base_qs.filter(
|
||||
Q(nicheng__icontains=keyword) | Q(user__yonghuid__icontains=keyword)
|
||||
Q(nicheng__icontains=keyword) | Q(user__UserUID__icontains=keyword)
|
||||
)
|
||||
if zhanghaozhuangtai is not None:
|
||||
try:
|
||||
@@ -3136,7 +3136,7 @@ class AdGuanLiYongHu(APIView):
|
||||
|
||||
if keyword:
|
||||
queryset = queryset.filter(
|
||||
Q(user__yonghuid__icontains=keyword) |
|
||||
Q(user__UserUID__icontains=keyword) |
|
||||
Q(nickname__icontains=keyword)
|
||||
)
|
||||
|
||||
@@ -3178,7 +3178,7 @@ class AdGuanLiYongHu(APIView):
|
||||
|
||||
if keyword:
|
||||
queryset = queryset.filter(
|
||||
Q(user__yonghuid__icontains=keyword) |
|
||||
Q(user__UserUID__icontains=keyword) |
|
||||
Q(nicheng__icontains=keyword) |
|
||||
Q(chenghao__icontains=keyword)
|
||||
)
|
||||
@@ -3224,7 +3224,7 @@ class AdGuanLiYongHu(APIView):
|
||||
|
||||
if keyword:
|
||||
queryset = queryset.filter(
|
||||
Q(user__yonghuid__icontains=keyword)
|
||||
Q(user__UserUID__icontains=keyword)
|
||||
)
|
||||
|
||||
# 获取总数
|
||||
@@ -3266,7 +3266,7 @@ class AdGuanLiYongHu(APIView):
|
||||
|
||||
if keyword:
|
||||
queryset = queryset.filter(
|
||||
Q(user__yonghuid__icontains=keyword) |
|
||||
Q(user__UserUID__icontains=keyword) |
|
||||
Q(nicheng__icontains=keyword)
|
||||
)
|
||||
|
||||
@@ -7074,7 +7074,7 @@ class KefuGetOrderListView(APIView):
|
||||
nickname_map = {}
|
||||
if laoban_ids:
|
||||
users = User.query.filter(UserUID__in=laoban_ids).select_related('boss_profile').only(
|
||||
'yonghuid', 'boss_profile__nickname'
|
||||
'UserUID', 'boss_profile__nickname'
|
||||
)
|
||||
for user in users:
|
||||
nickname_map[user.yonghuid] = user.boss_profile.nickname or '' if hasattr(user, 'boss_profile') else ''
|
||||
@@ -7205,7 +7205,7 @@ class KefuGetShangjiaOrderListView(APIView):
|
||||
# 通过商家扩展表关联 UserShangjia 的昵称
|
||||
q_conditions &= Q(shangjia_kuozhan__shangjia_id__in=User.query.filter(
|
||||
shop_profile__nicheng__icontains=shangjia_nicheng
|
||||
).values_list('yonghuid', flat=True))
|
||||
).values_list('UserUID', flat=True))
|
||||
|
||||
# ---------- 统计(仅按发单平台,非跨平台) ----------
|
||||
stats = Dingdan.query.filter(fadan_pingtai=2).aggregate(
|
||||
@@ -7243,7 +7243,7 @@ class KefuGetShangjiaOrderListView(APIView):
|
||||
nickname_map = {}
|
||||
if shangjia_ids:
|
||||
users = User.query.filter(UserUID__in=shangjia_ids).select_related('shop_profile').only(
|
||||
'yonghuid', 'shop_profile__nicheng'
|
||||
'UserUID', 'shop_profile__nicheng'
|
||||
)
|
||||
for user in users:
|
||||
nickname_map[user.yonghuid] = user.shop_profile.nicheng or '' if hasattr(user, 'shop_profile') else ''
|
||||
@@ -8396,7 +8396,7 @@ class KefuGetDashouListView(APIView):
|
||||
if keyword:
|
||||
# 搜索用户ID或打手昵称
|
||||
queryset = queryset.filter(
|
||||
Q(user__yonghuid__icontains=keyword) |
|
||||
Q(user__UserUID__icontains=keyword) |
|
||||
Q(nicheng__icontains=keyword)
|
||||
)
|
||||
|
||||
@@ -10411,9 +10411,9 @@ class AdKfglView(APIView):
|
||||
|
||||
if keyword:
|
||||
queryset = queryset.filter(
|
||||
#Q(user__yonghuid__icontains=keyword) |
|
||||
#Q(user__UserUID__icontains=keyword) |
|
||||
Q(nicheng__icontains=keyword) |
|
||||
Q(user__phone__icontains=keyword)
|
||||
Q(user__Phone__icontains=keyword)
|
||||
)
|
||||
|
||||
# 4. 构建返回数据
|
||||
|
||||
Reference in New Issue
Block a user