|
|
@ -1,4 +1,4 @@
|
|
|
|
var app = angular.module('wechat', ['ngRoute','ngCookies']);
|
|
|
|
var app = angular.module('wechat', ['ngRoute']);
|
|
|
|
var apiUrl = '/api/v1/';
|
|
|
|
var apiUrl = '/api/v1/';
|
|
|
|
var debug = false; //调试标志,如果在本地请置为true
|
|
|
|
var debug = false; //调试标志,如果在本地请置为true
|
|
|
|
|
|
|
|
|
|
|
@ -8,7 +8,7 @@ if(debug===true){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.factory('auth', function($http,$routeParams, $cookies, $q){
|
|
|
|
app.factory('auth', function($http,$routeParams, $q){
|
|
|
|
var _openid = '';
|
|
|
|
var _openid = '';
|
|
|
|
|
|
|
|
|
|
|
|
if(typeof g_openid !== 'undefined'){
|
|
|
|
if(typeof g_openid !== 'undefined'){
|
|
|
@ -31,15 +31,6 @@ app.factory('auth', function($http,$routeParams, $cookies, $q){
|
|
|
|
method: 'POST'
|
|
|
|
method: 'POST'
|
|
|
|
}).then(function successCallback(response) {
|
|
|
|
}).then(function successCallback(response) {
|
|
|
|
_openid = response.data.openid;
|
|
|
|
_openid = response.data.openid;
|
|
|
|
if(typeof _openid !== 'undefined' && _openid.length>0){
|
|
|
|
|
|
|
|
if(debug !== true){ //如果是生产环境,就存到cookies中
|
|
|
|
|
|
|
|
$cookies.put("openid", _openid);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if(debug!==true){//考虑从cookies中取出
|
|
|
|
|
|
|
|
_openid = $cookies.get('openid');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
deferred.resolve(_openid);
|
|
|
|
deferred.resolve(_openid);
|
|
|
|
}, function errorCallback(response) {
|
|
|
|
}, function errorCallback(response) {
|
|
|
|
deferred.reject(response);
|
|
|
|
deferred.reject(response);
|
|
|
|