/// <summary> /// 接口7.通知微信触发认证 /// </summary> /// <remarks>当用户未经扫一扫而手动连接Wi-Fi,或者用户之前设备记忆自动连接Wi-Fi后,发起网络请求不通过,Wi-Fi服务提供商通知微信触发验证通知时调用。 /// <para>当用户成功连接登录授权AP网络时,Wi-Fi服务提供商通知微信用户登录结果。</para></remarks> /// <param name="accessToken">调用接口凭证</param> /// <param name="action">通知触发的行为,目前有push,loginSuccess,loginFail。详见<see cref="NoticeWeixinInfoAction"/></param> /// <param name="mac">已经联网触发网络请求的设备手机mac地址</param> /// <param name="deviceMac">已经联网触发网络请求的AP设备mac地址 /// <para>(action为loginSuccess,loginFail时必须输入该该参数)</para></param> /// <returns></returns> public static async Task <WifiErrorJson> NoticeWeixinInfo(string accessToken, string mac, NoticeWeixinInfoAction action = NoticeWeixinInfoAction.push, string deviceMac = null) { string api = "https://api.weixin.qq.com/wifi/noticeWeixinInfo.xhtml?access_token=ACCESSTOKEN&action=ACTION&mac=CLIENTMAC&deviceMac=DEVICEMAC&format=json"; api = api.Replace("ACCESSTOKEN", accessToken); api = api.Replace("ACTION", action.ToString()); api = api.Replace("CLIENTMAC", mac); api = api.Replace("DEVICEMAC", deviceMac); WifiErrorJson result = await HttpUtility.GetJson <WifiErrorJson>(api); return(result); }
/// <summary> /// 接口14. 推送AP心跳数据到微信 /// <para>为更好的监控AP实时在线运营情况,以便给用户更好稳定的上网体验。微信需要AP心跳数据的支持。</para> /// <para>请WI-FI服务商每5分钟推送AP当前在线状态以及连接人数给到微信。</para> /// </summary> /// <param name="accessToken"></param> /// <returns>正常情况下,微信会返回下述JSON数据包给开发者: /// <para><code>{"errorCode":0, "errorMessage":"" }</code></para> /// 错误时微信会返回错误码等信息,JSON数据包示例如下(该示例为AppID无效错误): /// <para><code>{"errorCode":40013,"errorMessage":"invalid appid"}</code></para> /// </returns> public static async Task <WifiErrorJson> PushApOnline(string accessToken, List <ApOnlineData> apOnlineList) { string api = "https://api.weixin.qq.com/wifi/pushApOnline.xhtml?access_token=ACCESSTOKEN&format=json"; api = api.Replace("ACCESSTOKEN", accessToken); Dictionary <string, string> param = new Dictionary <string, string>(); param.Add("apOnlineList", JsonSerializer.Serialize(apOnlineList)); WifiErrorJson result = await HttpUtility.PostGetJson <WifiErrorJson>(api, null, param); return(result); }
/// <summary> /// 接口15. 绑定已生成的AD到AP /// <para>为方便开发者将已经设置过的广告应用到其他AP上,该接口只需提供之前设置过的广告ID以及希望应用于的AP的设备编号列表。</para> /// <para>接口6设置AD信息会返回设置好的广告ID:requestId,如果想将该广告应用到其他AP上,则可以传该ID。</para> /// <para>如果该广告审核不通过,则返回失败。 如果该广告审核不通过,则返回失败。</para> /// </summary> /// <param name="accessToken">调用接口凭证</param> /// <param name="adId">广告ID,即接口6设置AD信息成功后返回的requestId</param> /// <param name="deviceNos">AP设备编号列表,json数组串。 /// <para>例如:</para> /// <para><code>["deviceno1","deviceno2"]</code></para></param> /// <returns>正常情况下,微信会返回下述JSON数据包给开发者: /// <para><code>{"errorCode":0, "errorMessage":"" }</code></para> /// 错误时微信会返回错误码等信息,JSON数据包示例如下(该示例为AppID无效错误): /// <para><code>{"errorCode":40013,"errorMessage":"invalid appid"}</code></para> /// </returns> public static async Task <WifiErrorJson> BindAd(string accessToken, string adId, List <string> deviceNos) { string api = "https://api.weixin.qq.com/wifi/bindAd.xhtml?access_token=ACCESSTOKEN&format=json"; api = api.Replace("ACCESSTOKEN", accessToken); Dictionary <string, string> param = new Dictionary <string, string>(); param.Add("adId", adId); param.Add("deviceNos", JsonSerializer.Serialize(deviceNos)); WifiErrorJson result = await HttpUtility.PostGetJson <WifiErrorJson>(api, null, param); return(result); }
/// <summary> /// 接口13.设置WiFi服务商配置信息 /// <para>当Wi-Fi服务提供商完成回调授权接口的实现后,需要将该接口的url和接口凭证设置到微信系统中来。</para> /// </summary> /// <param name="accessToken"></param> /// <param name="callbackUrl">回调授权的URL /// <para>例如:“http://xxxx”</para></param> /// <param name="callbackToken">调用callbackUrl的凭证,即接口8(回调授权请求)中生成signature的token</param> /// <returns>正常情况下,微信会返回下述JSON数据包给开发者: /// <para><code>{"errorCode":0, "errorMessage":"" }</code></para> /// 错误时微信会返回错误码等信息,JSON数据包示例如下(该示例为AppID无效错误): /// <para><code>{"errorCode":40013,"errorMessage":"invalid appid"}</code></para> /// </returns> public static async Task <WifiErrorJson> SetVendorConfig(string accessToken, string callbackUrl, string callbackToken) { string api = "https://api.weixin.qq.com/wifi/setVendorConfig.xhtml?access_token=ACCESSTOKEN&format=json"; api = api.Replace("ACCESSTOKEN", accessToken); Dictionary <string, string> param = new Dictionary <string, string>(); param.Add("callbackUrl", callbackUrl); param.Add("token", callbackToken); WifiErrorJson result = await HttpUtility.PostGetJson <WifiErrorJson>(api, null, param); return(result); }
/// <summary> /// 接口11.推送AP统计数据到微信 /// <para>为保证用户体验,微信需要对服务商的连接成功率进行监控,需要AP相关的统计数据支持。WI-FI服务商每天推送前一天的AP统计数据给到微信。</para> /// </summary> /// <param name="accessToken"></param> /// <param name="statDate">Ap的统计数据日期,格式是20140903</param> /// <param name="statList">统计数据</param> /// <returns>正常情况下,微信会返回下述JSON数据包给开发者: /// <para><code>{“errorCode”:0, ”errorMessage”:”” }</code></para> /// 错误时微信会返回错误码和错误的设备编码等信息, JSON数据包示例如下: /// <para><code>{"errorCode":30013,"errorMessage":"参数非法"}</code></para> /// </returns> public static async Task <WifiErrorJson> PushStatData(string accessToken, DateTime statDate, List <DeviceStat> statList) { string api = "https://api.weixin.qq.com/wifi/pushStatData.xhtml?access_token=ACCESSTOKEN&format=json"; api = api.Replace("ACCESSTOKEN", accessToken); Dictionary <string, string> param = new Dictionary <string, string>(); param.Add("statDate", statDate.ToString("yyyyMMdd")); string statListJson = JsonSerializer.Serialize(statList); param.Add("statList", statListJson); WifiErrorJson result = await HttpUtility.PostGetJson <WifiErrorJson>(api, null, param); return(result); }