rails_wechat 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/app/apis/wechat/api/program/wxa.rb +15 -0
  3. data/app/apis/wechat/signature.rb +5 -1
  4. data/app/controllers/wechat/admin/apps_controller.rb +6 -4
  5. data/app/controllers/wechat/admin/wechat_users_controller.rb +1 -1
  6. data/app/controllers/wechat/controller/application.rb +2 -2
  7. data/app/controllers/wechat/my/users_controller.rb +1 -5
  8. data/app/controllers/wechat/panel/template_configs_controller.rb +0 -12
  9. data/app/controllers/wechat/platforms_controller.rb +1 -1
  10. data/app/controllers/wechat/program_users_controller.rb +16 -15
  11. data/app/controllers/wechat/wechat_controller.rb +1 -1
  12. data/app/controllers/wechat/wechats_controller.rb +2 -2
  13. data/app/helpers/wechat/application_helper.rb +31 -0
  14. data/app/jobs/wechat/ticket_clean_job.rb +9 -0
  15. data/app/models/oauth_user/wechat/wechat_user.rb +6 -0
  16. data/app/models/wechat/ext/member.rb +21 -0
  17. data/app/models/wechat/ext/organ.rb +1 -1
  18. data/app/models/wechat/ext/user.rb +2 -2
  19. data/app/models/wechat/ext/user_tag.rb +1 -1
  20. data/app/models/wechat/model/app/public_app.rb +3 -4
  21. data/app/models/wechat/model/app.rb +8 -4
  22. data/app/models/wechat/model/menu/click_menu.rb +1 -6
  23. data/app/models/wechat/model/menu/mini_program_menu.rb +1 -6
  24. data/app/models/wechat/model/menu/scan_push_menu.rb +1 -6
  25. data/app/models/wechat/model/menu/scan_wait_menu.rb +1 -6
  26. data/app/models/wechat/model/menu/view_menu.rb +1 -2
  27. data/app/models/wechat/model/menu.rb +1 -2
  28. data/app/models/wechat/model/oauth_user/program_user.rb +6 -4
  29. data/app/models/wechat/model/oauth_user/wechat_user.rb +26 -15
  30. data/app/models/wechat/model/receive.rb +2 -3
  31. data/app/models/wechat/model/reply/news_reply.rb +4 -0
  32. data/app/models/wechat/model/reply/success_reply.rb +4 -0
  33. data/app/models/wechat/model/reply.rb +4 -0
  34. data/app/models/wechat/model/request.rb +40 -7
  35. data/app/models/wechat/model/scene.rb +17 -4
  36. data/app/models/wechat/model/tag.rb +1 -1
  37. data/app/models/wechat/model/template_config/template_public.rb +1 -1
  38. data/app/models/wechat/model/template_config.rb +2 -0
  39. data/app/models/wechat/model/ticket.rb +5 -0
  40. data/app/models/wechat/model/user_tag.rb +2 -6
  41. data/app/views/admin/_wechat_nav.html.erb +2 -2
  42. data/app/views/application/_wx_open_subscribe.html.erb +15 -0
  43. data/app/views/my/_wechat_nav.html+phone.erb +2 -2
  44. data/app/views/panel/_wechat_nav.html.erb +2 -2
  45. data/app/views/wechat/admin/apps/_form.html.erb +1 -0
  46. data/app/views/wechat/admin/apps/_index_tbody.html.erb +4 -16
  47. data/app/views/wechat/admin/apps/_index_thead.html.erb +5 -2
  48. data/app/views/wechat/admin/apps/_index_tr.html.erb +27 -7
  49. data/app/views/wechat/admin/apps/_pay_form.html.erb +10 -7
  50. data/app/views/wechat/admin/apps/edit_cert.html.erb +2 -2
  51. data/app/views/wechat/admin/apps/edit_pay.html.erb +3 -0
  52. data/app/views/wechat/admin/apps/update_cert.turbo_stream.erb +3 -0
  53. data/app/views/wechat/admin/{menus → base}/_breadcrumb.html.erb +1 -0
  54. data/app/views/wechat/admin/base/_wechat_nav_user.html.erb +0 -8
  55. data/app/views/wechat/admin/extractors/_form.html.erb +2 -2
  56. data/app/views/wechat/admin/menus/_button.html.erb +3 -3
  57. data/app/views/wechat/admin/menus/_index_tbody.html.erb +2 -2
  58. data/app/views/wechat/admin/menus/_index_tr.html.erb +3 -3
  59. data/app/views/wechat/admin/registers/_button.html.erb +1 -1
  60. data/app/views/wechat/admin/registers/_index_tbody.html.erb +3 -3
  61. data/app/views/wechat/admin/registers/_index_tr.html.erb +6 -6
  62. data/app/views/wechat/admin/replies/_index_tbody.html.erb +2 -2
  63. data/app/views/wechat/admin/requests/_button.html.erb +1 -1
  64. data/app/views/wechat/admin/requests/_index_tr.html.erb +2 -2
  65. data/app/views/wechat/admin/responses/_index_tbody.html.erb +1 -1
  66. data/app/views/wechat/admin/responses/_index_thead.html.erb +1 -1
  67. data/app/views/wechat/admin/responses/_index_tr.html.erb +4 -4
  68. data/app/views/wechat/admin/responses/_show_table.html.erb +1 -1
  69. data/app/views/wechat/admin/tags/_button.html.erb +2 -2
  70. data/app/views/wechat/admin/tags/_index_tr.html.erb +3 -3
  71. data/app/views/wechat/admin/tags/index.html.erb +1 -0
  72. data/app/views/wechat/admin/templates/_button.html.erb +1 -1
  73. data/app/views/wechat/admin/templates/sync.turbo_stream.erb +3 -0
  74. data/app/views/wechat/admin/wechat_users/_filter_form.html.erb +2 -1
  75. data/app/views/wechat/admin/wechat_users/_index_tbody.html.erb +7 -1
  76. data/app/views/wechat/admin/wechat_users/_index_thead.html.erb +1 -1
  77. data/app/views/wechat/apps/login.html.erb +4 -1
  78. data/app/views/wechat/my/registers/_wechat_register.html.erb +3 -3
  79. data/app/views/wechat/my/registers/_wechat_register_done.html.erb +1 -1
  80. data/app/views/wechat/my/registers/index.html+phone.erb +1 -1
  81. data/app/views/wechat/my/registers/index.html.erb +4 -4
  82. data/app/views/wechat/my/subscribes/index.html.erb +4 -4
  83. data/app/views/wechat/my/users/_request.html.erb +26 -0
  84. data/app/views/wechat/my/users/invite_qrcode.html+phone.erb +4 -23
  85. data/app/views/wechat/panel/apps/_index_tbody.html.erb +4 -4
  86. data/app/views/wechat/panel/apps/_index_tr.html.erb +3 -3
  87. data/app/views/wechat/panel/menus/_button.html.erb +2 -2
  88. data/app/views/wechat/panel/menus/_index_tbody.html.erb +2 -2
  89. data/app/views/wechat/panel/menus/_index_tr.html.erb +3 -3
  90. data/app/views/wechat/panel/platforms/_index_tr.html.erb +5 -5
  91. data/app/views/wechat/share/apps/_index_tbody.html.erb +3 -3
  92. data/app/views/wechat/share/apps/_index_tr.html.erb +1 -1
  93. data/app/views/wechat/share/menus/_button.html.erb +3 -3
  94. data/app/views/wechat/share/menus/_index_tbody.html.erb +3 -3
  95. data/app/views/wechat/share/menus/_index_tr.html.erb +3 -3
  96. data/app/views/wechat/share/scenes/_index_tr.html.erb +6 -6
  97. data/app/views/wechat/share/wechat_users/_index_tr.html.erb +2 -2
  98. data/config/locales/zh.controller.yml +4 -0
  99. data/config/locales/zh.enum.yml +4 -3
  100. data/config/routes.rb +2 -2
  101. data/lib/rails_wechat/config.rb +6 -9
  102. data/lib/rails_wechat.rb +0 -1
  103. metadata +36 -19
  104. data/app/jobs/wechat/user_tag_remove_job.rb +0 -11
  105. data/app/views/wechat/admin/requests/_breadcrumb.html.erb +0 -7
  106. data/app/views/wechat/admin/templates/_breadcrumb.html.erb +0 -7
  107. data/app/views/wechat/my/users/requests.html+phone.erb +0 -53
  108. data/lib/rails_wechat/helpers.rb +0 -32
