Sha256: a071496c211f4d4e00cc47c4b7debf1ad8853da8ae886403833ee5de8c456756

Contents?: true

Size: 1.35 KB

Versions: 12

Compression:

Stored size: 1.35 KB

Contents

class EricWeixin::Cms::Weixin::ReplyMessageRulesController < EricWeixin::Cms::BaseController
  before_filter :need_login

  def index
    @reply_message_rules = ::EricWeixin::ReplyMessageRule.valid.paginate(page: params[:page], per_page:params[:per_page]||10)
    @public_accounts = ::EricWeixin::PublicAccount.all
  end

  def new
    @public_accounts = ::EricWeixin::PublicAccount.all
  end

  def create
    begin
      ::EricWeixin::ReplyMessageRule.create_reply_message_rule params
      flash[:success] = "创建成功。"
      redirect_to action: :index
    rescue Exception=>e
      dispose_exception e
      flash.now[:alert] = get_notice_str
      @public_accounts = ::EricWeixin::PublicAccount.all
      render :new
    end
  end

  def edit
    @rule = ::EricWeixin::ReplyMessageRule.find(params[:id])
    @public_accounts = ::EricWeixin::PublicAccount.all
  end

  def update
    begin
      @reply_message_rule = ::EricWeixin::ReplyMessageRule.update_reply_message_rule(params[:id],params)
      flash[:success] = "更新成功。"
      redirect_to action: :index
    rescue Exception=> e
      dispose_exception e
      flash.now[:alert] = get_notice_str
      @public_accounts = ::EricWeixin::PublicAccount.all
      render :edit
    end
  end

  def destroy
    rule = ::EricWeixin::ReplyMessageRule.find(params[:id])
    @rule_id = rule.id
    rule.destroy
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
eric_weixin-0.4.2 app/controllers/eric_weixin/cms/weixin/reply_message_rules_controller.rb
eric_weixin-0.4.1 app/controllers/eric_weixin/cms/weixin/reply_message_rules_controller.rb
eric_weixin-0.4.0 app/controllers/eric_weixin/cms/weixin/reply_message_rules_controller.rb
eric_weixin-0.3.3 app/controllers/eric_weixin/cms/weixin/reply_message_rules_controller.rb
eric_weixin-0.3.2 app/controllers/eric_weixin/cms/weixin/reply_message_rules_controller.rb
eric_weixin-0.3.1 app/controllers/eric_weixin/cms/weixin/reply_message_rules_controller.rb
eric_weixin-0.3.0 app/controllers/eric_weixin/cms/weixin/reply_message_rules_controller.rb
eric_weixin-0.2.3 app/controllers/eric_weixin/cms/weixin/reply_message_rules_controller.rb
eric_weixin-0.2.1 app/controllers/eric_weixin/cms/weixin/reply_message_rules_controller.rb
eric_weixin-0.2.0 app/controllers/eric_weixin/cms/weixin/reply_message_rules_controller.rb
eric_weixin-0.1.1 app/controllers/eric_weixin/cms/weixin/reply_message_rules_controller.rb
eric_weixin-0.1.0 app/controllers/eric_weixin/cms/weixin/reply_message_rules_controller.rb