<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %> <%@ page trimDirectiveWhitespaces="true" %> <%@ page import="net.sf.json.*" %> <%@ page import="java.util.HashMap" %> <%@ page import="java.util.Calendar" %> <%@ page import="java.util.ArrayList" %> <%@ page import="java.util.LinkedList" %> <%@ page import="java.util.Enumeration"%> <%@ page import="java.util.regex.Matcher"%> <%@ page import="java.util.regex.Pattern"%> <%@ page import="java.text.SimpleDateFormat" %> <%@ page import="java.net.URLEncoder" %> <%@ page import="java.net.URLDecoder" %> <%@ page import="java.security.MessageDigest" %> <%@ page import="javax.crypto.Cipher" %> <%@ page import="org.apache.commons.codec.binary.Base64" %> <%@ page import="com.j_roi.fancrew.cooperation.SCodeEncoder" %> <%@ page import="org.apache.commons.codec.binary.Hex" %> <%@ page import="com.nifty.cms.log.CMSLog" %> <%@ include file="openid/OpenIdUserData.jsp" %> <%@ include file="openid/OpenIdParamsBuilder.jsp" %> <%@ include file="model/OpenIdModel.jsp" %> <%@ include file="model/FcUserIdModel.jsp"%> <%@ include file="model/MailModel.jsp"%> <%@ include file="common/mBaaSProvider.jsp" %> <%@ include file="common/sessionCheck.jsp" %> <%@ include file="common/constants.jsp"%> <%@ include file="common/treasuredata.jsp"%> <%@ include file="/nifmo/_htdocs/vp/api/roi/roiXMLProvider.jsp" %> <%@ include file="/nifmo/_htdocs/vp/api/roi/roiSAXHandler.jsp" %> <%@ include file="product/frontale/common/mBaaSProviderHome.jsp" %> <%@ include file="research/common/researchProvider.jsp" %> <% // リクエストパラメータ格納用 String state =""; String code = ""; String scope = ""; // OpenIDデータ格納用 String resData = ""; String refreshToken = ""; String resultParam = ""; String userData = ""; // 当月確定取得パラメータ HashMap detailMonthParams = new HashMap(); Calendar cal = Calendar.getInstance(); String now_date = String.valueOf(cal.get(Calendar.YEAR)) + String.format("%1$02d", cal.get(Calendar.MONTH)+1); detailMonthParams.put("date_from", now_date); detailMonthParams.put("date_to", now_date); detailMonthParams.put("extract_field", "fixed"); detailMonthParams.put("status", "fixed"); MixedParamsBuilder builder = new MixedParamsBuilder(); builder.putRequest("user") .putRequest("point") .putRequest("point_detail", detailMonthParams) .putRequest("fc_user") .putRequest("email") .putRequest("is_point_present"); try{ resultParam = URLEncoder.encode(builder.build(), "UTF-8"); } catch (Exception e) { // システムエラー doSystemError("", request, response); } // アクセストークン取得 boolean existToken = false; boolean prefFlg = false; String sessionState = ""; Enumeration ename = session.getAttributeNames(); while(ename.hasMoreElements()) { String element = (String)ename.nextElement(); // refresh_token存在チェック if(element.equals("ut")){ existToken = true; } // state存在チェック if(element.equals("st")){ sessionState = (String)session.getAttribute("st"); } // 都道府県リスト存在チェック if(element.equals("pref_list")){ prefFlg = true; } } if(existToken){ // リフレッシュトークンがあれば使用 resData = refreshAccessToken((String)session.getAttribute("ut")); }else if(request.getParameter("state") == null){ //doSessionError("refresh_tokenがありません", request, response); String url = getFcCommonUrl() + "welcome.jsp"; response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY); response.setHeader("Location", url); }else{ state = request.getParameter("state"); if(!state.equals(sessionState)){ // セッション切れエラーに遷移 //doSessionError("stateの不一致", request, response); String url = getFcCommonUrl() + "welcome.jsp"; response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY); response.setHeader("Location", url); } code = request.getParameter("code"); scope = request.getParameter("scope"); // アクセストークン取得 resData = getAccessToken(code, scope); } // セッションチェック checkSession(resData, request, response); JSONObject jsonData = JSONObject.fromObject(resData); // リフレッシュトークンを更新 if(jsonData.has("refresh_token")){ refreshToken = jsonData.getString("refresh_token"); // sessionにrefresh_tokenを保存 session.setAttribute("ut", refreshToken); } // ただ成情報取得 JSONArray results = new JSONArray(); String name = ""; String contentsId = ""; String niftyId = ""; String gender = ""; String birth = ""; String total = ""; String carryover = "-"; PointSummaryModel mPoint = null; String fc_user_id = ""; String userAttr = ""; String email = ""; try{ // ユーザ情報取得 userData = getUserData(jsonData, resultParam); // ユーザ情報チェック try{ boolean arrayFlg = true; checkUserInfo(userData, request, response, arrayFlg); }catch(Exception e){ checkUserInfo(userData, request, response); } JSONObject datas = JSONObject.fromObject(userData); results = datas.getJSONArray("result"); } catch (Exception e) { } try{ // 顧客情報 JSONObject user = results.getJSONObject(0); JSONObject userResult = user.getJSONObject("result"); UserInformationModel mUser = UserInformationModel.createInstance(userResult); name = mUser.getUserName(); contentsId = mUser.getContentsId(); gender = mUser.getGender(); birth = mUser.getBirthday(); niftyId = mUser.getNiftyId(); } catch (Exception e) { } try{ // ポイント JSONObject point = results.getJSONObject(1); JSONObject pointResult = point.getJSONObject("result"); mPoint = PointSummaryModel.createInstance(pointResult); } catch (Exception e) { String cid = request.getParameter("cid"); if(cid != null && !"".equals(cid)) { CMSLog logger = new CMSLog(cid); logger.error("ポイント情報が不正です"); } // システムエラー doSystemError("", request, response); } // 割引額情報更新 if( mPoint != null ) { total = String.format("%,d", mPoint.getTotalPoint()); }else{ total = "----"; } try{ // 当月確定 JSONObject pointMonth = results.getJSONObject(2); JSONArray detailMonthResult = pointMonth.getJSONArray("result"); ArrayList mPointMonth = (ArrayList)PointDetailModel.createPointDetailList(detailMonthResult); // 繰り越し割引額情報更新 if(mPoint != null && mPointMonth != null){ // 月の取得合計 long monthTotal = 0; for(PointDetailModel model : mPointMonth ){ if(!model.getDisplayServiceName().equals("ポイント利用")){ monthTotal += model.getPoint(); } } // 繰り越し割引額 long totalaCarryOver = mPoint.getTotalPoint() - monthTotal; carryover = String.format("%,d", totalaCarryOver); }else{ carryover = "----"; } } catch (Exception e) { } try{ //ファンくるユーザーID JSONObject fcUserId = results.getJSONObject(3); String fcUserIdStatus = (String)fcUserId.get("status"); JSONObject fcUserIdResult = fcUserId.getJSONObject("result"); FcUserIdModel mFcUserId = FcUserIdModel.createInstance(fcUserIdResult); fc_user_id = mFcUserId.getFcUserId(); // 取得できればセッションに保持 if(!"".equals(fc_user_id)){ session.setAttribute("fc_user_id", fc_user_id); } String errorCode = ""; if("NG".equals(fcUserIdStatus)){ if(INVALID_PARAMETER.equals(errorCode)){ doServerError("", request, response); } } } catch (Exception e) { } try{ //メールアドレス取得 JSONObject emailData = results.getJSONObject(4); JSONObject emailDataResult = emailData.getJSONObject("result"); MailGetterModel mEmail = MailGetterModel.createInstance(emailDataResult); email = mEmail.getEmail(); } catch (Exception e) { } try{ //ポイントレコード存在確認 JSONObject pointExistData = results.getJSONObject(5); JSONObject pointExistDatResult = pointExistData.getJSONObject("result"); boolean isPresent = pointExistDatResult.getBoolean("present"); if(isPresent){ // CookieにTDのユーザー属性を保存 String strAttr = URLEncoder.encode("repeater-pointsprovided", "UTF-8"); Cookie cookieUserAttr = new Cookie("user_attr", strAttr); cookieUserAttr.setMaxAge(365 * 24 * 60 * 60); cookieUserAttr.setPath("/"); cookieUserAttr.setSecure(true); response.addCookie(cookieUserAttr); userAttr = "repeater-pointsprovided"; }else{ Cookie cookies[] = request.getCookies(); Cookie userAttrCookie = null; if(cookies != null) { for(int i = 0; i < cookies.length; i++) { if(cookies[i].getName().equals("user_attr")) { // 該当するクッキーを取得 userAttrCookie = cookies[i]; } } } String strUserAttr = ""; if(userAttrCookie != null) { strUserAttr = URLDecoder.decode(userAttrCookie.getValue()); } // ユーザ属性を保存 if(strUserAttr.equals("")){ String strAttr = URLEncoder.encode("newuser-firstboot", "UTF-8"); Cookie cookieUserAttr = new Cookie("user_attr", strAttr); cookieUserAttr.setMaxAge(365 * 24 * 60 * 60); cookieUserAttr.setPath("/"); cookieUserAttr.setSecure(true); response.addCookie(cookieUserAttr); userAttr = "newuser-firstboot"; }else{ String strAttr = URLEncoder.encode("newuser-repeat", "UTF-8"); Cookie cookieUserAttr = new Cookie("user_attr", strAttr); cookieUserAttr.setMaxAge(365 * 24 * 60 * 60); cookieUserAttr.setPath("/"); cookieUserAttr.setSecure(true); response.addCookie(cookieUserAttr); userAttr = "newuser-repeat"; } } } catch (Exception e) { } // --------------mBaaS情報取得--------------------- // ショッピング(Affiliate) Cookie cookies[] = request.getCookies(); Cookie shopdataCookie = null; if(cookies != null) { for(int i = 0; i < cookies.length; i++) { if(cookies[i].getName().equals("shopdata")) { // 該当するクッキーを取得 shopdataCookie = cookies[i]; } } } String cookieShopdata = ""; if(shopdataCookie != null) { cookieShopdata = URLDecoder.decode(shopdataCookie.getValue()); } ArrayList vcName = new ArrayList(); ArrayList vcLogo = new ArrayList(); ArrayList vcRate = new ArrayList(); ArrayList vcId = new ArrayList(); ArrayList vcCateId = new ArrayList(); if(cookieShopdata.equals("")){ // shopdataがなければ優先6件取得 ArrayList mVC = getVC("?limit=12" + "&contents_id=" + contentsId + "&type_id=normal&dispFlag=true"); if(mVC.size() > 0){ for(ValueCommerceModel data: mVC){ vcName.add(data.getName()); vcLogo.add(data.getLogoUrl()); vcRate.add(data.getRateNifty()); vcId.add(data.getObjectId()); vcCateId.add(data.getCategoryId()); } } }else{ // shopdataを優先的に取得し、残りを優先順で取得 LinkedList list = new LinkedList(); if(cookieShopdata != null && cookieShopdata.length() != 0){ for(String item : cookieShopdata.split(",")){ list.add(item); } } ArrayList mVChistory = getVC("?contents_id=" + contentsId + "&object_id=" + cookieShopdata + "&type_id=normal&dispFlag=true"); if(mVChistory.size() > 0){ for(String history : list){ for(ValueCommerceModel data: mVChistory){ if(history.equals(data.getObjectId())){ vcName.add(data.getName()); vcLogo.add(data.getLogoUrl()); vcRate.add(data.getRateNifty()); vcId.add(data.getObjectId()); vcCateId.add(data.getCategoryId()); } } } } ArrayList mVC = getVC("?limit=12" + "&contents_id=" + contentsId + "&type_id=normal&dispFlag=true"); if(mVC.size() > 0){ for(ValueCommerceModel data: mVC){ if(vcId.indexOf(data.getObjectId()) == -1){ vcName.add(data.getName()); vcLogo.add(data.getLogoUrl()); vcRate.add(data.getRateNifty()); vcId.add(data.getObjectId()); vcCateId.add(data.getCategoryId()); } } } } // お気に入り用商材(Affiliate) Cookie favoriteCookies[] = request.getCookies(); Cookie favoriteCookie = null; if(favoriteCookies != null) { for(int j = 0; j < favoriteCookies.length; j++) { if(favoriteCookies[j].getName().equals("favorite_shops")) { // 該当するクッキーを取得 favoriteCookie = favoriteCookies[j]; } } } String favoriteShops = ""; if(favoriteCookie != null) { favoriteShops = URLDecoder.decode(favoriteCookie.getValue()); } LinkedList favoriteList = new LinkedList(); if(favoriteShops != null && favoriteShops.length() != 0){ for(String item : favoriteShops.split(",")){ favoriteList.add(item); } } ArrayList vcFavoriteName = new ArrayList(); ArrayList vcFavoriteLogo = new ArrayList(); ArrayList vcFavoriteRate = new ArrayList(); ArrayList vcFavoriteId = new ArrayList(); ArrayList vcFavoriteCateId = new ArrayList(); if(favoriteList.size() > 0){ ArrayList mFavoriteVC = getVC("?contents_id=" + contentsId + "&object_id=" + favoriteShops + "&type_id=normal&dispFlag=true"); if(mFavoriteVC.size() > 0){ for(String favorite : favoriteList){ for(ValueCommerceModel data: mFavoriteVC){ if(favorite.equals(data.getObjectId())){ vcFavoriteName.add(data.getName()); vcFavoriteLogo.add(data.getLogoUrl()); vcFavoriteRate.add(data.getRateNifty()); vcFavoriteId.add(data.getObjectId()); vcFavoriteCateId.add(data.getCategoryId()); } } } } } // お知らせ(Information) ArrayList mInformation = getInformation(""); ArrayList info = new ArrayList(); ArrayList infoDate = new ArrayList(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日"); ArrayList detailURL = new ArrayList(); if(mInformation.size() > 0){ for(InformationModel data: mInformation){ info.add(data.getDescription()); String date = sdf.format(data.getReportDate().getTime()); infoDate.add(date); detailURL.add(data.getDetailURL()); } } // カテゴリー(Category) ArrayList mCategory = getCategory(""); ArrayList categoryNames = new ArrayList(); ArrayList categoryIds = new ArrayList(); if(mCategory.size() > 0){ for(CategoryModel data: mCategory){ categoryNames.add(data.getCategoryName()); categoryIds.add(data.getCategoryId()); } } // タイアップ(Fancrew) ArrayList mFancrew = getFancrew(""); String fancrewImageUrl = ""; String fancrewShopId = ""; String fancrewMonitorId = ""; if(mFancrew.size() > 0){ fancrewImageUrl = mFancrew.get(0).getImageUrl(); fancrewShopId = mFancrew.get(0).getShopIds(); fancrewMonitorId = mFancrew.get(0).getMonitorIds(); } // ブランド(FancrewBrand) ArrayList mFancrewBrand = getFancrewBrand(""); ArrayList brandImageUrl = new ArrayList(); ArrayList brandId = new ArrayList(); ArrayList brandPrefecture = new ArrayList(); ArrayList brandArea = new ArrayList(); ArrayList brandName = new ArrayList(); if(mFancrewBrand.size() > 0){ for(FancrewBrandModel data: mFancrewBrand){ brandImageUrl.add(data.getImageURL()); brandId.add(data.getBrandId()); brandPrefecture.add(data.getPrefectureId()); brandArea.add(data.getAreaId()); brandName.add(data.getTitle()); } } // サービスコラボ(ServiceCollaboration) ArrayList mServiceCollabo = getServiceCooperation(""); ArrayList collaboPartsUrl = new ArrayList(); ArrayList collaboServiceId = new ArrayList(); if(mServiceCollabo.size() > 0){ for(ServiceCooperationModel data: mServiceCollabo){ collaboPartsUrl.add(data.getPartsUrl()); collaboServiceId.add(data.getServiceId()); } } // SuperAdScript String ageStr = ""; int age = 0; if(!birth.equals("")){ Calendar target = Calendar.getInstance(); Calendar birthday = Calendar.getInstance(); // DateFormat作成 SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); Date dt = new Date(); // 日付文字列をDate型に変換 try { dt = df.parse(birth); } catch (ParseException e) { e.printStackTrace(); } birthday.setTime(dt); //誕生日の年月日をセット // 計算日の年と誕生日の年の差を算出 age = target.get(Calendar.YEAR) - birthday.get(Calendar.YEAR); // ただし誕生月・日より年齢計算月日が前であれば年齢は1歳少ない if (target.get(Calendar.MONTH) < birthday.get(Calendar.MONTH)) { age--; } else if (target.get(Calendar.MONTH) == birthday.get(Calendar.MONTH) && target.get(Calendar.DAY_OF_MONTH) < birthday.get(Calendar.DAY_OF_MONTH)) { age--; } ageStr = String.valueOf(age); } String adIds = ""; if(!gender.equals("") && !ageStr.equals("") && (gender.equals("0") || gender.equals("1"))){ ArrayList mCARAd = getCARAd( "?limit=2&ua=iOS" + "&gender=" + gender + "&age=" + ageStr); if(mCARAd.size() > 0){ for(CARAdModel data: mCARAd){ adIds += data.getAdId() + ":"; } } } // データがあれば末尾コロン削除 if(!adIds.equals("")){ adIds = adIds.substring(0,adIds.length()-1); } // セッションIDクッキーが存在しなければ作成 Cookie sessionIdCookie = null; String sessionId = ""; if(cookies != null) { for(int i = 0; i < cookies.length; i++) { if(cookies[i].getName().equals("session_id")) { // 該当するクッキーを取得 sessionIdCookie = cookies[i]; } } } if(sessionIdCookie == null) { // 現在時刻 Calendar sesCal = Calendar.getInstance(); SimpleDateFormat sesFormat = new SimpleDateFormat("yyMMddHHmmss"); String strTime = sesFormat.format(sesCal.getTime()); // CookieにセッションIDを保存 String strSessionId = URLEncoder.encode(contentsId + "X" + strTime, "UTF-8"); Cookie cookieSessionId = new Cookie("session_id", strSessionId); cookieSessionId.setMaxAge(365 * 24 * 60 * 60); cookieSessionId.setPath("/"); cookieSessionId.setSecure(true); response.addCookie(cookieSessionId); }else{ sessionId = URLDecoder.decode(sessionIdCookie.getValue()); } String sessionTime = sessionId.equals("") ? "" : sessionId.substring(sessionId.length()-12); // ========== UA判別 ========== // boolean isAndroid = false; boolean isIPhone = false; boolean isIPad = false; boolean isPhone = false; String userAgent = request.getHeader("User-Agent"); Pattern pAndroid = Pattern.compile("Android"); Matcher mAndroid = pAndroid.matcher(userAgent); if(mAndroid.find()) { isAndroid = true; } Pattern pIPhone = Pattern.compile("iPhone"); Matcher mIPhone = pIPhone.matcher(userAgent); if(mIPhone.find()) { isIPhone = true; } Pattern pIPad = Pattern.compile("ipad|iPad"); Matcher mIPad = pIPad.matcher(userAgent); if(mIPad.find()) { isIPad = true; } Pattern patternPhone = Pattern.compile("iPhone|iPad|iPod|Android|BlackBerry|windows Phone|NOKIA"); Matcher matcherPhone = patternPhone.matcher(userAgent); if(matcherPhone.find()) { isPhone = true; } // 「もっと見る」のURL生成 String superwall_apikey = ""; String moreLinkURL = ""; if(isAndroid){ superwall_apikey = "68253d61335cc3dd"; moreLinkURL = "http://car.mobadme.jp/spg/spnew/311/3574/index.php?user_id=" + contentsId + "&media_data=" + sessionTime; }else{ superwall_apikey = "91354e17765cb4d3"; moreLinkURL = "http://car.mobadme.jp/spg/spnew/311/5503/index.php?user_id=" + contentsId + "&media_data=" + sessionTime; } // cryptパラメータ生成 String crypt_base = contentsId+superwall_apikey; MessageDigest md = MessageDigest.getInstance("SHA-1"); byte[] digest = md.digest(crypt_base.getBytes()); String crypt = new String(Hex.encodeHex(digest)); moreLinkURL += "&crypt="+crypt; //CA_SuperAdScriptの設定 String superadscript_apikey = ""; String mID = ""; if(isAndroid){ superadscript_apikey = "909550bed7db8744"; mID = "5731"; }else{ superadscript_apikey = "97854e17e4222de3"; mID = "5504"; } String hexKey = superadscript_apikey+":"+contentsId+":"+mID; MessageDigest md_512 = MessageDigest.getInstance("SHA-512"); byte[] digest_512 = md_512.digest(hexKey.getBytes()); String caKey = new String(Hex.encodeHex(digest_512)); //ショップデータNG時 String shopErr = getMessage("shopErr"); //ショップカテゴリーNG時 String categoryErr = getMessage("categoryErr"); //ホームポップアップ確認 Cookie popupCookie = null; if(cookies != null) { for(int i = 0; i < cookies.length; i++) { if(cookies[i].getName().equals("popup")) { // 該当するクッキーを取得 popupCookie = cookies[i]; } } } String cookiePopup = ""; if(popupCookie != null) { cookiePopup = URLDecoder.decode(popupCookie.getValue()); } // マイページリンク生成 String MYPAGE_URL = ""; String createdScode = ""; if(!"".equals(fc_user_id)){ SCodeEncoder sce = new SCodeEncoder(SEACRET_KEY, FC_API_ID, FC_API_KEY); Long fcUserIdLong = Long.valueOf(fc_user_id); createdScode = sce.createSCode(fcUserIdLong); MYPAGE_URL = "/vp/api/fc_forward.jsp?cate=nifmo&_pf=my&_p=myTop&sCode=" + createdScode; }else{ MYPAGE_URL = ""; } // メールチェックフラグ Cookie mailCheckCookie = null; String mailCheck = ""; Cookie mailTokenCookie = null; String mailToken = ""; Cookie mailCallbackCookie = null; String mailCallback = ""; if(cookies != null) { for(int i = 0; i < cookies.length; i++) { if(cookies[i].getName().equals("mail_status")) { // 該当するクッキーを取得 mailCheckCookie = cookies[i]; } if(cookies[i].getName().equals("mail_token")) { // 該当するクッキーを取得 mailTokenCookie = cookies[i]; } if(cookies[i].getName().equals("mail_callback")) { // 該当するクッキーを取得 mailCallbackCookie = cookies[i]; } } } if(mailCheckCookie != null) { mailCheck = URLDecoder.decode(mailCheckCookie.getValue()); } if(!"".equals(mailCheck)){ if(mailTokenCookie != null) { mailToken = URLDecoder.decode(mailTokenCookie.getValue()); } if(mailCallbackCookie != null) { mailCallback = URLDecoder.decode(mailCallbackCookie.getValue()); } String MAIL_COMPLETE_URL = "/vp/mail_complete.jsp?token=" + mailToken + "&callback=" + mailCallback; response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY); response.setHeader("Location", MAIL_COMPLETE_URL); } // FC 前回の検索履歴取得 boolean lastSearchFlg = true; String cookieLastSearch = ""; String prevPref = ""; String prevPrefTop = "0"; // 現在地検索時の表示データ用 String prevArea = ""; String prevGenre = ""; String category_id ="1"; String freeword = ""; String sort = "1"; String offset = ""; String res = ""; String strADResult = ""; // 取得データ String params = ""; Cookie lastSearchCookie = null; if(cookies != null) { for(int i = 0; i < cookies.length; i++) { if(cookies[i].getName().equals("last_search_condition")) { // 該当するクッキーを取得 lastSearchCookie = cookies[i]; } } } if(lastSearchCookie != null) { cookieLastSearch = URLDecoder.decode(lastSearchCookie.getValue()); lastSearchFlg = true; prevPref = cookieLastSearch.replaceAll("pref:([0-9]+),.+", "$1"); prevArea = cookieLastSearch.replaceAll(".+area:([0-9]+),.+", "$1"); prevGenre = cookieLastSearch.replaceAll(".+genre:([0-9]+)(,.+|.?)", "$1"); if(cookieLastSearch.indexOf("freeword") != -1){ freeword = cookieLastSearch.replaceAll(".+freeword:(.+)?$", "$1"); }else{ freeword = ""; } } // 現在地の時は全国データ取得 if(!"999".equals(prevPref)){ prevPrefTop = prevPref; } if("0".equals(prevGenre)){ prevGenre = ""; } // 最終閲覧店舗詳細クッキーを取得 Cookie lastShopDetailCookie = null; String cookieLastShopDetail = ""; String prevId = ""; String prevTopImageUrl = ""; String prevGenreName = ""; String prevShopName = ""; String prevRateLimit = ""; String prevRateValue = ""; String prevRateType = ""; if(cookies != null) { for(int i = 0; i < cookies.length; i++) { if(cookies[i].getName().equals("last_shop_detail")) { // 該当するクッキーを取得 lastShopDetailCookie = cookies[i]; } } } if(lastShopDetailCookie != null) { cookieLastShopDetail = URLDecoder.decode(lastShopDetailCookie.getValue()); if(!cookieLastShopDetail.equals("")){ String[] parts = cookieLastShopDetail.split(",", -1); prevId = parts[0]; prevTopImageUrl = parts[1]; prevGenreName = parts[2]; prevShopName = parts[3]; prevRateLimit = parts[4]; prevRateValue = parts[5]; prevRateType = parts[6]; } strADResult = ""; }else{ params = getParams(prevPrefTop,prevArea,prevGenre,freeword,sort,offset); // カテゴリ「グルメ」固定 if("".equals(params)){ params = "?category_id=1"; }else{ params = params + "&category_id=1"; } // パラメータにファンくるユーザIDを付与 if(!"".equals(fc_user_id)){ if("".equals(params)){ params = "?user_id=" + fc_user_id; }else{ params = params + "&user_id=" + fc_user_id; } } strADResult = getSearch(params); } //strADResult = getSearch(prevPref,prevArea,category_id,prevGenre,freeword,sort,offset); res = strADResult; InputStream bais = new ByteArrayInputStream(res.getBytes("utf-8")); SearchHandler my = new SearchHandler(); //パースして検索一覧取得 ShopsModel shops = getShopsModel(bais,my); ArrayList mShop = shops.getShop(); ArrayList shopIds = new ArrayList(); ArrayList shopViewModes = new ArrayList(); ArrayList shopCategoryTypeIds = new ArrayList(); ArrayList shopNames = new ArrayList(); ArrayList shopNameKanas = new ArrayList(); ArrayList shopCatchPhrases = new ArrayList(); ArrayList shopDescriptions = new ArrayList(); ArrayList shopAverageBudgets = new ArrayList(); ArrayList shopReleaseTimestamps = new ArrayList(); ArrayList shopPcUrls = new ArrayList(); ArrayList shopMobileUrls = new ArrayList(); ArrayList shopSmartphoneUrls = new ArrayList(); ArrayList shopLogoImageUrls = new ArrayList(); ArrayList shopTopImageUrls = new ArrayList(); ArrayList shopTopImageUrlGrays = new ArrayList(); ArrayList shopNumOfReviewss = new ArrayList(); ArrayList shopBrandIds = new ArrayList(); ArrayList shopPostalCodes = new ArrayList(); ArrayList shopAddresss = new ArrayList(); ArrayList shopPhoneNumbers = new ArrayList(); ArrayList shopAccesss = new ArrayList(); ArrayList shopBusinessHourss = new ArrayList(); ArrayList shopFixedHolidays = new ArrayList(); ArrayList shopHasPrefecturess = new ArrayList(); ArrayList shopLatitudes = new ArrayList(); ArrayList shopLongitudes = new ArrayList(); ArrayList shopCategorys = new ArrayList(); ArrayList shopGenres = new ArrayList(); ArrayList shopPrefectures = new ArrayList(); ArrayList shopAreas = new ArrayList(); ArrayList shopMonitors = new ArrayList(); String shopNameFirst = ""; if(mShop.size() > 0){ for(ShopModel shop: mShop){ shopIds.add(shop.getId()); shopViewModes.add(shop.getViewMode()); shopCategoryTypeIds.add(shop.getCategoryTypeId()); shopNames.add(shop.getName()); shopNameKanas.add(shop.getNameKana()); shopCatchPhrases.add(shop.getCatchPhrase()); shopDescriptions.add(shop.getDescription()); shopAverageBudgets.add(shop.getAverageBudget()); shopReleaseTimestamps.add(shop.getReleaseTimestamp()); shopPcUrls.add(shop.getPcUrl()); shopMobileUrls.add(shop.getMobileUrl()); shopSmartphoneUrls.add(shop.getSmartphoneUrl()); shopLogoImageUrls.add(shop.getLogoImageUrl()); shopTopImageUrls.add(shop.getTopImageUrl()); shopTopImageUrlGrays.add(shop.getTopImageUrlGray()); shopNumOfReviewss.add(shop.getNumOfReviews()); shopBrandIds.add(shop.getBrandId()); shopPostalCodes.add(shop.getPostalCode()); shopAddresss.add(shop.getAddress()); shopPhoneNumbers.add(shop.getPhoneNumber()); shopAccesss.add(shop.getAccess()); shopBusinessHourss.add(shop.getBusinessHours()); shopFixedHolidays.add(shop.getFixedHoliday()); shopHasPrefecturess.add(shop.getHasPrefectures()); shopLatitudes.add(shop.getLatitude()); shopLongitudes.add(shop.getLongitude()); shopCategorys.add(shop.getCategory()); shopGenres.add(shop.getGenre()); shopPrefectures.add(shop.getPrefecture()); shopAreas.add(shop.getArea()); shopMonitors.add(shop.getMonitor()); } shopNameFirst = shopNames.get(0); } //都道府県一覧取得 String prexml = getPrefectures(params); InputStream preBais = new ByteArrayInputStream(prexml.getBytes("utf-8")); PrefecturesHandler ph = new PrefecturesHandler(); //パースしてリスト取得 ArrayList preList = getPrefectureList(preBais,ph); int prefSize = preList.size(); // 都道府県が取得できなかった場合 if(prefSize <= 0){ lastSearchFlg = false; } //カテゴリ一覧取得 String catexml = getGenresReal(params); InputStream catebais = new ByteArrayInputStream(catexml.getBytes("utf-8")); GenresRealHandler catemy = new GenresRealHandler(); //パースしてリスト取得 ArrayList list = getCategoryList(catebais,catemy); ArrayList fcCategoryIds = new ArrayList(); int cateSize = list.size(); // カテゴリが取得できなかった場合 if(cateSize <= 0){ lastSearchFlg = false; } //応募件数取得 String monixml = getMonitors("?user_id=" + fc_user_id); InputStream moniBais = new ByteArrayInputStream(monixml.getBytes("utf-8")); MonitorsHandler mh = new MonitorsHandler(); //パースしてリスト取得 int monitorsCount = getMonitorsNum(moniBais,mh); // 検索結果0件の場合は検索履歴なし扱い if(mShop.size() <= 0 && lastShopDetailCookie == null){ lastSearchFlg = false; } // Get info banner frontale ArrayList infoBanner = getBanner(); // get info of season ArrayList seasonInfo = getSeason(); boolean season = false ; if (seasonInfo.size() > 0 ) { if (seasonInfo.get(0).getDispFlag() == "true") { season = true; } } // --------------リサーチ情報取得--------------------- Object status = getStatus("?contents_id=" + contentsId); String rs_status = ""; ResearchEnqueteListModel enqueteList = null; Boolean isUserResearch = false; ArrayList newAllEnqueteList = new ArrayList(); ArrayList newEnqueteList = new ArrayList(); String profileId = ""; if(status != null){ if(status instanceof ResearchStatusModel){ ResearchStatusModel status_model = null; status_model = (ResearchStatusModel)status; rs_status = status_model.getStatus(); }else if((status instanceof String) && ((String)status).equals("503")){ enqueteList = new ResearchEnqueteListModel(); } }else{ // リサーチシステムエラー doResearchSystemError("", request, response); } if(rs_status.equals("2")){ Object getEnqueteData = getEnqueteList("?contents_id=" + contentsId); if(getEnqueteData instanceof ResearchEnqueteListModel){ enqueteList = (ResearchEnqueteListModel)getEnqueteData; newAllEnqueteList = enqueteList.getEnquete().getNewEnquete(); profileId = enqueteList.getProfile().getProfileId(); for(ResearchEnqueteDetailModel checkModel : newAllEnqueteList){ // 対象端末区分(PC+スマホ:1;PCのみ:2;スマホのみ:3) if(isPhone){ // スマホはPCのみ以外を表示 if(!checkModel.getTerminalType().equals("2")) { newEnqueteList.add(checkModel); } }else{ // PCはスマホのみ以外を表示 if(!checkModel.getTerminalType().equals("3")) { newEnqueteList.add(checkModel); } } } if(enqueteList.getProfile().getAnswerFlg().equals("1") && !enqueteList.getProfile().getNewRegistFlg().equals("1")){ isUserResearch = true; } }else if((getEnqueteData instanceof String) && ((String)getEnqueteData).equals("503")){ enqueteList = new ResearchEnqueteListModel(); }else{ // リサーチシステムエラー doResearchSystemError("", request, response); } } %> <%! /** * apiに渡すwhereパラメータを作成 */ public String getParams(String prefecture_id, String area_id, String genre_id, String freeword, String sort, String offset){ System.out.println("prefecture_id="+prefecture_id+"area_id="+area_id+"genre_id="+genre_id+"freeword="+freeword); System.out.println("sort="+sort+"offset="+offset); String resultParam = ""; StringBuilder params = new StringBuilder(); // 都道府県ID params.append("?"); params.append("prefecture_id=" + prefecture_id); // エリアID params.append("&"); params.append("area_id=" + area_id); // ジャンルID if(!genre_id.equals("")){ params.append("&"); params.append("genre_id=" + genre_id); } // フリーワード if(!freeword.equals("")){ params.append("&"); params.append("freeword=" + freeword); } // ソート if(!sort.equals("")){ params.append("&"); params.append("sort=" + sort); } // オフセット if(!offset.equals("")){ params.append("&"); params.append("offset=" + offset); } return params.toString(); } %> ホーム <% if(lastSearchFlg){ %> <% } %> <% if(lastSearchFlg){ %> <% }else{ %> <% } %>
<% if(info.size() > 0){ %>
<% for(int i=0; i <% if(showDetailURL.equals("")){ %> <% }else{ %> <% } %>
<%= showInfoDate %>
<%= showInfo %>
<% } %>
<% } %>