@@ -20,5 +20,9 @@ module Wechat
20
20
  }
21
21
  end
22
22
 
23
+ def has_content?
24
+ content[:Articles].present?
25
+ end
26
+
23
27
  end
24
28
  end
@@ -5,5 +5,9 @@ module Wechat
5
5
  {}
6
6
  end
7
7
 
8
+ def has_content?
9
+ true
10
+ end
11
+
8
12
  end
9
13
  end
@@ -22,6 +22,10 @@ module Wechat
22
22
  self
23
23
  end
24
24
 
25
+ def has_content?
26
+ value.present?
27
+ end
28
+
25
29
  def content
26
30
  {}
27
31
  end
@@ -27,7 +27,6 @@ module Wechat
27
27
  has_many :extractions, -> { order(id: :asc) }, dependent: :delete_all, inverse_of: :request # 解析 request body 内容,主要针对文字
28
28
  has_many :responses, ->(o){ default_where('request_types-any': o.type) }, foreign_key: :appid, primary_key: :appid
29
29
 
30
- before_save :generate_wechat_user, if: -> { open_id_changed? && open_id.present? }
31
30
  after_create :get_reply!
32
31
  end
33
32
 
@@ -39,6 +38,34 @@ module Wechat
39
38
  }.compact
40
39
  end
41
40
 
