コード例 #1
0
 def GetPrices(self):
     data = {}
     data['prices'] = []
     respuesta = conexion.search("select price from prices where id_place = %s",[self.id])
     for i in respuesta:
         data['prices'].append({'price':i[0]})
     return data['prices']
コード例 #2
0
 def GetDatail(self):
     data = {}
     data['sites'] = []
     respuesta = conexion.search("select * from places where id = %s ",[self.id])
     for i in respuesta:
         data['sites'].append({'id':i[0],'name':i[1],'img1':i[4],'img2':i[5],'img3':i[6],'description':i[10]})
     return data['sites']
コード例 #3
0
 def search_lug(self):
     data = {}
     data['sites'] = []
     rest = conexion.search(
         "select id,name,img  from places where locate = %s and type = 1",
         [self.place])
     for i in rest:
         data['sites'].append({'id': i[0], 'name': i[1], 'img': i[2]})
     return data['sites']
コード例 #4
0
 def search_category_hotel(self):
     data = {}
     data['hotels'] = []
     rest = conexion.search(
         "select id,name,img  from places where category = %s and type = 2",
         [self.category])
     for i in rest:
         data['hotels'].append({'id': i[0], 'name': i[1], 'img': i[2]})
     return data['hotels']
コード例 #5
0
 def search_hotel_get(self):
     data = {}
     data['hotels'] = []
     rest = conexion.search(
         "select id,name,img  from places where name like %s and type = 2",
         [self.search])
     for i in rest:
         data['hotels'].append({'id': i[0], 'name': i[1], 'img': i[2]})
     return data['hotels']
コード例 #6
0
 def send_email(self):
     respuesta = conexion.search('select name,email from users where email = %s',[self.email])
     if respuesta:
         for i in respuesta:
             now = datetime.now() + timedelta(hours=24)
             resp = conexion.Add('update users set code=%s, recovery_date= %s where email = %s',[self.code,now,self.email])
             return i[0]
     else:
         return None
コード例 #7
0
 def GetPurchaseHistory(self):
     data = {}
     data['history'] = []
     respuesta = conexion.search("select ticket, date_ex, date_com, amount, price, name_place from record where email = %s",[self.email])
     if(respuesta):
         for i in respuesta:
             data['history'].append({'ticket':i[0], 'date_ex': i[1], 'date_com':i[2], 'amount':i[3], 'price': i[4], 'name_place': i[5]})
         return data['history']
     else:
         return None
コード例 #8
0
 def check_code(self):
     respuesta = conexion.search('select code, recovery_date from users where code = %s',[self.code])
     if respuesta:
         for i in respuesta:
             now = datetime.now()
             if now.strftime('%Y %m %d %H %M %S') > i[1].strftime('%Y %m %d %H %M %S'):
                 return 'invalid'
             else:
                 return 'valid'
     else: 
         return None
コード例 #9
0
 def search_date(self):
     data = {}
     data['admin'] = []
     respuesta = conexion.search(
         "select id,name,type,date from places where name like %s",
         [self.search])
     for i in respuesta:
         data["admin"].append({
             'id': i[0],
             'name': i[1],
             'type': i[2],
             'fecha': format(i[3])
         })
     return data["admin"]
コード例 #10
0
 def get_prices(self):
     data = {}
     data['admin'] = []
     respuesta = conexion.search(
         "select price,id_place,id from prices where id_place = %s",
         [self.id])
     if (respuesta):
         for i in respuesta:
             data['admin'].append({
                 'price': i[0],
                 'id_place': i[1],
                 'id': i[2]
             })
         return data['admin']
     else:
         return respuesta
コード例 #11
0
 def bring_data_edit(self):
     data = {}
     data['admin'] = []
     respuesta = conexion.search("select * from places where id = %s",
                                 [self.id])
     if (respuesta):
         for i in respuesta:
             data['admin'].append({
                 'id': i[0],
                 'name': i[1],
                 'type': i[2],
                 'date': format(i[3]),
                 'img': i[4],
                 'imgc1': i[5],
                 'imgc2': i[6],
                 'imgc3': i[7],
                 'category': i[8],
                 'locate': i[9],
                 'description': i[10]
             })
         return data['admin']
     return None