-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'Developer' of https://github.com/JeffreySu/WeiXinMPSDK …
…into Developer
- Loading branch information
Showing
2 changed files
with
152 additions
and
0 deletions.
There are no files selected for viewing
106 changes: 106 additions & 0 deletions
106
src/Senparc.Weixin.Open/Senparc.Weixin.Open/WxaAPIs/SearchStatus/SearchStatusApi.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
#region Apache License Version 2.0 | ||
/*---------------------------------------------------------------- | ||
Copyright 2022 Jeffrey Su & Suzhou Senparc Network Technology Co.,Ltd. | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file | ||
except in compliance with the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software distributed under the | ||
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
either express or implied. See the License for the specific language governing permissions | ||
and limitations under the License. | ||
Detail: https://github.com/JeffreySu/WeiXinMPSDK/blob/master/license.md | ||
----------------------------------------------------------------*/ | ||
#endregion Apache License Version 2.0 | ||
|
||
/*---------------------------------------------------------------- | ||
Copyright (C) 2022 Senparc | ||
文件名:SearchStatusApi.cs | ||
文件功能描述:搜索状态接口 | ||
创建标识:Yaofeng - 20220805 | ||
----------------------------------------------------------------*/ | ||
|
||
using Senparc.CO2NET.Extensions; | ||
using Senparc.NeuChar; | ||
using Senparc.Weixin.CommonAPIs; | ||
using Senparc.Weixin.Entities; | ||
using Senparc.Weixin.Open.WxaAPIs.ModifyDomain; | ||
using Senparc.Weixin.Open.WxaAPIs.SearchStatus; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
|
||
namespace Senparc.Weixin.Open.WxaAPIs | ||
{ | ||
[NcApiBind(NeuChar.PlatformType.WeChat_Open, true)] | ||
public class SearchStatusApi | ||
{ | ||
#region 同步方法 | ||
/// <summary> | ||
/// 获取搜索状态 | ||
/// </summary> | ||
/// <param name="accessToken"></param> | ||
/// <param name="timeOut"></param> | ||
/// <returns></returns> | ||
public static GetWxaSearchStatusResultJson GetWxaSearchStatus(string accessToken, int timeOut = Config.TIME_OUT) | ||
{ | ||
var url = string.Format(Config.ApiMpHost + "/wxa/getwxasearchstatus?access_token={0}", accessToken.AsUrlData()); | ||
return CommonJsonSend.Send<GetWxaSearchStatusResultJson>(null, url, null, CommonJsonSendType.GET, timeOut); | ||
} | ||
|
||
/// <summary> | ||
/// 设置搜索状态 | ||
/// </summary> | ||
/// <param name="accessToken"></param> | ||
/// <param name="timeOut"></param> | ||
/// <returns></returns> | ||
public static WxJsonResult ChangeWxaSearchStatus(string accessToken, int status, int timeOut = Config.TIME_OUT) | ||
{ | ||
var url = string.Format(Config.ApiMpHost + "/wxa/changewxasearchstatus?access_token={0}", accessToken.AsUrlData()); | ||
object data = new | ||
{ | ||
status = status | ||
}; | ||
return CommonJsonSend.Send<WxJsonResult>(null, url, data, CommonJsonSendType.POST, timeOut); | ||
} | ||
#endregion | ||
|
||
#region 异步方法 | ||
/// <summary> | ||
/// 获取搜索状态 | ||
/// </summary> | ||
/// <param name="accessToken"></param> | ||
/// <param name="timeOut"></param> | ||
/// <returns></returns> | ||
public static async Task<GetWxaSearchStatusResultJson> GetWxaSearchStatusAsync(string accessToken, int timeOut = Config.TIME_OUT) | ||
{ | ||
var url = string.Format(Config.ApiMpHost + "/wxa/getwxasearchstatus?access_token={0}", accessToken.AsUrlData()); | ||
return await CommonJsonSend.SendAsync<GetWxaSearchStatusResultJson>(null, url, null, CommonJsonSendType.GET, timeOut); | ||
} | ||
|
||
/// <summary> | ||
/// 设置搜索状态 | ||
/// </summary> | ||
/// <param name="accessToken"></param> | ||
/// <param name="timeOut"></param> | ||
/// <returns></returns> | ||
public static async Task<WxJsonResult> ChangeWxaSearchStatusAsync(string accessToken, int status, int timeOut = Config.TIME_OUT) | ||
{ | ||
var url = string.Format(Config.ApiMpHost + "/wxa/changewxasearchstatus?access_token={0}", accessToken.AsUrlData()); | ||
object data = new | ||
{ | ||
status = status | ||
}; | ||
return await CommonJsonSend.SendAsync<WxJsonResult>(null, url, data, CommonJsonSendType.POST, timeOut); | ||
} | ||
#endregion | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
...Senparc.Weixin.Open/WxaAPIs/SearchStatus/SearchStatusJson/GetWxaSearchStatusResultJson.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#region Apache License Version 2.0 | ||
/*---------------------------------------------------------------- | ||
Copyright 2022 Jeffrey Su & Suzhou Senparc Network Technology Co.,Ltd. | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file | ||
except in compliance with the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software distributed under the | ||
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
either express or implied. See the License for the specific language governing permissions | ||
and limitations under the License. | ||
Detail: https://github.com/JeffreySu/WeiXinMPSDK/blob/master/license.md | ||
----------------------------------------------------------------*/ | ||
#endregion Apache License Version 2.0 | ||
|
||
/*---------------------------------------------------------------- | ||
Copyright (C) 2022 Senparc | ||
文件名:GetWxaSearchStatusJson.cs | ||
文件功能描述:获取搜索状态返回类型 | ||
创建标识:Yaofeng - 20220805 | ||
----------------------------------------------------------------*/ | ||
|
||
using Senparc.Weixin.Entities; | ||
|
||
namespace Senparc.Weixin.Open.WxaAPIs.SearchStatus | ||
{ | ||
/// <summary> | ||
/// 获取搜索状态返回类型 | ||
/// </summary> | ||
public class GetWxaSearchStatusResultJson : WxJsonResult | ||
{ | ||
/// <summary> | ||
/// 1 表示不可搜索,0 表示可搜索 | ||
/// </summary> | ||
public int status { get; set; } | ||
} | ||
} |