diff --git a/app/controllers/nps_controller.rb b/app/controllers/nps_controller.rb index 2e1b552b0..35dac164c 100644 --- a/app/controllers/nps_controller.rb +++ b/app/controllers/nps_controller.rb @@ -1,28 +1,15 @@ class NpsController < ApplicationController + # close,关闭 + # createIssue,创建issue + # createPullRequest,创建PR + # auditPullRequest,审核PR + # indexProject,项目主页 + # createProject,创建项目 + # createOrganization,创建组织 def create - tip_exception "缺少参数" if params[:action_id].blank? - action_type ||= begin - case params[:action_id].to_s - when '0' then - 'close' - when '1' then - 'createIssue' - when '2' then - 'createPullRequest' - when '3' then - 'auditPullRequest' - when '4' then - 'forkProject' - when '5' then - 'createProject' - when '6' then - 'createOrganization' - else - "#{params[:action_type].to_s}" - end - end - UserNp.create(:action_id => params[:action_id], :action_type => "#{action_type}", :user_id => User.current.id, :score => params[:score].to_f, memo: params[:memo]) + tip_exception "缺少参数" if params[:action_id].blank? || params[:action_type].blank? + UserNp.create(:action_id => params[:action_id].to_i, :action_type => params[:action_type], :user_id => User.current.id, :score => params[:score].to_f, memo: params[:memo]) render_ok end end