Compare commits

...

5 Commits
main ... lmy

Author SHA1 Message Date
mysq 48c1b91ed1 2222
4 weeks ago
mysq 99a4baaf02 1111
4 weeks ago
mysq 83c59016da 111
4 weeks ago
HanXiao 09ff4609a2 2
4 weeks ago
HanXiao f23a49145b 2
4 weeks ago

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 213 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 237 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

@ -1,8 +0,0 @@
# 默认忽略的文件
/shelf/
/workspace.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="FacetManager">
<facet type="django" name="Django">
<configuration>
<option name="rootFolder" value="$MODULE_DIR$" />
<option name="settingsModule" value="DjangoProject/settings.py" />
<option name="manageScript" value="$MODULE_DIR$/manage.py" />
<option name="environment" value="&lt;map/&gt;" />
<option name="doNotUseTestRunner" value="false" />
<option name="trackFilePattern" value="migrations" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.venv" />
</content>
<orderEntry type="jdk" jdkName="Python 3.13 (DjangoProject) (2)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TemplatesService">
<option name="TEMPLATE_CONFIGURATION" value="Django" />
<option name="TEMPLATE_FOLDERS">
<list>
<option value="$MODULE_DIR$/../DjangoProject\templates" />
</list>
</option>
</component>
</module>

@ -1,27 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
<data-source source="LOCAL" name="sw.sqlite" uuid="166e5de7-2427-48a7-b532-3707147a661a">
<driver-ref>sqlite.xerial</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
<jdbc-url>jdbc:sqlite:identifier.sqlite</jdbc-url>
<working-dir>$ProjectFileDir$</working-dir>
</data-source>
<data-source source="LOCAL" name="identifier" uuid="9e468e66-19e3-4806-802d-3f430c902f99">
<driver-ref>sqlite.xerial</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
<jdbc-url>jdbc:sqlite:E:\Python_study\DjangoProject\identifier.sqlite3</jdbc-url>
<working-dir>$ProjectFileDir$</working-dir>
<libraries>
<library>
<url>file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.45.1/org/xerial/sqlite-jdbc/3.45.1.0/sqlite-jdbc-3.45.1.0.jar</url>
</library>
<library>
<url>file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.45.1/org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar</url>
</library>
</libraries>
</data-source>
</component>
</project>

@ -1,16 +0,0 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredPackages">
<value>
<list size="3">
<item index="0" class="java.lang.String" itemvalue="django" />
<item index="1" class="java.lang.String" itemvalue="djangorestframework" />
<item index="2" class="java.lang.String" itemvalue="django-cors-headers" />
</list>
</value>
</option>
</inspection_tool>
</profile>
</component>

@ -1,6 +0,0 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Black">
<option name="sdkName" value="Python 3.13 (DjangoProject) (2)" />
</component>
</project>

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/DjangoProject.iml" filepath="$PROJECT_DIR$/.idea/DjangoProject.iml" />
</modules>
</component>
</project>

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../../" vcs="Git" />
</component>
</project>

@ -1,6 +0,0 @@
projectKey=Notes-master2
serverUrl=http://localhost:9000
serverVersion=25.3.0.104237
dashboardUrl=http://localhost:9000/dashboard?id=Notes-master2
ceTaskId=a33d0039-99a1-489c-8e22-20146e609d81
ceTaskUrl=http://localhost:9000/api/ce/task?id=a33d0039-99a1-489c-8e22-20146e609d81

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

