Przeglądaj źródła

앱 설정 수정

jsshin 5 lat temu
rodzic
commit
c87747a275

+ 8 - 6
src/main/java/com/style24/front/biz/service/TsfCustomerService.java

@@ -1117,14 +1117,14 @@ public class TsfCustomerService {
 	 * @since 2021. 05. 20
 	 */
 	@Transactional("shopTxnManager")
-	public void updateAppAgreeYn(String appAppAgreeYn) {
+	public int updateAppAgreeYn(String appAppAgreeYn) {
 		if (!TsfSession.isLogin()) {
 			throw new IllegalStateException("로그인 후 다시 시도하시기 바랍니다.");
 		}
 
 		Integer custNo = TsfSession.getInfo().getCustNo();
 		Customer customer = getCustomerFindByCustNo(custNo);
-
+		int resultCnt = 0;
 		if (customer != null) {
 			if (!customer.getAppAgreeYn().equals(appAppAgreeYn)) {
 				Customer custInfo = new Customer();
@@ -1136,9 +1136,10 @@ public class TsfCustomerService {
 
 				coreCustomerService.createCustomerHistory(custInfo);
 
-				customerDao.updateAppAgreeYn(custInfo);
+				resultCnt = customerDao.updateAppAgreeYn(custInfo);
 			}
 		}
+		return resultCnt;
 	}
 
 	/*
@@ -1149,14 +1150,14 @@ public class TsfCustomerService {
 	 * @since 2021. 05. 20
 	 */
 	@Transactional("shopTxnManager")
-	public void updateMkAgreeYn(String mkAgreeYn) {
+	public int updateMkAgreeYn(String mkAgreeYn) {
 		if (!TsfSession.isLogin()) {
 			throw new IllegalStateException("로그인 후 다시 시도하시기 바랍니다.");
 		}
 
 		Integer custNo = TsfSession.getInfo().getCustNo();
 		Customer customer = getCustomerFindByCustNo(custNo);
-
+		int resultCnt = 0;
 		if (customer != null) {
 			if (!customer.getMkAgreeYn().equals(mkAgreeYn)) {
 				Customer custInfo = new Customer();
@@ -1168,9 +1169,10 @@ public class TsfCustomerService {
 
 				coreCustomerService.createCustomerHistory(custInfo);
 
-				customerDao.updateMkAgreeYn(custInfo);
+				resultCnt = customerDao.updateMkAgreeYn(custInfo);
 			}
 		}
+		return resultCnt;
 	}
 
 

+ 11 - 5
src/main/java/com/style24/front/biz/web/TsfAppController.java

@@ -80,8 +80,12 @@ public class TsfAppController extends TsfBaseController {
 	 * @since 2021. 05. 20
 	 */
 	@PostMapping("/appagree/update")
-	public void updateAppAgreeYn(@RequestBody Customer customer) {
-		customerService.updateAppAgreeYn(customer.getAppAgreeYn());
+	@ResponseBody
+	public GagaMap updateAppAgreeYn(@RequestBody Customer customer) {
+		GagaMap result = new GagaMap();
+		int resultCnt = customerService.updateAppAgreeYn(customer.getAppAgreeYn());
+		result.setInt("resultCnt", resultCnt);
+		return result;
 	}
 
 	/**
@@ -93,9 +97,11 @@ public class TsfAppController extends TsfBaseController {
 	 */
 	@PostMapping("/mkagree/update")
 	@ResponseBody
-	public GagaResponse updateMkAgreeYn(@RequestBody Customer customer) {
-		customerService.updateMkAgreeYn(customer.getMkAgreeYn());
-		return super.ok(message.getMessage("SUCC_0004"));
+	public GagaMap updateMkAgreeYn(@RequestBody Customer customer) {
+		GagaMap result = new GagaMap();
+		int resultCnt = customerService.updateMkAgreeYn(customer.getMkAgreeYn());
+		result.setInt("resultCnt", resultCnt);
+		return result;
 	}
 
 	/**

+ 17 - 12
src/main/webapp/WEB-INF/views/mob/app/SettingFormMob.html

@@ -105,11 +105,11 @@
 	$(document).ready(function(){
 		$('#htopTitle').text('설정');
 
-		// 앱으로 푸시 상태값 조회. 앱에서 settingsSwtichPush 함수를 호출함.
+		// 앱으로 푸시 상태값 조회. 앱에서 settingsSwtichPush, settingsSwtichAdvertise 함수를 호출함.
 		if (_isApp === 'true') {
 			if (_osType === 'A') {
-				window.style24.isPushEnable(); // 정보성(푸시수신 API)
-				window.style24.isAdEnable();   // 마케팅성(광고푸시 API)
+				window.style24.isPushEnable(); // 정보성(푸시수신 API) settingsSwtichPush
+				window.style24.isAdEnable();   // 마케팅성(광고푸시 API) settingsSwtichAdvertise
 			} else if (_osType === 'I') {
 				// 아래와 같이 호출 시 settingsSwtichPush 함수가 앱에서 호출됨
 				window.webkit.messageHandlers.isAdEnable.postMessage({"dummy":"dummy"});
@@ -130,10 +130,9 @@
 		if (isLogin) {
 			// 데이터 상 앱푸시 여부(Y/N) 이랑 기기에 등록된 푸시수신 여부(ON/OFF)
 			if (appAgreeYn === 'Y' && onOff === 'OFF') {
-
-			}
-			if (appAgreeYn === 'N' && onOff === 'ON') {
-
+				fnAppPushAgreeUpdate('N');
+			} else if (appAgreeYn === 'N' && onOff === 'ON') {
+				fnAppPushAgreeUpdate('Y');
 			}
 		}
 	}
@@ -145,6 +144,15 @@
 		} else if (onOff === 'OFF') {
 			$('#btnMkSetting').prop('checked', false);
 		}
+
+		if (isLogin) {
+			// 데이터 상 마케팅동의 여부(Y/N) 이랑 기기에 등록된 푸시수신 여부(ON/OFF)
+			if (appMkAgreeYn === 'Y' && onOff === 'OFF') {
+				fnAppMkAgreeUpdate('N');
+			} else if (appMkAgreeYn === 'N' && onOff === 'ON') {
+				fnAppMkAgreeUpdate('Y');
+			}
+		}
 	}
 
 	$('#btnPushSetting').on('click', function() {
@@ -165,11 +173,9 @@
 				}
 				appAgreeYn = 'N';
 			}
-
 			if (isLogin) {
 				fnAppPushAgreeUpdate(appAgreeYn);
 			}
-
 		}
 	});
 
@@ -191,16 +197,14 @@
 				}
 				mkAgreeYn = 'N';
 			}
-
 			if (isLogin) {
 				fnAppMkAgreeUpdate(mkAgreeYn);
 			}
-
 		}
 	});
 
 
-	// 로그인시 앱푸시동의 여부 데이터 일치화
+	// 앱푸시동의 데이터 처리
 	var fnAppPushAgreeUpdate = function (appAgreeYn) {
 		let params = {}
 		params.appAgreeYn = appAgreeYn;
@@ -208,6 +212,7 @@
 		gagajf.ajaxJsonSubmit('/app/appagree/update', jsonData);
 	}
 
+	// 마케팅동의 데이터 처리
 	var fnAppMkAgreeUpdate = function (mkAgreeYn) {
 		let params = {}
 		params.mkAgreeYn = mkAgreeYn;