# Path: qiniuyun/backend.py
# class QiniuPush(QiniuStorage):
#     '''
#     根据settings中的QINIU_CONF配置七牛云的密钥、空间、域名等
#     直接调用该类的类方法即可进行文件上传、显示、删除
#     各方法的详细介绍见父类QiniuStorage
#     @auth:ZWJ
#     '''
#     def __init__(self):
#         super(QiniuPush,self).__init__(**settings.QINIU_CONF)
#             
#     @classmethod
#     def put_data(cls,name,data):
#         '''
#         上传内存中的文件流到七牛并返回上传后的url地址
#         example:
#             f=request.FILES['photo']
#             u.headImg=QiniuPush.put_data(f.name, f)
#             u.save() #保存到数据库
#             -----------------
#             #another def 
#             uuu = User.objects.get(username=request.session['user_name'])
#             uuu.headImg=QiniuPush.private_download_url(uuu.headImg) #生成 
#             return render(request, 'account/signup_result.html', {'user': uuu})
#         '''
#         qn=cls()
#         return super(QiniuPush,qn).put_data(name,data)
# 
#     @classmethod
#     def private_download_url(cls,url,expires=7200):
#         '''生成私有资源下载链接'''
#         qn=cls()
#         return super(QiniuPush,qn).private_download_url(url,expires)
#         
#     @classmethod            
#     def put_file(cls,filePath):
#         '''上传本地文件到七牛并返回上传后的url地址'''
#         qn=cls()
#         return super(QiniuPush,qn).put_file(filePath)
#         
#     @classmethod
#     def exists(cls,key):        
#         '''检测七牛云上是否有文件名为key的文件'''
#         qn=cls()
#         return super(QiniuPush,qn).exists(key)  
# 
#     @classmethod
#     def get_url(cls,key): 
#         '''返回七牛云上文件名为key的文件对应的url地址'''   
#         qn=cls()
#         return super(QiniuPush,qn).get_url(key)
#                 
#     @classmethod
#     def delete(cls,key):  
#         '''删除七牛云上文件名为key的文件'''
#         qn=cls()
#         return super(QiniuPush,qn).delete(key) 
#           
#     @classmethod
#     def ls_files(cls,prefix="", limit=100):
#         '''列出七牛云上的文件(前100个)'''
#         qn=cls()
#         return super(QiniuPush,qn).ls_files()
# 
# Path: qiniuyun/models.py
# class ImageAtQiniu(models.Model):
#     fullname = models.CharField(max_length=120,unique=True)
#     
#     def __unicode__(self):
#         return self.fullname
# 
# Path: DJangoHotel/viewspackage/indexView.py
# class ImgList(object):
#     def __init__(self,logo=None,k1=None,k2=None,k3=None):
#         self.logo=logo
#         self.key_home_1=k1
#         self.key_home_2=k2
#         self.key_home_3=k3
# 
# Path: DJangoHotel/models.py
# class Order(models.Model):    
#     customer = models.ForeignKey(Customer, on_delete=models.CASCADE)
#     roomtype = models.CharField(max_length=45,choices= ROOM_TPYE_CHOICES)
#     begin = models.DateField()
#     end = models.DateField()
#     totalprice = models.IntegerField()
#     state=models.CharField(max_length=45,choices=ORDER_STATE_CHOICES)
# 
#     def __unicode__(self):
#         return self.id
# 
# class RoomInfo(models.Model):
#     name = models.CharField(max_length=30,primary_key=True)
#     price = models.IntegerField(null=True,blank=True)
#     total = models.IntegerField(null=True,blank=True)
#     description = models.TextField()
# 
#     def __unicode__(self):
#         return self.name
# 
# class Customer(models.Model):
# #    id = models.AutoField(primary_key=True, default='SOME STRING')
#     tel = models.CharField(max_length=30)
#     name = models.CharField(max_length=30, default='someone')
#     IDcard=models.CharField(max_length=30,null=True,blank=True)
#     
#     def __unicode__(self):
#         return self.name    


from django.shortcuts import render
from django.http import HttpResponse
from qiniuyun.backend import QiniuPush
from qiniuyun.models import ImageAtQiniu
from .indexView import ImgList
from DJangoHotel.models import Order,RoomInfo,Customer
from random import randint
import time
import datetime
# -*- coding: utf-8 -*-

def orderResult(request):
    imgObjs=ImageAtQiniu.objects.all()
    imgUrls=[QiniuPush.private_download_url(i.fullname) for i in imgObjs]
    imgs=ImgList()
    
    for i in imgUrls:        
        if 'hotel-logo' in i:
            imgs.logo=i
                
    tel,name,IDcard= request.GET['tel'],request.GET['name'],request.GET['IDcard']
    if Customer.objects.all():

