C# Class MPHelper.MpManager

操作集合类
Show file Open project: 010227leo/MPHelper Class Usage Examples

Public Methods

Method Description
ChangeCategoryAsync ( string openId, string cateId ) : Task

更改用户分组(0:未分组; 1:黑名单; 2:星标组)

GetAllMessageList ( int count = 20, int day = 7 ) : IEnumerable

获取所有用户消息列表

GetContactInfo ( string openId ) : ContactInfo

获取用户信息

GetDonwloadFileBytes ( int msgId ) : byte[]

获取后台文件(音频、图片)

GetMessageListByKeyword ( string keyword, int count = 20 ) : IEnumerable

根据关键字检索消息列表

GetSingleSendMessageList ( string openId ) : IEnumerable

获取单个用户对话消息列表

GetStarMessageList ( int count = 20 ) : IEnumerable

获取星标消息列表

MassSendMessageAsync ( MpMessageType type, string value, string groupId = "-1", int gender, string country = null, string province = null, string city = null ) : Task

群组消息推送

Preheat ( ) : MpManager

预热

SetStarMessageAsync ( string messageId, bool isStar ) : Task

设置/取消星标消息

SingleSendMessageAsync ( string openId, MpMessageType type, string value ) : Task

单用户消息发送

Private Methods

Method Description
GetInstance ( string userName, string pwdMd5 ) : MpManager
InternalGetMessageList ( string url ) : IEnumerable
InternalLogin ( ) : bool

模拟后台登录

MpManager ( string userName, string pwdMd5 ) : System

MPManager

Method Details

ChangeCategoryAsync() public method

更改用户分组(0:未分组; 1:黑名单; 2:星标组)
public ChangeCategoryAsync ( string openId, string cateId ) : Task
openId string 用户OpenId
cateId string 分组ID
return Task

GetAllMessageList() public method

获取所有用户消息列表
public GetAllMessageList ( int count = 20, int day = 7 ) : IEnumerable
count int 消息条数
day int 0:今天;1:昨天;以此类推,后台最多保存5天数据,默认全部消息
return IEnumerable

GetContactInfo() public method

获取用户信息
public GetContactInfo ( string openId ) : ContactInfo
openId string 用户OpenId
return MPHelper.Dtos.ContactInfo

GetDonwloadFileBytes() public method

获取后台文件(音频、图片)
public GetDonwloadFileBytes ( int msgId ) : byte[]
msgId int 消息ID
return byte[]

GetMessageListByKeyword() public method

根据关键字检索消息列表
public GetMessageListByKeyword ( string keyword, int count = 20 ) : IEnumerable
keyword string 关键字
count int 消息条数
return IEnumerable

GetSingleSendMessageList() public method

获取单个用户对话消息列表
public GetSingleSendMessageList ( string openId ) : IEnumerable
openId string 用户OpenId
return IEnumerable

GetStarMessageList() public method

获取星标消息列表
public GetStarMessageList ( int count = 20 ) : IEnumerable
count int 消息条数
return IEnumerable

MassSendMessageAsync() public method

群组消息推送
public MassSendMessageAsync ( MpMessageType type, string value, string groupId = "-1", int gender, string country = null, string province = null, string city = null ) : Task
type MpMessageType 消息类型
value string /// 文字消息:文字内容; /// 图片、音频、视频消息:文件ID; /// 图文消息:消息ID; ///
groupId string 分组ID
gender int 性别(0:全部; 1:男; 2:女)
country string 国家
province string
city string
return Task

Preheat() public method

预热
public Preheat ( ) : MpManager
return MpManager

SetStarMessageAsync() public method

设置/取消星标消息
public SetStarMessageAsync ( string messageId, bool isStar ) : Task
messageId string 消息ID
isStar bool 是否为星标
return Task

SingleSendMessageAsync() public method

单用户消息发送
public SingleSendMessageAsync ( string openId, MpMessageType type, string value ) : Task
openId string 用户OpenId
type MpMessageType 消息类型
value string /// 文字消息:文字内容; /// 图片、音频、视频消息:文件ID; /// 图文消息:消息ID; ///
return Task