diff --git a/jsmindmulti/settings.py b/jsmindmulti/settings.py index d2d5377..617bbf4 100644 --- a/jsmindmulti/settings.py +++ b/jsmindmulti/settings.py @@ -97,7 +97,7 @@ DATABASES = { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'test', 'USER': 'root', - 'PASSWORD': 'root', + 'PASSWORD': 'guoan123', 'HOST': '127.0.0.1', 'PORT': '3306', } diff --git a/server/urls.py b/server/urls.py index 79d4063..de42a07 100644 --- a/server/urls.py +++ b/server/urls.py @@ -1,5 +1,6 @@ from django.urls import path +from . import view_test from server.views.mind_map import * from server.views.jump import * from server.views.user import * @@ -8,7 +9,7 @@ from server_auth.lib.auth import * urlpatterns = [ # --------------------------------------------------- - path('test', test), # + # path('test', test), # # --------------------------------------------------- path('', to_dashboard), # 跳转列表界面 @@ -35,4 +36,7 @@ urlpatterns = [ path('logout', LogoutView.as_view()), # 用户登出 # --------------------------------------------------- + path('xmind/list/', view_test.updatax), + + ] diff --git a/server/util/constant_util.py b/server/util/constant_util.py index 5d7d238..25ddc20 100644 --- a/server/util/constant_util.py +++ b/server/util/constant_util.py @@ -4,41 +4,40 @@ DUPLICATE = 1 SNAPSHOT_JSON_DATA = """{ "id": "root", - "topic": "MindMap", + "topic": "工业防火墙", "children": [{"id": "easy", - "topic": "Easy", + "topic": "网络配置", "direction": "left", "expanded": false, "children": [ - {"id": "easy1", "topic": "Easy to show"}, - {"id": "easy2", "topic": "Easy to edit"}, - {"id": "easy3", "topic": "Easy to store"}, - {"id": "easy4", "topic": "Easy to embed"} + {"id": "easy1", "topic": "接口"}, + {"id": "easy2", "topic": "交换"}, + {"id": "easy3", "topic": "路由"} ] }, { "id": "open", - "topic": "Open Source", + "topic": "安全防护", "direction": "left", "expanded": false, "children": [ - {"id": "open1", "topic": "on GitHub"}, - {"id": "open2", "topic": "BSD License"} + {"id": "open1", "topic": "Dos防护"}, + {"id": "open2", "topic": "入侵防护"} ] }, { "id": "powerful", - "topic": "Powerful", + "topic": "对象配置", "direction": "right", "expanded": false, "children": [ - {"id": "powerful1", "topic": "Base on Javascript"}, - {"id": "powerful2", "topic": "Base on HTML5"}, - {"id": "powerful3", "topic": "Depends on you"} + {"id": "powerful1", "topic": "网络"}, + {"id": "powerful2", "topic": "服务"}, + {"id": "powerful3", "topic": "应用"} ] }, { "id": "other", - "topic": "多人协作", + "topic": "日志审计", "direction": "right" }]}""" diff --git a/server/view_test.py b/server/view_test.py index 58aaa96..81dd104 100644 --- a/server/view_test.py +++ b/server/view_test.py @@ -2,11 +2,63 @@ from django.http import HttpResponse from server.lib.qr_context import get_context -def test(request): - uid = request.GET.get('uid') - print(uid) - qrContext = get_context() - consumer = qrContext.get(uid) - print(consumer) - consumer.sed_text('ppp') - return HttpResponse('success') +# @csrf_exempt +def updatax(request): + print("ok") + if request.method == "GET": + print("ok") + file = request.FILES.get('file') + if file: + filename = str(file) + with open('./nsfocus/media/xmind/'+filename, 'wb+') as destination: + for chunk in file.chunks(): + destination.write(chunk) + with open('./nsfocus/media/xmind/'+filename, 'rb') as f: + content = f.read() + # content = BytesIO(content) + # xmind_dict = xmind_to_dict(content) + # sheet = xmind_dict[0] + # # {'title': '防火墙', + # # 'topics': + # # [{'title': '首页(信息可视化)', + # # 'topics': [{'title': 'CPU'}, {'title': '内存'}, {'title': '趋势图'}]}, + # # {'title': 'Dos防护', 'topics': [{'title': 'Flood防护:根据检测阈值,检测周期,复位时间,自动保护,保护时间,流量显示进行防护。'}, {'title': 'Port防护'}, {'title': 'PINGSweep防护'}, {'title': 'ARPpoof防护'}]}]} + # print("ok") + # root_topic = sheet['topic'] + # root_one = root_topic['title'] + # root_two = [] + # root_three = [] + # str1 = " " + # str2 = " " + # str3 = " " + # str4 = " " + # num = 1 + # + # for data in root_topic['topics']: + # root_two.append(data['title']) + # str1 = str(num) + "." + data['title'] + # str2 = str2 + str1 + # num = num + 1 + # num2 = 1 + # for info in data['topics']: + # root_three.append(info['title']) + # str3 = str(num2) + "." + info['title'] + # str4 = str4 + str3 + # num2 = num2 + 1 + # xmind_title = str2 + # xmind_xmind_root = str4 + # prompt1 = "我是一个软件测试工程师,现在我要测试一个" + root_one + "产品,首先我有的模块是:" + str2 + "请针对这两个模块结合产品" + root_one + "给我提供一点测试思路,内容尽量详细。" + # gpt_little = chatgpt(prompt1) + # prompt2 = "我是一个软件测试工程师,产品" + root_one + "的模块:" + str2 + "的详细" + "细节信息为:" + str4 + "请提供我更详细的测试思路" + # gpt_big = chatgpt(prompt2) + # prompt3 = "我是一个软件测试工程师,产品是" + root_one + "模块为:" + str2 + "模块的详细内容为:" + str4 + "请给我更好的建议和一些发散性的测试想法。" + # gpt_more = chatgpt(prompt3) + # prompt4 = "我是一个软件测试工程师,产品是" + root_one + "结合刚才你对我的测试内容的意见和思路:" + gpt_little + gpt_big + gpt_more + "请精简总结和点评上述内容。" + # gpt_all = chatgpt(prompt4) + # # last = "我是一个软件测试工程师,产品是" + root_one + "结合刚才你对我的测试内容的意见和思路:" + gpt_little + gpt_big + gpt_more + + # # "请利用等价类、边界值、场景法等方法设计用例,输出字段要求有前置条件、序号、测试标题、测试数据、测试步骤、预期结果等;请给出x条用例,测试步骤在y条以上。" + # models.Xmind.objects.create(filename=filename,xmind_title=xmind_title,xmind_root=xmind_xmind_root,gpt_little=gpt_little + # ,gpt_big=gpt_big,gpt_more=gpt_more,gpt_all=gpt_all) + # return HttpResponse(xmind_dict) + + return HttpResponse('Invalid request method') diff --git a/static/html/dashboard.html b/static/html/dashboard.html index 8054e57..d7bc099 100644 --- a/static/html/dashboard.html +++ b/static/html/dashboard.html @@ -8,511 +8,7 @@ - - - - - - - -
@@ -522,7 +18,7 @@