forked from Trustie/forgeplus
新增:更新专家信息接口
This commit is contained in:
parent
e6c61050db
commit
8211e7580a
|
|
@ -32,6 +32,18 @@ class Api::V1::ResidentExpertsController < Api::V1::BaseController
|
|||
end
|
||||
end
|
||||
|
||||
def change
|
||||
@resident_expert = ResidentExpert.find_by(user_id: current_user.id)
|
||||
return render_error("用户未完成专家入驻") if @resident_expert.blank?
|
||||
@resident_expert.attributes = resident_expert_params
|
||||
if @resident_expert.save
|
||||
Util.write_file(@image, avatar_path(@resident_expert)) if params[:image].present?
|
||||
render_ok
|
||||
else
|
||||
render_error(@resident_expert.errors.full_messages)
|
||||
end
|
||||
end
|
||||
|
||||
def reset
|
||||
@resident_expert = ResidentExpert.find_by(user_id: current_user.id)
|
||||
return render_error("用户未完成专家入驻") if @resident_expert.blank?
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ defaults format: :json do
|
|||
resources :resident_experts do
|
||||
collection do
|
||||
post :reset
|
||||
post :change
|
||||
get :current
|
||||
get :actions
|
||||
put :update_image
|
||||
|
|
|
|||
Loading…
Reference in New Issue