get_conversational_automation_logic.go 954 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package whatsapp
  2. import (
  3. "context"
  4. "wechat-api/hook/aliyun"
  5. "wechat-api/internal/svc"
  6. "wechat-api/internal/types"
  7. "github.com/zeromicro/go-zero/core/logx"
  8. )
  9. type GetConversationalAutomationLogic struct {
  10. logx.Logger
  11. ctx context.Context
  12. svcCtx *svc.ServiceContext
  13. }
  14. func NewGetConversationalAutomationLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetConversationalAutomationLogic {
  15. return &GetConversationalAutomationLogic{
  16. Logger: logx.WithContext(ctx),
  17. ctx: ctx,
  18. svcCtx: svcCtx}
  19. }
  20. func (l *GetConversationalAutomationLogic) GetConversationalAutomation(req *types.ConversationalAutomationReq) (*types.ConversationalAutomationResp, error) {
  21. phone := *req.Cc + *req.Phone
  22. response, err := aliyun.GetConversationalAutomation(*req.WaId, phone)
  23. resp := types.ConversationalAutomationResp{}
  24. if err == nil && *response.Body.Code == "OK" {
  25. //resp.Data.Commands = response.Body.Data.Commands
  26. }
  27. return &resp, nil
  28. }