This commit is contained in:
@@ -1466,7 +1466,22 @@ class DistributorViewSet(viewsets.GenericViewSet):
|
|||||||
|
|
||||||
distributor = user.distributor
|
distributor = user.distributor
|
||||||
if distributor.qr_code_url:
|
if distributor.qr_code_url:
|
||||||
return Response({'qr_code_url': distributor.qr_code_url})
|
# 检查文件是否真的存在
|
||||||
|
try:
|
||||||
|
# 如果是本地存储,检查文件路径
|
||||||
|
if distributor.qr_code_url.startswith(settings.MEDIA_URL):
|
||||||
|
file_path = distributor.qr_code_url.replace(settings.MEDIA_URL, '', 1)
|
||||||
|
if default_storage.exists(file_path):
|
||||||
|
return Response({'qr_code_url': distributor.qr_code_url})
|
||||||
|
elif distributor.qr_code_url.startswith('http'):
|
||||||
|
# 远程 URL,假设有效
|
||||||
|
return Response({'qr_code_url': distributor.qr_code_url})
|
||||||
|
except Exception as e:
|
||||||
|
logger.warning(f"Error checking QR code existence: {e}")
|
||||||
|
|
||||||
|
# 如果文件不存在,重置 URL 并重新生成
|
||||||
|
distributor.qr_code_url = ''
|
||||||
|
distributor.save()
|
||||||
|
|
||||||
# 确保有邀请码
|
# 确保有邀请码
|
||||||
if not distributor.invite_code:
|
if not distributor.invite_code:
|
||||||
|
|||||||
@@ -32,6 +32,11 @@ const config = {
|
|||||||
enable: false // Disable cache to fix prebundle error
|
enable: false // Disable cache to fix prebundle error
|
||||||
},
|
},
|
||||||
mini: {
|
mini: {
|
||||||
|
compile: {
|
||||||
|
include: [
|
||||||
|
path.resolve(__dirname, '..', 'node_modules/marked')
|
||||||
|
]
|
||||||
|
},
|
||||||
postcss: {
|
postcss: {
|
||||||
pxtransform: {
|
pxtransform: {
|
||||||
enable: true,
|
enable: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user