类 GetIpRegionMethod

java.lang.Object
com.publiccms.common.base.BaseMethod
com.publiccms.views.method.tools.GetIpRegionMethod
所有已实现的接口:
freemarker.template.TemplateMethodModel, freemarker.template.TemplateMethodModelEx, freemarker.template.TemplateModel

@Component public class GetIpRegionMethod extends BaseMethod
getIpRegion 获取IP区域信息

返回结果

  • string ip
使用示例

${getIpRegion('127.0.0.1')}

<script>
fetch('${site.dynamicPath}api/method/getIpRegion?parameters=127.0.0.1').then(res => res.json()).then(data=>{
console.log(data);
});
</script>
 
  • 字段详细资料

    • ip2Region

      private static org.lionsoul.ip2region.service.Ip2Region ip2Region
  • 构造器详细资料

    • GetIpRegionMethod

      public GetIpRegionMethod()
  • 方法详细资料

    • init

      private void init()
    • getFilePath

      private File getFilePath(String path)
    • execute

      public Object execute(List<freemarker.template.TemplateModel> arguments) throws freemarker.template.TemplateModelException
      指定者:
      execute 在类中 BaseMethod
      抛出:
      freemarker.template.TemplateModelException
    • minParametersNumber

      public int minParametersNumber()
      指定者:
      minParametersNumber 在类中 BaseMethod
      返回:
      min parameters number
    • needAppToken

      public boolean needAppToken()
      指定者:
      needAppToken 在类中 BaseMethod
      返回:
      whether to need app token
    • getIpRegion

      private static IpRegion getIpRegion(String region)
    • destroy

      @PreDestroy public void destroy()