彻底解决了 create_time 的问题,将所有字段都改为了 CreateTime

This commit is contained in:
2026-06-19 19:19:22 +08:00
parent 90e0bde7f1
commit e64697b64a
35 changed files with 4803 additions and 4872 deletions

View File

@@ -440,8 +440,8 @@ class ShopOverviewView(APIView):
'zhuangtai': dianpu.zhuangtai,
'bangding_yonghushu': dianpu.bangding_yonghushu,
'erweima_url': dianpu.erweima_url or '',
'create_time': dianpu.create_time.isoformat() if dianpu.create_time else '',
'update_time': dianpu.update_time.isoformat() if dianpu.update_time else '',
'CreateTime': dianpu.CreateTime.isoformat() if dianpu.CreateTime else '',
'UpdateTime': dianpu.UpdateTime.isoformat() if dianpu.UpdateTime else '',
# 新增字段
'kaiqi_shouyi_choucheng': dianpu.kaiqi_shouyi_choucheng,
'shouyi_choucheng_feilv': float(dianpu.shouyi_choucheng_feilv) if dianpu.shouyi_choucheng_feilv else 0.0,
@@ -729,7 +729,7 @@ class ShopQrcodeView(APIView):
# 更新数据库
with transaction.atomic():
dianpu.erweima_url = relative_path
dianpu.save(update_fields=['erweima_url', 'update_time'])
dianpu.save(update_fields=['erweima_url', 'UpdateTime'])
return Response({
'code': 0,
@@ -1281,7 +1281,7 @@ class ShopProductListView(APIView):
'guize_tupian', 'yaoqiuleixing', 'huiyuan_id', 'yongjin',
'tupian_url', 'ewai_dashou_fencheng', 'paixu',
'dianpu_leixing_id', 'shangjia_zhuangtai', 'fengjin_zhuangtai',
'shenhe_zhuangtai', 'create_time', 'update_time'
'shenhe_zhuangtai', 'CreateTime', 'UpdateTime'
)
# 筛选
@@ -1342,8 +1342,8 @@ class ShopProductListView(APIView):
'shangjia_zhuangtai': p.shangjia_zhuangtai,
'fengjin_zhuangtai': p.fengjin_zhuangtai,
'shenhe_zhuangtai': p.shenhe_zhuangtai,
'create_time': p.create_time.isoformat() if p.create_time else '',
'update_time': p.update_time.isoformat() if p.update_time else '',
'CreateTime': p.CreateTime.isoformat() if p.CreateTime else '',
'UpdateTime': p.UpdateTime.isoformat() if p.UpdateTime else '',
})
return Response({
@@ -1589,7 +1589,7 @@ class ShopProductModifyView1(APIView):
update_fields.append('shenhe_zhuangtai')
if update_fields:
product.save(update_fields=update_fields + ['update_time'])
product.save(update_fields=update_fields + ['UpdateTime'])
return Response({'code': 0, 'msg': '商品修改成功'})
# ---------- 添加商品(增强会员/佣金默认逻辑) ----------
@@ -1823,7 +1823,7 @@ class SubShopListView(APIView):
pass
# 5. 排序:按创建时间倒序
queryset = queryset.order_by('-create_time')
queryset = queryset.order_by('-CreateTime')
# 6. 分页
try:
@@ -1844,8 +1844,8 @@ class SubShopListView(APIView):
'bangding_yonghushu': shop.bangding_yonghushu,
'zhengqu_zonge': str(shop.zhengqu_zonge),
'ketixian_yue': str(shop.ketixian_yue),
'create_time': shop.create_time.strftime('%Y-%m-%d %H:%M:%S') if shop.create_time else '',
'update_time': shop.update_time.strftime('%Y-%m-%d %H:%M:%S') if shop.update_time else '',
'CreateTime': shop.CreateTime.strftime('%Y-%m-%d %H:%M:%S') if shop.CreateTime else '',
'UpdateTime': shop.UpdateTime.strftime('%Y-%m-%d %H:%M:%S') if shop.UpdateTime else '',
'erweima_url': shop.erweima_url or '',
'fenhong_choucheng_feilv': str(shop.fenhong_choucheng_feilv) if shop.fenhong_choucheng_feilv else '0.0000',
})
@@ -1998,7 +1998,7 @@ class SubShopModifyView(APIView):
except (ValueError, TypeError):
return Response({'code': 400, 'msg': '分红费率格式错误'})
sub_dianpu.save(update_fields=['zhuangtai', 'fenhong_choucheng_feilv', 'update_time'])
sub_dianpu.save(update_fields=['zhuangtai', 'fenhong_choucheng_feilv', 'UpdateTime'])
return Response({'code': 200, 'msg': '修改成功'})
except Dianpu.DoesNotExist:
@@ -2486,8 +2486,8 @@ class ShopOrderManageView(APIView):
'beizhu': order.Remark or '',
'nicheng': order.Nickname or '',
'leixing_id': order.ProductTypeID,
'create_time': order.CreateTime.strftime('%Y-%m-%d %H:%M:%S') if order.CreateTime else '',
'update_time': order.UpdateTime.strftime('%Y-%m-%d %H:%M:%S') if order.UpdateTime else '',
'CreateTime': order.CreateTime.strftime('%Y-%m-%d %H:%M:%S') if order.CreateTime else '',
'UpdateTime': order.UpdateTime.strftime('%Y-%m-%d %H:%M:%S') if order.UpdateTime else '',
'pingtai_kuozhan': {
'laoban_id': ext.BossID or '',
'laoban_pingjia': ext.BossReview or '',