Merge branch 'api' of http://repository.trustie.net/xianbo/trustie2 into api
This commit is contained in:
commit
bd685e16ec
11
Gemfile.lock
11
Gemfile.lock
|
@ -130,6 +130,7 @@ 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)
|
||||
|
@ -185,6 +186,8 @@ GEM
|
|||
pry-remote (0.1.8)
|
||||
pry (~> 0.9)
|
||||
slop (~> 3.0)
|
||||
puma (2.10.1)
|
||||
rack (>= 1.1, < 2.0)
|
||||
rack (1.4.5)
|
||||
rack-accept (0.4.5)
|
||||
rack (>= 0.4)
|
||||
|
@ -233,6 +236,7 @@ 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)
|
||||
|
@ -283,6 +287,8 @@ GEM
|
|||
win32console (1.3.2-x86-mingw32)
|
||||
xpath (2.0.0)
|
||||
nokogiri (~> 1.3)
|
||||
zip-zip (0.3)
|
||||
rubyzip (>= 1.0.0)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
@ -306,6 +312,7 @@ DEPENDENCIES
|
|||
guard-test (~> 1.0.0)
|
||||
htmlentities
|
||||
i18n (~> 0.6.0)
|
||||
iconv
|
||||
jquery-rails (~> 2.0.2)
|
||||
kaminari
|
||||
mocha (~> 1.1.0)
|
||||
|
@ -316,12 +323,15 @@ DEPENDENCIES
|
|||
pry-byebug
|
||||
pry-rails
|
||||
pry-remote
|
||||
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)
|
||||
|
@ -329,3 +339,4 @@ DEPENDENCIES
|
|||
spork-testunit (~> 0.0.8)
|
||||
therubyracer
|
||||
uglifier (>= 1.0.3)
|
||||
zip-zip
|
||||
|
|
|
@ -10,7 +10,7 @@ module Mobile
|
|||
API.logger
|
||||
end
|
||||
|
||||
def authticate!
|
||||
def authenticate!
|
||||
error!('Unauthorized. Invalid or expired token.', 401) unless current_user
|
||||
end
|
||||
|
||||
|
|
|
@ -26,6 +26,27 @@ module Mobile
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
desc "modify user"
|
||||
params do
|
||||
#optional :file, type: File, desc: 'avatar'
|
||||
optional :occupation, type: String
|
||||
optional :brief_introduction, type: String
|
||||
optional :province, type: String
|
||||
optional :city, type: String
|
||||
optional :gender, type: Integer
|
||||
end
|
||||
put ':id' do
|
||||
authenticate!
|
||||
us = UsersService.new
|
||||
begin
|
||||
ue = us.edit_user params
|
||||
{status: 0, data: ue}
|
||||
rescue => e
|
||||
{status: 1, message: e.message}
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -75,7 +75,7 @@ class UsersService
|
|||
@se.gender = params[:gender]
|
||||
@se.location = params[:province] if params[:province]
|
||||
@se.location_city = params[:city] if params[:city]
|
||||
if @se.save
|
||||
raise @se.errors.full_message unless @se.save
|
||||
unless fileio.nil?
|
||||
file = fileio[:tempfile]
|
||||
diskfile=disk_filename(@user.class.to_s, @user.id)
|
||||
|
@ -102,11 +102,8 @@ class UsersService
|
|||
logger.error "[Error] avatar : users_service#edit_user ===> #{e}"
|
||||
end
|
||||
end
|
||||
return true
|
||||
else
|
||||
@se
|
||||
end
|
||||
end
|
||||
|
||||
#关注列表
|
||||
def user_watcher params
|
||||
|
|
Loading…
Reference in New Issue