41
+ def reply_params
42
+ if wechat_user.attributes['name'].blank?
43
+ {
44
+ appid: appid,
45
+ news_reply_items_attributes: [
46
+ {
47
+ title: '请绑定',
48
+ description: '授权您的信息',
49
+ url: app.oauth2_url
50
+ }
51
+ ]
52
+ }
53
+ elsif wechat_user.user.blank?
54
+ {
55
+ appid: appid,
56
+ news_reply_items_attributes: [
57
+ {
58
+ title: '请绑定',
59
+ description: '绑定信息',
60
+ url: Rails.application.routes.url_for(controller: 'auth/sign', action: 'sign', uid: open_id, host: app.host)
61
+ }
62
+ ]
63
+ }
64
+ else
65
+ {}
66
+ end
67
+ end
68
+
42
69
  def reply_from_rule
43
70
  filtered = RailsWechat.config.rules.find do |_, rule|
44
71
  if rule.slice(:msg_type, :event, :event_key) <= self.rule_tag && rule[:body]
@@ -47,8 +74,11 @@ module Wechat
47
74
  end
48
75
 
49
76
  if filtered.present?
50
- logger.debug " -----> Filter Key: #{filtered[1]}"
51
- filtered[1][:proc].call(self)
77
+ logger.debug "\e[35m Filter Key: #{filtered[1]} \e[0m"
78
+ r = filtered[1][:proc].call(self)
79
+ if r.has_content?
80
+ r
81
+ end
52
82
  end
53
83
  end
54
84
 
@@ -68,13 +98,16 @@ module Wechat
68
98
  app.api.message_custom_typing(wechat_user.uid, command)
69
99
  end
70
100
 
71
- def bind_url
72
- Rails.application.routes.url_for(controller: 'auth/sign', action: 'sign', request_id: id, uid: open_id, host: app.host)
73
- end
74
-
75
101
  def generate_wechat_user
76
102
  wechat_user || build_wechat_user
77
103
  wechat_user.appid = appid
104
+ if ['SCAN', 'subscribe'].include?(event)
105
+ if body.to_s.start_with?('invite_by_')
106
+ wechat_user.user_inviter_id = body.delete_prefix('invite_by_')
107
+ elsif body.to_s.start_with? 'invite_member_'
108
+ wechat_user.member_inviter_id = body.delete_prefix('invite_member_')
109
+ end
110
+ end
78
111
 
79
112
  if wechat_user.new_record?
80
113
  self.init_wechat_user = true
@@ -17,7 +17,7 @@ module Wechat
17
17
 
18
18
  has_one :response, ->(o){ where(match_value: o.match_value) }, primary_key: :appid, foreign_key: :appid
19
19
  has_one :tag, ->(o){ where(name: o.match_value) }, primary_key: :appid, foreign_key: :appid
20
- has_many :scene_menus, dependent: :destroy
20
+ has_many :scene_menus, dependent: :destroy_async
21
21
  has_many :menus, through: :scene_menus
22
22
 
23
23
  before_validation do
@@ -48,16 +48,29 @@ module Wechat
48
48
  alias_method :qrcode_file_url, :qrcode_data_url
49
49
 
50
50
  def commit_to_wechat
51
+ if ['Wechat::PublicApp', 'Wechat::ReadApp'].include? app.type
52
+ get_public_qrcode
53
+ elsif ['Wechat::ProgramApp'].include? app.type
54
+ get_program_qrcode
55
+ end
56
+
57
+ self.save
58
+ self
59
+ end
60
+
61
+ def get_public_qrcode
51
62
  if expire_seconds
52
63
  r = app.api.qrcode_create_scene self.match_value, expire_seconds
53
64
  else
54
65
  r = app.api.qrcode_create_limit_scene self.match_value
55
66
  end
56
-
57
67
  self.qrcode_ticket = r['ticket']
58
68
  self.qrcode_url = r['url']
59
- self.save
60
- r
69
+ end
70
+
71
+ def get_program_qrcode
72
+ r = app.api.generate_url
73
+ self.qrcode_url = r['url_link']
61
74
  end
62
75
 
63
76
  def expired?(time = Time.current)
@@ -13,7 +13,7 @@ module Wechat
13
13
  belongs_to :tagging, polymorphic: true, optional: true
14
14
  belongs_to :app, foreign_key: :appid, primary_key: :appid
15
15
  belongs_to :user_tag, optional: true
16
- has_many :user_tags, ->(o){ where(tag_name: o.name) }, primary_key: :appid, foreign_key: :appid, dependent: :destroy
16
+ has_many :user_tags, ->(o){ where(tag_name: o.name) }, primary_key: :appid, foreign_key: :appid, dependent: :destroy_async
17
17
  has_many :wechat_users, through: :user_tags
18
18
  has_many :requests, ->(o){ where(type: ['Wechat::ScanRequest', 'Wechat::SubscribeRequest'], body: o.name).order(id: :desc) }, foreign_key: :appid, primary_key: :appid
19
19
 
@@ -14,7 +14,7 @@ module Wechat
14
14
  r
15
15
  end
16
16
 
17
- def sync_key_words(app = WechatPublic.default)
17
+ def sync_key_words
18
18
  if tid.present? && app
19
19
  template = app.api.templates.find { |i| i['template_id'] == tid }
20
20
  if template.blank?
@@ -10,9 +10,11 @@ module Wechat
10
10
  attribute :notifiable_type, :string
11
11
  attribute :code, :string, default: 'default'
12
12
  attribute :content, :string