次回の割引額

<%= total %>

先月からの繰り越し<%= carryover %>円

<%-- Banner redirect to frontale page --%> <% if (season) { if (infoBanner.size() > 0) { %> <% } } %>

いますぐ貯める

短時間で割引額をサクサク貯めたい方はこちら!

<% if(isAndroid || isIPhone || isIPad){ %>
<% for(int i=0; i <% String clickLink = collaboPartsUrl.get(i); int index = clickLink.indexOf("/vp/"); index += "/vp/".length(); String showPage = clickLink.substring(index); String paramServiceId = collaboServiceId.get(i); %>
<% } %>
<% }else{ %>
Android OSをご利用の方専用アプリをインストールの上、ご利用ください。
google playgoogle play QRコード
  • ※NifMoのスマホセットをご購入の方は、インストール済みのアプリを起動してすぐにご利用いただけます。
iOSをご利用の方ブラウザーを起動し、専用ページにてご利用ください。
google playニフモプログラム専用サイト QRコード
  • ※ご利用には@nifty IDが必要です。
  • ※動作対象OS:iOS7.0 以上
<% } %>

ショッピングで貯める

買い物金額に応じて割引額が貯まるショップをご紹介!

  • ショップ
  • 商品

※商品検索は一部店舗のみ対応しております。

