|
|
|
@ -4,6 +4,7 @@ import com.ynxbd.push.helper.IPHelper; |
|
|
|
|
import com.ynxbd.push.helper.ProperHelper; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.ini4j.Wini; |
|
|
|
|
import org.springframework.util.ObjectUtils; |
|
|
|
|
import org.springframework.util.ResourceUtils; |
|
|
|
|
|
|
|
|
|
import java.io.IOException; |
|
|
|
@ -61,13 +62,46 @@ public class IniConfig { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 测试是否读取成功 |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
public static String test() { |
|
|
|
|
return WINI.fetch("10.20.10.60", "name"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// public static void main(String[] args) {
|
|
|
|
|
// System.out.println(test());
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取微信页面链接 |
|
|
|
|
* |
|
|
|
|
* @param isSuffix 是否需要后缀/ |
|
|
|
|
*/ |
|
|
|
|
public static String getWxWebPath(boolean isSuffix) { |
|
|
|
|
String domain = IniConfig.getInstance("domain"); |
|
|
|
|
if (!ObjectUtils.isEmpty(domain)) { |
|
|
|
|
String suffix = domain.substring(domain.length() - 1); |
|
|
|
|
if (suffix.equals("/")) { |
|
|
|
|
domain = domain.substring(0, domain.length() - 1); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
String weChatUIPath = IniConfig.getInstance("weChatUIPath"); |
|
|
|
|
if (!ObjectUtils.isEmpty(weChatUIPath) && weChatUIPath.length() > 1) { |
|
|
|
|
String prefix = weChatUIPath.substring(0, 1); |
|
|
|
|
String suffix = weChatUIPath.substring(weChatUIPath.length() - 1); |
|
|
|
|
if (!prefix.equals("/")) { |
|
|
|
|
weChatUIPath = "/" + weChatUIPath; |
|
|
|
|
} |
|
|
|
|
if (suffix.equals("/")) { |
|
|
|
|
weChatUIPath = weChatUIPath.substring(0, weChatUIPath.length() - 1); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
weChatUIPath = ""; |
|
|
|
|
} |
|
|
|
|
return domain + "/wx" + weChatUIPath + (isSuffix ? "/" : ""); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
|
|
System.out.println(test()); |
|
|
|
|
String wxWebPath = getWxWebPath(false); |
|
|
|
|
System.out.println(wxWebPath); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|