/** * 添加用户建议的信息 * * @param AccountLoginModel * @return */ public void insertAccountSuggest(AccountSuggestModel accountSuggestModel, String remoteAddr) { int accountId = 0; if (!ContextUtils.getCurrentUserEmail().isEmpty()) accountId = getAccountInfoByEmail(ContextUtils.getCurrentUserEmail()).getAccountId(); account.getAccountSuggestModel().fillAccountSuggest(accountSuggestModel, remoteAddr, accountId); account.getAccountSuggestModel().insert(); }
/** * 存储用户登录信息 * * @return */ @SuppressWarnings("rawtypes") public void insertLoginHistoryById(String explorer) { LoginHistoryModel loginHistoryModel = account.getLoginHistoryModel(); // 获取用户id AccountInfo accountInfo = getAccountInfoByEmail(ContextUtils.getCurrentUserEmail()); // 填充用户登录信息 loginHistoryModel.insertLoginHistory( accountInfo.getAccountId(), ContextUtils.getCurrentUserIp(), explorer); }
/** * 获取用户登录城市 * * @return */ public String getCurrentUserCity() { // 获取用户ip String ipAddress = ContextUtils.getCurrentUserIp(); // 获取淘宝IP API的JSON数据 return TaoBaoIPAPI.getCityByIP(ipAddress); }
/** * 获取用户信息 * * @return */ @SuppressWarnings("rawtypes") public AccountInfo getCurrentAccountInfo() { // 获取用户email String email = ContextUtils.getCurrentUserEmail(); AccountInfo a = getAccountInfoByEmail(email); return a; }