Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
孙龙
/
kaopu-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
8ca9f219
authored
Dec 12, 2019
by
Joneq
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
增加发送短信
parent
09c61258
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
internal/logic/mobile_message.go
internal/logic/mobile_message.go
0 → 100644
View file @
8ca9f219
package
logic
import
(
"bytes"
"encoding/json"
"fmt"
"net/http"
"time"
)
const
APIMD5STR
string
=
"fh6y5t4rr351d2c3bryi"
const
APIDOMAIN
string
=
"http://api.liexin.com/msg/sendMessageByAuto"
func
sendMessage
(
mobile
,
content
string
){
timeNow
:=
time
.
Now
()
.
Second
()
requestContent
,
_
:=
json
.
Marshal
(
map
[
string
]
string
{
"content"
:
content
})
requestTel
,
_
:=
json
.
Marshal
([]
string
{
mobile
})
requestbody
,
err
:=
json
.
Marshal
(
map
[
string
]
map
[
string
]
string
{
"form_params"
:
{
"data"
:
string
(
requestContent
),
"touser"
:
string
(
requestTel
),
"keyword"
:
"crm_notify_kefu"
,
"k1"
:
Int64TurnString
(
int64
(
timeNow
)),
"k2"
:
Md5
(
Md5
(
Int64TurnString
(
int64
(
timeNow
)))
+
APIMD5STR
),
"is_ignore"
:
"true"
,
},
})
if
err
!=
nil
{
fmt
.
Print
(
err
)
}
resp
,
err
:=
http
.
Post
(
APIDOMAIN
,
"application/json"
,
bytes
.
NewBuffer
(
requestbody
))
defer
resp
.
Body
.
Close
()
}
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