添加注释
This commit is contained in:
parent
b7e56e1291
commit
30878e899d
29
services/jedi/README.md
Normal file
29
services/jedi/README.md
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
|
||||||
|
|
||||||
|
### 发送短信调用示例
|
||||||
|
```go
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/services/jedi"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
c, err := jedi.NewClientWithAccessKey("accessKeyId", "accessKeySecret", "xxx.xxx.com")
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
req := jedi.CreateSendSmsRequest()
|
||||||
|
// sso统一用户名uid, 多个用户用逗句隔开
|
||||||
|
req.User = "liangzy,liaoks"
|
||||||
|
// 公共模板的代码模板
|
||||||
|
req.Code = "d7kt5IwP"
|
||||||
|
// 模板参数,模板里有多少个模板参数就传入几个替换字符串,
|
||||||
|
req.ParamsArray = []string{"www", "线上", "好人"}
|
||||||
|
if resp, err := c.SendSms(req); err == nil {
|
||||||
|
grlogs.Informational(fmt.Sprintf("%+v", resp.GetHttpContentString()))
|
||||||
|
} else {
|
||||||
|
grlogs.Error(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
@ -1,6 +1,9 @@
|
|||||||
package jedi
|
package jedi
|
||||||
|
|
||||||
import "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk"
|
import (
|
||||||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
HOST = "jedi"
|
HOST = "jedi"
|
||||||
@ -12,6 +15,9 @@ type Client struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) SendSms(req *SendSmsRequest) (response *SendSmsResponse, err error) {
|
func (c *Client) SendSms(req *SendSmsRequest) (response *SendSmsResponse, err error) {
|
||||||
|
if req.ParamsArray != nil && len(req.ParamsArray) > 0 {
|
||||||
|
req.Params = strings.Join(req.ParamsArray, ",,,")
|
||||||
|
}
|
||||||
response = CreateSendSmsResponse()
|
response = CreateSendSmsResponse()
|
||||||
err = c.DoAction(req, response)
|
err = c.DoAction(req, response)
|
||||||
return
|
return
|
||||||
|
@ -10,6 +10,7 @@ type SendSmsRequest struct {
|
|||||||
User string `position:"Query" field:"user" default:"" `
|
User string `position:"Query" field:"user" default:"" `
|
||||||
Code string `position:"Query" field:"code" default:"" `
|
Code string `position:"Query" field:"code" default:"" `
|
||||||
Params string `position:"Query" field:"params" default:"" `
|
Params string `position:"Query" field:"params" default:"" `
|
||||||
|
ParamsArray []string
|
||||||
}
|
}
|
||||||
|
|
||||||
type SendSmsResponseData struct {
|
type SendSmsResponseData struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user