|
|
@ -16,7 +16,7 @@ class UsersService
|
|
|
|
password_confirmation = params[:password_confirmation]
|
|
|
|
password_confirmation = params[:password_confirmation]
|
|
|
|
should_confirmation_password = params[:should_confirmation_password]
|
|
|
|
should_confirmation_password = params[:should_confirmation_password]
|
|
|
|
if !password.blank? && !password_confirmation.blank? && should_confirmation_password
|
|
|
|
if !password.blank? && !password_confirmation.blank? && should_confirmation_password
|
|
|
|
@user.password,@user.password_confirmation = password,password_confirmation
|
|
|
|
@user.password, @user.password_confirmation = password, password_confirmation
|
|
|
|
elsif !password.blank? && !should_confirmation_password
|
|
|
|
elsif !password.blank? && !should_confirmation_password
|
|
|
|
@user.password = password
|
|
|
|
@user.password = password
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -55,7 +55,7 @@ class UsersService
|
|
|
|
location = ""
|
|
|
|
location = ""
|
|
|
|
location << (@user.user_extensions.location || '')
|
|
|
|
location << (@user.user_extensions.location || '')
|
|
|
|
location << (@user.user_extensions.location_city || '')
|
|
|
|
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}
|
|
|
|
{: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
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
#编辑用户
|
|
|
|
#编辑用户
|
|
|
@ -75,12 +75,12 @@ class UsersService
|
|
|
|
@se.gender = params[:gender]
|
|
|
|
@se.gender = params[:gender]
|
|
|
|
@se.location = params[:province] if params[:province]
|
|
|
|
@se.location = params[:province] if params[:province]
|
|
|
|
@se.location_city = params[:city] if params[:city]
|
|
|
|
@se.location_city = params[:city] if params[:city]
|
|
|
|
if @se.save
|
|
|
|
raise @se.errors.full_message unless @se.save
|
|
|
|
unless fileio.nil?
|
|
|
|
unless fileio.nil?
|
|
|
|
file = fileio[:tempfile]
|
|
|
|
file = fileio[:tempfile]
|
|
|
|
diskfile=disk_filename(@user.class.to_s,@user.id)
|
|
|
|
diskfile=disk_filename(@user.class.to_s, @user.id)
|
|
|
|
@image_file = fileio[:name]
|
|
|
|
@image_file = fileio[:name]
|
|
|
|
@urlfile='/' << File.join("images","avatars",avatar_directory(@user.class.to_s),avatar_filename(@user.id,@image_file))
|
|
|
|
@urlfile='/' << File.join("images", "avatars", avatar_directory(@user.class.to_s), avatar_filename(@user.id, @image_file))
|
|
|
|
|
|
|
|
|
|
|
|
path = File.dirname(diskfile)
|
|
|
|
path = File.dirname(diskfile)
|
|
|
|
unless File.directory?(path)
|
|
|
|
unless File.directory?(path)
|
|
|
@ -94,7 +94,7 @@ class UsersService
|
|
|
|
width = 300.0
|
|
|
|
width = 300.0
|
|
|
|
proportion = (width/f[0].columns)
|
|
|
|
proportion = (width/f[0].columns)
|
|
|
|
height = (f[0].rows*proportion)
|
|
|
|
height = (f[0].rows*proportion)
|
|
|
|
f.resize_to_fill!(width,height)
|
|
|
|
f.resize_to_fill!(width, height)
|
|
|
|
f.write(diskfile)
|
|
|
|
f.write(diskfile)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
@ -102,11 +102,8 @@ class UsersService
|
|
|
|
logger.error "[Error] avatar : users_service#edit_user ===> #{e}"
|
|
|
|
logger.error "[Error] avatar : users_service#edit_user ===> #{e}"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return true
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
@se
|
|
|
|
@se
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#关注列表
|
|
|
|
#关注列表
|
|
|
|
def user_watcher params
|
|
|
|
def user_watcher params
|
|
|
|