Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sms
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
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gems
sms
Commits
d21d1c39
Commit
d21d1c39
authored
Apr 10, 2017
by
lra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sms执行结果记录
parent
09cae40e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
9 deletions
+18
-9
lib/sms.rb
+10
-1
lib/sms/taobao.rb
+8
-8
No files found.
lib/sms.rb
View file @
d21d1c39
...
...
@@ -30,7 +30,7 @@ class SmsSender
SOURCES
=
%w(taobao zucp)
attr_accessor
:source
,
:source_config
,
:template_code
,
:attrs
attr_accessor
:source
,
:source_config
,
:template_code
,
:attrs
,
:result
def
initialize
(
opts
=
{})
self
.
attrs
=
HashWithIndifferentAccess
.
new
(
opts
)
...
...
@@ -40,6 +40,7 @@ class SmsSender
return
unless
attrs
[
:source
]
send
(
"
#{
attrs
[
:source
].
to_s
}
_init"
)
attrs
[
:sender
]
=
self
@source
=
"Sms/
#{
attrs
[
:source
]
}
"
.
camelize
.
constantize
.
new
(
attrs
)
end
...
...
@@ -151,6 +152,14 @@ class SmsSender
@source
.
dingtalk_call_set_user_list
(
opts
)
end
# Example:
# sms_sender = SmsSender.new
# sms_sender.info('xxxx')
def
info
(
msg
)
self
.
class
.
info
msg
end
# Example:
# SmsSender.info('xxxx')
def
self
.
info
(
msg
)
...
...
lib/sms/taobao.rb
View file @
d21d1c39
...
...
@@ -5,12 +5,12 @@ require 'net/http'
module
Sms
class
Taobao
attr_accessor
:app_secret
,
:app_key
,
:sms_free_sign_name
,
:called_show_verify_nums
,
:called_show_notify_nums
,
:template_code
,
:param
,
:custom_params
,
:request_params
attr_accessor
:app_secret
,
:app_key
attr_accessor
:sms_free_sign_name
,
:called_show_verify_nums
,
:called_show_notify_nums
attr_accessor
:template_code
,
:param
attr_accessor
:custom_params
,
:request_params
attr_accessor
:staff_id
,
:session
,
:authed_corp_id
,
:authed_staff_id
,
:staff_id_list
attr_accessor
:sender
def
initialize
(
options
=
{})
options
.
each
{
|
k
,
v
|
...
...
@@ -99,13 +99,13 @@ module Sms
def
post
res
=
Net
::
HTTP
.
post_form
(
URI
.
parse
(
'https://eco.taobao.com/router/rest'
),
extend_params
)
SmsS
ender
.
info
"
#{
request_params
[
:method
]
}
request params:
#{
request_params
.
inspect
}
"
s
ender
.
info
"
#{
request_params
[
:method
]
}
request params:
#{
request_params
.
inspect
}
"
data
=
res
.
body
data
=
JSON
.
parse
(
data
)
if
data
.
is_a?
String
SmsS
ender
.
info
"
#{
request_params
[
:method
]
}
request result:
#{
data
.
inspect
}
"
result
=
HashWithIndifferentAccess
.
new
data
s
ender
.
info
"
#{
request_params
[
:method
]
}
request result:
#{
data
.
inspect
}
"
sender
.
result
=
result
=
HashWithIndifferentAccess
.
new
data
keys
=
result
.
keys
return
if
'error_response'
.
in?
(
keys
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment