Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
  • This project
    • Loading...
  • Sign in / Register
A
app_push
  • Overview
    • Overview
    • Details
    • Activity
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 0
    • Issues 0
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • ikcrm_server
  • app_push
  • Merge Requests
  • !2

Merged
Opened 5 years ago by Ghost User@ghost 
  • Report abuse
Report abuse

推送服务代码重构一期

Edited 5 years ago by Ghost User
Request to merge refactor/app_push into master

Merged by

The changes were merged into master

The source branch has been removed

  • Discussion 13
  • Commits 2
  • Changes 32
12/12 discussions resolved
  • Ghost User @ghost

    changed title from 推送服务代码重构 to 推送服务代码重构一期

    5 years ago

    changed title from 推送服务代码重构 to 推送服务代码重构一期

    changed title from **推送服务代码重构** to **推送服务代码重构{+一期+}**
    Toggle commit list
  • Ghost User @ghost added 1 commit 5 years ago

    added 1 commit

    • 570373c9 - 删除多余代码

    Compare with previous version

    added 1 commit * 570373c9 - 删除多余代码 [Compare with previous version](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=54380&start_sha=0f982532b72a34020d8243517c2bc9912002c2cd)
    Toggle commit list
  • Ghost User @ghost

    marked as a Work In Progress

    5 years ago

    marked as a Work In Progress

    marked as a **Work In Progress**
    Toggle commit list
  • Ghost User @ghost added 1 commit 5 years ago

    added 1 commit

    • 55871647 - 删除多余代码

    Compare with previous version

    added 1 commit * 55871647 - 删除多余代码 [Compare with previous version](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=54382&start_sha=570373c935e4fd540361ce6217117e22a513e5f2)
    Toggle commit list
  • Ghost User @ghost added 1 commit 5 years ago

    added 1 commit

    • 97beeb1d - 删除多余代码

    Compare with previous version

    added 1 commit * 97beeb1d - 删除多余代码 [Compare with previous version](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=54383&start_sha=55871647afa1f534ecd7b65df7acd370641bbf04)
    Toggle commit list
  • Ghost User @ghost added 1 commit 5 years ago

    added 1 commit

    • ae2c88d9 - change new

    Compare with previous version

    added 1 commit * ae2c88d9 - change new [Compare with previous version](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=54385&start_sha=97beeb1d3fe2c42f7cedff8fa85f95d2e258a136)
    Toggle commit list
  • 李福中
    @lifuzho started a discussion on an old version of the diff 5 years ago
    Resolved 5 years ago
    config/database.yml
    5 5 # gem 'sqlite3'
    • 李福中 @lifuzho commented 5 years ago
      Owner

      database.yml 不要直接放代码的项目里

      database.yml 不要直接放代码的项目里
    Please register or sign in to reply
  • 李福中
    @lifuzho started a discussion on an old version of the diff 5 years ago
    Resolved 5 years ago
    app/controllers/pushs_controller.rb
    21 21 # igetui_opts 个推推送的额外选项
    22 22 def push
    23 23 param! :app_name, String, required: true
    24 param! :device_ids_opts, String, required: true
    24 # param! :device_ids_opts, String, required: true
    25 25 param! :message, String, required: true
    26 26 param! :igetui_opts, String
    27 27 param! :app_type, String
    28 28 param! :sync_push, String
    29 param! :user_ids, Array, required: true
    29 30
    30 31 igetui_opts = JSON.parse(params[:igetui_opts]) rescue {}
    31 32 message = JSON.parse(params[:message]) rescue {}
    32 device_ids_opts = JSON.parse(params[:device_ids_opts]) rescue {}
    33 user_ids = JSON.parse(params[:user_ids]) rescue {}
    • 李福中 @lifuzho commented 5 years ago
      Owner

      前面已经校验了必填

      param! :user_ids, Array, required: true

      那

      user_ids = JSON.parse(params[:user_ids]) rescue {}

      这一行就是多余的了,并且 rescue 返回的类型最好也是 Array

      前面已经校验了必填 ```ruby param! :user_ids, Array, required: true ``` 那 ```ruby user_ids = JSON.parse(params[:user_ids]) rescue {} ``` 这一行就是多余的了,并且 `rescue` 返回的类型最好也是 `Array`
    • Ghost User @ghost

      changed this line in version 10 of the diff

      5 years ago

      changed this line in version 10 of the diff

      changed this line in [version 10 of the diff](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=54535&start_sha=5b382fc7ee8448c323104a67cbd4a9a3843e739b#153b115fdd072503a97b47d7d276f65bf1d19396_59_59)
      Toggle commit list
    Please register or sign in to reply
  • 李福中
    @lifuzho started a discussion on an old version of the diff 5 years ago
    Resolved 5 years ago
    app/services/push_sync_client.rb 0 → 100644
    12 end
    13
    14 def push_sync?
    15 if @sync_push
    16 timeout_seconds = $redis.get('push_timeout').to_i
    17 if timeout_seconds > 0
    18 Timeout.timeout(timeout_seconds) {
    19 ::PushWorker.new.perform(@opts)
    20 }
    21 else
    22 ::PushWorker.new.perform(@opts)
    23 end
    24 else
    25 ::PushWorker.perform_async(@opts)
    26 end
    27 end
    • 李福中 @lifuzho commented 5 years ago
      Owner

      以 ? 结尾的方法一般只是单纯返回 boolean 类型的值,可以把 push_sync? 方法里代码整个移动到 do_push 方法中去。

      以 `?` 结尾的方法一般只是单纯返回 `boolean` 类型的值,可以把 `push_sync?` 方法里代码整个移动到 `do_push` 方法中去。
    • Ghost User @ghost

      changed this line in version 6 of the diff

      5 years ago

      changed this line in version 6 of the diff

      changed this line in [version 6 of the diff](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=54529&start_sha=ae2c88d9e534f007e1279c78e6f52686a73e1eac#8bff7d6b19542ee5f4a80f5803195dee956bc9c8_27_0)
      Toggle commit list
    Please register or sign in to reply
  • Ghost User @ghost added 1 commit 5 years ago

    added 1 commit

    • f0ab7cbe - 重构

    Compare with previous version

    added 1 commit * f0ab7cbe - 重构 [Compare with previous version](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=54529&start_sha=ae2c88d9e534f007e1279c78e6f52686a73e1eac)
    Toggle commit list
  • Ghost User @ghost added 1 commit 5 years ago

    added 1 commit

    • 2e37142b - 代码重构

    Compare with previous version

    added 1 commit * 2e37142b - 代码重构 [Compare with previous version](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=54532&start_sha=f0ab7cbef35bbbe8d950104590a692b05fc2fe33)
    Toggle commit list
  • Ghost User @ghost added 1 commit 5 years ago

    added 1 commit

    • 496056de - 代码重构

    Compare with previous version

    added 1 commit * 496056de - 代码重构 [Compare with previous version](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=54533&start_sha=2e37142beddbbcb788c07b93c5258b3ca4838a3b)
    Toggle commit list
  • Ghost User @ghost added 1 commit 5 years ago

    added 1 commit

    • 5b382fc7 - 代码重构

    Compare with previous version

    added 1 commit * 5b382fc7 - 代码重构 [Compare with previous version](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=54534&start_sha=496056debd59b04fc007afa9a7d33e94797f0f7b)
    Toggle commit list
  • Ghost User @ghost added 1 commit 5 years ago

    added 1 commit

    • 04a739b7 - 代码重构

    Compare with previous version

    added 1 commit * 04a739b7 - 代码重构 [Compare with previous version](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=54535&start_sha=5b382fc7ee8448c323104a67cbd4a9a3843e739b)
    Toggle commit list
  • Ghost User @ghost

    resolved all discussions

    5 years ago

    resolved all discussions

    resolved all discussions
    Toggle commit list
  • Ghost User @ghost added 1 commit 5 years ago

    added 1 commit

    • 8c99f5c1 - 类型

    Compare with previous version

    added 1 commit * 8c99f5c1 - 类型 [Compare with previous version](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=54538&start_sha=04a739b7ab1875e3feb3e844d2e5f36a050001f8)
    Toggle commit list
  • Ghost User @ghost added 1 commit 5 years ago

    added 1 commit

    • 3a091d63 - 代码重构

    Compare with previous version

    added 1 commit * 3a091d63 - 代码重构 [Compare with previous version](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=54539&start_sha=8c99f5c1396e4dab54245033e629e1c4073b46c1)
    Toggle commit list
  • Ghost User @ghost added 1 commit 5 years ago

    added 1 commit

    • 04818c90 - 代码重构

    Compare with previous version

    added 1 commit * 04818c90 - 代码重构 [Compare with previous version](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=54540&start_sha=3a091d63e74e9451cb73c3df41fc1266a89facbe)
    Toggle commit list
  • Ghost User @ghost added 1 commit 5 years ago

    added 1 commit

    • 4b808a7d - 代码重构

    Compare with previous version

    added 1 commit * 4b808a7d - 代码重构 [Compare with previous version](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=54541&start_sha=04818c90561824500f4bca5f05f77b8e87fb56fb)
    Toggle commit list
  • Ghost User @ghost added 1 commit 5 years ago

    added 1 commit

    • f841c620 - 代码重构

    Compare with previous version

    added 1 commit * f841c620 - 代码重构 [Compare with previous version](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=54542&start_sha=4b808a7d1112269761fbeade015179c9f45d16f4)
    Toggle commit list
  • Ghost User @ghost added 1 commit 5 years ago

    added 1 commit

    • 6c656d79 - 代码重构

    Compare with previous version

    added 1 commit * 6c656d79 - 代码重构 [Compare with previous version](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=54543&start_sha=f841c6203c7344a183464e04676d802108f78d16)
    Toggle commit list
  • Ghost User @ghost added 1 commit 5 years ago

    added 1 commit

    • c141c79d - 代码重构

    Compare with previous version

    added 1 commit * c141c79d - 代码重构 [Compare with previous version](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=54547&start_sha=6c656d79cbf9209d52a71cc315021a2a125fab2b)
    Toggle commit list
  • Ghost User @ghost added 1 commit 5 years ago

    added 1 commit

    • 84bd3b77 - 代码重构

    Compare with previous version

    added 1 commit * 84bd3b77 - 代码重构 [Compare with previous version](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=54549&start_sha=c141c79d4d21606745b2761356f5aaabc456b812)
    Toggle commit list
  • Ghost User @ghost added 1 commit 5 years ago

    added 1 commit

    • 10fe0879 - add ignore

    Compare with previous version

    added 1 commit * 10fe0879 - add ignore [Compare with previous version](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=54553&start_sha=84bd3b776b01698fbcd463ed1968c6a2d046aad2)
    Toggle commit list
  • Ghost User @ghost added 1 commit 5 years ago

    added 1 commit

    • ee77a11a - 代码重构

    Compare with previous version

    added 1 commit * ee77a11a - 代码重构 [Compare with previous version](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=54556&start_sha=10fe08792b7c8d6d02b9824cfc05c3874ed370d9)
    Toggle commit list
  • Ghost User @ghost added 1 commit 5 years ago

    added 1 commit

    • 49bbe94d - change name

    Compare with previous version

    added 1 commit * 49bbe94d - change name [Compare with previous version](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=54599&start_sha=ee77a11a06cb08abfc8b95c593e24ac23b22ea88)
    Toggle commit list
  • Ghost User @ghost added 1 commit 5 years ago

    added 1 commit

    • 0386c4a0 - add whit_list

    Compare with previous version

    added 1 commit * 0386c4a0 - add whit_list [Compare with previous version](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=54600&start_sha=49bbe94de6d42993fd9fd422fca11b8090fdf889)
    Toggle commit list
  • Ghost User @ghost added 1 commit 5 years ago

    added 1 commit

    • 105b69ea - add pusher

    Compare with previous version

    added 1 commit * 105b69ea - add pusher [Compare with previous version](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=54601&start_sha=0386c4a081c691e68833324f50419f6d27a6a009)
    Toggle commit list
  • Ghost User @ghost added 3 commits 5 years ago

    added 3 commits

    • d3f6c0cd - bug
    • b3d25f2a - add logger
    • 6e731a60 - init pusher

    Compare with previous version

    added 3 commits * d3f6c0cd - bug * b3d25f2a - add logger * 6e731a60 - init pusher [Compare with previous version](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=55159&start_sha=105b69ea35332011e5cb707088761f020302c876)
    Toggle commit list
  • Ghost User @ghost added 1 commit 5 years ago

    added 1 commit

    • 7843d3f1 - mulit db

    Compare with previous version

    added 1 commit * 7843d3f1 - mulit db [Compare with previous version](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=55161&start_sha=6e731a603a4f0d60439a98834fefeb1fa9d87d61)
    Toggle commit list
  • Ghost User @ghost added 1 commit 5 years ago

    added 1 commit

    • 0228723f - change rails to 6.0.0

    Compare with previous version

    added 1 commit * 0228723f - change rails to 6.0.0 [Compare with previous version](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=55172&start_sha=7843d3f1639a11b54bb035733dc79ae260e49b37)
    Toggle commit list
  • Ghost User @ghost added 1 commit 5 years ago

    added 1 commit

    • 6e91099e - chenge gemfile.lock

    Compare with previous version

    added 1 commit * 6e91099e - chenge gemfile.lock [Compare with previous version](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=55173&start_sha=0228723f4ef1c3f9acecf8eb997570364dd85030)
    Toggle commit list
  • Ghost User @ghost added 1 commit 5 years ago

    added 1 commit

    • 054043ed - 自定义api controller

    Compare with previous version

    added 1 commit * 054043ed - 自定义api controller [Compare with previous version](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=55181&start_sha=6e91099ea524090285fec952ac134c94eea5826d)
    Toggle commit list
  • Ghost User @ghost added 1 commit 5 years ago

    added 1 commit

    • 98556222 - 项目重构

    Compare with previous version

    added 1 commit * 98556222 - 项目重构 [Compare with previous version](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=55186&start_sha=054043ed397da94ea1392c7b8d81534dbd3d97c7)
    Toggle commit list
  • Ghost User @ghost added 1 commit 5 years ago

    added 1 commit

    • af3f55fc - add db_role

    Compare with previous version

    added 1 commit * af3f55fc - add db_role [Compare with previous version](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=55187&start_sha=985562223d97bccabf3d5823dabdbcc13902bdfa)
    Toggle commit list
  • Ghost User @ghost added 1 commit 5 years ago

    added 1 commit

    • baaabb06 - ap only

    Compare with previous version

    added 1 commit * baaabb06 - ap only [Compare with previous version](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=55189&start_sha=af3f55fc918b394518ea7e4bee0c1c54e4b17cfa)
    Toggle commit list
  • 李福中
    @lifuzho started a discussion on an old version of the diff 5 years ago
    Resolved 5 years ago
    app/controllers/pushs_controller.rb
    18 # app_name 应用名称
    19 # user_device_ids 设备ids
    20 # message 推送信息的json 字符串
    21 # igetui_opts 个推推送的额外选项
    22 def push
    23 param! :app_name, String, required: true
    24 param! :device_ids_opts, String, required: true
    28
    29 igetui_opts = JSON.parse(params[:igetui_opts]) rescue {}
    30 message = JSON.parse(params[:message]) rescue {}
    31
    32 db_role = fetch_db_role
    33 user_device_exist = false
    34 ActiveRecord::Base.connected_to(role: db_role) do
    35 user_device_exist = UserDevice.where(user_id: params[:user_id]).exists?
    36 byebug
    • 李福中 @lifuzho commented 5 years ago
      Owner

      byebug 这行代码需要去掉

      `byebug` 这行代码需要去掉
    • Ghost User @ghost

      changed this line in version 33 of the diff

      5 years ago

      changed this line in version 33 of the diff

      changed this line in [version 33 of the diff](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=55555&start_sha=baaabb0678769341fa4a337840485de5b97ec3f4#153b115fdd072503a97b47d7d276f65bf1d19396_36_35)
      Toggle commit list
    Please register or sign in to reply
  • 李福中
    @lifuzho started a discussion on an old version of the diff 5 years ago
    Resolved 5 years ago
    app/controllers/pushs_controller.rb
    19 # user_device_ids 设备ids
    20 # message 推送信息的json 字符串
    21 # igetui_opts 个推推送的额外选项
    22 def push
    23 param! :app_name, String, required: true
    24 param! :device_ids_opts, String, required: true
    28
    29 igetui_opts = JSON.parse(params[:igetui_opts]) rescue {}
    30 message = JSON.parse(params[:message]) rescue {}
    31
    32 db_role = fetch_db_role
    33 user_device_exist = false
    34 ActiveRecord::Base.connected_to(role: db_role) do
    35 user_device_exist = UserDevice.where(user_id: params[:user_id]).exists?
    36 byebug
    37 stale?(last_modified: UserDevice.where(user_id: params[:user_id]).last.updated_at)
    • 李福中 @lifuzho commented 5 years ago
      Owner

      stale?(last_modified: UserDevice.where(user_id: params[:user_id]).last.updated_at) 这行代码写在这里是什么意思呢? 一般http缓存设置会写在方法的最后一行。

      `stale?(last_modified: UserDevice.where(user_id: params[:user_id]).last.updated_at)` 这行代码写在这里是什么意思呢? 一般http缓存设置会写在方法的最后一行。
    • Ghost User @ghost

      changed this line in version 33 of the diff

      5 years ago

      changed this line in version 33 of the diff

      changed this line in [version 33 of the diff](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=55555&start_sha=baaabb0678769341fa4a337840485de5b97ec3f4#153b115fdd072503a97b47d7d276f65bf1d19396_37_35)
      Toggle commit list
    Please register or sign in to reply
  • 李福中
    @lifuzho started a discussion on the diff 5 years ago
    Resolved 5 years ago
    app/services/token.rb → app/controllers/concerns/token_validate.rb
    1 module Token
    1 module TokenValidate
    2 extend ActiveSupport::Concern
    2 3 ACCESS_TOEKN_EXPIRE_TIME = 7200
    3 class << self
    4 def key(app_name)
    5 "push:api:#{app_name}:access_token"
    6 end
    4
    5 def validate_token(app_name, token)
    6 !! (token == get_token(app_name))
    • 李福中 @lifuzho commented 5 years ago
      Owner

      !! 这个完全没必要吧? 如果方法返回 boolean 的话,一般以问题结尾。

      `!!` 这个完全没必要吧? 如果方法返回 boolean 的话,一般以问题结尾。
    Please register or sign in to reply
  • 李福中
    @lifuzho started a discussion on an old version of the diff 5 years ago
    Resolved 5 years ago
    app/controllers/pushs_controller.rb
    1 1 class PushsController < ApplicationController
    2 2 include ActionController::HttpAuthentication::Token
    3 skip_before_action :verify_authenticity_token
    3 # skip_before_action :verify_authenticity_token
    • 李福中 @lifuzho commented 5 years ago
      Owner

      不是很明白,为什么 skip_before_action :verify_authenticity_token 这一行可以注释了。

      校验 user_device_exist 这个可以写在 before_action 里。

      不是很明白,为什么 `skip_before_action :verify_authenticity_token` 这一行可以注释了。 校验 `user_device_exist` 这个可以写在 `before_action` 里。
    • Ghost User @ghost

      changed this line in version 33 of the diff

      5 years ago

      changed this line in version 33 of the diff

      changed this line in [version 33 of the diff](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=55555&start_sha=baaabb0678769341fa4a337840485de5b97ec3f4#153b115fdd072503a97b47d7d276f65bf1d19396_3_3)
      Toggle commit list
    Please register or sign in to reply
  • John Shannon
    @jianghe started a discussion on an old version of the diff 5 years ago
    Resolved 5 years ago
    app/services/push_tool_client.rb 0 → 100644
    1 #push功能的代理选择用哪种推送工具1.个推 2.小米 3.华为
    2 class PushToolClient
    3
    4 def initialize(opts={})
    5 opts = HashWithIndifferentAccess.new(opts)
    6 @user_ids = opts[:user_ids]
    7 @opts = opts
    8 end
    9
    10 def do_push
    11 Settings.platform = @opts[:app_type] || Settings::DEFAULT
    • John Shannon @jianghe commented 5 years ago
      Master

      这里会覆盖掉全局变量,是不是用一个局部变量代替更好

      这里会覆盖掉全局变量,是不是用一个局部变量代替更好
    • Ghost User @ghost

      changed this line in version 34 of the diff

      5 years ago

      changed this line in version 34 of the diff

      changed this line in [version 34 of the diff](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=58109&start_sha=9f860ac473802b3b35e3d1991d22e6aa1a774e8d#ff47e4a3d724eacc7839a10b412c3a0226710442_11_11)
      Toggle commit list
    Please register or sign in to reply
  • Ghost User @ghost added 1 commit 5 years ago

    added 1 commit

    • 9f860ac4 - 向下兼容

    Compare with previous version

    added 1 commit * 9f860ac4 - 向下兼容 [Compare with previous version](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=55555&start_sha=baaabb0678769341fa4a337840485de5b97ec3f4)
    Toggle commit list
  • 于子洵
    @yuzixun started a discussion on an old version of the diff 5 years ago
    Resolved 5 years ago
    app/models/user_device.rb 0 → 100644
    1 class UserDevice < ApplicationRecord
    2 self.table_name = 'user_devices'
    3 connects_to database: { dev: :dev_development, test: :test_development, staging: :staging_development, production: :production }
    4
    5
    6 # 当前app端传递的platform的值:
    7 # android: igetui, xiaomi, huawei
    8 # iso: igetui 目前还不清楚为啥不用apns,暂时不修改
    9 enum platform: %i[igetui apns xiaomi huawei]
    10
    11 enum device_platform: %i[ios android]
    12
    13 # 用于区分当前的应用,为了推送准备, 因为推送需要根据不同的应用使用不同的 id,secret等。
    14 enum app_type: %i[ik_duli lx_duli lx_yun]
    • 于子洵 @yuzixun commented 5 years ago

      还有爱客云

      还有爱客云
    • Ghost User @ghost

      changed this line in version 34 of the diff

      5 years ago

      changed this line in version 34 of the diff

      changed this line in [version 34 of the diff](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=58109&start_sha=9f860ac473802b3b35e3d1991d22e6aa1a774e8d#84f143fb80847cf236f1ff1b4de76d98425d7c27_14_11)
      Toggle commit list
    Please register or sign in to reply
  • 于子洵
    @yuzixun started a discussion on the diff 5 years ago
    Resolved 5 years ago
    app/services/push_tool_client.rb 0 → 100644
    15 Igetui::Pusher.new(igetui_ios_client_ids, @opts.merge(device_platform: 'ios')).perform if igetui_ios_client_ids.present?
    16
    17 #现在好像不用了
    18 # Push::IgetuiIos.push(@push_collections[:igetui_ios], @opts) if @push_collections[:apns].present?
    19 # Push::IgetuiAndroid.push(@push_collections[:igetui_android], @opts) if @push_collections[:apns].present?
    20
    21 Xiaomi::Pusher.new(xiaomi_client_ids, @opts[:message]).perform if xiaomi_client_ids.present?
    22 Huawei::Pusher.new(huawei_client_ids, @opts[:message]).perform if huawei_client_ids.present?
    23 end
    24
    25 def fetch_client_ids
    26 igetui_android_client_ids = igetui_ios_client_ids = xiaomi_client_ids = huawei_client_ids = []
    27
    28 if (@opts[:device_ids_opts].is_a? Hash) && @user_ids.blank?
    29 push_devices = @opts[:device_ids_opts].keys.map(&:to_s)
    30 if push_devices.include? "igetui"
    • 于子洵 @yuzixun commented 5 years ago

      用这个方法Hash#key?(key)是不是更好?

      用这个方法`Hash#key?(key)`是不是更好?
    Please register or sign in to reply
  • 于子洵
    @yuzixun started a discussion on the diff 5 years ago
    Resolved 5 years ago
    app/workers/push_worker.rb
    2 2 include Sidekiq::Worker
    3 3 sidekiq_options queue: :push
    4 4
    5 def perform(device_ids_opts, message, igetui_opts, platform = nil)
    6 Push.push(device_ids_opts, message, igetui_opts, platform)
    5 def perform(opts)
    • 于子洵 @yuzixun commented 5 years ago

      如果发布前,队列里面有任务没有执行完。发布后,再次执行的时候,会报错吧?这种情况可以接受吗?

      如果发布前,队列里面有任务没有执行完。发布后,再次执行的时候,会报错吧?这种情况可以接受吗?
    • Ghost User @ghost commented 5 years ago

      看过线上队列机会没有积压

      看过线上队列机会没有积压
    Please register or sign in to reply
  • 于子洵
    @yuzixun started a discussion on the diff 5 years ago
    Resolved 5 years ago
    app/services/push/huawei.rb → app/services/huawei/pusher.rb
    58 end
    59 params_str
    52 }
    53 ::Log.info("huawei_payload: #{payload}, device_tokens: #{device_tokens}")
    54 params = {
    55 access_token: CGI.escape(access_token),
    56 nsp_svc: CGI.escape('openpush.message.api.send'),
    57 nsp_ts: CGI.escape(Time.now.to_i.to_s),
    58 device_token_list: CGI.escape(device_tokens.to_s),
    59 payload: CGI.escape(payload.to_json)
    60 }
    61 params_str = ''
    62 params.each_with_index do |(key,value), index|
    63 params_str += "#{key}=#{value}"
    64 params_str += '&' if index + 1 < params.size
    60 65 end
    • 于子洵 @yuzixun commented 5 years ago

      可以用Hash#to_param

      params.to_param

      Edited 5 years ago by 于子洵
      可以用`Hash#to_param` `params.to_param`
    Please register or sign in to reply
  • Ghost User @ghost

    resolved all discussions

    5 years ago

    resolved all discussions

    resolved all discussions
    Toggle commit list
  • Ghost User @ghost added 3 commits 5 years ago

    added 3 commits

    • 9f860ac4...5b2d80ce - 2 commits from branch master
    • 9f0ae753 - 项目重构

    Compare with previous version

    added 3 commits * 9f860ac4...5b2d80ce - 2 commits from branch `master` * 9f0ae753 - 项目重构 [Compare with previous version](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=58109&start_sha=9f860ac473802b3b35e3d1991d22e6aa1a774e8d)
    Toggle commit list
  • Ghost User @ghost added 2 commits 5 years ago

    added 2 commits

    • 41b1d714 - change master branch
    • 8bbf7858 - change migration

    Compare with previous version

    added 2 commits * 41b1d714 - change master branch * 8bbf7858 - change migration [Compare with previous version](http://gitlab.ikcrm.com/ikcrm_server/app_push/merge_requests/2/diffs?diff_id=58110&start_sha=9f0ae7539e75d1f3dc485a7a4306cbab4be0e65c)
    Toggle commit list
  • Ghost User @ghost

    unmarked as a Work In Progress

    5 years ago

    unmarked as a Work In Progress

    unmarked as a **Work In Progress**
    Toggle commit list
  • Ghost User @ghost

    mentioned in commit dd40de65

    5 years ago

    mentioned in commit dd40de65

    mentioned in commit dd40de65ba89828d08a8631f9453b89a5755b007
    Toggle commit list
  • Ghost User @ghost

    merged

    5 years ago

    merged

    merged
    Toggle commit list
  • Write
  • Preview
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
  • Write
  • Preview
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 sign in to comment
李福中
Assignee
李福中 @lifuzho
Assign to
None
Milestone
None
Assign milestone
None
Time tracking
No estimate or time spent
0
Labels
None
Assign labels
  • View labels
4
4 participants
Reference: ikcrm_server/app_push!2
×

Revert this merge request

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.
×

Cherry-pick this merge request

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.