diff --git a/app/controllers/wechats_controller.rb b/app/controllers/wechats_controller.rb index 77c737359..ac744106a 100644 --- a/app/controllers/wechats_controller.rb +++ b/app/controllers/wechats_controller.rb @@ -24,7 +24,7 @@ class WechatsController < ActionController::Base end on :event, with: 'subscribe' do |request| - sendBind(request) + default_msg(request) end # When unsubscribe user scan qrcode qrscene_xxxxxx to subscribe in public account @@ -125,6 +125,10 @@ class WechatsController < ActionController::Base end on :click, with: 'MY_NEWS' do |request, key| + default_msg(req) + end + + def default_msg(request) uw = user_binded?(request[:FromUserName]) if uw && uw.user @@ -137,9 +141,9 @@ class WechatsController < ActionController::Base activity = process_activity(a) if activity news << {title: activity[0], - content: activity[1], - picurl: "#{i == 1 ? logo : 'https://www.trustie.net/'+activity[2]}", - url: activity[3] + content: activity[1], + picurl: "#{i == 1 ? logo : 'https://www.trustie.net/'+activity[2]}", + url: activity[3] } end @@ -172,7 +176,7 @@ class WechatsController < ActionController::Base raise "非法操作, code不存在" unless params[:code] openid = get_openid(params[:code]) raise "无法获取到openid" unless openid - raise "此微信号已绑定用户, 不能得复绑定" if UserWechat.where(openid: openid).first + raise "此微信号已绑定用户, 不能得复绑定" if user_binded?(openid) user, last_login_on = User.try_to_login(params[:username], params[:password]) raise "用户名或密码错误,请重新登录" unless user diff --git a/config/menu.yml b/config/menu.yml index 95bc50cc5..c88e94ec4 100644 --- a/config/menu.yml +++ b/config/menu.yml @@ -3,11 +3,11 @@ button: type: "click" name: "最新动态" key: "MY_NEWS" - - - type: "view" - name: "进入网站" - url: "http://www.trustie.net/" - type: "click" name: "意见返馈" - key: "FEEDBACK" \ No newline at end of file + key: "FEEDBACK" + - + type: "view" + name: "进入网站" + url: "http://www.trustie.net/" \ No newline at end of file