@csrf_exempt
def addChangeHostInfo(request):
    '\n    新增主机\n    修改主机\n    '
    v_hostId = request.POST.get('host_id')
    v_businessName = request.POST.get('business_name')
    v_serviceEnv = request.POST.get('service_env')
    v_hostName = request.POST.get('host_name')
    v_intranetIpAddr = request.POST.get('intranet_ipaddr')
    v_publicIpAddr = request.POST.get('public_ipaddr')
    v_sshPort = request.POST.get('ssh_port')
    v_hostType = request.POST.get('host_type')
    v_hostRole = request.POST.get('host_role')
    v_hostDesc = request.POST.get('host_desc')
    print(v_hostId, v_businessName, v_serviceEnv, v_hostName, v_intranetIpAddr, v_publicIpAddr, v_sshPort, v_hostType, v_hostRole, v_hostDesc)
    if ((v_hostId == '') or (v_hostId is None)):
        try:
            hostObj = host(businessName=v_businessName, serviceEnv=v_serviceEnv, hostName=v_hostName, intranetIpAddr=v_intranetIpAddr, publicIpAddr=v_publicIpAddr, sshPort=v_sshPort, hostType=v_hostType, hostRole=v_hostRole, hostDesc=v_hostDesc)
            hostObj.save()
            result = {'status': 1, 'msg': '保存成功!', 'data': ''}
            return HttpResponse(json.dumps(result), content_type='application/json')
        except Exception as e:
            result = {'status': 2, 'msg': ('保存失败!' + str(e)), 'data': ''}
            return HttpResponse(json.dumps(result), content_type='application/json')
    else:
        try:
            hostObj = host.objects.filter(id=v_hostId)
            hostObj.update(businessName=v_businessName, serviceEnv=v_serviceEnv, hostName=v_hostName, intranetIpAddr=v_intranetIpAddr, publicIpAddr=v_publicIpAddr, sshPort=v_sshPort, hostType=v_hostType, hostRole=v_hostRole, hostDesc=v_hostDesc)
            result = {'status': 1, 'msg': '修改成功!', 'data': ''}
            return HttpResponse(json.dumps(result), content_type='application/json')
        except Exception as e:
            result = {'status': 2, 'msg': ('修改失败!' + str(e)), 'data': ''}
            return HttpResponse(json.dumps(result), content_type='application/json')
新增主机
修改主机
@csrf_exempt
def addChangeHostInfo(request):
    '\n    新增主机\n    修改主机\n    '
    v_hostId = request.POST.get('host_id')
    v_businessName = request.POST.get('business_name')
    v_serviceEnv = request.POST.get('service_env')
    v_hostName = request.POST.get('host_name')
    v_intranetIpAddr = request.POST.get('intranet_ipaddr')
    v_publicIpAddr = request.POST.get('public_ipaddr')
    v_sshPort = request.POST.get('ssh_port')
    v_hostType = request.POST.get('host_type')
    v_hostRole = request.POST.get('host_role')
    v_hostDesc = request.POST.get('host_desc')
    print(v_hostId, v_businessName, v_serviceEnv, v_hostName, v_intranetIpAddr, v_publicIpAddr, v_sshPort, v_hostType, v_hostRole, v_hostDesc)
    if ((v_hostId == ) or (v_hostId is None)):
        try:
            hostObj = host(businessName=v_businessName, serviceEnv=v_serviceEnv, hostName=v_hostName, intranetIpAddr=v_intranetIpAddr, publicIpAddr=v_publicIpAddr, sshPort=v_sshPort, hostType=v_hostType, hostRole=v_hostRole, hostDesc=v_hostDesc)
            hostObj.save()
            result = {'status': 1, 'msg': '保存成功!', 'data': }
            return HttpResponse(json.dumps(result), content_type='application/json')
        except Exception as e:
            result = {'status': 2, 'msg': ('保存失败!' + str(e)), 'data': }
            return HttpResponse(json.dumps(result), content_type='application/json')
    else:
        try:
            hostObj = host.objects.filter(id=v_hostId)
            hostObj.update(businessName=v_businessName, serviceEnv=v_serviceEnv, hostName=v_hostName, intranetIpAddr=v_intranetIpAddr, publicIpAddr=v_publicIpAddr, sshPort=v_sshPort, hostType=v_hostType, hostRole=v_hostRole, hostDesc=v_hostDesc)
            result = {'status': 1, 'msg': '修改成功!', 'data': }
            return HttpResponse(json.dumps(result), content_type='application/json')
        except Exception as e:
            result = {'status': 2, 'msg': ('修改失败!' + str(e)), 'data': }
            return HttpResponse(json.dumps(result), content_type='application/json')