@ -1,16 +0,0 @@
"""
ASGI config for DjangoProject project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/5.2/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'DjangoProject.settings')
application = get_asgi_application()

@ -1,95 +0,0 @@
import os
from pathlib import Path
BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = 'django-insecure-your-secret-key-here'
DEBUG = True
ALLOWED_HOSTS = ['*']
# 在INSTALLED_APPS中添加corsheaders
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'corsheaders', # 新增这一行
'project',
'django_crontab', # 定时任务应用
]
# 在MIDDLEWARE最前面添加CorsMiddleware
MIDDLEWARE = [
'corsheaders.middleware.CorsMiddleware', # 新增,必须放在最前面
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'DjangoProject.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'DjangoProject.wsgi.application'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'identifier.sqlite3',
}
}
LANGUAGE_CODE = 'zh-hans'
TIME_ZONE = 'Asia/Shanghai'
USE_I18N = True
USE_TZ = True
STATIC_URL = 'static/'
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
# AI服务配置
AI_API_KEY = "4agUQAXAv79GrBnxQy5Wh1sn"
AI_SECRET_KEY = "OZ9hyVAQdKbmG08oq5iMFH5zx8AoNAdv"
# 静态文件配置
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static'),
]
# 媒体文件配置
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
# ========== 新增CORS配置 ==========
CORS_ALLOW_ALL_ORIGINS = True # 允许所有域名跨域
CORS_ALLOW_CREDENTIALS = True # 允许携带cookie
# 定时匹配功能
CRONJOBS = [
('0 6,12,18,0 * * *', 'project.management.commands.scheduled_match.Command'),
]

@ -1,14 +0,0 @@
# DjangoProject/urls.py - 添加媒体文件服务
from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
path('admin/', admin.site.urls),
path('api/', include('project.urls')),
]
# 开发环境下提供媒体文件服务
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

@ -1,16 +0,0 @@
"""
WSGI config for DjangoProject project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/5.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'DjangoProject.settings')
application = get_wsgi_application()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

@ -1,22 +0,0 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'DjangoProject.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)
if __name__ == '__main__':
main()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

@ -1,26 +0,0 @@
from django.contrib import admin
from .models import T_User, T_Object_Info, T_Description
# 注册 T_User 模型到管理员界面
@admin.register(T_User)
class T_UserAdmin(admin.ModelAdmin):
list_display = ['user_id', 'wechat_id', 'nickname'] # 列表中显示的字段
list_display_links = ['user_id', 'nickname'] # 可点击进入编辑页的字段
search_fields = ['nickname', 'wechat_id'] # 可搜索的字段
list_per_page = 20 # 每页显示的数量
# 或者使用简单注册方式:
# admin.site.register(T_User)
@admin.register(T_Object_Info)
class T_Object_InfoAdmin(admin.ModelAdmin):
list_display = ['object', 'color', 'brand', 'feature','create_time', 'state', 'claim_phone'] # 添加状态和认领手机号
search_fields = ['object', 'color', 'brand','feature']
list_filter = ['state'] # 添加状态过滤器
@admin.register(T_Description)
class T_DescriptionAdmin(admin.ModelAdmin):
list_display = ['desc_id', 'wechat', 'description']
search_fields = ['wechat__wechat_id', 'wechat__nickname', 'description']
list_select_related = ['wechat']

@ -1,5 +0,0 @@
from django.apps import AppConfig
class ProjectConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'project'

@ -1,56 +0,0 @@
# project/crontab.py
from django.utils import timezone
from .models import T_Description, T_Object_Info
from .utils import SearchService
def auto_match_descriptions():
"""
自动匹配描述任务 - 改进版本
"""
print(f"开始执行自动匹配任务... {timezone.now()}")
# 获取所有需要匹配的描述
descriptions = T_Description.objects.all()
all_items = T_Object_Info.objects.all()
match_count = 0
match_results = []
for desc in descriptions:
# 使用搜索服务进行匹配
search_service = SearchService()
result = search_service.search_objects_by_description(desc.description, threshold=0.3)
if result['success']:
for match in result['results']:
item = match['object_info']
match_count += 1
match_result = {
'desc_id': desc.desc_id,
'wechat_id': desc.wechat.wechat_id,
'nickname': desc.wechat.nickname,
'user_description': desc.description,
'object_id': item.object_id,
'item_name': item.name,
'item_color': item.color,
'item_location': item.location,
'contact_number': item.contact_number,
'similarity': round(match['similarity'] * 100, 2), # 转换为百分比
'match_time': timezone.now().strftime('%Y-%m-%d %H:%M:%S')
}
match_results.append(match_result)
print(f"匹配成功: {desc.wechat.nickname}的描述 '{desc.description}'")
print(f" 与物品 '{item.name}({item.color})' 相似度 {match['similarity']:.2%}")
print(f"自动匹配完成,找到 {match_count} 个匹配结果")
# 保存匹配结果到数据库或发送通知
if match_results:
print("匹配结果汇总:")
for result in match_results:
print(
f"- {result['nickname']}: {result['user_description']} -> {result['item_name']}({result['item_color']}) 相似度{result['similarity']}%")
return match_results

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save