13
+ attribute :appid, :string
13
14
 
14
15
  validates :code, uniqueness: { scope: :notifiable_type }
15
16
 
17
+ belongs_to :app, foreign_key: :appid, primary_key: :appid, optional: true
16
18
  has_many :template_key_words, -> { order(position: :asc) }, inverse_of: :template_config, dependent: :delete_all
17
19
  has_many :templates, dependent: :nullify
18
20
  accepts_nested_attributes_for :template_key_words
@@ -13,6 +13,7 @@ module Wechat
13
13
  belongs_to :platform, foreign_key: :appid, primary_key: :appid, optional: true
14
14
 
15
15
  after_create_commit :parsed_data, if: -> { platform.present? }
16
+ after_create_commit :clean_last
16
17
  end
17
18
 
18
19
  def parsed_data
@@ -24,5 +25,9 @@ module Wechat
24
25
  data
25
26
  end
26
27
 
28
+ def clean_last
29
+ TicketCleanJob.perform_later(self)
30
+ end
31
+
27
32
  end
28
33
  end
@@ -13,17 +13,13 @@ module Wechat
13
13
  belongs_to :user_tagged, optional: true
14
14
 
15
15
  after_create_commit :sync_create_later
16
- after_destroy_commit :remove_from_wechat_later
16
+ after_destroy_commit :remove_from_wechat
17
17
  end
18
18
 
19
19
  def sync_create_later
20
20
  UserTagJob.perform_later(self)
21
21
  end
22
22
 
23
- def remove_from_wechat_later
24
- UserTagRemoveJob.perform_later(self)
25
- end
26
-
27
23
  def sync_to_wechat
28
24
  if wechat_api
29
25
  wechat_api.tag_add_user(tag.tag_id, wechat_user.uid)
@@ -35,7 +31,7 @@ module Wechat
35
31
  end
36
32
 
37
33
  def remove_from_wechat
38
- wechat_api.tag_del_user(tag.tag_id, wechat_user.uid) if wechat_api
34
+ wechat_api.tag_del_user(tag.tag_id, open_id) if wechat_api
39
35
  end
40
36
 
41
37
  end
@@ -4,8 +4,8 @@
4
4
  <%= link_to t('wechat.share.apps.index.title'), { controller: 'wechat/share/apps' }, class: active_helper(controllers: ['wechat/share/apps', 'wechat/share/menus', 'wechat/share/scenes', 'wechat/share/wechat_users'], active: 'is-active') %>
5
5
  <% end %>
6
6
  <a class="menu-label" data-action="menu#toggle">
7
- <i class="fab fa-weixin"></i>
7
+ <i class="fa-brands fa-weixin"></i>
8
8
  <span><%= t('wechat.admin.title') %></span>
9
- <i class="fas dropdown"></i>
9
+ <i class="fa-solid dropdown"></i>
10
10
  </a>
11
11
  </div>
@@ -0,0 +1,15 @@
1
+ <wx-open-subscribe template="TenvU22BA1jCp4YHfYEpRuESXYReQyDuhs4vbdWA99I" id="subscribe-btn">
2
+ <script type="text/wxtag-template" slot="style">
3
+ <style>
4
+ .subscribe-btn {
5
+ color: #fff;
6
+ background-color: #07c160;
7
+ }
8
+ </style>
9
+ </script>
10
+ <script type="text/wxtag-template">
11
+ <button class="subscribe-btn">
12
+ 一次性模版消息订阅
13
+ </button>
14
+ </script>
15
+ </wx-open-subscribe>
@@ -3,8 +3,8 @@
3
3
  <%= link_to t('wechat.panel.template_configs.index.title'), panel_template_configs_path, class: active_helper(controllers: 'template_configs', active: 'is-active') -%>
4
4
  <% end %>
5
5
  <a class="menu-label" data-action="menu#toggle">
6
- <i class="fab fa-weixin"></i>
6
+ <i class="fa-brands fa-weixin"></i>
7
7
  <span><%= t('wechat.panel.title') %></span>
8
- <i class="fas dropdown"></i>
8
+ <i class="fa-light dropdown"></i>
9
9
  </a>
10
10
  </div>
@@ -6,8 +6,8 @@
6
6
  <%= link_to t('wechat.panel.apps.index.title'), { controller: 'wechat/panel/apps' }, class: active_helper(controllers: 'apps', active: 'is-active') -%>
7
7
  <% end %>
8
8
  <a class="menu-label" data-action="menu#toggle">
9
- <i class="fab fa-weixin"></i>
9
+ <i class="fa-brands fa-weixin"></i>
10
10
  <span><%= t('wechat.panel.title') %></span>
11
- <i class="fas dropdown"></i>
11
+ <i class="fa-solid dropdown"></i>
12
12
  </a>
13
13
  </div>
@@ -4,3 +4,4 @@
4
4
  <%= f.text_field :appid %>
5
5
  <%= f.text_field :secret %>
6
6
  <%= f.check_box :encrypt_mode %>
7
+ <%= f.text_field :domain %>
@@ -41,21 +41,9 @@
41
41
  <%= f.check_box :enabled, data: { input_target: 'checkbox' }, id: nil, class: 'switch is-rounded' %>
