commit 505eb01bb05d03699a54870c9fd275c138691c90 Author: BINGWU Date: Mon Mar 25 22:50:23 2024 +0800 初始化服务端 diff --git a/serve/.idea/.gitignore b/serve/.idea/.gitignore new file mode 100644 index 0000000..a7cdac7 --- /dev/null +++ b/serve/.idea/.gitignore @@ -0,0 +1,8 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# 基于编辑器的 HTTP 客户端请求 +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/serve/.idea/inspectionProfiles/Project_Default.xml b/serve/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..3dce9c6 --- /dev/null +++ b/serve/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,12 @@ + + + + \ No newline at end of file diff --git a/serve/.idea/inspectionProfiles/profiles_settings.xml b/serve/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/serve/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/serve/.idea/misc.xml b/serve/.idea/misc.xml new file mode 100644 index 0000000..94ebc5f --- /dev/null +++ b/serve/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/serve/.idea/modules.xml b/serve/.idea/modules.xml new file mode 100644 index 0000000..c798cfc --- /dev/null +++ b/serve/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/serve/.idea/serve.iml b/serve/.idea/serve.iml new file mode 100644 index 0000000..78b182a --- /dev/null +++ b/serve/.idea/serve.iml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/serve/.idea/vcs.xml b/serve/.idea/vcs.xml new file mode 100644 index 0000000..2e3f692 --- /dev/null +++ b/serve/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/serve/serve/models/employee.py b/serve/serve/models/employee.py new file mode 100644 index 0000000..e69de29 diff --git a/serve/serve/models/feedback.py b/serve/serve/models/feedback.py new file mode 100644 index 0000000..e69de29 diff --git a/serve/serve/models/request.py b/serve/serve/models/request.py new file mode 100644 index 0000000..e69de29 diff --git a/serve/serve/models/reward.py b/serve/serve/models/reward.py new file mode 100644 index 0000000..e69de29 diff --git a/serve/serve/models/user.py b/serve/serve/models/user.py new file mode 100644 index 0000000..0823cf5 --- /dev/null +++ b/serve/serve/models/user.py @@ -0,0 +1,6 @@ +import mongoengine + + +class UserModel(mongoengine.Document): + username = mongoengine.StringField(max_length=30) + password = mongoengine.StringField(max_length=30) diff --git a/serve/serve/views/employee.py b/serve/serve/views/employee.py new file mode 100644 index 0000000..e69de29 diff --git a/serve/serve/views/feedback.py b/serve/serve/views/feedback.py new file mode 100644 index 0000000..e69de29 diff --git a/serve/serve/views/index.py b/serve/serve/views/index.py new file mode 100644 index 0000000..7adf145 --- /dev/null +++ b/serve/serve/views/index.py @@ -0,0 +1,5 @@ +from serve.views.user import user_url + + +def initUrls(urlpatterns): + urlpatterns += user_url diff --git a/serve/serve/views/request.py b/serve/serve/views/request.py new file mode 100644 index 0000000..e69de29 diff --git a/serve/serve/views/reward.py b/serve/serve/views/reward.py new file mode 100644 index 0000000..e69de29 diff --git a/serve/serve/views/user.py b/serve/serve/views/user.py new file mode 100644 index 0000000..0d11075 --- /dev/null +++ b/serve/serve/views/user.py @@ -0,0 +1,17 @@ +from django.shortcuts import render, HttpResponse +from serve.models.user import UserModel +import json +from django.urls import path + + +def createUser(request): + print(request.method) + data = json.loads(request.body) + print(data.get('name')) + UserModel.objects.create(username='154782456', password='123456') + return HttpResponse("插入成功") + + +user_url = [ + path('user/create', createUser), +]