From 890f49eb36719b3a873a2c764d7d3aa781d32683 Mon Sep 17 00:00:00 2001 From: z9hang Date: Tue, 9 Dec 2014 16:40:52 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=96=B9=E6=B3=95=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile.lock | 11 ----------- app/services/users_service.rb | 27 +++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 58f069ac1..43252793e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -122,7 +122,6 @@ GEM htmlentities (4.3.2) i18n (0.6.1) ice_nine (0.11.0) - iconv (1.0.4) journey (1.0.4) jquery-rails (2.0.3) railties (>= 3.1.0, < 5.0) @@ -172,8 +171,6 @@ GEM win32console (~> 1.3) pry-nav (0.2.3) pry (~> 0.9.10) - puma (2.10.1) - rack (>= 1.1, < 2.0) rack (1.4.5) rack-accept (0.4.5) rack (>= 0.4) @@ -222,7 +219,6 @@ GEM sass-rails rmagick (2.13.2) ruby-openid (2.1.8) - ruby-prof (0.15.2) rubyzip (1.1.6) sass (3.3.10) sass-rails (3.2.6) @@ -273,8 +269,6 @@ GEM win32console (1.3.2-x86-mingw32) xpath (2.0.0) nokogiri (~> 1.3) - zip-zip (0.3) - rubyzip (>= 1.0.0) PLATFORMS ruby @@ -297,7 +291,6 @@ DEPENDENCIES guard-test (~> 1.0.0) htmlentities i18n (~> 0.6.0) - iconv jquery-rails (~> 2.0.2) kaminari mocha (~> 1.1.0) @@ -307,15 +300,12 @@ DEPENDENCIES paperclip (~> 3.5.4) pry pry-nav - puma rack-mini-profiler! rack-openid rails (= 3.2.13) rich (= 1.4.6) rmagick (>= 2.0.0) ruby-openid (~> 2.1.4) - ruby-prof (~> 0.15.1) - rubyzip sass-rails (~> 3.2.3) seems_rateable! selenium-webdriver (~> 2.42.0) @@ -323,4 +313,3 @@ DEPENDENCIES spork-testunit (~> 0.0.8) therubyracer uglifier (>= 1.0.3) - zip-zip diff --git a/app/services/users_service.rb b/app/services/users_service.rb index 0f79e8308..3579b8a87 100644 --- a/app/services/users_service.rb +++ b/app/services/users_service.rb @@ -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