|
@@ -209,6 +209,7 @@ class PcTest(View):
|
|
def functionadd(self, request_dict, userID, response):
|
|
def functionadd(self, request_dict, userID, response):
|
|
functionname = request_dict.get('functionname', None)
|
|
functionname = request_dict.get('functionname', None)
|
|
functioncode = request_dict.get('functioncode', None)
|
|
functioncode = request_dict.get('functioncode', None)
|
|
|
|
+ id = request_dict.get('id', None)
|
|
param_flag = CommonService.get_param_flag(
|
|
param_flag = CommonService.get_param_flag(
|
|
data=[functionname])
|
|
data=[functionname])
|
|
if param_flag is not True:
|
|
if param_flag is not True:
|
|
@@ -216,9 +217,13 @@ class PcTest(View):
|
|
job_qs = PctestfunctionModel.objects.filter(functionname=functionname)
|
|
job_qs = PctestfunctionModel.objects.filter(functionname=functionname)
|
|
if job_qs.exists():
|
|
if job_qs.exists():
|
|
return response.json(174)
|
|
return response.json(174)
|
|
- else:
|
|
|
|
|
|
+
|
|
|
|
+ if not id:
|
|
PctestfunctionModel.objects.create(functionname=functionname,functioncode=functioncode)
|
|
PctestfunctionModel.objects.create(functionname=functionname,functioncode=functioncode)
|
|
- return response.json(0)
|
|
|
|
|
|
+ else:
|
|
|
|
+ PctestfunctionModel.objects.filter(id=id).update(functionname=functionname, functioncode=functioncode)
|
|
|
|
+
|
|
|
|
+ return response.json(0)
|
|
|
|
|
|
def functionquery(self, request_dict, userID, response):
|
|
def functionquery(self, request_dict, userID, response):
|
|
function_list = PctestfunctionModel.objects.all()
|
|
function_list = PctestfunctionModel.objects.all()
|