42
42
  <label data-action="click->input#check"></label>
43
43
  <% end %>
44
- </td>
45
- <td>
46
- <%= link_to({ controller: 'menus', app_id: model.id }, aria: { label: t('wechat.admin.menus.index.title') }, class: 'button is-small is-rounded is-light') do %>
47
- <i class="fas fa-bars"></i>
48
- <% end %>
49
- <%= link_to({ controller: 'responses', app_id: model.id }, aria: { label: t('wechat.admin.responses.index.title') }, class: 'button is-small is-rounded is-light') do %>
50
- <i class="fas fa-reply-all"></i>
51
- <% end %>
52
- <%= link_to({ controller: 'requests', app_id: model.id }, aria: { label: t('wechat.admin.requests.index.title') }, class: 'button is-small is-rounded is-light') do %>
53
- <i class="fas fa-comments"></i>
54
- <% end %>
55
- <%= link_to({ controller: 'tags', app_id: model.id }, aria: { label: t('wechat.admin.tags.index.title') }, class: 'button is-small is-rounded is-light') do %>
56
- <i class="fas fa-user-tag"></i>
57
- <% end %>
58
- <%= link_to({ controller: 'templates', app_id: model.id }, aria: { label: t('wechat.admin.templates.index.title') }, class: 'button is-small is-rounded is-light') do %>
59
- <i class="fas fa-inbox"></i>
44
+ <%= form_with theme: nil, model: model, scope: :app, url: { action: 'update', id: model.id }, data: { controller: 'input' } do |f| %>
45
+ <%= f.check_box :inviting, data: { input_target: 'checkbox' }, id: nil, class: 'switch is-rounded' %>
46
+ <label data-action="click->input#check"></label>
60
47
  <% end %>
61
48
  </td>
49
+ <td><%= model.domain %></td>
@@ -2,6 +2,9 @@
2
2
  <th><%= Wechat::App.human_attribute_name(:name) %></th>
3
3
  <th></th>
4
4
  <th><%= Wechat::App.human_attribute_name(:encrypt_mode) %></th>
5
- <th><%= Wechat::App.human_attribute_name(:enabled) %></th>
6
- <th></th>
5
+ <th>
6
+ <p><%= Wechat::App.human_attribute_name(:enabled) %></p>
7
+ <p><%= Wechat::App.human_attribute_name(:inviting) %></p>
8
+ </th>
9
+ <th><%= Wechat::App.human_attribute_name(:domain) %></th>
7
10
  <th></th>
@@ -1,22 +1,42 @@
1
1
  <tr id="tr_<%= model.id %>" data-controller="show" data-action="mouseenter->show#show mouseleave->show#hide">
2
2
  <%= yield %>
3
3
  <td>
4
- <span data-show-target="item" style="visibility: hidden">
4
+ <div data-show-target="item" style="visibility: hidden">
5
+ <%= link_to({ controller: 'menus', app_id: model.id }, aria: { label: t('wechat.admin.menus.index.title') }, class: 'button is-small is-rounded is-light') do %>
6
+ <i class="fa-light fa-bars"></i>
7
+ <% end %>
8
+ <%= link_to({ controller: 'responses', app_id: model.id }, aria: { label: t('wechat.admin.responses.index.title') }, class: 'button is-small is-rounded is-light') do %>
9
+ <i class="fa-light fa-reply-all"></i>
10
+ <% end %>
11
+ <%= link_to({ controller: 'requests', app_id: model.id }, aria: { label: t('wechat.admin.requests.index.title') }, class: 'button is-small is-rounded is-light') do %>
12
+ <i class="fa-light fa-comments"></i>
13
+ <% end %>
14
+ <%= link_to({ controller: 'tags', app_id: model.id }, aria: { label: t('wechat.admin.tags.index.title') }, class: 'button is-small is-rounded is-light') do %>
15
+ <i class="fa-light fa-user-tag"></i>
16
+ <% end %>
17
+ <%= link_to({ controller: 'templates', app_id: model.id }, aria: { label: t('wechat.admin.templates.index.title') }, class: 'button is-small is-rounded is-light') do %>
18
+ <i class="fa-light fa-inbox"></i>
19
+ <% end %>
20
+ </div>
21
+ <div data-show-target="item" class="mt-1" style="visibility: hidden">
5
22
  <%= link_to({ action: 'info', id: model.id }, data: { turbo_frame: 'modal' }, aria: { label: t('wechat.admin.apps.info.title') }, class: 'button is-small is-rounded is-light') do %>
6
- <i class="fas fa-cog"></i>
23
+ <i class="fa-light fa-cog"></i>
24
+ <% end %>
25
+ <%= link_to({ action: 'edit_pay', id: model.id }, data: { turbo_frame: 'modal' }, aria: { label: t('wechat.admin.apps.edit_pay.title') }, class: 'button is-small is-rounded is-light') do %>
26
+ <i class="fa-brands fa-amazon-pay"></i>
7
27
  <% end %>
8
28
  <%= link_to({ action: 'edit_cert', id: model.id }, data: { turbo_frame: 'modal' }, aria: { label: t('wechat.admin.apps.edit_cert.title') }, class: 'button is-small is-rounded is-light') do %>
