修复了已知的生产环境问题
This commit is contained in:
@@ -62,7 +62,7 @@ from orders.models import (
|
||||
Lilubiao, Pingfen, Tuikuanjilu
|
||||
)
|
||||
from products.models import Shangpin, ShangpinLeixing, Huiyuangoumai
|
||||
from users.models import UserDashou, UserShangjia, UserBoss
|
||||
from users.models import UserDashou, UserShangjia, UserBoss
|
||||
from gvsdsdk.models import User
|
||||
from rank.models import DashouBiaoxian, Chenghao, DingdanBiaoqian, YonghuChenghao
|
||||
from config.models import (
|
||||
@@ -241,7 +241,7 @@ class WechatPayNotifyView(APIView):
|
||||
if hasattr(dingdan, 'pingtai_kuozhan'):
|
||||
laoban_id = dingdan.pingtai_kuozhan.laoban_id
|
||||
if laoban_id:
|
||||
user_main = User.query.filter(yonghuid=laoban_id).first()
|
||||
user_main = User.query.filter(UserUID=laoban_id).first()
|
||||
if user_main and hasattr(user_main, 'boss_profile'):
|
||||
boss = user_main.boss_profile
|
||||
boss.zonge = (boss.zonge or 0) + (dingdan.jine or 0)
|
||||
@@ -525,7 +525,7 @@ class PaymentVerifyView(APIView):
|
||||
# 更新老板扩展表
|
||||
laoban_id = dingdan.pingtai_kuozhan.laoban_id if hasattr(dingdan, 'pingtai_kuozhan') else None
|
||||
if laoban_id:
|
||||
user_main = User.query.filter(yonghuid=laoban_id).first()
|
||||
user_main = User.query.filter(UserUID=laoban_id).first()
|
||||
if user_main and hasattr(user_main, 'boss_profile'):
|
||||
boss = user_main.boss_profile
|
||||
boss.zonge = (boss.zonge or 0) + (dingdan.jine or 0)
|
||||
@@ -712,7 +712,7 @@ class CreateOrderView(APIView):
|
||||
if zhiding:
|
||||
# 查询主表中是否存在该打手
|
||||
zhiding_user = User.query.filter(
|
||||
yonghuid=zhiding,
|
||||
UserUID=zhiding,
|
||||
#user_type='dashou'
|
||||
).first()
|
||||
|
||||
@@ -1349,7 +1349,7 @@ class JiedanView(APIView):
|
||||
# 7. 更新打手扩展表(如果有打手ID和分成)
|
||||
if jiedan_dashou_id and dashou_fencheng > 0:
|
||||
# 查询打手用户
|
||||
dashou_user = User.query.filter(yonghuid=jiedan_dashou_id).first()
|
||||
dashou_user = User.query.filter(UserUID=jiedan_dashou_id).first()
|
||||
|
||||
if dashou_user:
|
||||
# 查询打手扩展表
|
||||
@@ -1512,7 +1512,7 @@ class DingdanXiangqingView2(APIView):
|
||||
jiedan_time = ''
|
||||
tijiao_time = ''
|
||||
if jiedan_dashou_id:
|
||||
dashou_user = User.query.filter(yonghuid=jiedan_dashou_id).first()
|
||||
dashou_user = User.query.filter(UserUID=jiedan_dashou_id).first()
|
||||
if dashou_user:
|
||||
dashou_touxiang = dashou_user.avatar or ''
|
||||
try:
|
||||
@@ -1661,7 +1661,7 @@ class JiedanView2(APIView):
|
||||
|
||||
# 9. 更新打手收益与状态
|
||||
if jiedan_dashou_id and dashou_fencheng > 0:
|
||||
dashou_user = User.query.filter(yonghuid=jiedan_dashou_id).first()
|
||||
dashou_user = User.query.filter(UserUID=jiedan_dashou_id).first()
|
||||
if dashou_user:
|
||||
try:
|
||||
dashou_ext = dashou_user.dashou_profile
|
||||
@@ -1916,7 +1916,7 @@ class ShangjiaPaifaView(APIView):
|
||||
zhiding_dashou = None
|
||||
if zhiding_uid:
|
||||
try:
|
||||
zhiding_user = User.query.get(yonghuid=zhiding_uid)
|
||||
zhiding_user = User.query.get(UserUID=zhiding_uid)
|
||||
zhiding_dashou = zhiding_user.dashou_profile
|
||||
if zhiding_dashou.zhanghaozhuangtai != 1:
|
||||
return Response({'code': 400, 'msg': '指定打手状态异常'})
|
||||
@@ -2223,7 +2223,7 @@ class ShangjiaDingdanXiangqingView(APIView):
|
||||
dashou_avatar = ''
|
||||
if dashou_yonghuid:
|
||||
dashou_user = User.query.filter(
|
||||
yonghuid=dashou_yonghuid
|
||||
UserUID=dashou_yonghuid
|
||||
).select_related('dashou_profile').first()
|
||||
if dashou_user:
|
||||
dashou_avatar = dashou_user.avatar or ''
|
||||
@@ -2426,7 +2426,7 @@ class ShangjiaJiesuanView(APIView):
|
||||
# ========== 本地订单正常结算给打手 ==========
|
||||
# 查询打手信息
|
||||
try:
|
||||
dashou_user = User.query.get(yonghuid=jiedan_dashou_id)
|
||||
dashou_user = User.query.get(UserUID=jiedan_dashou_id)
|
||||
dashou = dashou_user.dashou_profile
|
||||
except (User.DoesNotExist, UserDashou.DoesNotExist):
|
||||
return Response({
|
||||
@@ -2769,7 +2769,7 @@ class ShangjiaTuikuanShenqingView(APIView):
|
||||
if dingdan.jiedan_dashou_id:
|
||||
try:
|
||||
dashou_main = User.query.filter(
|
||||
yonghuid=dingdan.jiedan_dashou_id
|
||||
UserUID=dingdan.jiedan_dashou_id
|
||||
).first()
|
||||
if dashou_main and hasattr(dashou_main, 'dashou_profile'):
|
||||
dashou_profile = dashou_main.dashou_profile
|
||||
@@ -2851,7 +2851,7 @@ class ShangjiaChufaShenqingView(APIView):
|
||||
with transaction.atomic():
|
||||
# 验证打手身份
|
||||
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({
|
||||
@@ -3030,7 +3030,7 @@ class DashouDingdanHuoquView(APIView):
|
||||
zhiding_info = {}
|
||||
if zhiding_ids:
|
||||
dashou_query = User.query.filter(
|
||||
yonghuid__in=zhiding_ids
|
||||
UserUID__in=zhiding_ids
|
||||
).select_related('dashou_profile').annotate(
|
||||
nicheng=F('dashou_profile__nicheng')
|
||||
).values('yonghuid', 'avatar', 'nicheng')
|
||||
@@ -3082,7 +3082,7 @@ class DashouDingdanHuoquView(APIView):
|
||||
# 将 yonghuid 字符串转换为 User 的主键 id
|
||||
user_id_map = {}
|
||||
if yonghuid_set:
|
||||
users = User.query.filter(yonghuid__in=yonghuid_set).values('id', 'yonghuid')
|
||||
users = User.query.filter(UserUID__in=yonghuid_set).values('id', 'yonghuid')
|
||||
for u in users:
|
||||
user_id_map[u['yonghuid']] = u['id']
|
||||
|
||||
@@ -3347,7 +3347,7 @@ def send_group_message(
|
||||
def check_user_permission(identity_type, uid, order):
|
||||
"""验证用户身份、账号状态、以及是否属于该订单"""
|
||||
try:
|
||||
user = User.query.get(yonghuid=uid)
|
||||
user = User.query.get(UserUID=uid)
|
||||
except User.DoesNotExist:
|
||||
return False, '用户不存在'
|
||||
|
||||
@@ -4674,7 +4674,7 @@ class AdGengHuanDaShou(APIView):
|
||||
# 8. 验证新打手ID是否存在,并且是打手身份
|
||||
try:
|
||||
new_dashou_user = User.query.get(
|
||||
yonghuid=new_dashou_id,
|
||||
UserUID=new_dashou_id,
|
||||
#user_type='dashou'
|
||||
)
|
||||
except User.DoesNotExist:
|
||||
@@ -4769,7 +4769,7 @@ class AdGengHuanDaShou(APIView):
|
||||
try:
|
||||
# 查询原打手主表
|
||||
old_dashou_user = User.query.get(
|
||||
yonghuid=old_dashou_id,
|
||||
UserUID=old_dashou_id,
|
||||
#user_type='dashou'
|
||||
)
|
||||
|
||||
@@ -4913,7 +4913,7 @@ class AdQiangZhiJieDan(APIView):
|
||||
try:
|
||||
# 查询打手用户主表
|
||||
dashou_user = User.query.get(
|
||||
yonghuid=jiedan_dashou_id,
|
||||
UserUID=jiedan_dashou_id,
|
||||
#user_type='dashou'
|
||||
)
|
||||
|
||||
@@ -4956,7 +4956,7 @@ class AdQiangZhiJieDan(APIView):
|
||||
if shangjia_id:
|
||||
# 查询商家用户主表
|
||||
shangjia_user = User.query.get(
|
||||
yonghuid=shangjia_id,
|
||||
UserUID=shangjia_id,
|
||||
#user_type='shop'
|
||||
)
|
||||
|
||||
@@ -5089,7 +5089,7 @@ class AdJuJueTuiKuan(APIView):
|
||||
try:
|
||||
# 查询打手用户主表
|
||||
dashou_user = User.query.get(
|
||||
yonghuid=jiedan_dashou_id,
|
||||
UserUID=jiedan_dashou_id,
|
||||
#user_type='dashou'
|
||||
)
|
||||
|
||||
@@ -5132,7 +5132,7 @@ class AdJuJueTuiKuan(APIView):
|
||||
if shangjia_id:
|
||||
# 查询商家用户主表
|
||||
shangjia_user = User.query.get(
|
||||
yonghuid=shangjia_id,
|
||||
UserUID=shangjia_id,
|
||||
#user_type='shop'
|
||||
)
|
||||
|
||||
@@ -5320,7 +5320,7 @@ class AdTongYiTuiKuanShangJia(APIView):
|
||||
try:
|
||||
# 查询打手用户主表
|
||||
dashou_user = User.query.get(
|
||||
yonghuid=jiedan_dashou_id,
|
||||
UserUID=jiedan_dashou_id,
|
||||
#user_type='dashou'
|
||||
)
|
||||
|
||||
@@ -5345,7 +5345,7 @@ class AdTongYiTuiKuanShangJia(APIView):
|
||||
try:
|
||||
# 查询商家用户主表
|
||||
shangjia_user = User.query.get(
|
||||
yonghuid=shangjia_id,
|
||||
UserUID=shangjia_id,
|
||||
#user_type='shop'
|
||||
)
|
||||
|
||||
@@ -5529,7 +5529,7 @@ class AdTongYiTuiKuanPingTai(APIView):
|
||||
# 14. 更新打手扩展表
|
||||
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.zhuangtai = 1 # 打手状态设为空闲
|
||||
dashou_profile.tuikuanliang += 1
|
||||
@@ -5540,7 +5540,7 @@ class AdTongYiTuiKuanPingTai(APIView):
|
||||
# 15. 更新老板扩展表
|
||||
if laoban_id:
|
||||
try:
|
||||
laoban_user = User.query.get(yonghuid=laoban_id)
|
||||
laoban_user = User.query.get(UserUID=laoban_id)
|
||||
laoban_profile = laoban_user.boss_profile
|
||||
laoban_profile.alltui += 1
|
||||
laoban_profile.zonge -= jine
|
||||
@@ -5865,7 +5865,7 @@ class AdJuJueJieSuan(APIView):
|
||||
|
||||
# 8. 更新打手扩展表
|
||||
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
|
||||
@@ -5947,7 +5947,7 @@ class AdZhuanYiDaTing(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.zhuangtai = 1
|
||||
dashou_profile.tuikuanliang += 1
|
||||
@@ -6225,7 +6225,7 @@ class ZxsjghdsView(APIView):
|
||||
# 6.2 释放打手
|
||||
if dashou_id:
|
||||
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.tuikuanliang = (dashou_profile.tuikuanliang or 0) + 1
|
||||
dashou_profile.zhuangtai = 1 # 空闲
|
||||
|
||||
Reference in New Issue
Block a user