Browse Source

소셜 적용

eskim 5 years ago
parent
commit
d4142078d2

+ 1 - 1
src/main/java/com/style24/persistence/mybatis/shop/TsfGoods.xml

@@ -196,7 +196,7 @@
 		         , IFNULL(B.DC_ARATE, C.DC_RATE) AS DC_RATE
 		         , (CASE WHEN #{frontGb} = 'P' THEN IFNULL(B.PNT_APRATE, C.PNT_PRATE) ELSE IFNULL(B.PNT_AMRATE,C.PNT_MRATE) END ) AS PNT_RATE
 		         , DATE_FORMAT(A.SOCIAL_STDT, '%Y%m%d%H%i%S')  AS SOCIAL_STDT
-		         , DATE_FORMAT(A.SOCIAL_EDDT, '%Y%m%d%H%i%S')  AS SOCIAL_EDDT
+		         , DATE_FORMAT(A.SOCIAL_EDDT, '%Y-%m-%dT%H:%i:%S')  AS SOCIAL_EDDT
 		    FROM TB_SOCIAL A
 		    INNER JOIN TB_SOCIAL_GOODS B ON A.SOCIAL_SQ = B.SOCIAL_SQ
 		                                 AND B.GOODS_CD = #{goodsCd}

+ 38 - 29
src/main/webapp/WEB-INF/views/web/goods/GoodsDetailFormWeb.html

@@ -80,14 +80,14 @@
 					<input type="hidden" name="selfGoodsYn" th:value="${goodsInfo.selfGoodsYn}"/>
 					<div class="area_desc">
 						<div class="desc_wrap">
-							<div class="timer_box">
+							<div class="timer_box" style="display:none;">
 								<p>
 									<span class="tit">남은시간</span>
 									<span class="timer">
-										<em id="d-days">27</em>
-										<em id="d-hours">21</em>
-										<em id="d-minutes">21</em>
-										<em id="d-seconds">07</em>
+										<em id="d-days">0</em>
+										<em id="d-hours">0</em>
+										<em id="d-minutes">0</em>
+										<em id="d-seconds">0</em>
 									</span>
 								</p>
 							</div>
@@ -978,6 +978,8 @@
 	
 	$(document).ready( function() {
 		
+		$('.timer_box').css('display', 'none');
+		
 		var params = new Object();
 		params.goodsCd = [[${params.goodsCd}]];
 		params.viewDt = [[${params.viewDt}]];
@@ -1099,31 +1101,38 @@
 			return false;
 		});
 		
-		/* 행사 남은시간 */
-		function promotionTimer() {
-			var endTime = new Date('30 March 2021 9:56:00 GMT+0900'); // 남은시간 지정		
-				endTime = (Date.parse(endTime) / 1000);
-
-				var now = new Date();
-				now = (Date.parse(now) / 1000);
-
-				var timeLeft = endTime - now;
-
-				var days = Math.floor(timeLeft / 86400); 
-				var hours = Math.floor((timeLeft - (days * 86400)) / 3600);
-				var minutes = Math.floor((timeLeft - (days * 86400) - (hours * 3600 )) / 60);
-				var seconds = Math.floor((timeLeft - (days * 86400) - (hours * 3600) - (minutes * 60)));
-
-				if (hours < '10') { hours = '0' + hours; }
-				if (minutes < '10') { minutes = '0' + minutes; }
-				if (seconds < '10') { seconds = '0' + seconds; }
-
-				$('#d-days').html(days);
-				$('#d-hours').html(hours);
-				$('#d-minutes').html(minutes);
-				$('#d-seconds').html(seconds);		
+		if (!gagajf.isNull([[${goodsInfo.socialSq}]])){
+			$('.timer_box').css('display', 'block');
+			/* 행사 남은시간 */
+			function promotionTimer() {
+				var endTime = new Date([[${goodsInfo.socialEddt}]]); // 남은시간 지정	30 March 2021 9:56:00 GMT+0900	
+					endTime = (Date.parse(endTime) / 1000);
+	
+					var now = new Date();
+					now = (Date.parse(now) / 1000);
+	
+					var timeLeft = endTime - now;
+	
+					var days = Math.floor(timeLeft / 86400); 
+					var hours = Math.floor((timeLeft - (days * 86400)) / 3600);
+					var minutes = Math.floor((timeLeft - (days * 86400) - (hours * 3600 )) / 60);
+					var seconds = Math.floor((timeLeft - (days * 86400) - (hours * 3600) - (minutes * 60)));
+	
+					if (hours < '10') { hours = '0' + hours; }
+					if (minutes < '10') { minutes = '0' + minutes; }
+					if (seconds < '10') { seconds = '0' + seconds; }
+	
+					if (Number(days) > 0 ){
+						$('#d-days').html(days);	
+					}else{
+						$('#d-days').css('display','none');
+					}
+					$('#d-hours').html(hours);
+					$('#d-minutes').html(minutes);
+					$('#d-seconds').html(seconds);		
+			}
+			setInterval(function() { promotionTimer(); }, 1000);
 		}
-		setInterval(function() { promotionTimer(); }, 1000);
 
 		/* 상품옵션변경 팝업 > 수량조절 */
 //