330 lines
16 KiB
C#
330 lines
16 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using System.Text;
|
||
using System.Threading.Tasks;
|
||
|
||
namespace PCRobot.PCWechat
|
||
{
|
||
public class BaseApi
|
||
{
|
||
public static bool IsInstall { get; protected set; } = false;
|
||
public static bool IsKsfInstall { get; protected set; } = false;
|
||
public static bool IsQYInstall { get; protected set; } = false;
|
||
|
||
public WechatUser User { get; private set; }
|
||
public BaseApi(WechatUser User)
|
||
{
|
||
this.User = User;
|
||
}
|
||
|
||
const string NotImplemented = "当前版本暂时不支持此操作!";
|
||
|
||
/// <summary>
|
||
/// 服务器的消息包命令
|
||
/// </summary>
|
||
public string ServerMsgID { get; set; }
|
||
|
||
/// <summary>
|
||
/// 发送消息
|
||
/// </summary>
|
||
/// <param name="wxid">发给谁</param>
|
||
/// <param name="message">消息内容</param>
|
||
public virtual void SendMessage(string wxid, string message) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 发送文件消息
|
||
/// </summary>
|
||
/// <param name="wxid">接收者的微信</param>
|
||
/// <param name="file">文件的路径</param>
|
||
public virtual void SendFile(string wxid, string file) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 获取朋友圈
|
||
/// </summary>
|
||
/// <param name="circleId">首页传0,后续的最后一个朋友圈的object_id</param>
|
||
/// <param name="username">获取谁的朋友圈,为空时查询朋友圈首页</param>
|
||
public virtual void FindCircles(string circleId, string username) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 小程序自动授权登录
|
||
/// </summary>
|
||
/// <param name="appid">小程序的id</param>
|
||
public virtual void AutoAuthMiniAPPLogin(string appid) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 发送朋友圈
|
||
/// </summary>
|
||
/// <param name="xmlmsg">朋友圈xml</param>
|
||
public virtual void SendCircle(string xmlmsg) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 发送朋友圈评论
|
||
/// </summary>
|
||
/// <param name="circleId"></param>
|
||
/// <param name="content"></param>
|
||
public virtual void SendCircleComment(string circleId, string content) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 朋友圈点赞
|
||
/// </summary>
|
||
/// <param name="circleId">朋友圈的object_id</param>
|
||
public virtual void SendCirclePraise(string circleId) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 朋友圈上传本地图片
|
||
/// </summary>
|
||
/// <param name="circleId"></param>
|
||
public virtual void CircleUpLoadImage(string path) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 发送图片
|
||
/// </summary>
|
||
/// <param name="wxid">接收者的微信</param>
|
||
/// <param name="path">图片的路径</param>
|
||
public virtual void SendImage(string wxid, string path) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 发送视频
|
||
/// </summary>MT_SEND_VIDEOMSG
|
||
/// <param name="wxid"></param>
|
||
public virtual void SendVideo(string wxid, string path) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 发送小程序
|
||
/// </summary>
|
||
/// <param name="wxid"></param>
|
||
/// <param name="dataJson"></param>
|
||
public virtual void SendProgramMessage(string wxid, string dataJson) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 查询好友信息
|
||
/// </summary>
|
||
/// <param name="wxid">好友的微信ID</param>
|
||
public virtual void GetFriend(string wxid) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
|
||
/// <summary>
|
||
/// 同意加我好友
|
||
/// </summary>
|
||
/// <param name="text">申请好友的校验信息</param>
|
||
public virtual void AgreeAddMe(string text) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 发送卡片
|
||
/// </summary>
|
||
/// <param name="to_wxid">接收者的微信</param>
|
||
/// <param name="card_wxid">名片人的微信</param>
|
||
public virtual void SendCard(string to_wxid, string card_wxid) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 创建群(支持企业和普通微信)
|
||
/// </summary>
|
||
/// <param name="wxidJson"></param>
|
||
public virtual void CreateRoom(string wxidData) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 邀请用户进群,40人以下无需告知用户,直接进群
|
||
/// </summary>
|
||
/// <param name="wxidData"></param>
|
||
public virtual void InviteMemberToRoom_40Down(string groupid, string wxidData) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 邀请用户进群,40人以上发送群邀请卡片
|
||
/// </summary>
|
||
/// <param name="message"></param>
|
||
public virtual void InviteMemberToRoom_40Up(string groupId, string wxidData) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 移除群用户
|
||
/// </summary>
|
||
/// <param name="room">群id</param>
|
||
/// <param name="wxid">用户账号</param>
|
||
public virtual void DeleteRoomMember(string wxid, string room) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 获取通讯录
|
||
/// </summary>
|
||
public virtual void GetContact() { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 获取通信录刷新
|
||
/// </summary>
|
||
/// <param name="isUpdate"></param>
|
||
public virtual void GetContact(bool isUpdate) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 获取好友列表
|
||
/// </summary>
|
||
/// <param name="flushGroupsCache">刷新缓存数据</param>
|
||
/// <returns></returns>
|
||
//public virtual List<FriendInfo> GetFriendInfos(bool flushGroupsCache = false) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
public virtual string GetFriendInfos(bool flushGroupsCache = false) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 获取群列表(不包含群成员)
|
||
/// </summary>
|
||
public virtual void GetGroupsNotInMember() { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 领取转账
|
||
/// </summary>
|
||
/// <param name="data"></param>
|
||
public virtual void PayTransferConfirm(string data) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 删除好友
|
||
/// </summary>
|
||
/// <param name="wxid">要删除的好友微信</param>
|
||
public virtual void DeleteFriend(string wxid) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 用户备注
|
||
/// </summary>
|
||
/// <param name="wxid">备注的用户微信</param>
|
||
/// <param name="remark">备注的内容,删除备注内容为空</param>
|
||
public virtual void EditCotacts(string wxid, string remark) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 置顶
|
||
/// </summary>
|
||
/// <param name="wxid">好友或群聊wxid</param>
|
||
/// <param name="status">0是取消置顶,1置顶</param>
|
||
public virtual void StateOpt(string wxid, int status) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 获取微信用户的详细信息
|
||
/// </summary>
|
||
/// <param name="wxid"></param>
|
||
public virtual void GetWxidInfo(string wxid) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 获取群和用户
|
||
/// </summary>
|
||
/// <param name="wxid"></param>
|
||
public virtual void GetGroupAndFriendInfo(string groupId, string wxid) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 获取群和用户
|
||
/// </summary>
|
||
/// <param name="groupId"></param>
|
||
/// <param name="wxid"></param>
|
||
public virtual void GetGroupAndFriendInfo(string groupId, string wxid, bool flush = false) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 获取群成员
|
||
/// </summary>
|
||
/// <param name="groupId"></param>
|
||
public virtual void GetGroupMemer(string groupId) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 刷新微信用户的详细信息(网络刷新)
|
||
/// </summary>
|
||
/// <param name="wxid"></param>
|
||
public virtual void UpdateWxidInfo(string wxid) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 解密微信加密的图片(.dat)
|
||
/// </summary>
|
||
/// <param name="src_file">微信加密图片路径</param>
|
||
/// <param name="dest_file">解密后的文件路径</param>
|
||
public virtual void DecryptImage(string src_file, string dest_file) { throw new Exception(NotImplemented); }
|
||
|
||
/// <summary>
|
||
/// 刷新微信群的详细信息(网络刷新)
|
||
/// </summary>
|
||
/// <param name="wxid"></param>
|
||
public virtual void UpdateGroupInfo(string groupId) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 获取当前登录版本微信
|
||
/// </summary>
|
||
public virtual string GetVersion() { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 退出当前微信
|
||
/// </summary>
|
||
public virtual void CloseWechat(string message) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 检测URL在微信中是否有效
|
||
/// </summary>
|
||
/// <param name="url"></param>
|
||
/// <returns></returns>
|
||
public virtual void CheckUrl(string url) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 打开内置浏览器
|
||
/// </summary>
|
||
/// <param name="url"></param>
|
||
public virtual void OpenUrl(string url) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 清理历史聊天记录
|
||
/// </summary>
|
||
public virtual void ClearChatHistoryMsg() { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 设置会话为已读
|
||
/// </summary>
|
||
public virtual void SetSessionReadedMsg(string wxid) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 修改群聊名称
|
||
/// </summary>
|
||
/// <param name="new_name">新的群名</param>
|
||
/// <param name="groupId">群id</param>
|
||
public virtual void SetRoomName(string new_name, string groupId) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 修改群公告(可用于@全体)
|
||
/// </summary>
|
||
/// <param name="notice">新公告</param>
|
||
/// <param name="groupId">群聊wxid</param>
|
||
public virtual void SetRoomNotice(string notice, string groupId) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 设置自己在群中昵称
|
||
/// </summary>
|
||
/// <param name="nickname">要设置的昵称</param>
|
||
/// <param name="groupId">需要设置的群id</param>
|
||
public virtual void ModRoomMyName(string nickname, string groupId) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 设置是否显示群成员昵称
|
||
/// </summary>
|
||
/// <param name="status">true为开启</param>
|
||
/// <param name="groupId">要显示得到群</param>
|
||
public virtual void SetRoomShowMemeberName(bool status, string groupId) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 修改群聊名称
|
||
/// </summary>
|
||
/// <param name="newnick">新名称</param>
|
||
/// <param name="groupId">群号</param>
|
||
public virtual void ModRoomName(string newnick, string groupId) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 是否消息免打扰
|
||
/// </summary>
|
||
/// <param name="status">true为开启</param>
|
||
/// <param name="wxid">wxid</param>
|
||
public virtual void SetRecvNotify(bool status, string wxid) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 关注公众号
|
||
/// </summary>
|
||
/// <param name="wxid">公众号wxid</param>
|
||
public virtual void AddPublicUser(string wxid) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
/// <summary>
|
||
/// 开启/关闭防撤回功能
|
||
/// </summary>
|
||
/// <param name="status">1是开启防撤回,0是关闭</param>
|
||
public virtual void SetDisableRevoke(bool status) { throw new Exception(NotImplemented + new System.Diagnostics.StackTrace().GetFrame(0).GetMethod()?.Name); }
|
||
|
||
public virtual
|
||
|
||
}
|
||
}
|