题目删除操作-本公司

This commit is contained in:
caoqianming 2020-11-15 15:43:29 +08:00
parent 180ebddf63
commit 5bd426191c
3 changed files with 30 additions and 17 deletions

View File

@ -26,8 +26,8 @@ class Groupmember(models.Model):
member = models.ForeignKey(s_models.Partment,on_delete=models.CASCADE, related_name='groupmember_member')
class Meta:
verbose_name="集团-管理员"
verbose_name_plural="集团-管理员"
verbose_name="集团-公司"
verbose_name_plural="集团-公司"
class GroupUser(models.Model):
username = models.CharField(max_length=128, unique=True)

View File

@ -15,10 +15,16 @@ headers = {
def getTzzs(certnum,stu_name):#特种证书(身份证号,姓名,均是字符)
certtype_code='720'
proxies = {
"http": "http://112.91.78.240:5412"
}
stu_name=parse.quote(parse.quote(stu_name))
sessionId = eval(requests.post('http://cx.mem.gov.cn//cms/html/certQuery/certQuery.do?method=getServerTime',headers=headers).text)['time']
text1 = requests.post('http://cx.mem.gov.cn//cms/html/certQuery/certQuery.do?method=getServerTime',headers=headers, proxies=proxies).text
print(text1)
sessionId = eval(text1)['time']
url = "http://cx.mem.gov.cn/cms/html/certQuery/certQuery.do?method=getCertQueryResult&ref=ch&certtype_code="+certtype_code+"&certnum="+certnum+"&stu_name="+stu_name+'&passcode=1234'+'&sessionId='+sessionId
data = requests.get(url,headers=headers).text
data = requests.get(url,headers=headers, proxies=proxies).text
tree = etree.HTML(data)
e1 = tree.xpath("//th[text()='姓名']/following-sibling::td[1]/text()")
e2 = tree.xpath("//th[text()='性别']/following-sibling::td[1]/text()")

View File

@ -4885,9 +4885,8 @@ def apitool(req):
i.save()
return JsonResponse({"code": 1})
elif a == 'correct_question':
for i in Question.objects.exclude(questioncat__usecomp__partid=1):
i.usecomps = ','+str(i.questioncat.usecomp.partid)+','
i.save()
objs = Question.objects.filter(usecomps=F('nousecomps'))
objs.update(deletemark=0)
return JsonResponse({"code": 1})
elif a == 'correct_menulist':
for i in Group.objects.all():
@ -5873,11 +5872,15 @@ def apiquestion(req):
user = User.objects.get(userid=userid)
a = Question.objects.get(id=id)
if user.issuper == 1 or a.createuser == user:
nl = a.nousecomps.split(',')
nl.append(companyid)
nl = ','+','.join(list(set(list(filter(None, nl)))))+','
a.nousecomps = nl
a.save()
if a.usecomps == ',' + companyid + ',':
a.deletemark = 0
a.save()
else:
nl = a.nousecomps.split(',')
nl.append(companyid)
nl = ','+','.join(list(set(list(filter(None, nl)))))+','
a.nousecomps = nl
a.save()
return JsonResponse({"code": 1})
else:
return JsonResponse({"code": 0})
@ -5888,11 +5891,15 @@ def apiquestion(req):
objs = Question.objects.filter(id__in=ids)
if user.issuper == 1:
for i in objs:
nl = i.nousecomps.split(',')
nl.append(companyid)
nl = ','+','.join(list(set(list(filter(None, nl)))))+','
i.nousecomps = nl
i.save()
if i.usecomps == ',' + companyid + ',':
i.deletemark = 0
i.save()
else:
nl = i.nousecomps.split(',')
nl.append(companyid)
nl = ','+','.join(list(set(list(filter(None, nl)))))+','
i.nousecomps = nl
i.save()
return JsonResponse({"code": 1})
else:
return JsonResponse({"code": 0})