customer_service_im 0.5.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b1159035b88fea5b356d2331f6a8ea28f703599bd2018e11f9daccde396095ac
4
- data.tar.gz: a8cdc0d5b2bbc65d595b882ecfde3321b6d862179ab487b5bde983ee74d376ee
3
+ metadata.gz: ef3046967b653b6fef336b498b9ce38b2cf38f83a438cc7b0a6940f643521534
4
+ data.tar.gz: 0ea99dfdc1571c5ed16248cbcb68e9267aadffa2c0b10cbb94039bf873ab7818
5
5
  SHA512:
6
- metadata.gz: 6c4993873b7ec3882da885ecfa2473853f5a81066130123de8596180f1141365e13441adb5780a8c1b484c8a674dddd2e5cd4fded54b3bea1483465bdb828540
7
- data.tar.gz: 02e4ed7d1ecaef3e70abaf09571f45bb1a501200bb0eddcf7c897327aceff83738364ab625c7d474bc797bd4865dd247a092f2aca9cd70ceecefd37c5d4f7256
6
+ metadata.gz: 6e8a80069a9478884028aed58ca3219ead1719f1d80836fb8a95f0b04d91a7e5ae792ab68c1e6ad0bd93f4ba3b8bd9889d502e08bd51bdca9e0181c6f8b844c8
7
+ data.tar.gz: 998059851c9d83fd45a526fa9d2970cb93547796deb809c45d97ae5b92ff9f0b7c865b356dfa2b273b10d60a6faf7d894b9371aa864797f5d3e26f1c0fbfe789
@@ -11,7 +11,7 @@ module CustomerServiceIm
11
11
 
12
12
  open_id = result.data[:openid]
13
13
 
14
- user = User.find_by!(open_id: open_id)
14
+ user = User.find_or_create_mp_user(open_id)
15
15
 
16
16
  render_200 user.as_json.merge({ token: token_user(user), conversation_id: user.conversation_ids.first })
17
17
  end
@@ -71,5 +71,14 @@ module CustomerServiceIm::Concerns::Customer
71
71
  def online_customer_list_in_redis
72
72
  redis.smembers online_customers_redis_key
73
73
  end
74
+
75
+ def find_or_create_mp_user(open_id)
76
+ return if open_id.blank?
77
+
78
+ User.create_with(
79
+ email: "#{SecureRandom.uuid}@mp.com",
80
+ password: Digest::MD5.hexdigest(open_id)
81
+ ).find_or_create_by(open_id: open_id)
82
+ end
74
83
  end
75
84
  end
@@ -1,3 +1,3 @@
1
1
  module CustomerServiceIm
2
- VERSION = '0.5.0'
2
+ VERSION = '0.9.0'
3
3
  end
@@ -3,5 +3,6 @@ class CustomerServiceIm::InstallGenerator < Rails::Generators::Base
3
3
 
4
4
  def copy_initializer
5
5
  copy_file "initializer.rb", "config/initializers/customer_service_im.rb"
6
+ rake "mini_program:install"
6
7
  end
7
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: customer_service_im
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ian
@@ -128,6 +128,20 @@ dependencies:
128
128
  - - ">="
129
129
  - !ruby/object:Gem::Version
130
130
  version: '0'
131
+ - !ruby/object:Gem::Dependency
132
+ name: bcrypt
133
+ requirement: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
138
+ type: :runtime
139
+ prerelease: false
140
+ version_requirements: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
131
145
  description: Description of CustomerServiceIm.
132
146
  email:
133
147
  - ianlynxk@gmail.com