diff --git a/luoo_comment/pom.xml b/luoo_comment/pom.xml index d601e60..998f534 100644 --- a/luoo_comment/pom.xml +++ b/luoo_comment/pom.xml @@ -33,6 +33,13 @@ org.springframework.cloud spring-cloud-starter-config + + + net.renfei + ip2location + 1.2.1 + + org.springframework.cloud spring-cloud-bus diff --git a/luoo_comment/redeme.md b/luoo_comment/redeme.md new file mode 100644 index 0000000..105b980 --- /dev/null +++ b/luoo_comment/redeme.md @@ -0,0 +1,2 @@ +# 解析IP三方库 +https://github.com/jarod/qqwry-java \ No newline at end of file diff --git a/luoo_comment/src/main/java/com/luoo/comment/config/MyConfiguration.java b/luoo_comment/src/main/java/com/luoo/comment/config/MyConfiguration.java new file mode 100644 index 0000000..9eec7a0 --- /dev/null +++ b/luoo_comment/src/main/java/com/luoo/comment/config/MyConfiguration.java @@ -0,0 +1,15 @@ +package com.luoo.comment.config; + +import org.springframework.context.ResourceLoaderAware; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.io.ResourceLoader; + +@Configuration +public class MyConfiguration implements ResourceLoaderAware { + private ResourceLoader resourceLoader; + + @Override + public void setResourceLoader(ResourceLoader resourceLoader) { + this.resourceLoader = resourceLoader; + } +} diff --git a/luoo_comment/src/main/java/com/luoo/comment/enums/Province.java b/luoo_comment/src/main/java/com/luoo/comment/enums/Province.java new file mode 100644 index 0000000..8088cac --- /dev/null +++ b/luoo_comment/src/main/java/com/luoo/comment/enums/Province.java @@ -0,0 +1,59 @@ +package com.luoo.comment.enums; + +public enum Province { + BEIJING("Beijing", "北京"), + TIANJIN("Tianjin", "天津"), + SHANGHAI("Shanghai", "上海"), + CHONGQING("Chongqing", "重庆"), + HEBEI("Hebei", "河北"), + SHANXI("Shanxi", "山西"), + LIAONING("Liaoning", "辽宁"), + JILIN("Jilin", "吉林"), + HEILONGJIANG("Heilongjiang", "黑龙江"), + JIANGSU("Jiangsu", "江苏"), + ZHEJIANG("Zhejiang", "浙江"), + ANHUI("Anhui", "安徽"), + FUJIAN("Fujian", "福建"), + JIANGXI("Jiangxi", "江西"), + SHANDONG("Shandong", "山东"), + HENAN("Henan", "河南"), + HUBEI("Hubei", "湖北"), + HUNAN("Hunan", "湖南"), + GUANGDONG("Guangdong", "广东"), + GUANGXI("Guangxi", "广西"), + HAINAN("Hainan", "海南"), + SICHUAN("Sichuan", "四川"), + GUIZHOU("Guizhou", "贵州"), + YUNNAN("Yunnan", "云南"), + TIBET("Tibet", "西藏"), + SHAANXI("Shaanxi", "陕西"), + GANSU("Gansu", "甘肃"), + QINGHAI("Qinghai", "青海"), + NINGXIA("Ningxia", "宁夏"), + XINJIANG("Xinjiang", "新疆"); + + private final String englishName; + private final String chineseName; + + Province(String englishName, String chineseName) { + this.englishName = englishName; + this.chineseName = chineseName; + } + + public String getEnglishName() { + return englishName; + } + + public String getChineseName() { + return chineseName; + } + + public static String getCityName(String englishName) { + for (Province province : Province.values()) { + if (englishName.equalsIgnoreCase(province.englishName)) { + return province.chineseName; + } + } + return "未知IP"; + } +} \ No newline at end of file diff --git a/luoo_comment/src/main/java/com/luoo/comment/pojo/Comment.java b/luoo_comment/src/main/java/com/luoo/comment/pojo/Comment.java index 29f04ea..4c3b7b4 100644 --- a/luoo_comment/src/main/java/com/luoo/comment/pojo/Comment.java +++ b/luoo_comment/src/main/java/com/luoo/comment/pojo/Comment.java @@ -9,15 +9,26 @@ public class Comment implements Serializable { @Id private String _id; + // 评论内容 private String content; + // 发布时间 private Date publishtime; private String userid; + // 昵称 private String nickname; + // 访问数 private Integer visits; + // 点赞数 private Integer thumbup; + // 转发数 private Integer share; + // 评论数量 private Integer comment; + + // 状态 private String state; + + private String parentid; private String articleid; diff --git a/luoo_comment/src/main/resources/iplocal/IP2LOCATION-LITE-DB11.BIN b/luoo_comment/src/main/resources/iplocal/IP2LOCATION-LITE-DB11.BIN new file mode 100644 index 0000000..ef74243 Binary files /dev/null and b/luoo_comment/src/main/resources/iplocal/IP2LOCATION-LITE-DB11.BIN differ diff --git a/luoo_comment/src/main/resources/iplocal/qqwry.dat b/luoo_comment/src/main/resources/iplocal/qqwry.dat new file mode 100644 index 0000000..0c2c201 Binary files /dev/null and b/luoo_comment/src/main/resources/iplocal/qqwry.dat differ diff --git a/luoo_comment/target/classes/iplocal/IP2LOCATION-LITE-DB11.BIN b/luoo_comment/target/classes/iplocal/IP2LOCATION-LITE-DB11.BIN new file mode 100644 index 0000000..ef74243 Binary files /dev/null and b/luoo_comment/target/classes/iplocal/IP2LOCATION-LITE-DB11.BIN differ