github.com/chanxuehong/wechat@v0.0.0-20230222024006-36f0325263cd/mp/dkf/resp.go (about)

     1  package dkf
     2  
     3  import (
     4  	"github.com/chanxuehong/wechat/mp/core"
     5  )
     6  
     7  const (
     8  	MsgTypeTransferCustomerService core.MsgType = "transfer_customer_service" // 将消息转发到多客服
     9  )
    10  
    11  // 将消息转发到多客服消息
    12  type TransferToCustomerService struct {
    13  	XMLName struct{} `xml:"xml" json:"-"`
    14  	core.MsgHeader
    15  	TransInfo *TransInfo `xml:"TransInfo,omitempty" json:"TransInfo,omitempty"`
    16  }
    17  
    18  type TransInfo struct {
    19  	KfAccount string `xml:"KfAccount" json:"KfAccount"`
    20  }
    21  
    22  // 如果不指定客服则 kfAccount 留空.
    23  func NewTransferToCustomerService(to, from string, timestamp int64, kfAccount string) (msg *TransferToCustomerService) {
    24  	msg = &TransferToCustomerService{
    25  		MsgHeader: core.MsgHeader{
    26  			ToUserName:   to,
    27  			FromUserName: from,
    28  			CreateTime:   timestamp,
    29  			MsgType:      MsgTypeTransferCustomerService,
    30  		},
    31  	}
    32  	if kfAccount != "" {
    33  		msg.TransInfo = &TransInfo{
    34  			KfAccount: kfAccount,
    35  		}
    36  	}
    37  	return
    38  }