#encoding module RailsAdmin module Config module Actions class UpdateIntroUser < RailsAdmin::Config::Actions::Base register_instance_option :visible? do authorized? end register_instance_option :member do true end register_instance_option :link_icon do 'icon-share' end register_instance_option :pjax? do false end register_instance_option :controller do Proc.new do require 'rest-client' wx_user = WxUser.where("id = ? and show_invite_mode = ?",@object.id, 0).first n = "此状态不支持操作" if not wx_user.blank? && wx_user.id!=1 n = "已成功升级" url = "#{CONFIG_FILE["api_host"]}/railsadmin/update/intro/#{@object.id}" begin ret = RestClient.get url, {} #per_page: 5 rescue Exception => e n = "升级失败!" end end new_wx_user = WxUser.where("id = ? ",@object.id).first if new_wx_user.id==1 n = "已成功整理关系!" url = "#{CONFIG_FILE["api_host"]}/v1/cron/comb_three_user" begin ret = RestClient.get url, {} #per_page: 5 rescue Exception => e n = "升级失败!" end end redirect_to :back, notice: "#{n}" end end end end end end