Class: EricWeixin::Cms::Weixin::PublicAccountsController
- Inherits:
-
BaseController
- Object
- BaseController
- EricWeixin::Cms::Weixin::PublicAccountsController
- Defined in:
- app/controllers/eric_weixin/cms/weixin/public_accounts_controller.rb
Instance Method Summary collapse
- #create_menu ⇒ Object
- #export ⇒ Object
- #index ⇒ Object
- #rebuild_weixin_users ⇒ Object
- #show ⇒ Object
Instance Method Details
#create_menu ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/eric_weixin/cms/weixin/public_accounts_controller.rb', line 10 def begin @public_account = ::EricWeixin::PublicAccount.find(params[:id]) @public_account. params[:menu_json] rescue Exception => e dispose_exception e flash[:alert] = '创建菜单失败,原因:' + get_notice_str end redirect_to :action => :show end |
#export ⇒ Object
30 31 32 33 34 |
# File 'app/controllers/eric_weixin/cms/weixin/public_accounts_controller.rb', line 30 def export @public_account = ::EricWeixin::PublicAccount.find(params[:id]) @csv = EricWeixin::WeixinUser.export_users_to_csv(@public_account.id) send_data @csv end |
#index ⇒ Object
2 3 4 |
# File 'app/controllers/eric_weixin/cms/weixin/public_accounts_controller.rb', line 2 def index @public_accounts = ::EricWeixin::PublicAccount.all.paginate(page:params[:page], per_page: 5) end |
#rebuild_weixin_users ⇒ Object
22 23 24 25 26 27 28 |
# File 'app/controllers/eric_weixin/cms/weixin/public_accounts_controller.rb', line 22 def rebuild_weixin_users @public_account = ::EricWeixin::PublicAccount.find(params[:id]) @public_account.rebuild_users # set_notice("重建成功") flash[:success] = "更新用户列表成功。" redirect_to :action => :index end |
#show ⇒ Object
5 6 7 8 |
# File 'app/controllers/eric_weixin/cms/weixin/public_accounts_controller.rb', line 5 def show @public_account = ::EricWeixin::PublicAccount.find(params[:id]) @weixin_menus = @public_account..to_json end |