|
|
@@ -3,14 +3,20 @@ package com.happy.action;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.google.gson.Gson;
|
|
|
import com.google.gson.reflect.TypeToken;
|
|
|
+import com.happy.Model.AdminManager;
|
|
|
import com.happy.Model.Advertise;
|
|
|
+import com.happy.Model.ArticleTweet;
|
|
|
+import com.happy.Model.Hotel;
|
|
|
import com.happy.Model.app.Around_product;
|
|
|
import com.happy.Model.app.Arounds;
|
|
|
import com.happy.Until.GetHttpParam;
|
|
|
import com.happy.Until.ResUtil;
|
|
|
import com.happy.Until.ResponseUtil;
|
|
|
import com.happy.Until.TimeExchange;
|
|
|
+import com.happy.service.AdminManagerService;
|
|
|
import com.happy.service.AdvertiseService;
|
|
|
+import com.happy.service.ArticleTweetService;
|
|
|
+import com.happy.service.HotelService;
|
|
|
import com.opensymphony.xwork2.ActionSupport;
|
|
|
import org.apache.struts2.ServletActionContext;
|
|
|
import org.apache.struts2.interceptor.ServletRequestAware;
|
|
|
@@ -29,6 +35,12 @@ public class advertiseAction extends ActionSupport implements ServletRequestAwar
|
|
|
|
|
|
@Resource
|
|
|
public AdvertiseService advertiseService;
|
|
|
+ @Resource
|
|
|
+ public AdminManagerService adminManagerService;
|
|
|
+ @Resource
|
|
|
+ public HotelService hotelService;
|
|
|
+ @Resource
|
|
|
+ public ArticleTweetService articleTweetService;
|
|
|
|
|
|
public Integer id;
|
|
|
public int page; // 当前页
|
|
|
@@ -154,6 +166,15 @@ public class advertiseAction extends ActionSupport implements ServletRequestAwar
|
|
|
return null;
|
|
|
}
|
|
|
advertise.setCreateTime(TimeExchange.getTime());
|
|
|
+ if (advertise.getJumpWay().equals("小程序") && advertise.getJumpDirection().equals("民宿")){
|
|
|
+ Hotel hotel = hotelService.getById(Integer.parseInt(advertise.getJumpPoint()));
|
|
|
+ AdminManager adminManager = adminManagerService.getById(hotel.getManagerId());
|
|
|
+ advertise.setTownId(adminManager.getHotelTownship());
|
|
|
+ }
|
|
|
+ if (advertise.getJumpWay().equals("小程序") && advertise.getJumpDirection().equals("攻略")){
|
|
|
+ ArticleTweet articleTweet = articleTweetService.queryArticleById(advertise.getJumpPoint(),null);
|
|
|
+ advertise.setTownId(articleTweet.getLocationId());
|
|
|
+ }
|
|
|
int m = advertiseService.insertAdvertise(advertise);
|
|
|
if (m > 0) {
|
|
|
resultjson.put("message", "添加成功");
|
|
|
@@ -223,6 +244,15 @@ public class advertiseAction extends ActionSupport implements ServletRequestAwar
|
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
|
|
|
return null;
|
|
|
}
|
|
|
+ if (advertise.getJumpWay().equals("小程序") && advertise.getJumpDirection().equals("民宿")){
|
|
|
+ Hotel hotel = hotelService.getById(Integer.parseInt(advertise.getJumpPoint()));
|
|
|
+ AdminManager adminManager = adminManagerService.getById(hotel.getManagerId());
|
|
|
+ advertise.setTownId(adminManager.getHotelTownship());
|
|
|
+ }
|
|
|
+ if (advertise.getJumpWay().equals("小程序") && advertise.getJumpDirection().equals("攻略")){
|
|
|
+ ArticleTweet articleTweet = articleTweetService.queryArticleById(advertise.getJumpPoint(),null);
|
|
|
+ advertise.setTownId(articleTweet.getLocationId());
|
|
|
+ }
|
|
|
advertise.setCreateTime(TimeExchange.getTime());
|
|
|
int m = advertiseService.updateAdvertise(advertise);
|
|
|
if (m > 0) {
|