boweniac hace 2 meses
padre
commit
4860fa5113

+ 2 - 1
desc/wechat/whatsapp.api

@@ -155,6 +155,7 @@ type (
 		Locale *string `json:"locale"`
 	}
 	submitCodeReq {
+	    Cc  *string `json:"cc"`
 		Phone  *string `json:"phone"`
 		WaId  *string `json:"waId"`
 		Code *string `json:"code"`
@@ -232,7 +233,7 @@ type (
 
 	UpdateAgentReq {
 	    Id  uint64 `json:"id"`
-		AgentId  uint64 `json:"agent_id"`
+		AgentId  uint64 `json:"agentId"`
 	}
 
 	// 获取黑白名单列表返回体

+ 34 - 9
hook/aliyun/whatsapp.go

@@ -1,6 +1,7 @@
 package aliyun
 
 import (
+	"fmt"
 	cams20200606 "github.com/alibabacloud-go/cams-20200606/v2/client"
 	openapi "github.com/alibabacloud-go/darabonba-openapi/v2/client"
 	"github.com/alibabacloud-go/tea/tea"
@@ -276,17 +277,41 @@ func SetCamsBusiness(phone, custSpaceId, address, description, vertical, email,
 	}
 
 	request := &cams20200606.ModifyPhoneBusinessProfileRequest{
-		PhoneNumber:       tea.String(phone),
-		CustSpaceId:       tea.String(custSpaceId),
-		Address:           tea.String(address),
-		Description:       tea.String(description),
-		Vertical:          tea.String(vertical),
-		Email:             tea.String(email),
-		ProfilePictureUrl: tea.String(profilePicUrl),
-		About:             tea.String(about),
-		Websites:          websites,
+		PhoneNumber: tea.String(phone),
+		CustSpaceId: tea.String(custSpaceId),
+		Vertical:    tea.String(vertical),
 	}
 
+	if vertical != "" && vertical != "UNDEFINED" {
+		request.Vertical = tea.String(vertical)
+	}
+
+	if address != "" {
+		request.Address = tea.String(address)
+	}
+
+	if description != "" {
+		request.Description = tea.String(description)
+	}
+
+	if profilePicUrl != "" {
+		request.ProfilePictureUrl = tea.String(profilePicUrl)
+	}
+
+	if email != "" {
+		request.Email = tea.String(email)
+	}
+
+	if about != "" {
+		request.About = tea.String(about)
+	}
+
+	if len(websites) > 0 {
+		request.Websites = websites
+	}
+
+	fmt.Printf("request=%v\n", request)
+
 	response, _err := client.ModifyPhoneBusinessProfile(request)
 	if _err != nil {
 		return nil, _err

+ 3 - 0
internal/logic/whatsapp/set_business_info_logic.go

@@ -28,6 +28,9 @@ func (l *SetBusinessInfoLogic) SetBusinessInfo(req *types.SetBusinessReq) (*type
 
 	websites := make([]*string, 0)
 	for _, v := range req.Websites {
+		if v == "" {
+			continue
+		}
 		websites = append(websites, &v)
 	}
 	_, err := aliyun.SetCamsBusiness(*req.Phone, *req.WaId, req.Address, req.Description, req.Vertical, req.Email, req.ProfilePictureUrl, req.About, websites)

+ 1 - 1
internal/logic/whatsapp/submit_whatsapp_code_logic.go

@@ -25,7 +25,7 @@ func NewSubmitWhatsappCodeLogic(ctx context.Context, svcCtx *svc.ServiceContext)
 
 func (l *SubmitWhatsappCodeLogic) SubmitWhatsappCode(req *types.SubmitCodeReq) (*types.BaseMsgResp, error) {
 	resp := types.BaseMsgResp{}
-	_, err := aliyun.SubmitCamsCode(*req.Phone, *req.Code, *req.WaId)
+	_, err := aliyun.SubmitCamsCode(*req.Cc+*req.Phone, *req.Code, *req.WaId)
 
 	if err != nil {
 		resp.Msg = err.Error()

+ 2 - 1
internal/types/types.go

@@ -3547,6 +3547,7 @@ type SendCodeReq struct {
 
 // swagger:model submitCodeReq
 type SubmitCodeReq struct {
+	Cc    *string `json:"cc"`
 	Phone *string `json:"phone"`
 	WaId  *string `json:"waId"`
 	Code  *string `json:"code"`
@@ -3648,7 +3649,7 @@ type DeregisterReq struct {
 // swagger:model UpdateAgentReq
 type UpdateAgentReq struct {
 	Id      uint64 `json:"id"`
-	AgentId uint64 `json:"agent_id"`
+	AgentId uint64 `json:"agentId"`
 }
 
 // 获取黑白名单列表返回体