9
- <i class="fas fa-certificate"></i>
29
+ <i class="fa-light fa-certificate"></i>
10
30
  <% end %>
11
31
  <%= link_to({ action: 'show', id: model.id }, data: { turbo_frame: 'modal' }, aria: { label: t('.show') }, class: 'button is-small is-rounded is-light') do %>
12
- <i class="fas fa-info"></i>
32
+ <i class="fa-light fa-circle-info"></i>
13
33
  <% end %>
14
34
  <%= link_to({ action: 'edit', id: model.id }, data: { turbo_frame: 'modal' }, aria: { label: t('.edit') }, class: 'button is-small is-rounded is-light') do %>
15
- <i class="fas fa-pencil-alt"></i>
35
+ <i class="fa-light fa-pencil"></i>
16
36
  <% end %>
17
37
  <%= button_to({ action: 'destroy', id: model.id }, method: :delete, aria: { label: t('.destroy') }, data: { confirm: t('.confirm') }, class: 'button is-small is-rounded is-light') do %>
18
- <i class="fas fa-trash-alt"></i>
38
+ <i class="fa-light fa-trash"></i>
19
39
  <% end %>
20
- </span>
40
+ </div>
21
41
  </td>
22
42
  </tr>
@@ -1,7 +1,10 @@
1
- <div class="level">
2
- <h4 class="level-item has-text-centered">微信支付</h4>
3
- </div>
4
- <%= f.text_field :mch_id %>
5
- <%= f.text_field :key %>
6
- <%= f.text_field :key_v3 %>
7
- <%= f.text_field :serial_no %>
1
+ <%= form_with model: @app, scope: :app, url: { action: 'update' } do |f| %>
2
+ <div class="level">
3
+ <h4 class="level-item has-text-centered">微信支付</h4>
4
+ </div>
5
+ <%= f.text_field :mch_id %>
6
+ <%= f.text_field :key %>
7
+ <%= f.text_field :key_v3 %>
8
+ <%= f.text_field :serial_no %>
9
+ <%= f.submit %>
10
+ <% end %>
@@ -1,3 +1,3 @@
1
- <turbo-frame id="modal">
1
+ <%= turbo_frame_tagged 'modal' do %>
2
2
  <%= render partial: 'cert_form' %>
3
- </turbo-frame>
3
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <%= turbo_frame_tagged 'modal' do %>
2
+ <%= render partial: 'pay_form' %>
3
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <%= turbo_stream.append 'body' do %>
2
+ <div data-controller="visit"></div>
3
+ <% end %>
@@ -2,6 +2,7 @@
2
2
  <ul>
3
3
  <li><%= link_to t('wechat.admin.apps.index.title'), { controller: 'apps' } %></li>
4
4
  <% if @app %>
5
+ <li><%= link_to @app.type_i18n, { controller: 'apps', type: @app.type } %></li>
5
6
  <li><%= link_to @app.name, { controller: 'apps', id: @app.id } %></li>
6
7
  <% end %>
7
8
  <li class="is-active"><%= t('.title') %></li>
@@ -1,11 +1,3 @@
1
- <div class="breadcrumb has-succeeds-separator">
2
- <ul>
3
- <li><%= link_to t('wechat.admin.apps.index.title'), { controller: 'apps' } %></li>
4
- <li><%= link_to @app.name, { controller: 'apps', id: @app.id } %></li>
5
- <li class="is-active"><%= t('.title') %></li>
6
- </ul>
7
- </div>
8
-
9
1
  <div class="tabs">
10
2
  <ul>
11
3
  <li class="<%= active_helper(controllers: 'tags', active: 'is-active') %>">
@@ -10,12 +10,12 @@
10
10
  <div class="field is-horizontal">
11
11
  <%= f.label :start_at %>
12
12
  <div class="field-body">
13
- <%= f.time_select :start_at, start_hour: 0, end_hour: 23, minute_step: 30, default: { hour: 0, min: 0 }, wrap: { all: 'field is-narrow', select: 'select' }, on: { label: false } %>
13
+ <%= f.time_select :start_at, start_hour: 0, end_hour: 23, minute_step: 30, default: { hour: 0, min: 0 }, wrap: { all: 'field is-narrow', select: 'select' }, label: nil %>
14
14
  </div>
15
15
  </div>
16
16
  <div class="field is-horizontal">
17
17
  <%= f.label :finish_at %>
18
18
  <div class="field-body">
19
- <%= f.time_select :finish_at, start_hour: 0, end_hour: 23, minute_step: 30, default: { hour: 23, min: 59 }, wrap: { all: 'field is-narrow', select: 'select' }, on: { label: false } %>
19
+ <%= f.time_select :finish_at, start_hour: 0, end_hour: 23, minute_step: 30, default: { hour: 23, min: 59 }, wrap: { all: 'field is-narrow', select: 'select' }, label: nil %>
20
20
  </div>
21
21
  </div>
@@ -1,9 +1,9 @@
1
1
  <%= button_to({ action: 'sync', appid: params[:appid] }, method: :post, class: 'button is-link') do %>
