diff --git a/app/controllers/wechats_controller.rb b/app/controllers/wechats_controller.rb
index 87ede1365..190502a3c 100644
--- a/app/controllers/wechats_controller.rb
+++ b/app/controllers/wechats_controller.rb
@@ -383,7 +383,15 @@ class WechatsController < ActionController::Base
render 'wechats/user_activities', layout: nil
end
+
+
def user_activities
+
+ @appid = Wechat.config.appid
+ ## sign
+
+ @sign_params = wechat.jsapi_ticket.signature(current_url)
+
session[:wechat_code] = params[:code] if params[:code]
@path = '/'+(params[:state] || '')
open_id = get_openid_from_code(params[:code]) rescue
@@ -431,6 +439,9 @@ class WechatsController < ActionController::Base
uw = UserWechat.where(openid: openid).first
end
+ def current_url
+ "#{request.protocol}#{request.host_with_port}#{request.fullpath}"
+ end
end
diff --git a/app/views/wechats/user_activities.html.erb b/app/views/wechats/user_activities.html.erb
index f5cfb8250..e06d84bfb 100644
--- a/app/views/wechats/user_activities.html.erb
+++ b/app/views/wechats/user_activities.html.erb
@@ -12,6 +12,7 @@
<%= stylesheet_link_tag '/stylesheets/weui/weixin.css' %>
+