Jelajahi Sumber

ST24PRJ-563 [결함][FRONT] 상품 Facebook 공유 관련 확인

card007 4 tahun lalu
induk
melakukan
1b920f28a1

+ 27 - 0
src/main/java/com/style24/front/biz/web/TsfGoodsController.java

@@ -8,6 +8,7 @@ import java.util.HashMap;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.core.env.Environment;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
@@ -115,6 +116,9 @@ public class TsfGoodsController extends TsfBaseController {
 	@Autowired
 	private SearchEngineDiquest diquest;
 
+	@Autowired
+	private Environment env;
+
 	/**
 	 * 상품상세
 	 *
@@ -389,6 +393,29 @@ public class TsfGoodsController extends TsfBaseController {
 		mav.addObject("params", paramsGoods);
 		mav.addObject("afLinkCd", afLinkCd);	// 파라미터 제휴코드
 
+		// 2021.12.20 card007 facebook 공유 메타정보 설정
+		String hasSsl = env.getProperty("has-ssl");
+		String protocol;
+
+		if ("true".equals(hasSsl)) {
+			protocol = "https:";
+		} else {
+			protocol = "http:";
+		}
+
+		String uploadGoodsUrl = env.getProperty("upload.goods.view");
+		String snsGoodsImg = protocol + uploadGoodsUrl + "/" + goods.getSysImgNm();
+		String snsUrl = protocol + "/goods/detail/form?goodsCd=" + paramsGoods.getGoodsCd();
+		if (StringUtils.isNotBlank(paramsGoods.getColorCd())) snsUrl += "&colorCd=" + paramsGoods.getColorCd();
+		String snsGoodsFullNm = goods.getGoodsFullNm();
+
+		GagaMap map = new GagaMap();
+		map.setString("snsGoodsFullNm", snsGoodsFullNm);
+		map.setString("ogDesc", snsGoodsFullNm);
+		map.setString("ogImage", snsGoodsImg);
+		map.setString("snsUrl", snsUrl);
+		mav.addObject("goodsMetaInfo", map);
+
 		if (TscConstants.GoodsType.DEAL.value().equals(goods.getGoodsType())) {
 			if ("Y".equals(mobileYn)) {
 				mav.setViewName("mob/goods/GoodsDealDetailFormMob");

+ 12 - 4
src/main/webapp/WEB-INF/views/mob/common/fragments/HeadMob.html

@@ -12,11 +12,19 @@
 	<meta name="Title" th:content="${metaInfo.browserTitle}" content="한세공식몰 스타일24"/>
 	<meta name="description" th:content="${metaInfo.ogDesc}" content="한세공식몰,TBJ,FRJ,NBA,NBA KIDS,LPGA,PGATOUR,컬리수,모이몰른,MOIMOLN,리카앤,리바이스키즈,ANDEW,BUCKAROO,나이키키즈"/>
 	<meta name="keywords" th:content="${metaInfo.keywords}" content="한세공식몰,TBJ,FRJ,NBA,NBA KIDS,LPGA,PGATOUR,컬리수,모이몰른,MOIMOLN,리카앤,리바이스키즈,ANDEW,BUCKAROO,나이키키즈"/>
+	<th:block th:if="${goodsMetaInfo}">
+		<meta property="og:image" th:content="${goodsMetaInfo.ogImage}" content="/image/web/common/og_style24.png"/>
+		<meta property="og:url"th:content="${goodsMetaInfo.snsUrl}" content="http://www.style24.com"/>
+		<meta property="og:title" th:content="${goodsMetaInfo.snsGoodsFullNm}" content="스타일24"/>
+		<meta property="og:description" th:content="${goodsMetaInfo.ogDesc}" content="한세공식몰,TBJ,FRJ,NBA,NBA KIDS,LPGA,PGATOUR,컬리수,모이몰른,MOIMOLN,리카앤,리바이스키즈,ANDEW,BUCKAROO,나이키키즈"/>
+	</th:block>
+	<th:block th:unless="${goodsMetaInfo}">
+		<meta property="og:image" th:content="${metaInfo.ogImage}" content="/image/web/common/og_style24.png"/>
+		<meta property="og:url" th:content="${@environment.getProperty('domain.front')}" content="http://www.style24.com"/>
+		<meta property="og:title" th:content="${metaInfo.browserTitle}" content="스타일24"/>
+		<meta property="og:description" th:content="${metaInfo.ogDesc}" content="한세공식몰,TBJ,FRJ,NBA,NBA KIDS,LPGA,PGATOUR,컬리수,모이몰른,MOIMOLN,리카앤,리바이스키즈,ANDEW,BUCKAROO,나이키키즈"/>
+	</th:block>
 	<meta property="og:type" content="website"/>
-	<meta property="og:image" th:content="${metaInfo.ogImage}" content="/image/web/common/og_style24.png"/>
-	<meta property="og:url" th:content="${@environment.getProperty('domain.front')}" content="http://www.style24.com"/>
-	<meta property="og:title" th:content="${metaInfo.browserTitle}" content="스타일24"/>
-	<meta property="og:description" th:content="${metaInfo.ogDesc}" content="한세공식몰,TBJ,FRJ,NBA,NBA KIDS,LPGA,PGATOUR,컬리수,모이몰른,MOIMOLN,리카앤,리바이스키즈,ANDEW,BUCKAROO,나이키키즈"/>
 	<meta property="og:locale" content="ko_KR"/>
 	<meta property="og:site_name" th:content="${metaInfo.browserTitle}" content="한세공식몰 스타일24"/>
 

+ 13 - 4
src/main/webapp/WEB-INF/views/web/common/fragments/HeadWeb.html

@@ -8,14 +8,23 @@
 <!-- 	<meta http-equiv="cache-control" content="no-cache"/> -->
 <!-- 	<meta http-equiv="expires" content="0"/> -->
 <!-- 	<meta http-equiv="pragma" content="no-cache"/> -->
+	<th:block th:if="${goodsMetaInfo}">
+		<meta property="og:image" th:content="${goodsMetaInfo.ogImage}" content="/image/web/common/og_style24.png"/>
+		<meta property="og:url" th:content="${goodsMetaInfo.snsUrl}" content="http://www.style24.com"/>
+		<meta property="og:title" th:content="${goodsMetaInfo.snsGoodsFullNm}" content="스타일24"/>
+		<meta property="og:description" th:content="${goodsMetaInfo.ogDesc}" content="한세공식몰,TBJ,FRJ,NBA,NBA KIDS,LPGA,PGATOUR,컬리수,모이몰른,MOIMOLN,리카앤,리바이스키즈,ANDEW,BUCKAROO,나이키키즈"/>
+	</th:block>
+	<th:block th:unless="${goodsMetaInfo}">
+		<meta property="og:image" th:content="${metaInfo.ogImage}" content="/image/web/common/og_style24.png"/>
+		<meta property="og:url" th:content="${@environment.getProperty('domain.front')}" content="http://www.style24.com"/>
+		<meta property="og:title" th:content="${metaInfo.browserTitle}" content="스타일24"/>
+		<meta property="og:description" th:content="${metaInfo.ogDesc}" content="한세공식몰,TBJ,FRJ,NBA,NBA KIDS,LPGA,PGATOUR,컬리수,모이몰른,MOIMOLN,리카앤,리바이스키즈,ANDEW,BUCKAROO,나이키키즈"/>
+	</th:block>
 	<meta name="Title" th:content="${metaInfo.browserTitle}" content="한세공식몰 스타일24"/>
 	<meta name="description" th:content="${metaInfo.ogDesc}" content="한세공식몰,TBJ,FRJ,NBA,NBA KIDS,LPGA,PGATOUR,컬리수,모이몰른,MOIMOLN,리카앤,리바이스키즈,ANDEW,BUCKAROO,나이키키즈"/>
 	<meta name="keywords" th:content="${metaInfo.keywords}" content="한세공식몰,TBJ,FRJ,NBA,NBA KIDS,LPGA,PGATOUR,컬리수,모이몰른,MOIMOLN,리카앤,리바이스키즈,ANDEW,BUCKAROO,나이키키즈"/>
 	<meta property="og:type" content="website"/>
-	<meta property="og:image" th:content="${metaInfo.ogImage}" content="/image/web/common/og_style24.png"/>
-	<meta property="og:url" th:content="${@environment.getProperty('domain.front')}" content="http://www.style24.com"/>
-	<meta property="og:title" th:content="${metaInfo.browserTitle}" content="스타일24"/>
-	<meta property="og:description" th:content="${metaInfo.ogDesc}" content="한세공식몰,TBJ,FRJ,NBA,NBA KIDS,LPGA,PGATOUR,컬리수,모이몰른,MOIMOLN,리카앤,리바이스키즈,ANDEW,BUCKAROO,나이키키즈"/>
+	
 	<meta property="og:locale" content="ko_KR"/>
 	<meta property="og:site_name" th:content="${metaInfo.browserTitle}" content="한세공식몰 스타일24"/>
 

+ 1 - 1
src/main/webapp/ux/style24_link.js

@@ -1596,7 +1596,7 @@ function sendSns(sns, url, txt, media, description)
 			if (_isApp != null && _isApp == 'true') {
 				location.href = 'public://?link=' + twitUrl + _txt;
 			} else {
-				window.open(faceUrl + _txt + '&url=' + _url, "_blank", 'width=600,height=400,resizable=yes,scrollbars=yes');
+				window.open(twitUrl + _txt + '&url=' + _url, "_blank", 'width=600,height=400,resizable=yes,scrollbars=yes');
 			}
 			break;
 		default: