加入了 GVSDSDK 模块,进行了 QModel 兼容层的尝试,生产环境可用

This commit is contained in:
2026-06-16 00:13:10 +08:00
parent 9d9cfa53a4
commit 63e0f4edfc
68 changed files with 10256 additions and 1143 deletions

View File

@@ -17,6 +17,7 @@ import logging
from orders.models import Dingdan
from users.models import UserMain, UserDashou, UserShangjia
from utils.celery_utils import safe_decimal_operation, log_task_execution, rollback_on_failure
from gvsdsdk.fluent import db, func, FQ
logger = logging.getLogger(__name__)
@@ -62,13 +63,13 @@ def process_expired_order(self, dingdan_id):
if dashou_id:
try:
# 查询打手用户主表
dashou_user = UserMain.objects.filter(yonghuid=dashou_id).first()
dashou_user = UserMain.query.filter(yonghuid=dashou_id).first()
if dashou_user:
# 获取打手扩展表
dashou_profile = getattr(dashou_user, 'dashou_profile', None)
if dashou_profile:
# 使用F表达式原子更新
UserDashou.objects.filter(pk=dashou_profile.pk).update(
UserDashou.query.filter(pk=dashou_profile.pk).update(
chengjiaozongliang=F('chengjiaozongliang') + 1,
yue=F('yue') + dashou_fencheng,
zonge=F('zonge') + dashou_fencheng,
@@ -91,12 +92,12 @@ def process_expired_order(self, dingdan_id):
shangjia_id = shangjia_kuozhan.shangjia_id
if shangjia_id:
# 查询商家用户
shangjia_user = UserMain.objects.filter(yonghuid=shangjia_id).first()
shangjia_user = UserMain.query.filter(yonghuid=shangjia_id).first()
if shangjia_user:
shangjia_profile = getattr(shangjia_user, 'shop_profile', None)
if shangjia_profile:
# 更新商家成交订单数量
UserShangjia.objects.filter(pk=shangjia_profile.pk).update(
UserShangjia.query.filter(pk=shangjia_profile.pk).update(
chengjiao=F('chengjiao') + 1
)
updated_shangjia = True
@@ -151,7 +152,7 @@ def check_order_expire_task():
check_time = timezone.now() - timedelta(seconds=settings.ORDER_EXPIRE_SECONDS + 86400) # 48+24=72小时
# 查询状态为8且创建时间早于检查时间的订单
expired_orders = Dingdan.objects.filter(
expired_orders = Dingdan.query.filter(
zhuangtai=8,
create_time__lt=check_time
).values_list('dingdan_id', flat=True)