|
@@ -22,7 +22,7 @@ from apps.AppInfo.models import (
|
|
|
Article, CKArticle, Equip, Equip_type, FarmList, FarmUser, GardenManage,
|
|
Article, CKArticle, Equip, Equip_type, FarmList, FarmUser, GardenManage,
|
|
|
Hotel_Info, Hotel_Photo, JKdata, MyUser, Pick_Pub, Product, QXZdata,
|
|
Hotel_Info, Hotel_Photo, JKdata, MyUser, Pick_Pub, Product, QXZdata,
|
|
|
QXZdata_New, QXZstatus, QXZstatus_New, QXZswitchdata, QXZswitchstatus,
|
|
QXZdata_New, QXZstatus, QXZstatus_New, QXZswitchdata, QXZswitchstatus,
|
|
|
- Video_data,GardenArea,Store_Manage,Areacrop,Sell_Manage,Person_Pick,QXZAutoswitch)
|
|
|
|
|
|
|
+ Video_data,GardenArea,Store_Manage,Areacrop,Sell_Manage,Person_Pick,QXZAutoswitch,Sightsee_Info)
|
|
|
from apps.Equipment.all_dict import qxz_dict
|
|
from apps.Equipment.all_dict import qxz_dict
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1294,83 +1294,63 @@ class Dorm_Pub(ListView):
|
|
|
return HttpResponse(data)
|
|
return HttpResponse(data)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+# 旅游发布介绍图
|
|
|
|
|
+class Sightsee_Photo(ListView):
|
|
|
|
|
+ def get(self,request):
|
|
|
|
|
+ pass
|
|
|
|
|
+ def post(self,request):
|
|
|
|
|
+ sightsee_photos = request.FILES.get('sightsee_photos')
|
|
|
|
|
+ if sightsee_photos:
|
|
|
|
|
+ print("视频图片:", sightsee_photos)
|
|
|
|
|
+ sightsee_photos_dir = 'sightsee_photos/'
|
|
|
|
|
+ end_name = sightsee_photos.name.split('.')[-1]
|
|
|
|
|
+ # 判断如果路径不存在,即创建路径
|
|
|
|
|
+ if os.path.exists(sightsee_photos_dir) == False:
|
|
|
|
|
+ os.makedirs(sightsee_photos_dir)
|
|
|
|
|
+ img = Image.open(sightsee_photos)
|
|
|
|
|
+ now_time = time.strftime('%Y%m%d%H%M%S', time.localtime(time.time()))
|
|
|
|
|
+ pic_name = now_time + '.' + end_name
|
|
|
|
|
+ print("pic_name:", pic_name)
|
|
|
|
|
+ img.save(sightsee_photos_dir + pic_name)
|
|
|
|
|
+ sightsee_photos = sightsee_photos_dir + pic_name
|
|
|
|
|
+ print("sightsee_photos:",sightsee_photos)
|
|
|
|
|
+ data = {"code": 0,"msg": "","data": {"src": sightsee_photos}}
|
|
|
|
|
+ else:
|
|
|
|
|
+ sightsee_photos = "0"
|
|
|
|
|
+ data = {"code": 404,"msg": "","data": {"src": sightsee_photos}}
|
|
|
|
|
+ data = json.dumps(data)
|
|
|
|
|
+ return HttpResponse(data)
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
# 旅游发布
|
|
# 旅游发布
|
|
|
class Sightsee_Pub(ListView):
|
|
class Sightsee_Pub(ListView):
|
|
|
def get(self,request):
|
|
def get(self,request):
|
|
|
return render(request, 'backstageNet/info/SightseePub.html', context={})
|
|
return render(request, 'backstageNet/info/SightseePub.html', context={})
|
|
|
def post(self,request):
|
|
def post(self,request):
|
|
|
- current_user = MyUser.objects.get(username="admin")
|
|
|
|
|
name = request.POST.get('name')
|
|
name = request.POST.get('name')
|
|
|
price = request.POST.get('price')
|
|
price = request.POST.get('price')
|
|
|
- person = request.POST.get('person')
|
|
|
|
|
- mobile = request.POST.get('mobile')
|
|
|
|
|
- img_url = request.POST.get('img_url')
|
|
|
|
|
- addr = request.POST.get('addr')
|
|
|
|
|
|
|
+ sightsee_tel = request.POST.get('mobile')
|
|
|
|
|
+ sightsee_img = request.POST.get('img_url')
|
|
|
|
|
+ sightsee_time = request.POST.get('time')
|
|
|
|
|
+ # 位置
|
|
|
location = request.POST.get('location')
|
|
location = request.POST.get('location')
|
|
|
- intro = request.POST.get('intro')
|
|
|
|
|
|
|
+ # 内容
|
|
|
content = request.POST.get('content')
|
|
content = request.POST.get('content')
|
|
|
- pic_list = request.POST.get('pic_list')
|
|
|
|
|
- Hotel_id= request.POST.get("id")
|
|
|
|
|
- if Hotel_id:
|
|
|
|
|
- if Hotel_Info.objects.filter(id=Hotel_id).exists():
|
|
|
|
|
- try:
|
|
|
|
|
- Hotel_Info.objects.filter(id=Hotel_id).update(
|
|
|
|
|
- name=name,
|
|
|
|
|
- price=price,
|
|
|
|
|
- intro=intro,
|
|
|
|
|
- addr=addr,
|
|
|
|
|
- location=location,
|
|
|
|
|
- person=person,
|
|
|
|
|
- hotel_img=img_url,
|
|
|
|
|
- hotel_tel=mobile,
|
|
|
|
|
- content=content,
|
|
|
|
|
- author=current_user,
|
|
|
|
|
- )
|
|
|
|
|
- data="1"
|
|
|
|
|
- except Exception as e:
|
|
|
|
|
- print("-----------报错信息为-------------")
|
|
|
|
|
- print(e)
|
|
|
|
|
- data = "0"
|
|
|
|
|
- if data == "1":
|
|
|
|
|
- try:
|
|
|
|
|
- hotel_obj = Hotel_Info.objects.get(name=name)
|
|
|
|
|
- pic_list = pic_list.split(',')
|
|
|
|
|
- for i in pic_list:
|
|
|
|
|
- Hotel_Photo.objects.filter(hotel=hotel_obj).update(hotel=hotel_obj,addr=i)
|
|
|
|
|
- except Exception as aa:
|
|
|
|
|
- print("滚动图保存错误")
|
|
|
|
|
- print(aa)
|
|
|
|
|
- else:
|
|
|
|
|
- data = "0"
|
|
|
|
|
- return HttpResponse(data)
|
|
|
|
|
- else:
|
|
|
|
|
- try:
|
|
|
|
|
- Hotel_Info.objects.create(
|
|
|
|
|
- name=name,
|
|
|
|
|
- price=price,
|
|
|
|
|
- intro=intro,
|
|
|
|
|
- addr=addr,
|
|
|
|
|
- location=location,
|
|
|
|
|
- person=person,
|
|
|
|
|
- hotel_img=img_url,
|
|
|
|
|
- hotel_tel=mobile,
|
|
|
|
|
- content=content,
|
|
|
|
|
- author=current_user)
|
|
|
|
|
- data = "1"
|
|
|
|
|
- except Exception as e:
|
|
|
|
|
- print("-----------报错信息为-------------")
|
|
|
|
|
- print(e)
|
|
|
|
|
- data = "0"
|
|
|
|
|
- if data == "1":
|
|
|
|
|
- try:
|
|
|
|
|
- hotel_obj = Hotel_Info.objects.get(name=name)
|
|
|
|
|
- pic_list = pic_list.split(',')
|
|
|
|
|
- for i in pic_list:
|
|
|
|
|
- Hotel_Photo.objects.create(hotel=hotel_obj,addr=i)
|
|
|
|
|
- except Exception as aa:
|
|
|
|
|
- print("滚动图保存错误")
|
|
|
|
|
- print(aa)
|
|
|
|
|
- return HttpResponse(data)
|
|
|
|
|
|
|
+ # 简介
|
|
|
|
|
+ desc = request.POST.get('desc')
|
|
|
|
|
+ Sightsee_Info.objects.create(
|
|
|
|
|
+ name=name,
|
|
|
|
|
+ price=price,
|
|
|
|
|
+ location=location,
|
|
|
|
|
+ sightsee_time=sightsee_time,
|
|
|
|
|
+ sightsee_img=sightsee_img,
|
|
|
|
|
+ sightsee_tel=sightsee_tel,
|
|
|
|
|
+ content=content,
|
|
|
|
|
+ desc=desc)
|
|
|
|
|
+ data = "0"
|
|
|
|
|
+ return HttpResponse(data)
|
|
|
|
|
+
|
|
|
|
|
|
|
|
# 视频审核
|
|
# 视频审核
|
|
|
class Video_Check(ListView):
|
|
class Video_Check(ListView):
|