From 2cfd876f2fb17c19bcb87565d4ef3a2161ccb4cb Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Fri, 12 Aug 2016 14:17:50 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/wechats_controller.rb | 16 ++++----- public/javascripts/wechat/others/factory.js | 36 ++++++++++----------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/app/controllers/wechats_controller.rb b/app/controllers/wechats_controller.rb index 0228be12c..ed0e2149b 100644 --- a/app/controllers/wechats_controller.rb +++ b/app/controllers/wechats_controller.rb @@ -424,14 +424,14 @@ class WechatsController < ActionController::Base session[:wechat_openid] = open_id if params[:code] - # if params[:userid] - # redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}&userid=#{params[:userid]}" and return - # elsif params[:id] - # redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}" and return - # else - # redirect_to "/wechat/user_activities##{@path}" and return - # end - redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}" and return + if params[:userid] + redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}&userid=#{params[:userid]}" and return + elsif params[:id] + redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}" and return + else + redirect_to "/wechat/user_activities##{@path}" and return + end + # redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}" and return end # end render 'wechats/user_activities', layout: nil diff --git a/public/javascripts/wechat/others/factory.js b/public/javascripts/wechat/others/factory.js index 14efda6e7..229c08a63 100644 --- a/public/javascripts/wechat/others/factory.js +++ b/public/javascripts/wechat/others/factory.js @@ -264,30 +264,30 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$loc var link = ""; -// if(args.urlName == "discussion"){ -// var urlName = response.data.type_name + "_discussion"; -// link = "https://open.weixin.qq.com/connect/oauth2/authorize?appid="+window.g_appid + -// "&redirect_uri="+window.g_localhost+"/wechat/user_activities?id="+response.data.data.act_id+ -// "&response_type=code&scope=snsapi_userinfo&state="+urlName+"&connect_redirect=1#wechat_redirect"; -// } -// else{ -// link = "https://open.weixin.qq.com/connect/oauth2/authorize?appid="+window.g_appid + -// "&redirect_uri="+window.g_localhost+"/wechat/user_activities?id="+response.data.data.act_id+ -// "&response_type=code&scope=snsapi_userinfo&state="+args.urlName+"&connect_redirect=1#wechat_redirect"; -// } - if(args.urlName == "discussion"){ var urlName = response.data.type_name + "_discussion"; - link = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d" + - "&redirect_uri=https://test.forge.trustie.net/wechat/user_activities?id="+response.data.data.act_id+ - "&response_type=code&scope=snsapi_base&state="+urlName+"&connect_redirect=1#wechat_redirect"; + link = "https://open.weixin.qq.com/connect/oauth2/authorize?appid="+window.g_appid + + "&redirect_uri="+window.g_localhost+"/wechat/user_activities?id="+response.data.data.act_id+ + "&response_type=code&scope=snsapi_userinfo&state="+urlName+"&connect_redirect=1#wechat_redirect"; } else{ - link = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d" + - "&redirect_uri=https://test.forge.trustie.net/wechat/user_activities?id="+response.data.data.act_id+ - "&response_type=code&scope=snsapi_base&state="+args.urlName+"&connect_redirect=1#wechat_redirect"; + link = "https://open.weixin.qq.com/connect/oauth2/authorize?appid="+window.g_appid + + "&redirect_uri="+window.g_localhost+"/wechat/user_activities?id="+response.data.data.act_id+ + "&response_type=code&scope=snsapi_userinfo&state="+args.urlName+"&connect_redirect=1#wechat_redirect"; } +// if(args.urlName == "discussion"){ +// var urlName = response.data.type_name + "_discussion"; +// link = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d" + +// "&redirect_uri=https://test.forge.trustie.net/wechat/user_activities?id="+response.data.data.act_id+ +// "&response_type=code&scope=snsapi_base&state="+urlName+"&connect_redirect=1#wechat_redirect"; +// } +// else{ +// link = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d" + +// "&redirect_uri=https://test.forge.trustie.net/wechat/user_activities?id="+response.data.data.act_id+ +// "&response_type=code&scope=snsapi_base&state="+args.urlName+"&connect_redirect=1#wechat_redirect"; +// } + console.log("link= "+link); wxConfig(title,desc,imgUrl,link);