|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
class UsersService
|
|
|
|
|
include ApplicationHelper
|
|
|
|
|
include AccountHelper
|
|
|
|
|
#将用户注册的功能函数写这里
|
|
|
|
|
#参数约定
|
|
|
|
@ -36,4 +37,30 @@ class UsersService
|
|
|
|
|
@user
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#显示用户
|
|
|
|
|
#id用户id
|
|
|
|
|
def show_user
|
|
|
|
|
@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
|
|
|
|
|
{: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
|
|
|
|
|
|
|
|
|
|
#编辑用户
|
|
|
|
|
def edit_user params
|
|
|
|
|
@user = User.find(params[:id])
|
|
|
|
|
file = params[:file]
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|