h 2 anni fa
parent
commit
54c3410ca2

+ 1 - 0
admin_site/admin_site/settings.py

@@ -34,6 +34,7 @@ APPEND_SLASH=False
 INSTALLED_APPS = [
     'user',
     'order',
+    'files',
     'corsheaders',
     'rest_framework',
     'django.contrib.admin',

+ 2 - 0
admin_site/admin_site/urls.py

@@ -17,6 +17,7 @@ from django.contrib import admin
 from django.urls import path,include,re_path
 from user import urls as user_urls
 from order import urls as order_urls
+from files import urls as files_urls
 
 # urlpatterns = [
 #     path('admin/', admin.site.urls),
@@ -30,6 +31,7 @@ urlpatterns = [
     # path(r'user/update', user_views.update),
     re_path(r'^user/?', include(user_urls)),
     re_path(r'^order/?', include(order_urls)),
+    re_path(r'^files/?', include(files_urls)),
     # path(r'order/info', order_views.info),
     # path(r'order/list', order_views.list),
     # path(r'order/add', order_views.add),

+ 0 - 0
admin_site/files/__init__.py


+ 9 - 0
admin_site/files/admin.py

@@ -0,0 +1,9 @@
+from django.contrib import admin
+
+# Register your models here.
+from django.contrib import admin
+
+# Register your models here.
+from .models import Files
+
+admin.site.register(Files)

+ 6 - 0
admin_site/files/apps.py

@@ -0,0 +1,6 @@
+from django.apps import AppConfig
+
+
+class FilesConfig(AppConfig):
+    default_auto_field = 'django.db.models.BigAutoField'
+    name = 'files'

+ 26 - 0
admin_site/files/migrations/0001_initial.py

@@ -0,0 +1,26 @@
+# Generated by Django 4.1.7 on 2023-04-02 10:11
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    initial = True
+
+    dependencies = [
+    ]
+
+    operations = [
+        migrations.CreateModel(
+            name='Files',
+            fields=[
+                ('id', models.BigAutoField(primary_key=True, serialize=False)),
+                ('user_id', models.CharField(max_length=100, null=True)),
+                ('file_path', models.FileField(upload_to='uploads/')),
+                ('create_time', models.DateTimeField(auto_now_add=True)),
+                ('update_time', models.DateTimeField(auto_now=True)),
+                ('delete_time', models.DateTimeField(auto_now=True)),
+                ('is_delete', models.IntegerField(default=0)),
+            ],
+        ),
+    ]

+ 0 - 0
admin_site/files/migrations/__init__.py


+ 16 - 0
admin_site/files/models.py

@@ -0,0 +1,16 @@
+from django.db import models
+
+# Create your models here.
+# 创建模型
+from multiprocessing.sharedctypes import Value
+from django.db import models
+
+# 人员信息表
+class Files(models.Model):
+    id = models.BigAutoField(primary_key=True)  #文件id
+    user_id = models.CharField(max_length=100,null=True) # 用户ID
+    file_path = models.FileField(upload_to='uploads/') # 文件存放地址
+    create_time = models.DateTimeField(auto_now_add=True)  # 创建时间
+    update_time = models.DateTimeField(auto_now=True)  # 更新时间
+    delete_time = models.DateTimeField(auto_now=True)  # 删除时间
+    is_delete = models.IntegerField(default=0)  # 是否删除: 0:未删除;1:删除

+ 3 - 0
admin_site/files/tests.py

@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.

+ 9 - 0
admin_site/files/urls.py

@@ -0,0 +1,9 @@
+from django.urls import path, re_path
+from rest_framework import routers, serializers, viewsets
+
+from . import views
+
+urlpatterns = [
+    # re_path('', views.info),
+    re_path('^info', views.info),
+]

+ 20 - 0
admin_site/files/views.py

@@ -0,0 +1,20 @@
+from django.shortcuts import render
+
+# Create your views here.
+import json
+import copy
+from django.utils import timezone
+from django.shortcuts import render
+from user.models import User as User_models
+from order.models import Order as Order_models
+# Create your views here.
+from django.http import HttpResponse
+from django.views.decorators.http import require_http_methods
+from django.views.decorators.csrf import csrf_exempt
+from django.core import serializers  # 序列化 QuerySet
+from admin_site.utils import setError, setSuccess, userPersonToDictionary
+
+@csrf_exempt
+@require_http_methods(["POST"])
+def info(request):
+    return HttpResponse(setError("文件不存在"))

+ 69 - 0
admin_site/requirements.txt

@@ -0,0 +1,69 @@
+apturl==0.5.2
+asgiref==3.6.0
+blinker==1.4
+Brlapi==0.8.3
+certifi==2020.6.20
+chardet==4.0.0
+click==8.0.3
+colorama==0.4.4
+command-not-found==0.3
+cryptography==3.4.8
+cupshelpers==1.0
+dbus-python==1.2.18
+defer==1.0.6
+distro==1.7.0
+distro-info===1.1build1
+Django==4.1.7
+django-cors-headers==3.14.0
+djangorestframework==3.14.0
+httplib2==0.20.2
+idna==3.3
+importlib-metadata==4.6.4
+jeepney==0.7.1
+keyring==23.5.0
+language-selector==0.1
+launchpadlib==1.10.16
+lazr.restfulclient==0.14.4
+lazr.uri==1.0.6
+louis==3.20.0
+macaroonbakery==1.3.1
+more-itertools==8.10.0
+mysqlclient==2.1.1
+netifaces==0.11.0
+oauthlib==3.2.0
+olefile==0.46
+pexpect==4.8.0
+Pillow==9.0.1
+protobuf==3.12.4
+psutil==5.9.0
+ptyprocess==0.7.0
+pycairo==1.20.1
+pycups==2.0.1
+PyGObject==3.42.1
+PyJWT==2.3.0
+pymacaroons==0.13.0
+PyNaCl==1.5.0
+pyparsing==2.4.7
+pyRFC3339==1.1
+python-apt==2.4.0+ubuntu1
+python-dateutil==2.8.1
+python-debian===0.1.43ubuntu1
+pytz==2022.1
+pyxdg==0.27
+PyYAML==5.4.1
+reportlab==3.6.8
+requests==2.25.1
+screen-resolution-extra==0.0.0
+SecretStorage==3.3.1
+six==1.16.0
+sqlparse==0.4.3
+systemd-python==234
+ubuntu-advantage-tools==8001
+ubuntu-drivers-common==0.0.0
+ufw==0.36.1
+unattended-upgrades==0.1
+urllib3==1.26.5
+wadllib==1.3.6
+xdg==5
+xkit==0.0.0
+zipp==1.0.0

+ 18 - 0
admin_site/user/migrations/0004_user_disease.py

@@ -0,0 +1,18 @@
+# Generated by Django 4.1.7 on 2023-04-02 09:51
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('user', '0003_alter_user_create_time_alter_user_update_time'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='user',
+            name='disease',
+            field=models.CharField(blank=True, max_length=200, null=True),
+        ),
+    ]

+ 17 - 0
admin_site/user/migrations/0005_remove_user_car.py

@@ -0,0 +1,17 @@
+# Generated by Django 4.1.7 on 2023-04-02 09:53
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('user', '0004_user_disease'),
+    ]
+
+    operations = [
+        migrations.RemoveField(
+            model_name='user',
+            name='car',
+        ),
+    ]

