https://wx2.qq.com/?&lang=zh_CN
/** * 启动二维码登录 */ function doQrcodeLogin() { loginFactory.getUUID().then(function (uuid) { utilFactory.log('login',uuid); $scope.uuid = uuid; $scope.qrcodeUrl = 'https://login.weixin.qq.com/qrcode/'+ uuid; $scope.code = 0; $scope.isScan = false; $scope.isIPad = utilFactory.isIPad; $scope.isMacOS = utilFactory.isMacOS; $scope.isWindows = utilFactory.isWindows; $scope.lang = utilFactory.queryParser().lang || 'zh_CN'; var qrcodeLoaded = false; reportService.report(reportService.ReportType.timing,{ timing:{ qrcodeStart:Date.now() } }); setTimeout(function(){ if(!qrcodeLoaded){ reportService.report(reportService.ReportType.picError,{ text:'qrcode can not load', src:$scope.qrcodeUrl }); } },3000); $scope.qrcodeLoad = function(){ qrcodeLoaded = true; reportService.report(reportService.ReportType.timing,{ timing:{ qrcodeEnd:Date.now() } }); }; loginFactory.checkLogin(uuid,1).then(checkLoginHandler, function (data){ if(!data && window.checkLoginPromise){ $scope.isBrokenNetwork = true; }else{ $scope.isBrokenNetwork = false; } }); }, function (code){ console.log('get uuid error'); if(!code){ $scope.isBrokenNetwork = true; }else{ $scope.isBrokenNetwork = false; } }); }
angular.module('Services') .factory('loginFactory', ['$http', '$q','$timeout', 'accountFactory', 'confFactory', 'utilFactory','mmHttp','reportService', function($http, $q, $timeout, accountFactory, confFactory,utilFactory,mmHttp,reportService) { var service = { getUUID: function () { var deferred = $q.defer(); window.QRLogin = {}; // ie8 $.ajax({ url: confFactory.API_jsLogin, dataType : "script", timeout : 10000 }).done(function() { if(window.QRLogin.code==200){ deferred.resolve(window.QRLogin.uuid); }else{ deferred.reject(window.QRLogin.code); } }).fail(function(){ deferred.reject(); console.log('get uuid fail.....'); }); /*$http.jsonp(confFactory.API_jsLogin).success(function(data){ //not standard jsonp, call error handler. }).error(function(data){ if(window.QRLogin.code==200){ deferred.resolve(window.QRLogin.uuid); }else{ deferred.reject(window.QRLogin.code); } });*/ return deferred.promise; }, getQrcode: function (argument) { // body... },
def like_wx_uuid(random_digit=12, reserved_digit=2):
'''
微信网页版 https://wx.qq.com/
https://res.wx.qq.com/a/wx_fed/webwx/res/static/js/index_c7d281c.js https://res.wx.qq.com/a/wx_fed/webwx/res/static/js/index_c7d281c.js
getUUID: function () {
var deferred = $q.defer();
window.QRLogin = {};
// ie8
$.ajax({
url: confFactory.API_jsLogin,
dataType : "script",
timeout : 10000
}).done(function() {
if(window.QRLogin.code==200){
deferred.resolve(window.QRLogin.uuid);
}else{
deferred.reject(window.QRLogin.code);
}
}).fail(function(){
deferred.reject();
console.log('get uuid fail.....');
});
/*$http.jsonp(confFactory.API_jsLogin).success(function(data){
//not standard jsonp, call error handler.
}).error(function(data){
if(window.QRLogin.code==200){
deferred.resolve(window.QRLogin.uuid);
}else{
deferred.reject(window.QRLogin.code);
}
});*/
return deferred.promise;
},
e.g.
wbJM5_KqQw==
oYN1ZHR-Tw==
Yf-wiqev-g==
app.
https://login.weixin.qq.com/qrcode/Yf-wiqev-g==
'''
assert random_digit > reserved_digit
import random, string
pool = string.ascii_letters + '-_' + string.digits
return ''.join(random.choice(pool) if i < random_digit - reserved_digit else '=' for i in range(random_digit))