调整nps用户调研接口

This commit is contained in:
“xxq250” 2022-08-31 10:38:21 +08:00
parent d51bb7030f
commit a7c24dea64
1 changed files with 9 additions and 22 deletions

View File

@ -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