# Path: qiniuyun/backend.py
# class QiniuPush(QiniuStorage):
#     '''
#     根据settings中的QINIU_CONF配置七牛云的密钥、空间、域名等
#     直接调用该类的类方法即可进行文件上传、显示、删除
#     各方法的详细介绍见父类QiniuStorage
#     @auth:ZWJ
#     '''
#     def __init__(self):
#         super(QiniuPush,self).__init__(**settings.QINIU_CONF)
#             
#     @classmethod
#     def put_data(cls,name,data):
#         '''
#         上传内存中的文件流到七牛并返回上传后的url地址
#         example:
#             f=request.FILES['photo']
#             u.headImg=QiniuPush.put_data(f.name, f)
#             u.save() #保存到数据库
#             -----------------
#             #another def 
#             uuu = User.objects.get(username=request.session['user_name'])
#             uuu.headImg=QiniuPush.private_download_url(uuu.headImg) #生成 
#             return render(request, 'account/signup_result.html', {'user': uuu})
#         '''
#         qn=cls()
#         return super(QiniuPush,qn).put_data(name,data)
# 
#     @classmethod
#     def private_download_url(cls,url,expires=7200):
#         '''生成私有资源下载链接'''
#         qn=cls()
#         return super(QiniuPush,qn).private_download_url(url,expires)
#         
#     @classmethod            
#     def put_file(cls,filePath):
#         '''上传本地文件到七牛并返回上传后的url地址'''
#         qn=cls()
#         return super(QiniuPush,qn).put_file(filePath)
#         
#     @classmethod
#     def exists(cls,key):        
#         '''检测七牛云上是否有文件名为key的文件'''
#         qn=cls()
#         return super(QiniuPush,qn).exists(key)  
# 
#     @classmethod
#     def get_url(cls,key): 
#         '''返回七牛云上文件名为key的文件对应的url地址'''   
#         qn=cls()
#         return super(QiniuPush,qn).get_url(key)
#                 
#     @classmethod
#     def delete(cls,key):  
#         '''删除七牛云上文件名为key的文件'''
#         qn=cls()
#         return super(QiniuPush,qn).delete(key) 
#           
#     @classmethod
#     def ls_files(cls,prefix="", limit=100):
#         '''列出七牛云上的文件(前100个)'''
#         qn=cls()
#         return super(QiniuPush,qn).ls_files()
# 
# Path: qiniuyun/models.py
# class ImageAtQiniu(models.Model):
#     fullname = models.CharField(max_length=120,unique=True)
#     
#     def __unicode__(self):
#         return self.fullname
# 
# Path: DJangoHotel/viewspackage/indexView.py
# class ImgList(object):
#     def __init__(self,logo=None,k1=None,k2=None,k3=None):
#         self.logo=logo
#         self.key_home_1=k1
#         self.key_home_2=k2
#         self.key_home_3=k3
# 
# Path: DJangoHotel/models.py
# class Order(models.Model):    
#     customer = models.ForeignKey(Customer, on_delete=models.CASCADE)
#     roomtype = models.CharField(max_length=45,choices= ROOM_TPYE_CHOICES)
#     begin = models.DateField()
#     end = models.DateField()
#     totalprice = models.IntegerField()
#     state=models.CharField(max_length=45,choices=ORDER_STATE_CHOICES)
# 
#     def __unicode__(self):
#         return self.id
# 
# class RoomInfo(models.Model):
#     name = models.CharField(max_length=30,primary_key=True)
#     price = models.IntegerField(null=True,blank=True)
#     total = models.IntegerField(null=True,blank=True)
#     description = models.TextField()
# 
#     def __unicode__(self):
#         return self.name
# 
# class Customer(models.Model):
# #    id = models.AutoField(primary_key=True, default='SOME STRING')
#     tel = models.CharField(max_length=30)
#     name = models.CharField(max_length=30, default='someone')
#     IDcard=models.CharField(max_length=30,null=True,blank=True)
#     
#     def __unicode__(self):
#         return self.name    


# Path: DJangoHotel/viewspackage/orderResultView.py
from django.shortcuts import render
from django.http import HttpResponse
from qiniuyun.backend import QiniuPush
from qiniuyun.models import ImageAtQiniu
from .indexView import ImgList
from DJangoHotel.models import Order,RoomInfo,Customer
from random import randint
import time
import datetime

# -*- coding: utf-8 -*-

def orderResult(request):
    imgObjs=ImageAtQiniu.objects.all()
    imgUrls=[QiniuPush.private_download_url(i.fullname) for i in imgObjs]
    imgs=ImgList()
    
    for i in imgUrls:        
        if 'hotel-logo' in i:
            imgs.logo=i
                
    tel,name,IDcard= request.GET['tel'],request.GET['name'],request.GET['IDcard']
    if Customer.objects.all():

        cc=Customer.objects.filter(IDcard=IDcard)