29 lines
1.0 KiB
Ruby
29 lines
1.0 KiB
Ruby
class NpsController < ApplicationController
|
|
|
|
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])
|
|
render_ok
|
|
end
|
|
end
|