sms新增绑定手机号模板,优化飞书webhook
This commit is contained in:
		
							parent
							
								
									792d13fa32
								
							
						
					
					
						commit
						6c3dfae18b
					
				@ -2,6 +2,7 @@ package sms
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
 | 
			
		||||
	"testing"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
@ -37,9 +38,9 @@ func TestClient_SendEmail(t *testing.T) {
 | 
			
		||||
 | 
			
		||||
func TestClient_SendFeiShuWebHook(t *testing.T) {
 | 
			
		||||
	//req := CreateSendFeiShuWebHookRequest(SendFeiShuWebHookParam{
 | 
			
		||||
	//	Do:         "sendCardText",
 | 
			
		||||
	//	Do:         FeiShuWebHookDoTypeSendRichText,
 | 
			
		||||
	//	Token:      "b762f80c-fe4f-4182-b48e-5c78041592bc",
 | 
			
		||||
	//	Content:    "[{\"tag\":\"div\",\"text\":{\"tag\":\"plain_text\",\"content\":\"请完成以下任务:\"}},{\"tag\":\"action\",\"actions\":[{\"tag\":\"button\",\"text\":{\"tag\":\"plain_text\",\"content\":\"查看详情\"},\"type\":\"primary\",\"url\":\"https:\\\\\\\\/\\\\\\\\/example.com\\\\\\\\/task\"}]}]",
 | 
			
		||||
	//	Content:    "[[{\"tag\":\"text\",\"text\":\"富文本信息: \"},{\"tag\":\"a\",\"text\":\"请查看\",\"href\":\"http://www.example.com/\"},{\"tag\":\"at\",\"user_id\":\"ou_18eac8********17ad4f02e8bbbb\"}]]",
 | 
			
		||||
	//	Title:      "卡片主标题",
 | 
			
		||||
	//	TitleColor: "purple",
 | 
			
		||||
	//})
 | 
			
		||||
@ -48,10 +49,10 @@ func TestClient_SendFeiShuWebHook(t *testing.T) {
 | 
			
		||||
	//if err != nil {
 | 
			
		||||
	//	panic(err)
 | 
			
		||||
	//}
 | 
			
		||||
	//fmt.Println(resp)
 | 
			
		||||
	//
 | 
			
		||||
	//fmt.Println(resp.Msg)
 | 
			
		||||
 | 
			
		||||
	//req2 := CreateSendFeiShuWebHookRequest(SendFeiShuWebHookParam{
 | 
			
		||||
	//	Do:      "sendSimpleText",
 | 
			
		||||
	//	Do:      FeiShuWebHookDoTypeSendSimpleText,
 | 
			
		||||
	//	Token:   "b762f80c-fe4f-4182-b48e-5c78041592bc",
 | 
			
		||||
	//	Content: "  - 苹果ID:XXXX\n  - 游戏ID:XXXX\n  - bundleID:XXXX\n  - 应用名:XXX\n  - 下架时间:2025-04-18 12:36:52\n  - IP:XX(城市A省份)、XX(城市B省份);说明:XX为具体的IP,括号内为IP对应的城市;",
 | 
			
		||||
	//})
 | 
			
		||||
@ -63,24 +64,24 @@ func TestClient_SendFeiShuWebHook(t *testing.T) {
 | 
			
		||||
	//fmt.Println(resp2)
 | 
			
		||||
 | 
			
		||||
	//[
 | 
			
		||||
	//    [
 | 
			
		||||
	//        {
 | 
			
		||||
	//            "tag": "text",
 | 
			
		||||
	//            "text": "苹果ID:XXXX"
 | 
			
		||||
	//        }
 | 
			
		||||
	//    ],
 | 
			
		||||
	//    [
 | 
			
		||||
	//        {
 | 
			
		||||
	//            "tag": "text",
 | 
			
		||||
	//            "text": "游戏ID:XXXX"
 | 
			
		||||
	//        }
 | 
			
		||||
	//    ]
 | 
			
		||||
	//   [
 | 
			
		||||
	//       {
 | 
			
		||||
	//           "tag": "text",
 | 
			
		||||
	//           "text": "苹果ID:XXXX"
 | 
			
		||||
	//       }
 | 
			
		||||
	//   ],
 | 
			
		||||
	//   [
 | 
			
		||||
	//       {
 | 
			
		||||
	//           "tag": "text",
 | 
			
		||||
	//           "text": "游戏ID:XXXX"
 | 
			
		||||
	//       }
 | 
			
		||||
	//   ]
 | 
			
		||||
	//]
 | 
			
		||||
 | 
			
		||||
	req3 := CreateSendFeiShuWebHookRequest(SendFeiShuWebHookParam{
 | 
			
		||||
		TitleColor: "purple",
 | 
			
		||||
		Title:      "监控报警",
 | 
			
		||||
		Do:         "sendCardText",
 | 
			
		||||
		Do:         FeiShuWebHookDoTypeSendCardText,
 | 
			
		||||
		Token:      "b762f80c-fe4f-4182-b48e-5c78041592bc",
 | 
			
		||||
		Content:    "[{\"tag\":\"div\",\"text\":{\"tag\":\"plain_text\",\"content\":\"苹果ID:XXXX\"}},{\"tag\":\"div\",\"text\":{\"tag\":\"plain_text\",\"content\":\"游戏ID:XXXX\"}}]",
 | 
			
		||||
	})
 | 
			
		||||
@ -96,11 +97,15 @@ func TestClient_SendFeiShuWebHook(t *testing.T) {
 | 
			
		||||
func TestClient_SendSms(t *testing.T) {
 | 
			
		||||
	req := CreateSendSmsRequest(SendSmsParam{
 | 
			
		||||
		Mobile:  "18320021439",
 | 
			
		||||
		Type:    SmsTypeRegister,
 | 
			
		||||
		Type:    SmsTypeBindPhone,
 | 
			
		||||
		Code:    123456,
 | 
			
		||||
		Expired: 5,
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
	req.Domain = requests.Host{
 | 
			
		||||
		Default: "127.0.0.1:8804",
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	sms, err := client.SendSms(req)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		panic(err)
 | 
			
		||||
 | 
			
		||||
@ -19,8 +19,16 @@ type SendFeiShuWebHookResponse struct {
 | 
			
		||||
	FeishuData string `json:"feishu_data"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type FeiShuWebHookDoType = string
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	FeiShuWebHookDoTypeSendSimpleText FeiShuWebHookDoType = "sendSimpleText"
 | 
			
		||||
	FeiShuWebHookDoTypeSendRichText   FeiShuWebHookDoType = "sendRichText"
 | 
			
		||||
	FeiShuWebHookDoTypeSendCardText   FeiShuWebHookDoType = "sendCardText"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type SendFeiShuWebHookParam struct {
 | 
			
		||||
	Do         string
 | 
			
		||||
	Do         FeiShuWebHookDoType
 | 
			
		||||
	Token      string
 | 
			
		||||
	Content    string
 | 
			
		||||
	Title      string
 | 
			
		||||
 | 
			
		||||
@ -20,7 +20,8 @@ type SendSmsResponse struct {
 | 
			
		||||
type SmsType = string
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	SmsTypeRegister SmsType = "reg" // 注册
 | 
			
		||||
	SmsTypeRegister  SmsType = "reg"        // 注册
 | 
			
		||||
	SmsTypeBindPhone SmsType = "bind_phone" // 绑定手机号
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type SendSmsParam struct {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user