Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
U
utils
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
library
utils
Commits
614bd255
Verified
Commit
614bd255
authored
Jan 24, 2019
by
Cui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix issue with json.Marshal no html encode
parent
d27d247c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
3 deletions
+13
-3
gzh.go
sender/gzh.go
+3
-3
tools.go
tools.go
+10
-0
No files found.
sender/gzh.go
View file @
614bd255
...
...
@@ -57,7 +57,7 @@ func CustomerMessageSender(accessToken string, cmi CustomerMessageInterface) (in
uri
:=
sendUri
+
"?access_token="
+
accessToken
data
,
_
:=
json
.
Marshal
(
cmi
)
data
,
_
:=
JSON
Marshal
(
cmi
)
body
,
_
,
err
:=
FasthttpPost
(
uri
,
data
)
...
...
@@ -90,7 +90,7 @@ func TemplateMessageSender(accessToken string, tm TemplateMessage) (int, string)
uri
:=
TEMPLATEURI
+
"?access_token="
+
accessToken
data
,
_
:=
json
.
Marshal
(
tm
)
data
,
_
:=
JSON
Marshal
(
tm
)
body
,
_
,
err
:=
FasthttpPost
(
uri
,
data
)
...
...
@@ -122,7 +122,7 @@ func SubscribeMessageSender(accessToken string, sm SubscribeMessage) (int, strin
})
uri
:=
SUBSCRIBEURI
+
"?access_token="
+
accessToken
data
,
_
:=
json
.
Marshal
(
sm
)
data
,
_
:=
JSON
Marshal
(
sm
)
body
,
_
,
err
:=
FasthttpPost
(
uri
,
data
)
...
...
tools.go
View file @
614bd255
...
...
@@ -6,9 +6,11 @@
package
utils
import
(
"bytes"
"crypto/sha256"
"database/sql"
"encoding/hex"
"encoding/json"
"errors"
"github.com/sirupsen/logrus"
"io"
...
...
@@ -53,6 +55,14 @@ func SmsDoSign(appKey string, tels []string, time int64, rand int) string {
return
hex
.
EncodeToString
(
h
.
Sum
(
nil
))
}
func
JSONMarshal
(
t
interface
{})
([]
byte
,
error
)
{
buffer
:=
&
bytes
.
Buffer
{}
encoder
:=
json
.
NewEncoder
(
buffer
)
encoder
.
SetEscapeHTML
(
false
)
err
:=
encoder
.
Encode
(
t
)
return
buffer
.
Bytes
(),
err
}
// Deep Copy
func
Copy
(
toValue
interface
{},
fromValue
interface
{})
(
err
error
)
{
var
(
...
...
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