Sha256: f91f64c6df7af0a4d35743eb70047ac16a1196c600b95f0f491ccee1ddf7cb8e
Contents?: true
Size: 1.88 KB
Versions: 5
Compression:
Stored size: 1.88 KB
Contents
require_dependency "educode_sales/application_controller" module EducodeSales class SalesController < ApplicationController # load_and_authorize_resource # authorize_resource class: false def index authorize! :sales, Staff respond_to do |format| format.html do end format.json do common = Common.find_by(clazz: 'staff_type', name: '销售') @a_clazz = Common.find_by(clazz: 'business_type', name: 'A类') @b_clazz = Common.find_by(clazz: 'business_type', name: 'B类') @x = Common.find_by(extras: EducodeSales::Common::XTYPE) @step_ids = Common.where(name: %w(已中标 已签单 已验收 回款中 服务中 已结束), clazz: 'business_step').pluck(:id) @staffs = Staff.where(job_type: common.id).page(params[:page]).per(params[:limit]) end end end def trends authorize! :trends, SaleTrend @year = params[:year] ? params[:year] : Time.now.year @sale_trend = SaleTrend.find_or_create_by(year: @year) end def sale_trends authorize! :sale_trends, SaleTrend sale_trend = SaleTrend.find_by(year: params[:year]) if sale_trend.update(sale_trend_params) render_success else render_failure sale_trend end end def operations authorize! :operations, Staff respond_to do |format| format.html do end format.json do common_id = Common.where(clazz: 'staff_type', name: ['销售', '运营']).pluck(:id) @staffs = Staff.where(job_type: common_id).page(params[:page]).per(params[:limit]) end end end def school render layout: false end def xschool render layout: false end private def sale_trend_params params.permit(:chance_money, :ballot_money, :sign_money, :returned_money) end end end
Version data entries
5 entries across 5 versions & 1 rubygems