Parcourir la source

앱 관련 필수/선택 업데이트 안내 alert 메시지 표출

gagamel il y a 4 ans
Parent
commit
cc335e052f

+ 23 - 0
src/main/java/com/style24/front/biz/web/TsfAppController.java

@@ -168,4 +168,27 @@ public class TsfAppController extends TsfBaseController {
 		return super.ok(message.getMessage("SUCC_0005"));
 	}
 
+	/**
+	 * 업데이트 정보 조회
+	 *
+	 * @author gagamel
+	 * @since 2021. 11. 18
+	 */
+	@GetMapping("/update/info")
+	@ResponseBody
+	public GagaMap getUpdateInfo() {
+		GagaMap result = new GagaMap();
+
+		if ("I".equals(TsfSession.getAttribute("osType"))) {
+			result.setString("regAppVersion", envsetService.getIosAppVersion(TscConstants.Site.STYLE24.value()));
+			result.setString("regUpdateGb", envsetService.getIosAppUpdateGb(TscConstants.Site.STYLE24.value()));
+		} else if ("A".equals(TsfSession.getAttribute("osType"))) {
+			result.setString("regAppVersion", envsetService.getAosAppVersion(TscConstants.Site.STYLE24.value()));
+			result.setString("regUpdateGb", envsetService.getAosAppUpdateGb(TscConstants.Site.STYLE24.value()));
+		}
+		log.info("result: {}", result);
+
+		return result;
+	}
+
 }

+ 102 - 25
src/main/webapp/WEB-INF/views/mob/common/fragments/FooterMob.html

@@ -556,36 +556,113 @@
 	}
 
 	$(document).ready(function() {
-		// 퀵메뉴탭 조회
-		fnCreateQuickMenuTab();
+		// 필수/선택 업데이트 안내
+		if (_isApp === 'true') {
+			$.getJSON('/app/update/info'
+					, function(result) {
+						if (_appVersion != result.regAppVersion) {
+							// 안내 alert 표기
+							if (_osType == 'I') { // IOS
+								if (result.regUpdateGb == 'Y') { // 필수업데이트
+									mcxDialog.alertC('필수 업데이트가 있습니다. 업데이트 하시겠습니까?', {
+										sureBtnText: "업데이트",
+										sureBtnClick: function() {
+											document.location.href = 'update://?link=https://apps.apple.com/kr/app/id627774402?mt=8';
+										}
+									});
+								} else {
+									mcxDialog.confirm("최신 업데이트가 있습니다. 원활한 서비스 이용을 위해 업데이트하시겠습니까?", {
+										cancelBtnText: "나중에",
+										sureBtnText: "업데이트",
+										sureBtnClick: function() {
+											document.location.href = 'update://?link=https://apps.apple.com/kr/app/id627774402?mt=8';
+										}
+									});
+								}
+							} else { // AOS
+								if (result.regUpdateGb == 'Y') { // 필수업데이트
+									mcxDialog.alertC('필수 업데이트가 있습니다. 업데이트를 위해 스토어로 이동합니다.', {
+										sureBtnText: "업데이트",
+										sureBtnClick: function() {
+											document.location.href = 'update://?link=https://play.google.com/store/apps/details?id=com.istyle24.commerce';
+										}
+									});
+								} else {
+									mcxDialog.confirm("최신 업데이트가 있습니다. 원활한 서비스 이용을 위해 업데이트하시겠습니까?", {
+										cancelBtnText: "취소",
+										sureBtnText: "확인",
+										sureBtnClick: function() {
+											document.location.href = 'update://?link=https://play.google.com/store/apps/details?id=com.istyle24.commerce';
+										}
+									});
+								}
+							}
+						} else {
+							// 퀵메뉴탭 조회
+							fnCreateQuickMenuTab();
+
+							// 최근 본 상품 조회
+							fnGetRecentlyGoods();
+							
+							// 팝업조회
+							fnGetPopup();
+							
+							$.getJSON('/cart/goods/not/soldout/cnt', function (order, status) {
+								let cartCnt;
+								if (order.cartGoodsList.length > 99) {
+									cartCnt = "99+";
+								} else {
+									cartCnt = order.cartGoodsList.length;
+								}
 
-		// 최근 본 상품 조회
-		fnGetRecentlyGoods();
+//					 			$("header #htopSub .button_wrap .store>span").text(cartCnt);
+//					 			$("#header .gnb .btn_cart").attr("href", _PAGE_CART);
+								if (cartCnt > 0) {
+									$('#spanGnbCartCnt').html(cartCnt);
+									$('#spanGnbCartCnt').show();
+								}
+							});
 
-		// 팝업조회
-		fnGetPopup();
+							// 공유하기 기능 추가
+							shareUrl = gagajf.getCookie('st24ck_share_url');
+							gagajf.setCookie('st24ck_share_url', '', 1);
+							if (!gagajf.isNull(shareUrl) && _frontGb === 'M') {
+								$("#adHide").show();
+							}
+						}
+					});
+		} else {
+			// 퀵메뉴탭 조회
+			fnCreateQuickMenuTab();
+
+			// 최근 본 상품 조회
+			fnGetRecentlyGoods();
+			
+			// 팝업조회
+			fnGetPopup();
+			
+			$.getJSON('/cart/goods/not/soldout/cnt', function (order, status) {
+				let cartCnt;
+				if (order.cartGoodsList.length > 99) {
+					cartCnt = "99+";
+				} else {
+					cartCnt = order.cartGoodsList.length;
+				}
 
-		$.getJSON('/cart/goods/not/soldout/cnt', function (order, status) {
-			let cartCnt;
-			if (order.cartGoodsList.length > 99) {
-				cartCnt = "99+";
-			} else {
-				cartCnt = order.cartGoodsList.length;
-			}
+//	 			$("header #htopSub .button_wrap .store>span").text(cartCnt);
+//	 			$("#header .gnb .btn_cart").attr("href", _PAGE_CART);
+				if (cartCnt > 0) {
+					$('#spanGnbCartCnt').html(cartCnt);
+					$('#spanGnbCartCnt').show();
+				}
+			});
 
-// 			$("header #htopSub .button_wrap .store>span").text(cartCnt);
-// 			$("#header .gnb .btn_cart").attr("href", _PAGE_CART);
-			if (cartCnt > 0) {
-				$('#spanGnbCartCnt').html(cartCnt);
-				$('#spanGnbCartCnt').show();
+			// 공유하기 기능 추가
+			shareUrl = gagajf.getCookie('st24ck_share_url');
+			gagajf.setCookie('st24ck_share_url', '', 1);
+			if (!gagajf.isNull(shareUrl) && _frontGb === 'M') {
+				$("#adHide").show();
 			}
-		});
-
-		// 공유하기 기능 추가
-		shareUrl = gagajf.getCookie('st24ck_share_url');
-		gagajf.setCookie('st24ck_share_url', '', 1);
-		if (!gagajf.isNull(shareUrl) && _frontGb === 'M') {
-			$("#adHide").show();
 		}
 	});