-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from lijiahangmax/dev
Dev
- Loading branch information
Showing
115 changed files
with
2,663 additions
and
1,071 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
orion-ext/src/main/java/com/orion/ext/KitExtConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.orion.ext; | ||
|
||
import com.orion.lang.config.KitConfig; | ||
import com.orion.lang.utils.Strings; | ||
|
||
/** | ||
* orion-ext 配置初始化器 | ||
* | ||
* @author Jiahang Li | ||
* @version 1.0.0 | ||
* @since 2023/3/6 18:31 | ||
*/ | ||
public final class KitExtConfiguration { | ||
|
||
public static final KitExtConfiguration CONFIG = new KitExtConfiguration(); | ||
|
||
public final String LOCATION_UNKNOWN = "location.address.unknown"; | ||
|
||
public final String MAIL_CUSTOMER_HOST = "mail.customer.host"; | ||
|
||
public final String MAIL_CUSTOMER_PORT = "mail.customer.port"; | ||
|
||
static { | ||
KitConfig.init(CONFIG.LOCATION_UNKNOWN, "未知"); | ||
KitConfig.init(CONFIG.MAIL_CUSTOMER_HOST, Strings.EMPTY); | ||
KitConfig.init(CONFIG.MAIL_CUSTOMER_PORT, 465); | ||
} | ||
|
||
private KitExtConfiguration() { | ||
} | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
orion-ext/src/main/java/com/orion/ext/location/LocationConst.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.orion.ext.location; | ||
|
||
import com.orion.ext.KitExtConfiguration; | ||
import com.orion.lang.config.KitConfig; | ||
|
||
/** | ||
* 地址常量 | ||
* | ||
* @author Jiahang Li | ||
* @version 1.0.0 | ||
* @since 2023/3/7 17:48 | ||
*/ | ||
public class LocationConst { | ||
|
||
private LocationConst() { | ||
} | ||
|
||
public static final String CZ88_NET = "CZ88.NET"; | ||
|
||
public static final String UNKNOWN = KitConfig.get(KitExtConfiguration.CONFIG.LOCATION_UNKNOWN); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
orion-ext/src/main/java/com/orion/ext/location/ext/core/IpLocation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package com.orion.ext.location.ext.core; | ||
|
||
import com.orion.ext.location.LocationConst; | ||
import com.orion.lang.utils.Strings; | ||
|
||
/** | ||
* ip 所在的国家和地区 | ||
* | ||
* @author Jiahang Li | ||
* @version 1.0.0 | ||
* @since 2023/3/7 17:14 | ||
*/ | ||
public class IpLocation { | ||
|
||
/** | ||
* 国家 | ||
*/ | ||
protected String country; | ||
|
||
/** | ||
* 地区 | ||
*/ | ||
protected String area; | ||
|
||
protected IpLocation() { | ||
this.country = Strings.EMPTY; | ||
this.area = Strings.EMPTY; | ||
} | ||
|
||
protected IpLocation copy() { | ||
IpLocation ret = new IpLocation(); | ||
ret.country = this.getCountry(); | ||
ret.area = this.getArea(); | ||
return ret; | ||
} | ||
|
||
public String getCountry() { | ||
return country.endsWith(LocationConst.CZ88_NET) ? LocationConst.UNKNOWN : country; | ||
} | ||
|
||
public String getArea() { | ||
return area.endsWith(LocationConst.CZ88_NET) ? LocationConst.UNKNOWN : area; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return this.getCountry() + Strings.SPACE + this.getArea(); | ||
} | ||
|
||
} |
Oops, something went wrong.