Class: EricWeixin::Cms::Weixin::WeixinUsersController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/eric_weixin/cms/weixin/weixin_users_controller.rb

Instance Method Summary collapse

Instance Method Details

#batch_update_user_infosObject



38
39
40
41
42
43
44
45
46
47
48
# File 'app/controllers/eric_weixin/cms/weixin/weixin_users_controller.rb', line 38

def batch_update_user_infos
   = ::EricWeixin::PublicAccount.find(params[:public_account_id])
  if .blank?
    flash[:alert] = '未指定公众账号'
    redirect_to action: :index
    return
  end
  .delay(:priority => 10).update_users
  flash[:success] = '已经把批量更新微信用户信息任务添加到队列任务中'
  redirect_to action: :index
end

#indexObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/eric_weixin/cms/weixin/weixin_users_controller.rb', line 2

def index
  @public_accounts = ::EricWeixin::PublicAccount.all
   = ::EricWeixin::PublicAccount.find_by_id(params[:public_account_id])
  @weixin_users = .weixin_users.custom_query(params.permit(:subscribe,
                                                                         :nickname,
                                                                         :sex,
                                                                         :city,
                                                                         :province,
                                                                         :weixin_public_account_id,
                                                                         :start_date,
                                                                         :end_date,
                                                           :first_register_channel,
                                                           :last_register_channel)).
      order(id: :desc).
      paginate(page: params[:page]||1, per_page: params[:per_page]||10) unless .blank?
end

#modify_remarkObject



19
20
21
22
23
24
# File 'app/controllers/eric_weixin/cms/weixin/weixin_users_controller.rb', line 19

def modify_remark
  user = ::EricWeixin::WeixinUser.find(params[:id])
  user.set_remark params[:new_remark]
  user.reload
  render text: user.remark
end

#quick_get_user_infosObject



26
27
28
29
30
31
32
33
34
35
36
# File 'app/controllers/eric_weixin/cms/weixin/weixin_users_controller.rb', line 26

def quick_get_user_infos
   = ::EricWeixin::PublicAccount.find(params[:public_account_id])
  if .blank?
    flash[:alert] = '未指定公众账号'
    redirect_to action: :index
    return
  end
  .delay(:priority => 10).rebuild_users_simple
  flash[:success] = '已经把快速更新微信用户信息任务添加到队列任务中'
  redirect_to action: :index
end