更新了项目文件
This commit is contained in:
@@ -15,11 +15,23 @@ from pathlib import Path
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
# C:/Users/HC/Desktop/视频号/后端/website/MyApi/证书
|
||||
WX_CERT_PATH = '/www/wwwroot/unapp_admin/证书/apiclient_cert.pem' #生产环境
|
||||
WX_KEY_PATH = '/www/wwwroot/unapp_admin/证书/apiclient_key.pem' #生产环境
|
||||
WX_CERT_PATH = '/www/wwwroot/cyqhz/证书/apiclient_cert.pem' #生产环境
|
||||
WX_KEY_PATH = '/www/wwwroot/cyqhz/证书/apiclient_key.pem' #生产环境
|
||||
# WX_CERT_PATH = 'C:/Users/HC/Desktop/视频号/后端/website/MyApi/证书/apiclient_cert.pem'
|
||||
# WX_KEY_PATH = 'C:/Users/HC/Desktop/视频号/后端/website/MyApi/证书/apiclient_key.pem'
|
||||
|
||||
# 公众号网页配置 测试
|
||||
LOGIN_APP_ID = 'wx8364534d4631c660' # 公众号appid
|
||||
LOGIN_APP_SECRET = '58e97d9beb933cab0cad19c2d59f3465' # 替换为你的微信APP Secret
|
||||
LOGIN_REDIRECT_URI = 'https://unapp.guimiaokeji.com/myapp/app_callback' # 替换为你的重定向URI
|
||||
LOGIN_WEB_URI = 'https://unapp.guimiaokeji.com/pay'
|
||||
LOGIN_WX_CERT_PATH = '/www/wwwroot/cyqhz/证书/apiclient_cert.pem'
|
||||
LOGIN_WX_KEY_PATH = '/www/wwwroot/cyqhz/证书/apiclient_key.pem'
|
||||
LOGIN_WX_MCH_ID="1674012932"
|
||||
LOGIN_WX_SERIAL_NO="66DB35F836EFD4CBEC66F3815D283A2892310324"
|
||||
LOGIN_V3_KEY="f229acb2c90b93cbc1439c185a2b26fe"
|
||||
LOGIN_WX_NOTIFY_URL='https://unapp.guimiaokeji.com/myapp/wpp_pay_notify/' #测试环境
|
||||
# Application definitionB
|
||||
# Quick-start development settings - unsuitable for production
|
||||
# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/
|
||||
|
||||
@@ -32,7 +44,7 @@ WX_API_KEY='f229acb2c90b93cbc1439c185a2b26fe'
|
||||
WX_NOTIFY_URL='https://unapp.guimiaokeji.com/myapp/wx_pay_notify/'
|
||||
WX_SERIAL_NO='66DB35F836EFD4CBEC66F3815D283A2892310324'
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
DEBUG = False
|
||||
# settings.py
|
||||
|
||||
QINIU_ACCESS_KEY = 'AO6u6sDWi6L9TsPfr4awC7FYP85JTjt3bodZACCM'
|
||||
@@ -44,6 +56,12 @@ QINIU_DOMAIN = 'file.guimiaokeji.com' # 如 http://yourbucket.qiniudn.com
|
||||
ALLOWED_HOSTS = ['*']
|
||||
|
||||
|
||||
# settings.py
|
||||
|
||||
# LOGIN_APP_ID = 'wxafa04cf8c4270ff9' # 替换为你的微信APP ID
|
||||
# LOGIN_APP_SECRET = '6c8dce18e99ee058b49aeb1e1298e111' # 替换为你的微信APP Secret
|
||||
# LOGIN_REDIRECT_URI = 'http://520642leen52.vicp.fun/' # 替换为你的重定向URI
|
||||
|
||||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
|
||||
@@ -23,9 +23,13 @@ urlpatterns = [
|
||||
# path('admin/', admin.site.urls),
|
||||
path('myapp/', include('MyApi.urls')), # 包含myapp应用的URL配置
|
||||
path('admin/', include('MyWeb.urls')), # 包含myapp应用的URL配置
|
||||
path('.well-known/acme-challenge/<str:token>', views.acme_challenge),
|
||||
path('ON6tV9YE1M.txt', views.acme_challenge),
|
||||
path('download/', views.download_proxy, name='download_proxy'),
|
||||
path('proxy/', views.ProxyView.as_view(), name='proxy'),
|
||||
path('api/check_status/', views.check_status, name='check_status'),
|
||||
path('pay/', views.pay, name='pay'),
|
||||
|
||||
|
||||
]
|
||||
if settings.DEBUG:
|
||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import aiohttp
|
||||
from django.http import HttpResponse, StreamingHttpResponse
|
||||
from django.http import HttpResponse, StreamingHttpResponse,HttpResponseRedirect
|
||||
import os
|
||||
from datetime import datetime
|
||||
import requests
|
||||
@@ -9,11 +9,23 @@ from django.views.decorators.csrf import csrf_exempt
|
||||
from urllib.parse import quote
|
||||
from django.http import HttpResponse
|
||||
from aiohttp import ClientSession
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
from django.http import JsonResponse
|
||||
from django.conf import settings
|
||||
from django.urls import reverse
|
||||
from django.shortcuts import render
|
||||
|
||||
def acme_challenge(request, token):
|
||||
print(token)
|
||||
content = f'{token}.E4H2n2zqARGJeN2ulDerea5xYFCDXMy1y9v61hoQfms'
|
||||
import qrcode
|
||||
from io import BytesIO
|
||||
import base64
|
||||
from django.views.decorators.http import require_GET
|
||||
from MyApi.API_Log import get_logger
|
||||
log_file = '网页授权登录日志.log'
|
||||
logger = get_logger('网页授权登录日志', log_file, when='midnight', backup_count=7)
|
||||
|
||||
|
||||
def acme_challenge(request):
|
||||
|
||||
content = f'd692debbc196f8a9849ee230e56f3b24'
|
||||
return HttpResponse(content, content_type='text/plain')
|
||||
|
||||
|
||||
@@ -79,4 +91,41 @@ class ProxyView(View):
|
||||
proxy_response = HttpResponse(content=response.content, content_type=content_type)
|
||||
proxy_response['Content-Disposition'] = content_disposition
|
||||
|
||||
return proxy_response
|
||||
return proxy_response
|
||||
|
||||
def pay(request):
|
||||
return render(request, 'pay/index.html')
|
||||
|
||||
|
||||
|
||||
def check_status(request):
|
||||
param = request.GET.get('param') # 获取参数值
|
||||
if param is None: # 如果参数不存在,设置默认值
|
||||
param = 1
|
||||
else:
|
||||
try:
|
||||
param = int(param) # 类型转换
|
||||
except ValueError:
|
||||
return JsonResponse({'error': 'param 参数必须是整数'}, status=400)
|
||||
data={
|
||||
"list": [
|
||||
{
|
||||
"title": "下载视频请添加机器人微信:【post3933】并转发视频给机器人",
|
||||
"url": "https://mp.weixin.qq.com/s/xEvhtVFmXSvmC0nRoaTfXQ"
|
||||
},
|
||||
{
|
||||
"title": "下载视频请添加机器人微信:【post3933】不会使用的点击这里查看教程。",
|
||||
"url": "https://mp.weixin.qq.com/s/CI5YF0yjQ_wfK-J17j04og"
|
||||
},
|
||||
{
|
||||
"title": "下载视频请添加机器人微信:【post3933】有问题或需要合作联系客服微信:post0025",
|
||||
"url": ""
|
||||
}
|
||||
],
|
||||
"pay_url": "https://unapp.guimiaokeji.com/pay/"
|
||||
}
|
||||
|
||||
if param == 0:
|
||||
return JsonResponse({'status':True,"data":data})
|
||||
return JsonResponse({'status': True,"data":data})
|
||||
|
||||
|
||||
@@ -14,3 +14,4 @@ from django.core.wsgi import get_wsgi_application
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'website.settings')
|
||||
|
||||
application = get_wsgi_application()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user