<% if(vcFavoriteName.size() > 0){ %>
お気に入りショップ
    <% for(int i=0; i
  • <%= showVC %>

    <%= showVC %>

    <%= showVCRate %>%割引還元

  • <% } %>
<% } %>
閲覧履歴
<% if(vcName.size() > 0){ int count = 3; if(vcName.size()<3){ count = vcName.size(); }%>
    <% for(int i=0; i
  • <%= showVC %>

    <%= showVC %>

    <%= showVCRate %>%割引還元

  • <% } %>
<% } else { %>

<%= shopErr %>

<% } %>

アンケートで貯める

簡単なアンケートに答えるだけで割引額がどんどん貯まる!

<% if(rs_status.equals("1") || rs_status.equals("3")){ %> <% }else{ %> <% if(newEnqueteList != null && newEnqueteList.size() > 0){ %>
<% if(!isUserResearch){ int newNum = newEnqueteList.size(); %>
新着(<%= newNum %>件)
<% } %>

※アンケート回答後、「回答終了」への切り替えに時間がかかる場合がございます。

    <% for(int i=0; i= 3){ break; } String enqueteType = ""; String typeName = ""; if(newEnqueteList.get(i).getInvestKind().equals("0") || newEnqueteList.get(i).getInvestKind().equals("90")) { enqueteType = "user"; typeName = "ユーザー調査"; }else if(newEnqueteList.get(i).getInvestKind().equals("2")){ enqueteType = "research"; typeName = "実地調査"; }else if(newEnqueteList.get(i).getInvestKind().equals("3")){ enqueteType = "introduction"; typeName = "紹介"; }else if(newEnqueteList.get(i).getInvestKind().equals("5")){ enqueteType = "regular"; typeName = "定期"; }else if(newEnqueteList.get(i).getInvestKind().equals("6")){ enqueteType = "adWith"; typeName = "広告付き"; }else if(newEnqueteList.get(i).getInvestKind().equals("99")){ enqueteType = "ad"; typeName = "広告"; } String showAmount = ""; String showTime = ""; String showMainAmount = ""; String showMainTime = ""; if(newEnqueteList.get(i).getEnqueteCType().equals("1")) { showAmount = newEnqueteList.get(i).getScMonitorAmount(); showTime = newEnqueteList.get(i).getScTime(); }else if(newEnqueteList.get(i).getEnqueteCType().equals("2")){ showAmount = newEnqueteList.get(i).getScMonitorAmount(); showTime = newEnqueteList.get(i).getScTime(); showMainAmount = newEnqueteList.get(i).getMainMonitorAmount(); showMainTime = newEnqueteList.get(i).getMainTime(); }else if(newEnqueteList.get(i).getEnqueteCType().equals("3")){ showAmount = newEnqueteList.get(i).getMainMonitorAmount(); showTime = newEnqueteList.get(i).getMainTime(); }else if(newEnqueteList.get(i).getEnqueteCType().equals("4")){ showAmount = newEnqueteList.get(i).getEtcMonitorAmount(); showTime = newEnqueteList.get(i).getEtcTime(); } String showDate = "-"; SimpleDateFormat dataFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()); SimpleDateFormat showFormat = new SimpleDateFormat("yyyy/MM/dd", Locale.getDefault()); try { Date formatDate = dataFormat.parse(newEnqueteList.get(i).getOpenDate()); showDate = showFormat.format(formatDate); } catch (ParseException e) { showDate = "-"; } %>
  • <%= typeName %>

    <%= newEnqueteList.get(i).getEnqueteNm() %>

    <% if(showMainAmount.equals("")){ %>

    (所要時間・<%= showTime %>分程)

    <% }else{ %>

    (所要時間・<%= showTime %>分程)
    ⇒本調査:<%= showMainAmount %>
    (所要時間・<%= showMainTime %>分程)

    <% } %>

    <%= showDate %> (<%= newEnqueteList.get(i).getEnqueteId() %>)

    <%= showAmount %>
    還元
  • <% } %>
