customer_service_im 0.5.0 → 0.6.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51614b5350dfdda2b865dde53f6781b7d0e01a61fd4d9a52f807bacd0d4c1535
|
4
|
+
data.tar.gz: 546af3c9b523ce2ea30292fae46fc542ebe0b8c1bed3576192193bfd5b29dba6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a76f3ff1b5673fd1ba393d123d95cb79408ac402a6fba35b35146513102dc0ecca49e2cf8b89709baec5fa31d2ce8df867832fd60950758d33a91b7aec083de5
|
7
|
+
data.tar.gz: 1a0ab5cd159159668367664ea402c7d0c9b82cfd1e9753e36c226237430c01c249875cb2323126a8e9a78ceebf63b4abe3922eda53444f5c173bb48cd995f602
|
@@ -11,7 +11,7 @@ module CustomerServiceIm
|
|
11
11
|
|
12
12
|
open_id = result.data[:openid]
|
13
13
|
|
14
|
-
user = User.
|
14
|
+
user = User.find_or_create_mp_user(open_id: 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
|