From 606599047d5a3452290321bc1bb32de3cf65d6dd Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 5 Apr 2016 17:35:27 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=A6=E6=83=85=E9=A1=B5=E5=87=BA=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/wechat/app.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/public/javascripts/wechat/app.js b/public/javascripts/wechat/app.js index 119e962d1..5a18a2e35 100644 --- a/public/javascripts/wechat/app.js +++ b/public/javascripts/wechat/app.js @@ -21,20 +21,22 @@ app.factory('auth', function($http,$routeParams, $cookies){ method: 'POST' }).then(function successCallback(response) { _openid = response.data.openid; - if(debug !== true){ //如果是生产环境,就存到cookies中 - $cookies.put("openid", _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'); + } } + cb(_openid); }, function errorCallback(response) { - if(debug!==true){//考虑从cookies中取出 - _openid = $cookies.get('openid'); - } - cb(_openid); + cb(null); }); }; - - var openid = function(){ return _openid; }