Commit ddb1aa07 by 李福中

Add sync_push options

parent 4c671d66
......@@ -25,13 +25,20 @@ class PushsController < ApplicationController
param! :message, String, required: true
param! :igetui_opts, String
param! :app_type, String
param! :sync_push, String
igetui_opts = JSON.parse(params[:igetui_opts]) rescue {}
message = JSON.parse(params[:message]) rescue {}
device_ids_opts = JSON.parse(params[:device_ids_opts]) rescue {}
token = token_and_options(request).first
if token == Token.token(params[:app_name])
if params.has_key?(:sync_push)
Timeout.timeout(3) {
::PushWorker.new.perform(device_ids_opts, message, igetui_opts, params[:app_type])
}
else
::PushWorker.perform_async(device_ids_opts, message, igetui_opts, params[:app_type])
end
render json: { code: 0, message: 'success', describe: '异步任务正在处理'}
else
render json: { code: -1, message: 'token 错误/过期'}
......
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