From a7c24dea64da900ac411bf0ce2d2a971534f95da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cxxq250=E2=80=9D?= <“xxq250@qq.com”> Date: Wed, 31 Aug 2022 10:38:21 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4nps=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E8=B0=83=E7=A0=94=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/nps_controller.rb | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) 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