Browse Source

Merge remote-tracking branch 'origin/master'

[user3] 4 năm trước cách đây
mục cha
commit
8060011dcf

+ 13 - 6
src/main/java/com/jeeplus/modules/sys/web/PicturePreviewController.java

@@ -11,6 +11,9 @@ import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
 /**
  * 图片预览Controller
  * @author 付光裕
@@ -24,19 +27,23 @@ public class PicturePreviewController extends BaseController {
 	/**
 	 * 阿里云文件服务器前缀
 	 */
-	private static final String aliyunOssPrefix = "http://"+ Global.getConfig("bucketName") + "." + Global.getConfig("ossPrefix");
+	private static final String aliyunOssPrefix = "http://";
 
 
 	@RequestMapping("picturePreview")
 	public String picturePreview(@RequestParam("url")String url, Model model){
 		if("2".equals(uploadMode)){
-			if(url.indexOf(aliyunOssPrefix)!=-1){
-				url = url.replace(aliyunOssPrefix,"");
+			//去除掉http前缀
+			if(url.indexOf("http://")!=-1){
+				url = url.replace("http://","");
 			}
+
+			int i = url.indexOf("/");
+			url = url.substring(i,url.length());
+			url = url.substring(0,url.lastIndexOf("?"));
+			url = aliyunUrl + url;
+			url = new OSSClientUtil().getFileTemporaryLookUrl(url);
 		}
-		url = url.substring(0,url.lastIndexOf("?"));
-		url = aliyunUrl + url;
-		url = new OSSClientUtil().getFileTemporaryLookUrl(url);
 		model.addAttribute("url",url);
 		return "modules/sys/picturePreview";
 	}

+ 0 - 1
src/main/resources/jeeplus.properties

@@ -149,7 +149,6 @@ aliyunUrl=http://oss.gangwaninfo.com
 aliyunDownloadUrl=http://cdn.gangwaninfo.com
 oSSUrl=http://cdn.gangwaninfo.com/jeeplus-resource-data/static
 endpoint=http://oss-cn-hangzhou.aliyuncs.com
-ossPrefix=oss-cn-hangzhou.aliyuncs.com
 accessKeyId=LTAI5tQDWoM9c1WyJNPs86rX
 accessKeySecret=84dDIx4edT1n78KUOqqSmDZ35pchJv
 #\u5F00\u53D1\u73AF\u5883