Merge branch 'coresite_gj' into 'master'

房价网优化

See merge request !330
This commit is contained in:
2022-06-21 12:57:50 +08:00
4 changed files with 107 additions and 10 deletions
@@ -6,12 +6,19 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URLEncoder;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Handler;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.fangjia.core.util.DataUtil;
import com.fangjia.core.util.DingDingMessageUtil;
import com.fangjia.core.util.HttpRequest;
import com.fangjia.core.util.HttpRequestException;
import net.sf.json.JSONObject;
import org.apache.commons.lang.StringUtils;
import com.fangjia.coresite.model.JsonModel;
@@ -129,8 +136,33 @@ public class SaleLeadsController {
}
saleLeads = converValue(saleLeads);
String body =
"业务需求:" + saleLeads.getBusiness() + " " + saleLeads.getOtherBusiness() + "\n\n"
+ "姓名:" + saleLeads.getUname() + "\n\n"
+ "城市:" + saleLeads.getCity() + "\n\n"
+ "工作职能:" + saleLeads.getWork() + "" + saleLeads.getOtherWork() + "\n\n"
+ "手机:" + saleLeads.getMobile() + "\n\n"
+ "邮箱:" + saleLeads.getEmail() + "\n\n"
+ "公司名称:" + saleLeads.getCompany() + "\n\n"
+ "行业性质:" + saleLeads.getIndustryNature() + "\n\n"
+ "线索来源:房价网" ;
try {
JSONObject requestBody = new JSONObject();
requestBody.put("msgtype", "markdown");
JSONObject markdown = new JSONObject();
markdown.put("title", "销售线索");
markdown.put("text", body);
requestBody.put("markdown", markdown);
HttpRequest request = new HttpRequest();
final String ding_url = "https://oapi.dingtalk.com/robot/send?access_token=894650a12af9497bed599df1d5f93b21d6da5bbae45f35f18c5825580ebbdf64";
Map<String, String> headers = new HashMap<String, String>();
headers.put("Content-Type", "application/json; charset=utf-8");
request.postWithBody(ding_url, requestBody, headers, "UTF-8");
} catch (HttpRequestException e) {
e.printStackTrace();
}
saleLeadsService.save(saleLeads);
if(StringUtils.isNotBlank(saleLeads.getBusiness()) && saleLeads.getBusiness().contains("_")){
String[] businessArray = saleLeads.getBusiness().split("_");
for(String s : businessArray){
@@ -1,6 +1,15 @@
package com.fangjia.coresite.controllers;
import com.fangjia.core.util.HttpRequest;
import com.fangjia.core.util.HttpRequestException;
import com.fangjia.coresite.model.FangjiaModel;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.commons.lang3.StringUtils;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
/**
* 解决方案 控制器
@@ -14,7 +23,32 @@ public class SolutionController {
* @param model
* @return
*/
public Object apiAction(FangjiaModel model) {
public Object apiAction(FangjiaModel model, HttpServletRequest request) {
// 对于百度广告过来的信息,进行回传
try {
String queryString = request.getQueryString();
if (StringUtils.isNotBlank(queryString) && queryString.contains("bd_vid")) {
HttpRequest httpRequest = new HttpRequest();
final String baiduUrl = "https://ocpc.baidu.com/ocpcapi/api/uploadConvertData";
Map<String, String> headers = new HashMap<String, String>();
headers.put("Content-Type", "application/json; charset=utf-8");
JSONObject requestBody = new JSONObject();
// https://fengchao.baidu.com/fc/toolscenter/optimize/track/user/27002539
requestBody.put("token", "EZGISwlOClRMEZErT2ThZTEjpLAzs2wE@9POwrGLqpRtQeGhvvCug1N3OK1tq3skk");
JSONArray jsonArray = new JSONArray();
JSONObject contentJson = new JSONObject();
contentJson.put("logidUrl", request.getRequestURL().append("?" + request.getQueryString()).toString());
contentJson.put("newType", "1");
jsonArray.add(contentJson);
requestBody.put("conversionTypes", jsonArray);
String result = httpRequest.postWithBody(baiduUrl, requestBody, headers, "UTF-8");
System.out.println(result);
}
} catch (HttpRequestException e) {
e.printStackTrace();
}
return model;
}
@@ -48,6 +48,11 @@ public class AntiSpiderFilter implements Filter {
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) resp;
// 放开首页不做爬虫验证
if (request.getRequestURL().toString().endsWith("fangjia.com")) {
chain.doFilter(req, resp);
return;
}
if(request.getRequestURI().endsWith("/validate") || request.getRequestURI().contains("randomCode") || request.getRequestURI().contains("checkCode")|| request.getRequestURI().contains("yeepayCallBack")){
chain.doFilter(req, resp);
return;
@@ -555,27 +555,53 @@ $(".user_btn").click(function(){
scrollTo(0,0);
return false;
}
// 解决信息丢失问题
var work = $(".duty:visible").find("select").val()
if (work) {
work = work.replaceAll("请选择您的工作职能", "")
work = work.replaceAll("请选择", "")
$("#work").val(work);
}
var box = $(".demand p i.checked");
if(box.length>0) {
$(".demand").parent().find(".error span").text("")
$(".demand").parent().find(".error").hide();
var selectOtherFlag = false;
var content = []
box.each(function () {
var s = $(this).parent().find("span").text();
if (s.indexOf("请填写") > 0) {
selectOtherFlag = true;
} else {
content.push(s);
}
})
$("#business").val(content.join("_"));
}
/*if(!checkEmail()){
scrollBy(0,-300);
return false;
}
if(!checkNature()){
scrollBy(0,-200);
return false;
}
if(!checkWork()){
scrollBy(0,-100);
return false;
}
if(!checkNature()){
scrollBy(0,-200);
return false;
}
if(mid=="1018"||mid=="1016"){
if(!checkOtherInfo()){
scrollBy(0,-100);
return false;
}
} */
}
*/
var cls = $(".agreement i").attr("class");
if(cls.indexOf("checked")>-1){