| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- #encoding
- module RailsAdmin
- module Config
- module Actions
- class GenerateLiveAward < 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-star'
- end
- register_instance_option :pjax? do
- false
- end
- register_instance_option :controller do
- Proc.new do
- require 'rest-client'
- live_award = LiveAward.where("id = ? and status = ? ",@object.id,0).first
- n = "发放成功"
- if not live_award.blank?
- n = "已成功发放"
- url = "#{CONFIG_FILE["api_host"]}/railsadmin/live/award/#{@object.id}"
- 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
|