2
- <i class="fas fa-sync"></i><span><% t('.sync') %></span>
2
+ <i class="fa-light fa-sync"></i><span><% t('.sync') %></span>
3
3
  <% end %>
4
4
  <%= link_to({ action: 'new', appid: params[:appid] }, data: { turbo_frame: 'modal' }, class: 'button is-link') do %>
5
- <i class="fas fa-plus"></i><span><% t('.new') %></span>
5
+ <i class="fa-light fa-plus"></i><span><% t('.new') %></span>
6
6
  <% end %>
7
7
  <%= link_to({ action: 'new_parent', appid: params[:appid] }, data: { turbo_frame: 'modal' }, class: 'button is-link') do %>
8
- <i class="fas fa-plus"></i><span><% t('.new_parent') %></span>
8
+ <i class="fa-light fa-plus"></i><span><% t('.new_parent') %></span>
9
9
  <% end %>
@@ -1,9 +1,9 @@
1
1
  <td>
2
2
  <span style="width: <%= model.parent_id ? 1.43 : 0 %>em; display: inline-block"></span>
3
3
  <% if model.children.size > 0 %>
4
- <i class="fas fa-fw fa-caret-down" data-action="click->tree#collapse" style="cursor: pointer"></i>
4
+ <i class="fa-solid fa-fw fa-caret-down" style="cursor: pointer" data-action="click->tree#collapse"></i>
5
5
  <% else %>
6
- <i class="fas fa-fw fa-minus"></i>
6
+ <i class="fa-light fa-fw fa-minus"></i>
7
7
  <% end %>
8
8
  <%= model.type_i18n %>
9
9
  </td>
@@ -5,15 +5,15 @@
5
5
  <% if model.appid.to_s == @app.appid %>
6
6
  <% if model.type == 'Wechat::ParentMenu' %>
7
7
  <%= link_to({ action: 'edit_parent', id: model.id }, data: { turbo_frame: 'modal' }, aria: { label: t('.edit') }, class: 'button is-small is-rounded is-light') do %>
8
- <i class="fas fa-pencil-alt"></i>
8
+ <i class="fa-light fa-pencil"></i>
9
9
  <% end %>
10
10
  <% else %>
11
11
  <%= link_to({ action: 'edit', id: model.id }, data: { turbo_frame: 'modal' }, aria: { label: t('.edit') }, class: 'button is-small is-rounded is-light') do %>
12
- <i class="fas fa-pencil-alt"></i>
12
+ <i class="fa-light fa-pencil"></i>
13
13
  <% end %>
14
14
  <% end %>
15
15
  <%= button_to({ action: 'destroy', id: model.id }, method: :delete, data: { confirm: t('.confirm') }, aria: { label: t('.destroy') }, class: 'button is-small is-rounded is-light') do %>
16
- <i class="fas fa-trash-alt"></i>
16
+ <i class="fa-light fa-trash"></i>
17
17
  <% end %>
18
18
  <% end %>
19
19
  </span>
@@ -1,3 +1,3 @@
1
1
  <%= link_to({ action: 'new' }, data: { turbo_frame: 'modal' }, class: 'button is-link') do %>
2
- <i class="fas fa-plus"></i><span><%= t('.new') %></span>
2
+ <i class="fa-light fa-plus"></i><span><%= t('.new') %></span>
3
3
  <% end %>
@@ -11,7 +11,7 @@
11
11
  <p>
12
12
  <%= model.mobile %>
13
13
  <%= link_to code_admin_register_path(model), method: :put, aria: { label: '验证码' }, data: { confirm: t('.confirm') }, class: 'button is-small is-rounded is-light' do %>
14
- <i class="fas fa-paper-plane"></i>
14
+ <i class="fa-light fa-paper-plane"></i>
15
15
  <% end %>
16
16
  </p>
17
17
  <p><%= model.mobile_code %></p>
@@ -20,13 +20,13 @@
20
20
  <p>
21
21
  <%= image_tag model.bind_qrcode, class: 'image is-24x24' if model.bind_qrcode.attached? %>
22
22
  <%= link_to bind_admin_register_path(model), aria: { label: t('.bind') }, class: 'button is-small is-rounded is-light' do %>
23
- <i class="fas fa-qrcode"></i>
23
+ <i class="fa-light fa-qrcode"></i>
24
24
  <% end %>
25
25
  </p>
26
26
  <p>
27
27
  <%= image_tag model.qrcode, class: 'image is-24x24' if model.qrcode.attached? %>
28
28
  <%= link_to qrcode_admin_register_path(model), aria: { label: t('.qrcode') }, class: 'button is-small is-rounded is-light' do %>
29
- <i class="fas fa-qrcode"></i>
29
+ <i class="fa-light fa-qrcode"></i>
30
30
  <% end %>
31
31
  </p>
32
32
  </td>
@@ -3,22 +3,22 @@
3
3
  <td>
4
4
  <span data-show-target="item" style="visibility: hidden">
5
5
  <%= link_to assign_admin_register_path(model), aria: { label: '分配' }, class: 'button is-small is-rounded is-light' do %>