<% }else{ %>

食べて貯める

食事の後のアンケートで割引額が貯まっちゃう!

<% if(!fancrewImageUrl.equals("") && !fancrewShopId.equals("")){ %> <% } %> <% for(int i=0; i 0 && brandId.size() > 0){ %> <% String showImage = brandImageUrl.get(i); String paramId = brandId.get(i); String paramPrefecture = brandPrefecture.get(i); String paramArea = brandArea.get(i); String paramName = brandName.get(i); %> <% } } %> <% if(!lastSearchFlg){ %> <% }else{ %>
<% if(shopIds.size() > 0){ for (int i = 0; i < 1; i++) { String showId = shopIds.get(i); String showViewMode = shopViewModes.get(i); String showCategoryTypeId = shopCategoryTypeIds.get(i); String showName = shopNames.get(i); String showNameKana = shopNameKanas.get(i); String showCatchPhrase = shopCatchPhrases.get(i); String showDescriptionate = shopDescriptions.get(i); String showAverageBudget = shopAverageBudgets.get(i); String showReleaseTimestamp = shopReleaseTimestamps.get(i); String showPcUrl = shopPcUrls.get(i); String showMobileUrl = shopMobileUrls.get(i); String showSmartphoneUrl = shopSmartphoneUrls.get(i); String showLogoImageUrl = shopLogoImageUrls.get(i); String showTopImageUrl = shopTopImageUrls.get(i); String showTopImageUrlGray = shopTopImageUrlGrays.get(i); String showNumOfReviews = shopNumOfReviewss.get(i); String showBrandId = shopBrandIds.get(i); String showPostalCode = shopPostalCodes.get(i); String showAddress = shopAddresss.get(i); String showPhoneNumber = shopPhoneNumbers.get(i); String showAccess = shopAccesss.get(i); String showBusinessHours = shopBusinessHourss.get(i); String showFixedHoliday = shopFixedHolidays.get(i); String showHasPrefectures = shopHasPrefecturess.get(i); String showLatitude = shopLatitudes.get(i); String showLongitude = shopLongitudes.get(i); FcCategoryModel category = shopCategorys.get(i); GenreModel genre = shopGenres.get(i); PrefectureModel prefecture = shopPrefectures.get(i); AreaModel area = shopAreas.get(i); MonitorModel monitor = shopMonitors.get(i); RateModel rate = monitor.getRate(); RewardInfoModel rewardInfo = monitor.getRewardInfo(); OriginalFeeRateModel originalFeeRate = monitor.getOriginalFeeRate(); ArrayList noticeList = monitor.getNotice(); %> <% } } %> <% if(lastShopDetailCookie != null){ %> <% } %>

<% if(!"".equals(email)){ %> <% } %>
<% } %>