customservice

package
v0.0.0-...-f5adc6c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 26, 2014 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

客户服务相关的数据结构.

参考 http://dkf.qq.com

Index

Constants

View Source
const (
	OnlineKfInfoStatusPC          = 1
	OnlineKfInfoStatusMobile      = 2
	OnlineKfInfoStatusPCAndMobile = 3
)
View Source
const (
	RecordPageSizeLimit = 1000 // 客户聊天记录每页最多拉取1000条
)

Variables

This section is empty.

Functions

This section is empty.

Types

type KfInfo

type KfInfo struct {
	Id       string `json:"kf_id"`      // 客服工号
	Account  string `json:"kf_account"` // 客服账号@微信别名; 微信别名如有修改,旧账号返回旧的微信别名,新增的账号返回新的微信别名
	Nickname string `json:"kf_nick"`    // 客服昵称
}

客服基本信息

type OnlineKfInfo

type OnlineKfInfo struct {
	Id                  string `json:"kf_id"`         // 客服工号
	Account             string `json:"kf_account"`    // 客服账号@微信别名; 微信别名如有修改,旧账号返回旧的微信别名,新增的账号返回新的微信别名
	Status              int    `json:"status"`        // 客服在线状态 1:pc在线,2:手机在线, 若pc和手机同时在线则为 1+2=3
	AutoAcceptThreshold int    `json:"auto_accept"`   // 客服设置的最大自动接入数
	AcceptingNumber     int    `json:"accepted_case"` // 客服当前正在接待的会话数
}

在线客服接待信息

type Record

type Record struct {
	Worker string `json:"worker"` // 客服账号
	OpenId string `json:"openid"` // 用户的标识,对当前公众号唯一

	// 操作ID(会话状态),具体说明见下文
	// 1000	 创建未接入会话
	// 1001	 接入会话
	// 1002	 主动发起会话
	// 1004	 关闭会话
	// 1005	 抢接会话
	// 2001	 公众号收到消息
	// 2002	 客服发送消息
	// 2003	 客服收到消息
	OperateCode int    `json:"opercode"`
	TimeStamp   int64  `json:"time"` // 操作时间,UNIX时间戳
	Text        string `json:"text"` // 聊天记录
}

一条聊天记录

type RecordGetRequest

type RecordGetRequest struct {
	StartTime int64  `json:"starttime"` // 查询开始时间,UNIX时间戳
	EndTime   int64  `json:"endtime"`   // 查询结束时间,UNIX时间戳,每次查询不能跨日查询
	OpenId    string `json:"openid"`    // 普通用户的标识,对当前公众号唯一
	PageSize  int    `json:"pagesize"`  // 每页大小,每页最多拉取1000条
	PageIndex int    `json:"pageindex"` // 查询第几页,从1开始
}

获取客服聊天记录 请求消息结构

type RecordIterator

type RecordIterator interface {
	HasNext() bool
	NextPage() (records []Record, err error)
}

聊天记录遍历器

iter, err := Client.CustomServiceRecordIterator(request)
if err != nil {
    // TODO: 增加你的代码
}

for iter.HasNext() {
    records, err := iter.NextPage()
    if err != nil {
        // TODO: 增加你的代码
    }
    // TODO: 增加你的代码
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL