|
|
|
@ -45,17 +45,8 @@ class UsersService
|
|
|
|
|
@user = User.find(params[:id])
|
|
|
|
|
img_url = url_to_avatar(@user)
|
|
|
|
|
gender = @user.user_extensions.gender.nil? ? 0 : @user.user_extensions.gender
|
|
|
|
|
work_unit = ""
|
|
|
|
|
if @user.user_extensions.identity == 0 || @user.user_extensions.identity == 1
|
|
|
|
|
work_unit = @user.user_extensions.school.name unless @user.user_extensions.school.nil?
|
|
|
|
|
elsif @user.user_extensions.identity == 3
|
|
|
|
|
work_unit = @user.user_extensions.occupation
|
|
|
|
|
elsif @user.user_extensions.identity == 2
|
|
|
|
|
work_unit = @user.firstname
|
|
|
|
|
end
|
|
|
|
|
location = ""
|
|
|
|
|
location << (@user.user_extensions.location || '')
|
|
|
|
|
location << (@user.user_extensions.location_city || '')
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
@ -104,7 +95,28 @@ class UsersService
|
|
|
|
|
logger.error "[Error] avatar : users_service#edit_user ===> #{e}"
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
@se
|
|
|
|
|
[:user_extensions =>@se,:img_url => url_to_avatar(@user),:work_unit => get_user_work_unit(@user),:location => get_user_location(user)]
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#获取用户的工作单位
|
|
|
|
|
def get_user_work_unit user
|
|
|
|
|
work_unit = ""
|
|
|
|
|
if user.user_extensions.identity == 0 || user.user_extensions.identity == 1
|
|
|
|
|
work_unit = user.user_extensions.school.name unless user.user_extensions.school.nil?
|
|
|
|
|
elsif user.user_extensions.identity == 3
|
|
|
|
|
work_unit = user.user_extensions.occupation
|
|
|
|
|
elsif user.user_extensions.identity == 2
|
|
|
|
|
work_unit = user.firstname
|
|
|
|
|
end
|
|
|
|
|
work_unit
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#获取用户地区
|
|
|
|
|
def get_user_location user
|
|
|
|
|
location = ""
|
|
|
|
|
location << (user.user_extensions.location || '')
|
|
|
|
|
location << (user.user_extensions.location_city || '')
|
|
|
|
|
location
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#关注列表
|
|
|
|
|