Esempio n. 1
0
        /// <summary>
        /// 获取群员列表数据
        /// </summary>
        /// <param name="group"></param>
        /// <returns></returns>
        public static List <GroupUser> getGroupUserList(long group)
        {
            int    ac       = CQAPI.getAuthCode();
            string jsonData = CQAPI.getGroupUserList(ac, group);

            try {
                JArray           list = JArray.Parse(jsonData);
                List <GroupUser> data = new List <GroupUser>();
                for (int i = 0; i < list.Count; i++)
                {
                    GroupUser gu = new GroupUser();
                    gu.setName(list[i]["name"].ToString());
                    gu.setQQId(int.Parse(list[i]["qqid"].ToString()));
                    gu.setCard(list[i]["card"].ToString());
                    gu.setSex(int.Parse(list[i]["sex"].ToString()));
                    gu.setAge(int.Parse(list[i]["age"].ToString()));
                    gu.setAddress(list[i]["address"].ToString());

                    gu.setJoinTime(long.Parse(list[i]["joinTime"].ToString()));
                    gu.setLastTime(long.Parse(list[i]["lastTime"].ToString()));
                    gu.setRule(int.Parse(list[i]["rule"].ToString()));
                    data.Add(gu);
                }
                return(data);
            } catch (Exception e) {
                return(null);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 获取群员列表数量
        /// </summary>
        /// <param name="group"></param>
        /// <returns></returns>
        public static int getGroupUserListSize(long group)
        {
            int    ac       = CQAPI.getAuthCode();
            string jsonData = CQAPI.getGroupUserList(ac, group);

            try {
                JArray list = JArray.Parse(jsonData);
                return(list.Count);
            } catch (Exception e) {
                return(0);
            }
        }
Esempio n. 3
0
        //public static UdpClient udpClient = null;
        /// <summary>
        /// 撤回消息
        /// </summary>
        /// <param name="msgid">消息ID</param>
        /// <returns></returns>
        public static int deleteMessage(long msgid)
        {
            int ac = CQAPI.getAuthCode();

            if (msgid == (-10))
            {
                CQAPI.xtAddLog(ac, LogType.status.INFO, "撤回消息", "无法撤回消息:查询msgid发生异常,状态码【-10】");
                return(1);
            }
            else if (msgid == 0)
            {
                CQAPI.xtAddLog(ac, LogType.status.INFO, "撤回消息", "无法撤回消息:没有找到所属数据,状态码【0】");
                return(1);
            }
            else if (msgid == (-1))
            {
                CQAPI.xtAddLog(ac, LogType.status.INFO, "撤回消息", "无法撤回消息:没有获取到当前登陆QQ号码,状态码【-1】");
                return(1);
            }
            return(CQAPI.xtDeleteMessage(ac, msgid));
        }
Esempio n. 4
0
 public static int xtAddLog(LogType.status state, string type, string content)
 {
     Log.addLog("CQAPI", type + ":" + content);
     return(xtAddCQPLog(CQAPI.getAuthCode(), state, type, content));
 }