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
09cae40e
Commit
09cae40e
authored
Apr 07, 2017
by
lra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sms日志添加
parent
8a3c1a4b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
+13
-2
lib/sms.rb
+11
-0
lib/sms/taobao.rb
+2
-2
No files found.
lib/sms.rb
View file @
09cae40e
...
@@ -151,6 +151,17 @@ class SmsSender
...
@@ -151,6 +151,17 @@ class SmsSender
@source
.
dingtalk_call_set_user_list
(
opts
)
@source
.
dingtalk_call_set_user_list
(
opts
)
end
end
# Example:
# SmsSender.info('xxxx')
def
self
.
info
(
msg
)
if
defined?
::
Rails
@logger
||=
ActiveSupport
::
Logger
.
new
(
"
#{
Rails
.
root
}
/log/sms_sender.log"
,
"weekly"
)
@logger
.
info
"
#{
msg
}
"
else
puts
msg
end
end
protected
protected
def
backend
(
translations
)
def
backend
(
translations
)
...
...
lib/sms/taobao.rb
View file @
09cae40e
...
@@ -99,12 +99,12 @@ module Sms
...
@@ -99,12 +99,12 @@ module Sms
def
post
def
post
res
=
Net
::
HTTP
.
post_form
(
URI
.
parse
(
'https://eco.taobao.com/router/rest'
),
extend_params
)
res
=
Net
::
HTTP
.
post_form
(
URI
.
parse
(
'https://eco.taobao.com/router/rest'
),
extend_params
)
puts
"
#{
request_params
[
:method
]
}
request params:
#{
request_params
.
inspect
}
"
SmsSender
.
info
"
#{
request_params
[
:method
]
}
request params:
#{
request_params
.
inspect
}
"
data
=
res
.
body
data
=
res
.
body
data
=
JSON
.
parse
(
data
)
if
data
.
is_a?
String
data
=
JSON
.
parse
(
data
)
if
data
.
is_a?
String
puts
"
#{
request_params
[
:method
]
}
request result:
#{
data
.
inspect
}
"
SmsSender
.
info
"
#{
request_params
[
:method
]
}
request result:
#{
data
.
inspect
}
"
result
=
HashWithIndifferentAccess
.
new
data
result
=
HashWithIndifferentAccess
.
new
data
keys
=
result
.
keys
keys
=
result
.
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