新增:更新专家信息接口

This commit is contained in:
yystopf 2026-04-02 09:59:50 +08:00
parent e6c61050db
commit 8211e7580a
2 changed files with 13 additions and 0 deletions

View File

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

View File

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