using Nancy;using Nancy.ModelBinding;using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace Code.Module{public class CoolQModule : NancyModule{public CoolQModule() : base("/cqapi"){Post["/SendGroupMessage"] = x =>{var para = this.Bind<ApiSendMessage>();int flag = Common.Api.SendGroupMessage(para.Id, para.Message).Id;return this.Response.AsJson(flag, flag > 0 ? HttpStatusCode.OK : HttpStatusCode.NotFound);};Post["/SendPrivateMessage"] = x =>{var para = this.Bind<ApiSendMessage>();int flag = Common.Api.SendPrivateMessage(para.Id, para.Message).Id;return this.Response.AsJson(flag, flag > 0 ? HttpStatusCode.OK : HttpStatusCode.NotFound);};Post["/SendDiscussMessage"] = x =>{var para = this.Bind<ApiSendMessage>();int flag = Common.Api.SendDiscussMessage(para.Id, para.Message).Id;return this.Response.AsJson(flag, flag > 0 ? HttpStatusCode.OK : HttpStatusCode.NotFound);};Post["/GetStrangerInfo"] = x =>{var para = this.Bind<ApiGetStrangerInfo>();return this.Response.AsJson(Common.Api.GetStrangerInfo(para.QqId));};Post["/GetGroupMemberInfo"] = x =>{var para = this.Bind<ApiGetGroupMemberInfo>();return this.Response.AsJson(Common.Api.GetGroupMemberInfo(para.GroupId, para.QqId));};Post["/GetGroupMemberList"] = x =>{var para = this.Bind<ApiGetGroupMemberList>();return this.Response.AsJson(Common.Api.GetGroupMemberList(para.GroupId));};Get["/GetLoginQQ"] = x =>{return this.Response.AsJson(Common.Api.GetLoginQQ());};Get["/GetLoginQQId"] = x =>{return this.Response.AsJson(Common.Api.GetLoginQQ().Id);};Get["/GetLoginNick"] = x =>{return this.Response.AsJson(Common.Api.GetLoginNick());};Get["/GetFriendList"] = x =>{return this.Response.AsJson(Common.Api.GetFriendList().Select(s=> new { s.Nick, s.QQ.Id , s.Postscript}));};Get["/GetGroupList"] = x =>{return this.Response.AsJson(Common.Api.GetGroupList().Select(s => new { s.Group.Id, s.Name, s.CurrentMemberCount, s.MaxMemberCount}));};}}public class ApiSendMessage{public long Id { get; set; }public string Message { get; set; }}public class ApiGetGroupMemberList{public long GroupId { get; set; }}public class ApiGetGroupMemberInfo{public long GroupId { get; set; }public long QqId { get; set; }}public class ApiGetStrangerInfo{public long QqId { get; set; }}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。