MCPcopy Create free account
hub / github.com/diyhi/bbs / queryProvinceAddress

Method queryProvinceAddress

src/main/java/cms/utils/IpAddress.java:138–169  ·  view source on GitHub ↗

查询省份IP归属地 @param ip ip地址 @return

(String ip)

Source from the content-addressed store, hash-verified

136 * @return
137 */
138 public static String queryProvinceAddress(String ip){
139 if(searcher != null){
140 try {
141 String region = searcher.search(ip);
142 if(region != null && !region.trim().isEmpty()){
143 String [] regionGroup = region.split("\\|");
144 if(regionGroup.length >=5){
145
146 if(regionGroup[2] != null && !regionGroup[2].equals("0")){
147 return regionGroup[2];
148 }
149
150 if(regionGroup[0] != null && !regionGroup[0].equals("0")){
151 return regionGroup[0];
152 }
153 if(regionGroup[4] != null && !regionGroup[4].equals("0")){
154 return regionGroup[4];
155 }
156 }
157
158 }
159
160 } catch (Exception e) {
161 // TODO Auto-generated catch block
162 // e.printStackTrace();
163 if (logger.isErrorEnabled()) {
164 logger.error("IP地址查询错误",e);
165 }
166 }
167 }
168 return "";
169 }
170
171
172

Callers 5

getQuestionDetailMethod · 0.95
getTopicDetailMethod · 0.95
getAnswerPageMethod · 0.95
getUserInfoMethod · 0.95
getCommentPageMethod · 0.95

Calls 3

searchMethod · 0.45
isEmptyMethod · 0.45
equalsMethod · 0.45

Tested by

no test coverage detected