修复了已知的生产环境问题
This commit is contained in:
106
users/views.py
106
users/views.py
@@ -39,8 +39,8 @@ from rest_framework.throttling import AnonRateThrottle
|
||||
from rest_framework_simplejwt.tokens import RefreshToken
|
||||
from rest_framework_simplejwt.authentication import JWTAuthentication
|
||||
|
||||
from gvsdsdk.fluent import db, func, FQ
|
||||
|
||||
from gvsdsdk.fluent import db, func, FQ
|
||||
|
||||
from utils.oss_utils import validate_image, upload_to_oss, delete_from_oss
|
||||
from utils.fadan_utils import check_fadan_qiangdan_eligible
|
||||
from utils.wechat_v3 import verify_wechat_sign, decrypt_callback_ciphertext
|
||||
@@ -343,7 +343,7 @@ class WechatMiniProgramLoginView(APIView):
|
||||
user_id = timestamp_part + random_part
|
||||
|
||||
if len(user_id) == 7 and user_id.isdigit():
|
||||
if not User.query.filter(yonghuid=user_id).exists():
|
||||
if not User.query.filter(UserUID=user_id).exists():
|
||||
return user_id
|
||||
|
||||
raise Exception('生成用户ID失败')
|
||||
@@ -827,7 +827,7 @@ class HuoQuYaoQingRenView(APIView):
|
||||
|
||||
# 3. 查询邀请人主表(头像)
|
||||
try:
|
||||
inviter_main = User.query.get(yonghuid=yaoqingren_id)
|
||||
inviter_main = User.query.get(UserUID=yaoqingren_id)
|
||||
touxiang = inviter_main.avatar or ''
|
||||
except User.DoesNotExist:
|
||||
return Response({
|
||||
@@ -1081,7 +1081,7 @@ class ShangJiaXinXiView(APIView):
|
||||
|
||||
# ------------------- 3. 从 ShangjiaRiTongji 获取今日统计 -------------------
|
||||
try:
|
||||
today_stat = ShangjiaRiTongji.query.get(yonghuid=yonghuid, riqi=today)
|
||||
today_stat = ShangjiaRiTongji.query.get(UserUID=yonghuid, riqi=today)
|
||||
jinri_paifa_dingdan = today_stat.paifa_dingdan_shu
|
||||
jinri_paifa_jine = float(today_stat.paifa_jine)
|
||||
jinri_tuikuan_dingdan = today_stat.tuikuan_dingdan_shu
|
||||
@@ -1096,7 +1096,7 @@ class ShangJiaXinXiView(APIView):
|
||||
|
||||
# ------------------- 4. 从 ShangjiaRiTongji 获取本月统计 -------------------
|
||||
month_stats = ShangjiaRiTongji.query.filter(
|
||||
yonghuid=yonghuid,
|
||||
UserUID=yonghuid,
|
||||
riqi__gte=this_month_start,
|
||||
riqi__lte=today
|
||||
).aggregate(
|
||||
@@ -2161,7 +2161,7 @@ class TixianJiluHuoquViewV2(APIView):
|
||||
limit = 100
|
||||
offset = (page - 1) * limit
|
||||
|
||||
qs = Tixianjilu.query.filter(yonghuid=yonghuid)
|
||||
qs = Tixianjilu.query.filter(UserUID=yonghuid)
|
||||
if mode == 2:
|
||||
# 自动提现:含新审核关联记录;zhuangtai>0 时按状态筛选
|
||||
if zhuangtai_filter > 0:
|
||||
@@ -3668,7 +3668,7 @@ class AdTongYiChuFa(APIView):
|
||||
|
||||
# 11.2 查询打手扩展表(只是验证存在性)
|
||||
try:
|
||||
dashou = UserDashou.query.get(user__yonghuid=chufajilu.dashouid)
|
||||
dashou = UserDashou.query.get(user__UserUID=chufajilu.dashouid)
|
||||
except UserDashou.DoesNotExist:
|
||||
return Response(
|
||||
{'code': 404, 'message': '被处罚打手不存在', 'data': None},
|
||||
@@ -3698,7 +3698,7 @@ class AdTongYiChuFa(APIView):
|
||||
# 🔴【新增】11.5 返还打手积分(加5分)
|
||||
if chufajilu.jifen > 0:
|
||||
try:
|
||||
dashou = UserDashou.query.get(user__yonghuid=chufajilu.dashouid)
|
||||
dashou = UserDashou.query.get(user__UserUID=chufajilu.dashouid)
|
||||
|
||||
# 🔴【新增】安全验证:必须积分小于等于5分才允许加分
|
||||
if dashou.jifen <= 5: # 判断积分是否小于等于5分
|
||||
@@ -3827,7 +3827,7 @@ class AdckyhxqView(APIView):
|
||||
}, status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
# 查询用户主表 - 使用select_related优化查询
|
||||
user_main = User.query.filter(yonghuid=uid).first()
|
||||
user_main = User.query.filter(UserUID=uid).first()
|
||||
if not user_main:
|
||||
return Response({
|
||||
'code': 404,
|
||||
@@ -3856,7 +3856,7 @@ class AdckyhxqView(APIView):
|
||||
# 根据用户类型查询扩展信息
|
||||
if user_type == 1: # 老板
|
||||
# 使用select_related预取boss_profile
|
||||
user_main = User.query.filter(yonghuid=uid).select_related('boss_profile').first()
|
||||
user_main = User.query.filter(UserUID=uid).select_related('boss_profile').first()
|
||||
if user_main.boss_profile:
|
||||
boss_profile = user_main.boss_profile
|
||||
user_info.update({
|
||||
@@ -3869,7 +3869,7 @@ class AdckyhxqView(APIView):
|
||||
|
||||
elif user_type == 2: # 打手
|
||||
# 使用select_related预取dashou_profile
|
||||
user_main = User.query.filter(yonghuid=uid).select_related('dashou_profile').first()
|
||||
user_main = User.query.filter(UserUID=uid).select_related('dashou_profile').first()
|
||||
if user_main.dashou_profile:
|
||||
dashou_profile = user_main.dashou_profile
|
||||
|
||||
@@ -3928,7 +3928,7 @@ class AdckyhxqView(APIView):
|
||||
|
||||
elif user_type == 3: # 管事
|
||||
# 使用select_related预取guanshi_profile
|
||||
user_main = User.query.filter(yonghuid=uid).select_related('guanshi_profile').first()
|
||||
user_main = User.query.filter(UserUID=uid).select_related('guanshi_profile').first()
|
||||
if user_main.guanshi_profile:
|
||||
guanshi_profile = user_main.guanshi_profile
|
||||
user_info.update({
|
||||
@@ -3947,7 +3947,7 @@ class AdckyhxqView(APIView):
|
||||
|
||||
elif user_type == 4: # 商家
|
||||
# 使用select_related预取shop_profile
|
||||
user_main = User.query.filter(yonghuid=uid).select_related('shop_profile').first()
|
||||
user_main = User.query.filter(UserUID=uid).select_related('shop_profile').first()
|
||||
if user_main.shop_profile:
|
||||
shop_profile = user_main.shop_profile
|
||||
user_info.update({
|
||||
@@ -4061,7 +4061,7 @@ class AdcjxgView(APIView):
|
||||
}, status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
# 查询用户主表
|
||||
user_main = User.query.filter(yonghuid=uid).first()
|
||||
user_main = User.query.filter(UserUID=uid).first()
|
||||
if not user_main:
|
||||
return Response({
|
||||
'code': 404,
|
||||
@@ -5457,7 +5457,7 @@ class WechatLoginAndDashouRegisterView(APIView):
|
||||
user_id = timestamp_part + random_part
|
||||
|
||||
if len(user_id) == 7 and user_id.isdigit():
|
||||
if not User.query.filter(yonghuid=user_id).exists():
|
||||
if not User.query.filter(UserUID=user_id).exists():
|
||||
return user_id
|
||||
|
||||
raise Exception('生成用户ID失败')
|
||||
@@ -5730,7 +5730,7 @@ class YonghuTixianShenheXiugaiView(APIView):
|
||||
try:
|
||||
tixian_record = Tixianjilu.objects.select_for_update().get(
|
||||
id=tixian_id,
|
||||
yonghuid=current_yonghuid # 确保只能修改自己的记录
|
||||
UserUID=current_yonghuid # 确保只能修改自己的记录
|
||||
)
|
||||
except Tixianjilu.DoesNotExist:
|
||||
return Response({
|
||||
@@ -6158,7 +6158,7 @@ class ChufaJiluHuoquView(APIView):
|
||||
zhengju_mapping = {}
|
||||
if dingdan_ids and shangjia_ids:
|
||||
# 构建Q对象:dingdan_id在列表中 AND yonghuid在商家ID列表中
|
||||
zhengju_q = Q(dingdan_id__in=dingdan_ids, yonghuid__in=shangjia_ids)
|
||||
zhengju_q = Q(dingdan_id__in=dingdan_ids, UserUID__in=shangjia_ids)
|
||||
zhengju_queryset = Chufatupian.query.filter(zhengju_q).values('dingdan_id', 'yonghuid', 'tupian')
|
||||
|
||||
for item in zhengju_queryset:
|
||||
@@ -6353,7 +6353,7 @@ class DashouShensuView(APIView):
|
||||
# 检查是否已经有申诉图片
|
||||
existing_shensu_tupian = Chufatupian.query.filter(
|
||||
dingdan_id=chufa_record.dingdan_id,
|
||||
yonghuid=yonghuid
|
||||
UserUID=yonghuid
|
||||
).exists()
|
||||
|
||||
if existing_shensu_tupian:
|
||||
@@ -6600,7 +6600,7 @@ class ShangjiaChufaJiluHuoquView(APIView):
|
||||
shensu_mapping = {}
|
||||
if dingdan_ids and dashou_ids:
|
||||
# 构建Q对象:dingdan_id在列表中 AND yonghuid在打手ID列表中
|
||||
shensu_q = Q(dingdan_id__in=dingdan_ids, yonghuid__in=dashou_ids)
|
||||
shensu_q = Q(dingdan_id__in=dingdan_ids, UserUID__in=dashou_ids)
|
||||
shensu_queryset = Chufatupian.query.filter(shensu_q).values('dingdan_id', 'yonghuid', 'tupian')
|
||||
|
||||
for item in shensu_queryset:
|
||||
@@ -7064,7 +7064,7 @@ class KefuGetOrderListView(APIView):
|
||||
laoban_ids = [o.pingtai_kuozhan.laoban_id for o in orders_qs if hasattr(o, 'pingtai_kuozhan') and o.pingtai_kuozhan.laoban_id]
|
||||
nickname_map = {}
|
||||
if laoban_ids:
|
||||
users = User.query.filter(yonghuid__in=laoban_ids).select_related('boss_profile').only(
|
||||
users = User.query.filter(UserUID__in=laoban_ids).select_related('boss_profile').only(
|
||||
'yonghuid', 'boss_profile__nickname'
|
||||
)
|
||||
for user in users:
|
||||
@@ -7233,7 +7233,7 @@ class KefuGetShangjiaOrderListView(APIView):
|
||||
shangjia_ids = [o.shangjia_kuozhan.shangjia_id for o in orders_qs if hasattr(o, 'shangjia_kuozhan') and o.shangjia_kuozhan.shangjia_id]
|
||||
nickname_map = {}
|
||||
if shangjia_ids:
|
||||
users = User.query.filter(yonghuid__in=shangjia_ids).select_related('shop_profile').only(
|
||||
users = User.query.filter(UserUID__in=shangjia_ids).select_related('shop_profile').only(
|
||||
'yonghuid', 'shop_profile__nicheng'
|
||||
)
|
||||
for user in users:
|
||||
@@ -7339,7 +7339,7 @@ class KefuChangeDashouView(APIView):
|
||||
|
||||
# 5. 查询新打手
|
||||
try:
|
||||
new_dashou_user = User.query.get(yonghuid=new_dashou_id)
|
||||
new_dashou_user = User.query.get(UserUID=new_dashou_id)
|
||||
except User.DoesNotExist:
|
||||
return Response({'code': 404, 'msg': '打手不存在'}, status=status.HTTP_404_NOT_FOUND)
|
||||
|
||||
@@ -7401,7 +7401,7 @@ class KefuChangeDashouView(APIView):
|
||||
old_dashou_id = order.jiedan_dashou_id
|
||||
if old_dashou_id:
|
||||
try:
|
||||
old_dashou_user = User.query.get(yonghuid=old_dashou_id)
|
||||
old_dashou_user = User.query.get(UserUID=old_dashou_id)
|
||||
old_dashou_profile = old_dashou_user.dashou_profile
|
||||
old_dashou_profile.zhuangtai = 1 # 恢复空闲
|
||||
old_dashou_profile.tuikuanliang += 1 # 原打手退款总量+1(业务逻辑)
|
||||
@@ -7577,7 +7577,7 @@ class KefuPlatformRefundView(APIView):
|
||||
jiedan_dashou_id = order.jiedan_dashou_id
|
||||
if jiedan_dashou_id:
|
||||
try:
|
||||
dashou_user = User.query.get(yonghuid=jiedan_dashou_id)
|
||||
dashou_user = User.query.get(UserUID=jiedan_dashou_id)
|
||||
dashou_profile = dashou_user.dashou_profile
|
||||
dashou_profile.tuikuanliang += 1
|
||||
dashou_profile.zhuangtai = 1 # 打手状态设为空闲
|
||||
@@ -7842,7 +7842,7 @@ class KefuRejectRefundView(APIView):
|
||||
# 7. 给打手结算(返还分成)
|
||||
if jiedan_dashou_id:
|
||||
try:
|
||||
dashou_user = User.query.get(yonghuid=jiedan_dashou_id)
|
||||
dashou_user = User.query.get(UserUID=jiedan_dashou_id)
|
||||
dashou_profile = dashou_user.dashou_profile
|
||||
# 增加打手相关统计数据
|
||||
dashou_profile.chengjiaozongliang += 1
|
||||
@@ -7862,7 +7862,7 @@ class KefuRejectRefundView(APIView):
|
||||
shangjia_kuozhan = order.shangjia_kuozhan
|
||||
shangjia_id = shangjia_kuozhan.shangjia_id
|
||||
if shangjia_id:
|
||||
shangjia_user = User.query.get(yonghuid=shangjia_id)
|
||||
shangjia_user = User.query.get(UserUID=shangjia_id)
|
||||
shangjia_profile = shangjia_user.shop_profile
|
||||
shangjia_profile.chengjiao += 1
|
||||
shangjia_profile.save()
|
||||
@@ -8019,7 +8019,7 @@ class KefuMerchantRefundView(APIView):
|
||||
# 更新打手
|
||||
if jiedan_dashou_id:
|
||||
try:
|
||||
dashou_user = User.query.get(yonghuid=jiedan_dashou_id)
|
||||
dashou_user = User.query.get(UserUID=jiedan_dashou_id)
|
||||
dashou_profile = dashou_user.dashou_profile
|
||||
dashou_profile.tuikuanliang += 1
|
||||
dashou_profile.zhuangtai = 1
|
||||
@@ -8029,7 +8029,7 @@ class KefuMerchantRefundView(APIView):
|
||||
|
||||
# 更新商家
|
||||
try:
|
||||
shangjia_user = User.query.get(yonghuid=shangjia_id)
|
||||
shangjia_user = User.query.get(UserUID=shangjia_id)
|
||||
shangjia_profile = shangjia_user.shop_profile
|
||||
shangjia_profile.tuikuan += 1
|
||||
shangjia_profile.yue += jine
|
||||
@@ -8156,7 +8156,7 @@ class KefuRejectSettlementView(APIView):
|
||||
|
||||
# 5.3 更新打手扩展表
|
||||
try:
|
||||
dashou_user = User.query.get(yonghuid=jiedan_dashou_id)
|
||||
dashou_user = User.query.get(UserUID=jiedan_dashou_id)
|
||||
dashou_profile = dashou_user.dashou_profile
|
||||
dashou_profile.zhuangtai = 1 # 打手状态设为空闲
|
||||
dashou_profile.tuikuanliang += 1 # 退款订单总量+1
|
||||
@@ -8240,7 +8240,7 @@ class KefuTransferHallView(APIView):
|
||||
|
||||
|
||||
if order.jiedan_dashou_id:
|
||||
UserDashou.query.filter(user__yonghuid=order.jiedan_dashou_id).update(zhuangtai=1)
|
||||
UserDashou.query.filter(user__UserUID=order.jiedan_dashou_id).update(zhuangtai=1)
|
||||
else:
|
||||
pass
|
||||
|
||||
@@ -8617,7 +8617,7 @@ class KefuUpdateDashouView(APIView):
|
||||
|
||||
# 3. 查询打手是否存在
|
||||
try:
|
||||
dashou_user = User.query.get(yonghuid=dashou_id, user_type='dashou')
|
||||
dashou_user = User.query.get(UserUID=dashou_id, user_type='dashou')
|
||||
dashou_profile = dashou_user.dashou_profile
|
||||
except User.DoesNotExist:
|
||||
return Response({'code': 404, 'msg': '打手不存在'})
|
||||
@@ -9189,11 +9189,11 @@ class KefuPunishmentDetailView(APIView):
|
||||
shensu_images = []
|
||||
try:
|
||||
# 商家证据图片:上传者为请求人 (qingqiuid)
|
||||
zhengju_qs = Chufatupian.query.filter(dingdan_id=dingdan_id, yonghuid=record.qingqiuid)
|
||||
zhengju_qs = Chufatupian.query.filter(dingdan_id=dingdan_id, UserUID=record.qingqiuid)
|
||||
zhengju_images = [item.tupian for item in zhengju_qs if item.tupian]
|
||||
|
||||
# 打手申诉图片:上传者为打手 (dashouid)
|
||||
shensu_qs = Chufatupian.query.filter(dingdan_id=dingdan_id, yonghuid=record.dashouid)
|
||||
shensu_qs = Chufatupian.query.filter(dingdan_id=dingdan_id, UserUID=record.dashouid)
|
||||
shensu_images = [item.tupian for item in shensu_qs if item.tupian]
|
||||
except Exception as e:
|
||||
logger.error(f"查询图片失败: {e}")
|
||||
@@ -9294,7 +9294,7 @@ class KefuPunishmentActionView(APIView):
|
||||
# 可选验证打手存在
|
||||
if record.dashouid:
|
||||
try:
|
||||
dashou = UserDashou.query.get(user__yonghuid=record.dashouid)
|
||||
dashou = UserDashou.query.get(user__UserUID=record.dashouid)
|
||||
except UserDashou.DoesNotExist:
|
||||
return Response({'code': 400, 'msg': '被处罚打手不存在'}, status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
@@ -9315,7 +9315,7 @@ class KefuPunishmentActionView(APIView):
|
||||
# 返还积分
|
||||
if record.jifen > 0 and record.dashouid:
|
||||
try:
|
||||
dashou = UserDashou.query.get(user__yonghuid=record.dashouid)
|
||||
dashou = UserDashou.query.get(user__UserUID=record.dashouid)
|
||||
if dashou.jifen <= 1000: # 安全限制
|
||||
dashou.jifen += record.jifen
|
||||
dashou.save()
|
||||
@@ -9410,7 +9410,7 @@ class KefuForceCompleteView(APIView):
|
||||
|
||||
# 5. 给打手结算
|
||||
try:
|
||||
dashou_user = User.query.get(yonghuid=dashou_id)
|
||||
dashou_user = User.query.get(UserUID=dashou_id)
|
||||
dashou_profile = dashou_user.dashou_profile
|
||||
# 原子更新(避免并发重复加)
|
||||
dashou_profile.chengjiaozongliang = F('chengjiaozongliang') + 1
|
||||
@@ -9431,7 +9431,7 @@ class KefuForceCompleteView(APIView):
|
||||
# 通过 DingdanShangjia 获取商家ID
|
||||
shangjia_ext = order.shangjia_kuozhan # 假设 related_name='shangjia_kuozhan'
|
||||
if shangjia_ext and shangjia_ext.shangjia_id:
|
||||
shangjia_user = User.query.get(yonghuid=shangjia_ext.shangjia_id)
|
||||
shangjia_user = User.query.get(UserUID=shangjia_ext.shangjia_id)
|
||||
shangjia_profile = shangjia_user.shop_profile
|
||||
shangjia_profile.chengjiao = F('chengjiao') + 1
|
||||
shangjia_profile.save(update_fields=['chengjiao'])
|
||||
@@ -9874,7 +9874,7 @@ class KefuWithdrawDetailView(APIView):
|
||||
|
||||
# 查询用户主表
|
||||
try:
|
||||
user = User.query.get(yonghuid=record.yonghuid)
|
||||
user = User.query.get(UserUID=record.yonghuid)
|
||||
except User.DoesNotExist:
|
||||
user = None
|
||||
|
||||
@@ -10047,7 +10047,7 @@ class KefuWithdrawActionView(APIView):
|
||||
raise ValueError(f'提现记录{tixian_id}:审核记录非审核中状态')
|
||||
|
||||
try:
|
||||
user = User.objects.select_for_update().get(yonghuid=req_yonghuid)
|
||||
user = User.objects.select_for_update().get(UserUID=req_yonghuid)
|
||||
except User.DoesNotExist:
|
||||
raise ValueError(f'用户{req_yonghuid}不存在')
|
||||
|
||||
@@ -10100,7 +10100,7 @@ class KefuWithdrawActionView(APIView):
|
||||
raise ValueError(f'提现记录{tixian_id}:自动打款请走自动流程')
|
||||
|
||||
try:
|
||||
user = User.query.get(yonghuid=tixian.yonghuid)
|
||||
user = User.query.get(UserUID=tixian.yonghuid)
|
||||
except User.DoesNotExist:
|
||||
raise ValueError(f'用户{tixian.yonghuid}不存在')
|
||||
|
||||
@@ -10247,7 +10247,7 @@ class KefuPunishView(APIView):
|
||||
|
||||
# 5. 查询打手
|
||||
try:
|
||||
dashou_user = User.query.get(yonghuid=dashou_id)
|
||||
dashou_user = User.query.get(UserUID=dashou_id)
|
||||
dashou = dashou_user.dashou_profile
|
||||
except User.DoesNotExist:
|
||||
return Response({'code': 404, 'msg': '打手用户不存在'}, status=status.HTTP_404_NOT_FOUND)
|
||||
@@ -10329,7 +10329,7 @@ class AdKftjView(APIView):
|
||||
timestamp = str(int(time.time()))[-5:]
|
||||
rand = str(random.randint(0, 99)).zfill(2)
|
||||
uid = timestamp + rand
|
||||
if len(uid) == 7 and not User.query.filter(yonghuid=uid).exists():
|
||||
if len(uid) == 7 and not User.query.filter(UserUID=uid).exists():
|
||||
return uid
|
||||
raise Exception('无法生成唯一用户ID')
|
||||
|
||||
@@ -10645,7 +10645,7 @@ class WechatLoginAndGuanshiRegisterView(APIView):
|
||||
random_part = str(random.randint(0, 99)).zfill(2)
|
||||
user_id = timestamp_part + random_part
|
||||
if len(user_id) == 7 and user_id.isdigit():
|
||||
if not User.query.filter(yonghuid=user_id).exists():
|
||||
if not User.query.filter(UserUID=user_id).exists():
|
||||
return user_id
|
||||
raise Exception('生成用户ID失败')
|
||||
|
||||
@@ -11931,7 +11931,7 @@ class FaKuanPayPollView(APIView):
|
||||
if not dingdanid:
|
||||
return Response({'code': 400, 'message': '订单ID不能为空'})
|
||||
|
||||
order = Czjilu.query.get(dingdan_id=dingdanid, yonghuid=request.user.yonghuid)
|
||||
order = Czjilu.query.get(dingdan_id=dingdanid, UserUID=request.user.yonghuid)
|
||||
if order.zhuangtai == 3:
|
||||
return Response({'code': 200, 'message': '支付成功'})
|
||||
else:
|
||||
@@ -11954,7 +11954,7 @@ class FaKuanPayFailView(APIView):
|
||||
if not dingdanid:
|
||||
return Response({'code': 400, 'message': '订单ID不能为空'})
|
||||
|
||||
order = Czjilu.query.get(dingdan_id=dingdanid, yonghuid=request.user.yonghuid)
|
||||
order = Czjilu.query.get(dingdan_id=dingdanid, UserUID=request.user.yonghuid)
|
||||
if order.zhuangtai == 9: # 未支付
|
||||
order.delete()
|
||||
logger.info(f"用户{request.user.yonghuid}删除未支付订单: {dingdanid}")
|
||||
@@ -12004,7 +12004,7 @@ class KaohePayView(APIView):
|
||||
|
||||
# 1. 检查是否有未支付的考核订单
|
||||
"""unpaid_order = Czjilu.query.filter(
|
||||
yonghuid=user.yonghuid,
|
||||
UserUID=user.yonghuid,
|
||||
leixing=5,
|
||||
zhuangtai=9
|
||||
).exists()
|
||||
@@ -12366,10 +12366,10 @@ class KaohePayCallbackView(View):
|
||||
|
||||
# 从临时表获取业务参数并创建审核记录
|
||||
try:
|
||||
temp = KaohePayTemp.query.get(dingdan_id=out_trade_no, yonghuid=order.yonghuid)
|
||||
temp = KaohePayTemp.query.get(dingdan_id=out_trade_no, UserUID=order.yonghuid)
|
||||
logger.info(f"找到临时表记录: {out_trade_no}, 用户ID: {order.yonghuid}")
|
||||
|
||||
user = User.query.get(yonghuid=order.yonghuid)
|
||||
user = User.query.get(UserUID=order.yonghuid)
|
||||
logger.info(f"获取用户信息成功: {user.yonghuid}")
|
||||
|
||||
success, msg, record = create_shenhe_jilu_from_temp(user, temp)
|
||||
@@ -12486,7 +12486,7 @@ class KaohePayPollView(APIView):
|
||||
if not dingdanid:
|
||||
return Response({'code': 400, 'message': '订单ID不能为空'})
|
||||
try:
|
||||
order = Czjilu.query.get(dingdan_id=dingdanid, yonghuid=request.user.yonghuid, leixing=5)
|
||||
order = Czjilu.query.get(dingdan_id=dingdanid, UserUID=request.user.yonghuid, leixing=5)
|
||||
if order.zhuangtai == 3:
|
||||
return Response({'code': 200, 'message': '支付成功'})
|
||||
return Response({'code': 400, 'message': '订单尚未支付'})
|
||||
@@ -12503,7 +12503,7 @@ class KaohePayFailView(APIView):
|
||||
if not dingdanid:
|
||||
return Response({'code': 400, 'message': '订单ID不能为空'})
|
||||
try:
|
||||
order = Czjilu.query.get(dingdan_id=dingdanid, yonghuid=request.user.yonghuid, leixing=5)
|
||||
order = Czjilu.query.get(dingdan_id=dingdanid, UserUID=request.user.yonghuid, leixing=5)
|
||||
if order.zhuangtai == 9:
|
||||
order.delete()
|
||||
return Response({'code': 200, 'message': '订单已删除'})
|
||||
@@ -12676,7 +12676,7 @@ class GuanshiContactView(APIView):
|
||||
|
||||
# 4. 根据邀请人用户ID查询用户主表
|
||||
try:
|
||||
inviter_user = User.query.get(yonghuid=inviter_yonghuid)
|
||||
inviter_user = User.query.get(UserUID=inviter_yonghuid)
|
||||
except User.DoesNotExist:
|
||||
logger.error(f"邀请人用户不存在: yonghuid={inviter_yonghuid}")
|
||||
return Response({
|
||||
@@ -12855,7 +12855,7 @@ class TixianQueRenAutoView(APIView):
|
||||
try:
|
||||
auto_record = TixianAutoRecord.objects.select_for_update().get(
|
||||
tixian_id=tixian_id,
|
||||
yonghuid=user_main.yonghuid,
|
||||
UserUID=user_main.yonghuid,
|
||||
)
|
||||
except TixianAutoRecord.DoesNotExist:
|
||||
return Response({'code': 4, 'msg': '提现记录不存在'}, status=status.HTTP_404_NOT_FOUND)
|
||||
|
||||
Reference in New Issue
Block a user