Commit d581e4c7 by zmj

添加api 为推送服务

parent 31fc931f
......@@ -29,6 +29,9 @@
/public/assets
.byebug_history
/config/push.yml
/config/settings.yml
/config/app.yml
# Ignore master key for decrypting credentials and more.
/config/master.key
\ No newline at end of file
......@@ -61,3 +61,10 @@ end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'igetui-ruby', require: 'igetui'
gem 'settingslogic', '~> 2.0', '>= 2.0.9'
gem 'httparty', '~> 0.13.7'
gem 'redis-rails', '~> 5.0', '>= 5.0.2'
gem 'rails_param', '~> 0.10.2'
gem 'sidekiq', '~> 4.1', '>= 4.1.2'
\ No newline at end of file
......@@ -52,14 +52,13 @@ GEM
msgpack (~> 1.0)
builder (3.2.3)
byebug (11.0.1)
capybara (3.20.0)
capybara (3.20.2)
addressable
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
regexp_parser (~> 1.2)
uglifier
xpath (~> 3.2)
childprocess (1.0.1)
rake (< 13.0)
......@@ -74,17 +73,25 @@ GEM
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.1.5)
connection_pool (2.2.2)
crass (1.0.4)
erubi (1.8.0)
execjs (2.7.0)
ffi (1.10.0)
ffi (1.11.0)
globalid (0.4.2)
activesupport (>= 4.2.0)
httparty (0.13.7)
json (~> 1.8)
multi_xml (>= 0.5.2)
i18n (1.6.0)
concurrent-ruby (~> 1.0)
igetui-ruby (1.2.2)
json (~> 1.8, >= 1.8.1)
ruby-protocol-buffers (~> 1.5, >= 1.5.1)
io-like (0.3.0)
jbuilder (2.9.1)
activesupport (>= 4.2.0)
json (1.8.6)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
......@@ -102,12 +109,15 @@ GEM
mini_portile2 (2.4.0)
minitest (5.11.3)
msgpack (1.2.10)
multi_xml (0.6.0)
nio4r (2.3.1)
nokogiri (1.10.3)
mini_portile2 (~> 2.4.0)
public_suffix (3.0.3)
puma (3.12.1)
rack (2.0.7)
rack-protection (2.0.5)
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (5.2.3)
......@@ -128,6 +138,7 @@ GEM
nokogiri (>= 1.6)
rails-html-sanitizer (1.0.4)
loofah (~> 2.2, >= 2.2.2)
rails_param (0.10.2)
railties (5.2.3)
actionpack (= 5.2.3)
activesupport (= 5.2.3)
......@@ -138,7 +149,25 @@ GEM
rb-fsevent (0.10.3)
rb-inotify (0.10.0)
ffi (~> 1.0)
redis (3.3.5)
redis-actionpack (5.0.2)
actionpack (>= 4.0, < 6)
redis-rack (>= 1, < 3)
redis-store (>= 1.1.0, < 2)
redis-activesupport (5.0.7)
activesupport (>= 3, < 6)
redis-store (>= 1.3, < 2)
redis-rack (2.0.5)
rack (>= 1.5, < 3)
redis-store (>= 1.2, < 2)
redis-rails (5.0.2)
redis-actionpack (>= 5.0, < 6)
redis-activesupport (>= 5.0, < 6)
redis-store (>= 1.2, < 2)
redis-store (1.6.0)
redis (>= 2.2, < 5)
regexp_parser (1.5.0)
ruby-protocol-buffers (1.6.1)
ruby_dep (1.5.0)
rubyzip (1.2.2)
sass (3.7.4)
......@@ -155,6 +184,12 @@ GEM
selenium-webdriver (3.142.2)
childprocess (>= 0.5, < 2.0)
rubyzip (~> 1.2, >= 1.2.2)
settingslogic (2.0.9)
sidekiq (4.2.10)
concurrent-ruby (~> 1.0)
connection_pool (~> 2.2, >= 2.2.0)
rack-protection (>= 1.5.0)
redis (~> 3.2, >= 3.2.1)
spring (2.0.2)
activesupport (>= 4.2)
spring-watcher-listen (2.0.1)
......@@ -198,12 +233,18 @@ DEPENDENCIES
capybara (>= 2.15)
chromedriver-helper
coffee-rails (~> 4.2)
httparty (~> 0.13.7)
igetui-ruby
jbuilder (~> 2.5)
listen (>= 3.0.5, < 3.2)
puma (~> 3.11)
rails (~> 5.2.2, >= 5.2.2.1)
rails_param (~> 0.10.2)
redis-rails (~> 5.0, >= 5.0.2)
sass-rails (~> 5.0)
selenium-webdriver
settingslogic (~> 2.0, >= 2.0.9)
sidekiq (~> 4.1, >= 4.1.2)
spring
spring-watcher-listen (~> 2.0.0)
sqlite3
......
class ApplicationController < ActionController::Base
rescue_from StandardError, with: :rescue_all
def rescue_all(e)
ErrorLog.error(e)
render json: { code: 500, message: '抱歉~ 系统出错了,攻城狮们已经在修理了!', error: e.class.name.underscore, original_message: e.message }
end
end
......@@ -11,9 +11,28 @@ module AppPush
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.2
require_relative '../app/services/settings'
# Settings in config/environments/* take precedence over those specified here.
# Application configuration can go into files in config/initializers
# -- all .rb files in that directory are automatically loaded after loading
# the framework and any gems in your application.
config.i18n.default_locale = 'zh-CN'
config.time_zone = 'Beijing'
redis_conf = Settings['redis']
config.cache_store = :redis_store, {
host: redis_conf['host'],
port: redis_conf['port'],
db: redis_conf['cache_db'],
password: redis_conf['password'],
expires_in: 4.hours
}
config.eager_load_paths += [
Rails.root.join('app/services')
]
config.active_job.queue_adapter = :sidekiq
end
end
Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
post 'api/v1/token', to: 'pushs#token'
post 'api/v1/push', to: 'pushs#push'
require 'sidekiq/web'
Sidekiq::Web.use Rack::Auth::Basic do |username, password|
username == "sidekiqadmin" && password == "5529d99a"
end if Rails.env.production?
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment