|
|
@ -11,6 +11,7 @@ import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 微信相关服务实现类 |
|
|
|
* |
|
|
@ -28,6 +29,15 @@ public class WxServiceImpl implements WxService { |
|
|
|
@Override |
|
|
|
public Result<WxJsapiSignature> getWxConfig(String url) { |
|
|
|
try { |
|
|
|
String httpPrefix = "http://"; |
|
|
|
String httpsPrefix = "https://"; |
|
|
|
if (url.startsWith(httpPrefix)) { |
|
|
|
url = url.replace(httpPrefix, httpsPrefix); |
|
|
|
} else if (url.startsWith(httpsPrefix)) { |
|
|
|
// 不做处理
|
|
|
|
} else { |
|
|
|
url = httpsPrefix.concat(url); |
|
|
|
} |
|
|
|
WxJsapiSignature wxJsapiSignature = wxMpService.createJsapiSignature(url); |
|
|
|
return new Result<WxJsapiSignature>().ok(wxJsapiSignature); |
|
|
|
} catch (WxErrorException e) { |
|
|
|