6
- <i class="fas fa-hand-point-right"></i>
6
+ <i class="fa-light fa-hand-point-right"></i>
7
7
  <% end %>
8
8
  <%= link_to app_admin_register_path(model), aria: { label: t('.app') }, class: 'button is-small is-rounded is-light' do %>
9
- <i class="fab fa-weixin"></i>
9
+ <i class="fa-brands fa-weixin"></i>
10
10
  <% end %>
11
11
  <%= link_to({ controller: 'bench/me/tasks', tasking_type: 'Register', tasking_id: model.id }, aria: { label: t('.tasks') }, class: 'button is-small is-rounded is-light') do %>
12
- <i class="fas fa-tasks"></i>
12
+ <i class="fa-light fa-tasks"></i>
13
13
  <% end %>
14
14
  <%= link_to({ action: 'show', id: model.id }, aria: { label: t('.show') }, class: 'button is-small is-rounded is-light') do %>
15
- <i class="fas fa-info"></i>
15
+ <i class="fa-light fa-circle-info"></i>
16
16
  <% end %>
17
17
  <%= link_to({ action: 'edit', id: model.id }, data: { turbo_frame: 'modal' }, aria: { label: t('.edit') }, class: 'button is-small is-rounded is-light') do %>
18
- <i class="fas fa-pencil-alt"></i>
18
+ <i class="fa-light fa-pencil"></i>
19
19
  <% end %>
20
20
  <%= button_to({ action: 'destroy', id: model.id }, method: :delete, aria: { label: t('.destroy') }, data: { confirm: t('.confirm') }, class: 'button is-small is-rounded is-light') do %>
21
- <i class="fas fa-trash-alt"></i>
21
+ <i class="fa-light fa-trash"></i>
22
22
  <% end %>
23
23
  </span>
24
24
  </td>
@@ -11,7 +11,7 @@
11
11
  <div class="media-right">
12
12
  <%= image_tag item.pic_url, class: 'image is-64x64' if item.pic_url.present? %>
13
13
  <%= button_to({ controller: 'news_reply_items', action: 'destroy', reply_id: model.id, id: item.id }, method: :delete) do %>
14
- <i class="fas fa-times"></i>
14
+ <i class="fa-light fa-times"></i>
15
15
  <% end %>
16
16
  </div>
17
17
  </article>
@@ -19,7 +19,7 @@
19
19
  <article class="media">
20
20
  <div class="content">
21
21
  <%= link_to({ action: 'add', id: model.id }, data: { turbo_frame: 'modal' }) do %>
22
- <i class="fas fa-plus"></i><span><%= t('.add') %></span>
22
+ <i class="fa-light fa-plus"></i><span><%= t('.add') %></span>
23
23
  <% end %>
24
24
  </div>
25
25
  </article>
@@ -1,3 +1,3 @@
1
1
  <%= link_to({ controller: 'datum/panel/table_lists', action: 'find', data_list_id: 'RequestDailyExport', **params.permit('created_at-gte', 'created_at-lte') }, data: { turbo_frame: 'modal' }, class: 'button is-link is-small') do %>
2
- <i class="fas fa-file-excel"></i><span><%= t('.export') %></span>
2
+ <i class="fa-light fa-file-excel"></i><span><%= t('.export') %></span>
3
3
  <% end %>
@@ -3,10 +3,10 @@
3
3
  <td>
4
4
  <span data-show-target="item" style="visibility: hidden">
5
5
  <%= link_to({ action: 'show', id: model.id }, data: { turbo_frame: 'modal' }, aria: { label: t('.show') }, class: 'button is-small is-rounded is-light') do %>
6
- <i class="fas fa-info"></i>
6
+ <i class="fa-light fa-circle-info"></i>
7
7
  <% end %>
8
8
  <%= button_to({ action: 'destroy', id: model.id }, method: :delete, data: { confirm: t('.confirm') }, aria: { label: t('.destroy') }, class: 'button is-small is-rounded is-light') do %>
9
- <i class="fas fa-trash-alt"></i>
9
+ <i class="fa-light fa-trash"></i>
10
10
  <% end %>
11
11
  </span>
12
12
  </td>
@@ -19,7 +19,7 @@
19
19
  <p>
20
20
  <span><%= model.reply.type_i18n %></span>
21
21
  <%= link_to({ action: 'edit_reply', id: model.id }, data: { turbo_frame: 'modal' }, aria: { label: t('.edit') }, class: 'button is-small is-rounded is-light') do %>
22
- <i class="fas fa-pencil-alt"></i>
22
+ <i class="fa-light fa-pencil"></i>
23
23
  <% end %>
24
24
  </p>
25
25
  <p><%= model.reply.value %></p>
@@ -8,7 +8,7 @@
8
8
  <th>
9
9
  <%= Wechat::Response.human_attribute_name(:reply_id) %>
10
10
  <%= link_to({ controller: 'replies' }, aria: { label: t('wechat.admin.replies.index.title') }) do %>
11
- <i class="fas fa-cog"></i>
11
+ <i class="fa-light fa-cog"></i>
12
12
  <% end %>
13
13
  </th>
14
14
  <th></th>