1、修正用户编辑接口报错问题。2、修正用户注册,编辑用户接口返回数据不正确问题
This commit is contained in:
parent
2c49dad4dc
commit
ed776fa9b9
|
@ -35,7 +35,7 @@ module Mobile
|
|||
authenticate!
|
||||
us = UsersService.new
|
||||
ue = us.edit_user params.merge(id: current_user.id)
|
||||
present :data, ue.user, with: Mobile::Entities::User
|
||||
present :data, ue,with: Mobile::Entities::User
|
||||
present :status, 0
|
||||
end
|
||||
|
||||
|
|
|
@ -3,7 +3,12 @@ module Mobile
|
|||
class User < Grape::Entity
|
||||
def self.user_expose(f)
|
||||
expose f do |u,opt|
|
||||
u.send(f) if u.respond_to?(f)
|
||||
if u.is_a?(Hash) && u.key?(f)
|
||||
u[f]
|
||||
#else
|
||||
# u.send(f) if u.respond_to?(f)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -36,7 +36,11 @@ class UsersService
|
|||
ue.user_id = @user.id
|
||||
ue.save
|
||||
end
|
||||
@user
|
||||
img_url = url_to_avatar(@user)
|
||||
gender = @user.user_extensions.gender.nil? ? 0 : @user.user_extensions.gender
|
||||
work_unit = get_user_work_unit @user
|
||||
location = get_user_location @user
|
||||
{:id => @user.id, :img_url => img_url, :nickname => @user.login, :gender => gender, :work_unit => work_unit, :mail => @user.mail, :location => location, :brief_introduction => @user.user_extensions.brief_introduction}
|
||||
end
|
||||
|
||||
#显示用户
|
||||
|
@ -95,7 +99,11 @@ class UsersService
|
|||
logger.error "[Error] avatar : users_service#edit_user ===> #{e}"
|
||||
end
|
||||
end
|
||||
[:user_extensions =>@se,:img_url => url_to_avatar(@user),:work_unit => get_user_work_unit(@user),:location => get_user_location(@user)]
|
||||
img_url = url_to_avatar(@user)
|
||||
gender = @user.user_extensions.gender.nil? ? 0 : @user.user_extensions.gender
|
||||
work_unit = get_user_work_unit @user
|
||||
location = get_user_location @user
|
||||
{:id => @user.id, :img_url => img_url, :nickname => @user.login, :gender => gender, :work_unit => work_unit, :mail => @user.mail, :location => location, :brief_introduction => @user.user_extensions.brief_introduction}
|
||||
end
|
||||
|
||||
#获取用户的工作单位
|
||||
|
|
Loading…
Reference in New Issue