예제 #1
0
 def post(self, request):
     if request.method == 'POST':
         target = request.POST.get('target', '')
         sql = "Select * FROM getinfo_everycomponent where target='%s'" % (
             target)
         data = get_data(sql)
         return JsonResponse(data=data, safe=False)
예제 #2
0
 def post(self, request):
     if request.method == 'POST':
         dizhi = request.data['dizhi']
         sql = "SELECT * FROM getinfo_xiuxiannongjia where city='%s'" % (
             dizhi)
         data = get_data(sql)
         return JsonResponse(data=data, safe=False)
예제 #3
0
 def post(self, request):
     if request.method == 'POST':
         dizhi = request.data['dizhi']
         pinyin = word(dizhi)
         sql = "SELECT * FROM mafengwo_food where city='%s'" % (pinyin)
         data = get_data(sql)
         return JsonResponse(data=data, safe=False)
예제 #4
0
 def post(self, request):
     if request.method == 'POST':
         dizhi = request.data['dizhi']
         pinyin = word(dizhi)
         sql = "SELECT hotel_name,location,pinfen,customer,price,images,city FROM hotelinfo_hotelinfo where city='%s'" % (
             pinyin)
         data = get_data(sql)
         return JsonResponse(data=data, safe=False)
예제 #5
0
 def post(self, request):
     if request.method == 'POST':
         hotel_name = request.POST.get('hotel_name', '')
         target = '0'
         sql = "Select * FROM getinfo_everycomponent where hotel_name='%s'and target='%s'order by time " % (
             hotel_name, target)
         data = get_data(sql)
         return JsonResponse(data=data, safe=False)
예제 #6
0
 def post(self,request):
     if request.method =='POST':
         city = request.POST.get('city', '')
         sql = "SELECT title,content,author_name,touxiang,photo,gooded,requests_math FROM share_submmit where is_pass='******'and city='%s'order by time " % (
             city)
         data = get_data(sql)
         return JsonResponse(data=data,safe=False)
     else:
         return HttpResponse(status=status.HTTP_405_METHOD_NOT_ALLOWED)
예제 #7
0
 def post(self,request):
     if request.method =='POST':
         openid = request.POST.get('openid', '')
         is_starff=userinfo.objects.get(openid=openid).is_starff
         if is_starff=='1':
             sql = "SELECT article_id,title,content,author_name,photo,touxiang FROM share_submmit where waitselect='0' order by time "
             data=get_data(sql)
             return JsonResponse(data=data,safe=False)
         else:
             return HttpResponse(status.HTTP_403_FORBIDDEN)
     else:
         return HttpResponse(status=status.HTTP_405_METHOD_NOT_ALLOWED)
예제 #8
0
 def post(self,request):
     if request.method=='POST':
         openid=request.POST.get('openid','')
         article_id=request.POST.get('article_id','')
         goods = good.objects.filter(author_id=openid, article_id=article_id)
         sql="SELECT requests_math FROM share_submmit where article_id='%s'"%(article_id)
         data=get_data(sql)
         data=int(data[0]['requests_math'])+1
         requests_math_data=submmit.objects.get(article_id=article_id)
         requests_math_data.requests_math=str(data)
         requests_math_data.save()
         if goods:
             pass
         else:
             good.objects.create(author_id=openid, article_id=article_id)
         sql = "SELECT article_id,is_good,is_keep FROM share_good where author_id='%s'and article_id='%s'" % (
         openid, article_id)
         data = get_data(sql)
         return JsonResponse(data=data,safe=False)
     else:
         return HttpResponse(status=status.HTTP_405_METHOD_NOT_ALLOWED)
예제 #9
0
 def post(self,request):
     if request.method=='POST':
         openid=request.POST.get('openid','')
         goods = good.objects.filter(author_id=openid, is_keep='1')
         data_all=[]
         if goods:
             for i in range(len(goods)):
                 article_id=goods[i].article_id
                 sql = "SELECT title,content,article_id,author_name,touxiang,gooded,requests_math FROM share_submmit where article_id='%s'and is_pass='******' order by time "%(article_id)
                 data=get_data(sql)
                 print(data[0])
                 data_all.append(data[0])
             return JsonResponse(data=data_all, safe=False)
         else:
             data={}
             return JsonResponse(data=data,safe=False)
예제 #10
0
 def post(self, request):
     if request.method == 'POST':
         hotel_name = request.POST.get('hotel_name', '')
         openid = request.POST.get('openid', '')
         username = request.POST.get('username', '')
         touxiang = request.POST.get('touxiang', '')
         target = request.POST.get('target', '')
         content = request.POST.get('content', '')
         sql = "Select comment_amount FROM getinfo_everycomponent where id='%s'" % (
             target)
         data = get_data(sql)
         datas = data[0]['comment_amount']
         comment_amount_update = EveryComponent.objects.get(id=target)
         comment_amount_update.comment_amount = str(int(datas) + 1)
         comment_amount_update.save()
         EveryComponent.objects.create(hotel_name=hotel_name,
                                       openid=openid,
                                       username=username,
                                       touxiang=touxiang,
                                       content=content,
                                       target=target)
     return HttpResponse(status=status.HTTP_201_CREATED)