admin
2019-09-26 c33c46549b12a674ccabb175c6b0632551780fdd
分享bug解决
3个文件已修改
22 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/h5/H5RecommendController.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/log/LogHelper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
utils/src/main/java/org/yeshi/utils/HttpUtil.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/h5/H5RecommendController.java
@@ -243,6 +243,9 @@
    @RequestMapping(value = "getGoodsDetail", method = RequestMethod.GET)
    public void getGoodsDetail(final AcceptData acceptData, final String id, String tid, String uid, String callback,
            PrintWriter out) {
        if (!StringUtil.isNullOrEmpty(uid))
            uid = uid.replace(" ", "+");
        LogHelper.shareGoods("分享出去的H5访问: uid:" + uid + " id:" + id);
        long begin = java.lang.System.currentTimeMillis();
        if (StringUtil.isNullOrEmpty(id)) {
fanli/src/main/java/com/yeshi/fanli/log/LogHelper.java
@@ -10,8 +10,6 @@
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger;
import com.yeshi.fanli.util.TimeUtil;
utils/src/main/java/org/yeshi/utils/HttpUtil.java
@@ -44,7 +44,6 @@
import org.apache.http.util.EntityUtils;
import org.yeshi.utils.entity.ProxyIP;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
public class HttpUtil {
@@ -61,12 +60,12 @@
    public static String getShortLink(String url) {
        return url;
        // String shortLink = getShortLink3(url);
        // if (StringUtil.isNullOrEmpty(shortLink))
        // shortLink = getShortLink1(url);
        // if (StringUtil.isNullOrEmpty(shortLink))
        // shortLink = getShortLink2(url);
        // return shortLink;
//         String shortLink = getShortLink3(url);
//         if (StringUtil.isNullOrEmpty(shortLink))
//         shortLink = getShortLink1(url);
//         if (StringUtil.isNullOrEmpty(shortLink))
//         shortLink = getShortLink2(url);
//         return shortLink;
    }
    private static String getShortLink1(String url) {
@@ -103,11 +102,11 @@
    private static String getShortLink3(String url) {
        try {
            String totalUrl = String.format(
                    "http://api.ft12.com/api.php?format=json&url=%s&apikey=Lqh4eXURkvKhbboXwz@ddd",
                    "http://h5.flq001.com/short/createShort?url=%s",
                    URLEncoder.encode(url, "UTF-8"));
            String result = get(totalUrl, null);
            JSONObject data = JSONObject.fromObject(result);
            return data.optString("url");
            return data.optString("short_url");
        } catch (Exception e) {
            e.printStackTrace();
        }