Compare commits

..

No commits in common. "7a6a519fbeb72aaa46bb7bc90dd676d57eb74d42" and "47bc81025679f87f72815522bf5c126b523b7712" have entirely different histories.

11 changed files with 10 additions and 118 deletions

View File

@ -1,24 +0,0 @@
.git
.gitignore
.env
.env.example
.vscode
.idea
venv/
.venv/
__pycache__/
*.pyc
*.pyo
*.egg-info/
dist/
build/
*.log
*.sqlite3
media/
staticfiles/
.DS_Store
k8s/
.gitea/
docs/
CLAUDE.md
README.md

View File

@ -39,8 +39,7 @@ jobs:
- name: Setup Kubectl
run: |
curl -LO "https://dl.k8s.io/release/v1.28.2/bin/linux/amd64/kubectl" || \
curl -LO "https://cdn.dl.k8s.io/release/v1.28.2/bin/linux/amd64/kubectl"
curl -LO "https://files.m.daocloud.io/dl.k8s.io/release/v1.28.2/bin/linux/amd64/kubectl"
chmod +x kubectl
mv kubectl /usr/local/bin/
@ -119,12 +118,11 @@ jobs:
\"stack_trace\": [\"${ERROR_LOG}\"]
},
\"context\": {
\"job_name\": \"build-and-deploy\",
\"step_name\": \"${FAILED_STEP}\",
\"workflow\": \"${{ github.workflow }}\",
\"run_id\": \"${{ github.run_id }}\",
\"branch\": \"${{ github.ref_name }}\",
\"actor\": \"${{ github.actor }}\",
\"failed_step\": \"${FAILED_STEP}\",
\"commit\": \"${{ github.sha }}\"
}
}" || true

View File

@ -28,4 +28,4 @@ COPY . /app/
EXPOSE 8000
# Run entrypoint
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--workers", "2", "--timeout", "120", "--access-logfile", "-", "--error-logfile", "-", "config.wsgi:application"]
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "config.wsgi:application"]

View File

@ -1,26 +0,0 @@
"""
设备模块服务层
"""
from .models import Device, UserDevice
class DeviceStatsService:
"""设备统计服务"""
@staticmethod
def get_bindrate(user):
"""获取用户设备绑定率"""
total_count = Device.objects.count()
if total_count == 0:
return {
'total_count': 0,
'bound_count': 0,
'bind_rate': 0,
}
bound_count = Device.objects.filter(status='bound').count()
bind_rate = bound_count / total_count * 100
return {
'total_count': total_count,
'bound_count': bound_count,
'bind_rate': round(bind_rate, 2),
}

View File

@ -119,11 +119,8 @@ class DeviceViewSet(viewsets.ViewSet):
'is_active': True
}
)
# 更新设备状态和可选的设备名称
device_name = request.data.get('device_name')
if device_name:
device.name = device_name
# 更新设备状态
device.status = 'bound'
device.save()

View File

@ -26,6 +26,4 @@ class Spirit(models.Model):
ordering = ['-created_at']
def __str__(self):
if self.user_id is None:
return self.name
return f"{self.name} - {self.user.phone}"

View File

@ -7,13 +7,8 @@ URL configuration for RTC_DEMO project.
"""
from django.contrib import admin
from django.urls import path, include
from django.http import JsonResponse
from drf_spectacular.views import SpectacularAPIView, SpectacularSwaggerView, SpectacularRedocView
def health_check(request):
return JsonResponse({"status": "ok"})
# ============ App端路由 (普通用户,手机一键登录) ============
app_api_patterns = [
path('', include('apps.users.urls')),
@ -42,9 +37,6 @@ admin_api_patterns = [
]
urlpatterns = [
# Health check (no auth, for K8s probes)
path('healthz/', health_check),
# Django Admin
path('django-admin/', admin.site.urls),

View File

@ -68,22 +68,6 @@ spec:
value: "https://qiyuan-log-center-api.airlabs.art"
- name: LOG_CENTER_ENABLED
value: "true"
livenessProbe:
httpGet:
path: /healthz/
port: 8000
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
httpGet:
path: /healthz/
port: 8000
initialDelaySeconds: 15
periodSeconds: 5
timeoutSeconds: 3
failureThreshold: 3
resources:
requests:
memory: "256Mi"

View File

@ -76,22 +76,6 @@ spec:
value: "https://qiyuan-log-center-api.airlabs.art"
- name: LOG_CENTER_ENABLED
value: "true"
livenessProbe:
httpGet:
path: /healthz/
port: 8000
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
httpGet:
path: /healthz/
port: 8000
initialDelaySeconds: 15
periodSeconds: 5
timeoutSeconds: 3
failureThreshold: 3
resources:
requests:
memory: "256Mi"

View File

@ -5,7 +5,7 @@ certifi==2026.1.4
cffi==2.0.0
charset-normalizer==3.4.4
crcmod==1.7
cryptography==44.0.3
cryptography==46.0.4
Django==6.0.1
django-cors-headers==4.9.0
djangorestframework==3.16.1
@ -26,16 +26,8 @@ requests==2.32.5
six==1.17.0
sqlparse==0.5.5
urllib3==2.6.3
python-dotenv==1.0.0
drf-spectacular==0.27.1
alibabacloud_dysmsapi20170525==4.4.0
alibabacloud_dypnsapi20170525==2.0.0
alibabacloud-tea-openapi==0.4.3
alibabacloud-tea-util==0.3.14
alibabacloud-credentials==1.0.2
alibabacloud-openapi-util==0.2.2
alibabacloud-gateway-spi==0.0.3
alibabacloud-endpoint-util==0.0.4
darabonba-core==1.0.5
alibabacloud_dysmsapi20170525>=4.4.0
alibabacloud_dypnsapi20170525>=3.0.0
volcengine-python-sdk[ark]>=5.0.9
edge-tts>=6.1.0

View File

@ -6,10 +6,7 @@ import traceback
import threading
import requests
from rest_framework.views import exception_handler
from rest_framework.exceptions import AuthenticationFailed as DRFAuthenticationFailed
from rest_framework.exceptions import NotAuthenticated
from rest_framework import status
from rest_framework_simplejwt.exceptions import InvalidToken, AuthenticationFailed as JWTAuthenticationFailed
from utils.response import APIResponse
@ -139,8 +136,8 @@ class ErrorCode:
def custom_exception_handler(exc, context):
"""自定义异常处理器"""
# 上报到 Log Center (排除业务异常和认证异常,这些是正常业务流程)
if not isinstance(exc, (BusinessException, DRFAuthenticationFailed, NotAuthenticated, InvalidToken, JWTAuthenticationFailed)):
# 上报到 Log Center (仅上报非业务异常)
if not isinstance(exc, BusinessException):
report_to_log_center(exc, context)
# 处理业务异常