网易内推联系我哦

网易无偿内推,点击下方【首页】置顶帖查看说明

0%

背景

近期在重构项目中,由于部分查询的数据库配置是根据不同的用户进行个性化配置的,所以在查询过程中,存在 MyBatis 多源数据库切换问题。

原项目实现方式为,在 MyBatis 查询前,切换到个性化配置,查询完毕后,再切换回默认数据库配置。

现在希望通过注解标注形式,进行重构代码。

阅读全文 »

获取内网 IP 地址

function getIpAddress() {
    window.RTCPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection;
    var pc = new RTCPeerConnection({
        iceServers: []
    }),
    noop = function() {};
    pc.createDataChannel(''); //create a bogus data channel 
    pc.createOffer(pc.setLocalDescription.bind(pc), noop); // create offer andsetlocaldescription
    pc.onicecandidate = function(ice) {
        if (ice && ice.candidate && ice.candidate.candidate) {
            var myIP = /([0-9]{1,3}(\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7})/.exec(ice.candidate.candidate)[1];
            console.log('my IP: ', myIP); //【注:Chrome浏览器下ice.candidate.address也可以拿到值,火狐浏览器不可以】
            pc.onicecandidate = noop;
			return myIP;
        }
    };
	return null;
}
阅读全文 »

跨域访问时很多需求,所以 SpringBoot 的跨域解决也是必须的。

Access to XMLHttpRequest at 'http://127.0.0.1:18888/XXXX' from origin 'http://127.0.0.1:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
阅读全文 »