| 1 | <%--
|
|---|
| 2 | Author : xuesheng
|
|---|
| 3 | Company £ºpcgroup
|
|---|
| 4 | Document : ѯŒÛœÓ¿Ú£¬Ì᜻wap°æ³µŽûѯŒÛÇëÇóÖÁ³µḚ́ï
|
|---|
| 5 | Created on : 2015-9-24
|
|---|
| 6 | Version £º v1.0
|
|---|
| 7 | --%>
|
|---|
| 8 |
|
|---|
| 9 | <%@page import="cn.pconline.autofinance.util.StringUtils"%>
|
|---|
| 10 | <%@page import="java.net.URLDecoder"%>
|
|---|
| 11 | <%@page import="java.util.HashMap"%>
|
|---|
| 12 | <%@page import="java.util.Map"%>
|
|---|
| 13 | <%@page import="java.util.Date"%>
|
|---|
| 14 | <%@page import="cn.pconline.autofinance.util.OutInterface"%>
|
|---|
| 15 | <%@page import="cn.pconline.autofinance.util.SysConfig"%>
|
|---|
| 16 | <%@page import="com.alibaba.fastjson.JSONObject"%>
|
|---|
| 17 | <%@page import="org.gelivable.web.Env"%>
|
|---|
| 18 | <%@page import="org.gelivable.web.EnvUtils"%>
|
|---|
| 19 | <%@page import="cn.pconline.autofinance.util.T"%>
|
|---|
| 20 | <%@page contentType="text/html" pageEncoding="UTF-8"%>
|
|---|
| 21 | <%
|
|---|
| 22 | //œÓ¿Ú°×Ãûµ¥Ð£Ñé
|
|---|
| 23 | if (!T.isValidRequest(request)) {
|
|---|
| 24 | out.println("·Ç·š·ÃÎÊ£¡");
|
|---|
| 25 | return;
|
|---|
| 26 | }
|
|---|
| 27 |
|
|---|
| 28 | Env env = EnvUtils.getEnv();
|
|---|
| 29 | SysConfig sc = EnvUtils.getEnv().getBean(SysConfig.class);
|
|---|
| 30 |
|
|---|
| 31 | String data = env.param("data", "");
|
|---|
| 32 | System.out.println("ѯŒÛ£º"+data);
|
|---|
| 33 | if ("".equals(data)) {
|
|---|
| 34 | JSONObject rJson = new JSONObject();
|
|---|
| 35 | rJson.put("code", 1);
|
|---|
| 36 | rJson.put("msg", "ÇëÇó²ÎÊýŽíÎó");
|
|---|
| 37 | out.clear();
|
|---|
| 38 | out.println(rJson.toString());
|
|---|
| 39 | return;
|
|---|
| 40 | }
|
|---|
| 41 | JSONObject dJson = JSONObject.parseObject(data);
|
|---|
| 42 |
|
|---|
| 43 | String dealerIds = dJson.getString("dealerIds"); //ŸÏúÉÌID×Ö·ûŽ® 123,123,123 ¶ººÅ·Öžô
|
|---|
| 44 | long serialGroupId = dJson.getLongValue("serialGroupId"); //³µÏµID
|
|---|
| 45 | long modelId = dJson.getLongValue("modelId"); //³µÏµID
|
|---|
| 46 | int regionId = dJson.getIntValue("regionId"); //³ÇÊÐID
|
|---|
| 47 | String name = dJson.getString("name"); //ÐÕÃû
|
|---|
| 48 | String phone = dJson.getString("phone"); //µç»°
|
|---|
| 49 | String ip = dJson.getString("ip"); //Ì᜻ѯŒÛµÄ¿Í»§¶ËIPµØÖ·
|
|---|
| 50 |
|
|---|
| 51 | JSONObject rJson = new JSONObject();
|
|---|
| 52 |
|
|---|
| 53 | if (!T.isBlank(dealerIds)) {
|
|---|
| 54 | try {
|
|---|
| 55 | String priceRoot = sc.getConfig("price.root");
|
|---|
| 56 |
|
|---|
| 57 | /*
|
|---|
| 58 | Ö÷¹«£¬ÕâžöpriceRootŸÍÊÇËûÃDZšŒÛ¿âµÄÓòÃûÀ²£¬
|
|---|
| 59 | ²âÊÔ»·Ÿ³£ºhttp://dev3.pcauto.com.cn:8001
|
|---|
| 60 | ÏßÉÏ»·Ÿ³£ºhttp://price.pcauto.com.cn
|
|---|
| 61 | */
|
|---|
| 62 |
|
|---|
| 63 | //»ñÈ¡œÓ¿Ú·ÃÎÊtoken
|
|---|
| 64 | String tokenUrl = priceRoot + "/interface/token/applyToken.jsp";
|
|---|
| 65 | String token = OutInterface.get(tokenUrl, "jr.pcauto.com.cn"); //¶Ô·œœÓ¿ÚÐèҪУÑéreferer,ÊÖ¶¯Öž¶š
|
|---|
| 66 |
|
|---|
| 67 | //Ì᜻ѯŒÛÃûµ¥
|
|---|
| 68 | Map<String, Object> params = new HashMap<String, Object>();
|
|---|
| 69 | params.put("serialGroupId", serialGroupId);
|
|---|
| 70 | params.put("modelId", modelId);
|
|---|
| 71 | params.put("regionId", regionId);
|
|---|
| 72 | params.put("name", URLDecoder.decode(StringUtils.xssCharFilter(name), "utf-8"));
|
|---|
| 73 | params.put("phone", StringUtils.xssCharFilter(phone));
|
|---|
| 74 | params.put("ip", ip);
|
|---|
| 75 | params.put("refererType", "2");
|
|---|
| 76 | params.put("origin", "2"); //Ɯ̚ÀŽÔŽ,0:ÎŽÖª,1:web,2:wap,3:IOS,4:Android,5:WP,6£ºÔÓÖŸ
|
|---|
| 77 | params.put("payType", "0");
|
|---|
| 78 | params.put("html_TOKEN", token);
|
|---|
| 79 |
|
|---|
| 80 | String sendOrderUrl = sc.getConfig("postOrder.url");
|
|---|
| 81 | /*
|
|---|
| 82 | ÕâžöŸÍÊÇÌ᜻ѯŒÛµÄœÓ¿ÚÁË
|
|---|
| 83 | ²âÊÔ»·Ÿ³£ºhttp://dev3.pcauto.com.cn:8001/dealer/action/add_order.jsp?_charset=GBK
|
|---|
| 84 | ÏßÉÏ»·Ÿ³£ºhttp://price.pcauto.com.cn/dealer/action/add_order.jsp?_charset=GBK
|
|---|
| 85 | */
|
|---|
| 86 |
|
|---|
| 87 | String result = OutInterface.post(sendOrderUrl, "jr.pcauto.com.cn", params);
|
|---|
| 88 | JSONObject jsonResult = JSONObject.parseObject(result);
|
|---|
| 89 | if (jsonResult.getIntValue("status") == 1) {
|
|---|
| 90 | rJson.put("code", 0);
|
|---|
| 91 | rJson.put("msg", "ѯŒÛ³É¹Š");
|
|---|
| 92 | } else {
|
|---|
| 93 | rJson.put("code", 1);
|
|---|
| 94 | rJson.put("msg", "ѯŒÛʧ°Ü");
|
|---|
| 95 | }
|
|---|
| 96 | } catch (Exception ex) {
|
|---|
| 97 | ex.printStackTrace();
|
|---|
| 98 | rJson.put("code", 1);
|
|---|
| 99 | rJson.put("msg", "ѯŒÛÒì³£");
|
|---|
| 100 | }
|
|---|
| 101 | } else {
|
|---|
| 102 | rJson.put("code", 1); //ѯŒÛʧ°Ü
|
|---|
| 103 | rJson.put("msg", "²ÎÊýŽíÎó"); //ʧ°ÜÐÅÏ¢
|
|---|
| 104 | }
|
|---|
| 105 | out.clear();
|
|---|
| 106 | out.println(rJson.toString());
|
|---|
| 107 | %> |
|---|