+ 6 - 5
admin_site/user/models.py

@@ -7,14 +7,15 @@ class User(models.Model):
     id = models.BigAutoField(primary_key=True)  # 用户id
     name = models.CharField(max_length=10,blank=True)  # 用户名称
     email = models.CharField(blank=True,max_length=100,null=True)  # 账号
-    type = models.CharField(blank=False,max_length=20) # 用户类型 FL001:客户;FL002:垃圾车司机;FL003:回收站人员
+    type = models.CharField(blank=False,max_length=20) # 用户类型 FL001:客户;FL002:管理员;
     sex = models.IntegerField(default=3)  # 性别: 0:保密;1:女;2: 男
     create_time = models.DateTimeField(auto_now_add=True)  # 创建时间
     update_time = models.DateTimeField(auto_now=True)  # 更新时间
-    car = models.CharField(max_length=200,blank=True,null=True)  # 车牌号
     is_delete = models.IntegerField(default=0)  # 是否删除: 0:未删除;1:删除
 
-    address = models.TextField(blank=True, null=True)  # 用户地址|回收站:用户
-    password = models.CharField(max_length=10, blank=True, null=True)  # 密码:用户|司机
-    nickname = models.CharField(max_length=20, blank=True)  # 用户昵称:用户|司机
+    address = models.TextField(blank=True, null=True)  # 用户地址|管理员:用户
+    password = models.CharField(max_length=10, blank=True, null=True)  # 密码:用户|管理员
+    nickname = models.CharField(max_length=20, blank=True)  # 用户昵称:用户|管理员
     mobile = models.CharField(max_length=20, blank=True)  # 用户联系方式:用户|
+
+    disease = models.CharField(max_length=200, blank=True, null=True)  # 用户是否患病:用户|

+ 3 - 2
admin_site/user/views.py

@@ -20,9 +20,10 @@ def index(request):
 
 
 @csrf_exempt
-@require_http_methods(["POST"])
+@require_http_methods(["POST", "GET"])
 def info(request):
-    print('25')
+    if len(request.body) == 0:
+        return HttpResponse(setError("请传入数据!"))
     body = json.loads(request.body)
     if body.get('id') == None:
         return HttpResponse(setError("该用户不存在!"))

+ 1 - 0
env/bin/python

@@ -0,0 +1 @@
+python3

+ 1 - 0
env/bin/python3

@@ -0,0 +1 @@
+/usr/bin/python3

+ 1 - 0
env/bin/python3.10

@@ -0,0 +1 @@
+python3

+ 1 - 0
env/lib64

@@ -0,0 +1 @@
+lib

+ 3 - 0
env/pyvenv.cfg

@@ -0,0 +1,3 @@
+home = /usr/bin
+include-system-site-packages = false
+version = 3.10.6

BIN
需求文档.epub