def Message(request):
    ret = public(request,'vmware-manage','通知','配置')
    if request.method == 'POST':
        form_key = ['order_apply','order_pay','wechat_secret','wechat_id','wechat_corp']
        form_value = GetFormPost(request,form_key)
        new = dict()
        for x in form_key:
            new['key'] = x
            new['val'] = form_value.get(x)
            mess = message.objects.filter(key=x)
            if mess.count() == 0 :
                message(**new).save()
            else:
                mess.update(**new)
        return redirect('/vMware/message/')
    else:
        mes = message.objects.filter()
        messa = dict()
        for x in mes:
            messa[x.key] = x.val
        ret['messages'] = messa
        ret['num'] = mes.count()
    return render_to_response('vmware/manage/message.html',ret)
def OrderOpened(request,id):
    ret = public(request,'apply-apply','订单','开通')
    if request.method == 'POST':
        form_key = ['ippools',]
        form_value = GetFormPost(request,form_key)
        order_rs = order_flow.objects.filter(order__id=id,key='opened_ippools')
        if len(order_rs) == 0:
            order.objects.filter(id=id).update(status=3)
            OrderFlowSave({'order':id,'key':'opened_ippools','rs':0,'uid':ret['uid'],'ippool':form_value.get('ippools',None)})
            return redirect('/vMware/manage/')
        else:
            vMwareOrderInfoError(ret)
            return render_to_response('public/message.html',ret)