fix(wxapi): 修复代码分析工具检测出的 API 定义问题

This commit is contained in:
Fu Diwei 2021-06-09 17:32:50 +08:00
parent f5adf00c8a
commit 05c1680789
43 changed files with 56 additions and 56 deletions

View File

@ -53,7 +53,7 @@
- 本库专注于 API 本身的封装;盛派微信 SDK 提供了大而全的功能,可与 MVC 深度集成。
- 本库的接口模型遵循的是微软官方推荐的 C# 属性命名方式(大驼峰命名法);盛派微信 SDK 提供的是微信支付接口本身的命名方式(蛇形命名法和小驼峰命名法混杂)。
- 本库的接口模型遵循的是微软官方推荐的 C# 属性命名方式(大驼峰命名法);盛派微信 SDK 提供的是微信接口本身的命名方式(蛇形命名法和小驼峰命名法混杂)。
- 本库封装了**目前微信官方提供的所有 API**(不支持的已在各模块文档中列出具体原因);盛派微信 SDK 只提供了常用的 API只完整支持直连商户模式、部分支持服务商模式。

View File

@ -858,8 +858,8 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
#region GiftCardOrder
/// <summary>
/// <para>异步调用 [POST] /card/paygiftcard/order/get 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/offiaccount/Cards_and_Offer/Membership_Cards/Manage_Member_Card.html#4 </para>
/// <para>异步调用 [POST] /card/giftcard/order/get 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/offiaccount/Cards_and_Offer/gift_card.html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
@ -871,7 +871,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
if (request is null) throw new ArgumentNullException(nameof(request));
IFlurlRequest flurlReq = client
.CreateRequest(HttpMethod.Post, "card", "paygiftcard", "order", "get")
.CreateRequest(HttpMethod.Post, "card", "giftcard", "order", "get")
.SetOptions(request)
.SetQueryParam("access_token", request.AccessToken);
@ -879,8 +879,8 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
}
/// <summary>
/// <para>异步调用 [POST] /card/paygiftcard/order/batchget 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/offiaccount/Cards_and_Offer/Membership_Cards/Manage_Member_Card.html#4 </para>
/// <para>异步调用 [POST] /card/giftcard/order/batchget 接口。</para>
/// <para>REF:https://developers.weixin.qq.com/doc/offiaccount/Cards_and_Offer/gift_card.html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
@ -892,7 +892,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
if (request is null) throw new ArgumentNullException(nameof(request));
IFlurlRequest flurlReq = client
.CreateRequest(HttpMethod.Post, "card", "paygiftcard", "order", "batchget")
.CreateRequest(HttpMethod.Post, "card", "giftcard", "order", "batchget")
.SetOptions(request)
.SetQueryParam("access_token", request.AccessToken);
@ -900,8 +900,8 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
}
/// <summary>
/// <para>异步调用 [POST] /card/paygiftcard/order/refund 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/offiaccount/Cards_and_Offer/Membership_Cards/Manage_Member_Card.html#4 </para>
/// <para>异步调用 [POST] /card/giftcard/order/refund 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/offiaccount/Cards_and_Offer/gift_card.html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
@ -913,7 +913,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
if (request is null) throw new ArgumentNullException(nameof(request));
IFlurlRequest flurlReq = client
.CreateRequest(HttpMethod.Post, "card", "paygiftcard", "order", "refund")
.CreateRequest(HttpMethod.Post, "card", "giftcard", "order", "refund")
.SetOptions(request)
.SetQueryParam("access_token", request.AccessToken);

View File

@ -84,7 +84,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CgibinUserResponse> ExecuteCgibinUserAsync(this WechatApiClient client, Models.CgibinUserRequest request, CancellationToken cancellationToken = default)
public static async Task<Models.CgibinUserGetResponse> ExecuteCgibinUserGetAsync(this WechatApiClient client, Models.CgibinUserGetRequest request, CancellationToken cancellationToken = default)
{
if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request));
@ -97,7 +97,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
if (!string.IsNullOrEmpty(request.NextOpenId))
flurlReq.SetQueryParam("next_openid", request.NextOpenId);
return await client.SendRequestAsync<Models.CgibinUserResponse>(flurlReq, cancellationToken: cancellationToken);
return await client.SendRequestAsync<Models.CgibinUserGetResponse>(flurlReq, cancellationToken: cancellationToken);
}
}
}

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /cv/ocr/bankcard 接口的响应。</para>
/// <para>表示 [POST] /cv/ocr/comm 接口的响应。</para>
/// </summary>
public class CVOCRCommonResponse : WechatApiResponse
{

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/guide/getguidebuyerchatrecord 接口的响应。</para>
/// <para>表示 [POST] /cgi-bin/guide/addguidebuyerrelation 接口的响应。</para>
/// </summary>
public class CgibinGuideAddGuideBuyerRelationResponse : WechatApiResponse
{

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/guide/addguidebuyerrelation 接口的请求。</para>
/// <para>表示 [POST] /cgi-bin/guide/getguidebuyerrelationlist 接口的请求。</para>
/// </summary>
public class CgibinGuideGetGuideBuyerRelationListRequest : WechatApiRequest
{

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/guide/getguidebuyerchatrecord 接口的响应。</para>
/// <para>表示 [POST] /cgi-bin/guide/rebindguideacctforbuyer 接口的响应。</para>
/// </summary>
public class CgibinGuideRebindGuideAccountForBuyerResponse : WechatApiResponse
{

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/guide/addguide2guidegroup 接口的请求。</para>
/// <para>表示 [POST] /cgi-bin/guide/delguide2guidegroup 接口的请求。</para>
/// </summary>
public class CgibinGuideDeleteGuide2GuideGroupRequest : WechatApiRequest
{

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/guide/addguide2guidegroup 接口的响应。</para>
/// <para>表示 [POST] /cgi-bin/guide/delguide2guidegroup 接口的响应。</para>
/// </summary>
public class CgibinGuideDeleteGuide2GuideGroupResponse : WechatApiResponse
{

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/guide/addguidebuyertag 接口的响应。</para>
/// <para>表示 [POST] /cgi-bin/guide/delguidebuyertag 接口的响应。</para>
/// </summary>
public class CgibinGuideDeleteGuideBuyerTagResponse : WechatApiResponse
{

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/material/get_materialcount 接口的请求。</para>
/// <para>表示 [GET] /cgi-bin/material/get_materialcount 接口的请求。</para>
/// </summary>
public class CgibinMaterialGetMaterialCountRequest : WechatApiRequest
{

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/material/get_materialcount 接口的响应。</para>
/// <para>表示 [GET] /cgi-bin/material/get_materialcount 接口的响应。</para>
/// </summary>
public class CgibinMaterialGetMaterialCountResponse : WechatApiResponse
{

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/media/uploadimg 接口的响应。</para>
/// <para>表示 [POST] /cgi-bin/media/uploadnews 接口的响应。</para>
/// </summary>
public class CgibinMediaUploadNewsResponse : CgibinMediaUploadResponse
{

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/open/create 接口的请求。</para>
/// <para>表示 [POST] /cgi-bin/open/get 接口的请求。</para>
/// </summary>
public class CgibinOpenGetRequest : CgibinOpenCreateRequest
{

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/poi/de;poi 接口的响应。</para>
/// <para>表示 [POST] /cgi-bin/poi/delpoi 接口的响应。</para>
/// </summary>
public class CgibinPOIDeletePOIResponse : WechatApiResponse
{

View File

@ -4,9 +4,9 @@ using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [GET] /cgi-bin/user 接口的请求。</para>
/// <para>表示 [GET] /cgi-bin/user/get 接口的请求。</para>
/// </summary>
public class CgibinUserRequest : WechatApiRequest
public class CgibinUserGetRequest : WechatApiRequest
{
/// <summary>
/// 获取或设置第一个拉取的 OpenId。不填默认从头开始拉取。

View File

@ -6,7 +6,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Models
/// <summary>
/// <para>表示 [GET] /cgi-bin/user/get 接口的响应。</para>
/// </summary>
public class CgibinUserResponse : WechatApiResponse
public class CgibinUserGetResponse : WechatApiResponse
{
public static class Types
{

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [GET] /customservice/kfsession/waitcase 接口的响应。</para>
/// <para>表示 [GET] /customservice/kfsession/getwaitcase 接口的响应。</para>
/// </summary>
public class CustomServiceKfSessionGetWaitCaseResponse : WechatApiResponse
{

View File

@ -9,14 +9,14 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Models
public class CustomServiceMessageRecordGetMessageListRequest : WechatApiRequest
{
/// <summary>
/// 获取或设置起始时间戳。
/// 获取或设置指定起始时间戳。
/// </summary>
[Newtonsoft.Json.JsonProperty("starttime")]
[System.Text.Json.Serialization.JsonPropertyName("starttime")]
public long StartTimestamp { get; set; }
/// <summary>
/// 获取或设置结束时间戳。
/// 获取或设置指定结束时间戳。
/// </summary>
[Newtonsoft.Json.JsonProperty("endtime")]
[System.Text.Json.Serialization.JsonPropertyName("endtime")]
@ -30,7 +30,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Models
public long MessageId { get; set; } = 1;
/// <summary>
/// 获取或设置每次获取条数
/// 获取或设置分页每页数量
/// </summary>
[Newtonsoft.Json.JsonProperty("number")]
[System.Text.Json.Serialization.JsonPropertyName("number")]

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [GET] /customservice/msgrecord/getmsglist 接口的响应。</para>
/// <para>表示 [POST] /customservice/msgrecord/getmsglist 接口的响应。</para>
/// </summary>
public class CustomServiceMessageRecordGetMessageListResponse : WechatApiResponse
{

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /merchant/category/getgetsku 接口的请求。</para>
/// <para>表示 [POST] /merchant/category/getsku 接口的请求。</para>
/// </summary>
public class MerchantCategoryGetSKURequest : WechatApiRequest
{

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /merchant/category/getgetsku 接口的响应。</para>
/// <para>表示 [POST] /merchant/category/getsku 接口的响应。</para>
/// </summary>
public class MerchantCategoryGetSKUResponse : WechatApiResponse
{

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /merchant/express/del 接口的响应。</para>
/// <para>表示 [POST] /merchant/group/del 接口的响应。</para>
/// </summary>
public class MerchantGroupDeleteResponse : WechatApiResponse
{

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /nontax/downloadbill 接口的请求。</para>
/// <para>表示 [POST] /nontax/notifyinconsistentorder 接口的请求。</para>
/// </summary>
public class NontaxNotifyInconsistentOrderRequest : WechatApiRequest
{

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /nontax/downloadbill 接口的响应。</para>
/// <para>表示 [POST] /nontax/notifyinconsistentorder 接口的响应。</para>
/// </summary>
public class NontaxNotifyInconsistentOrderResponse : WechatApiResponse
{

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /product/address/update 接口的请求。</para>
/// <para>表示 [POST] /product/address/delete 接口的请求。</para>
/// </summary>
public class ProductAddressDeleteRequest : WechatApiRequest
{

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /product/decoration/wxaproduct_decoration_pressure_test 接口的请求。</para>
/// <para>表示 [POST] /product/decoration/wxaproduct_decoration_query_pressure_test_status 接口的请求。</para>
/// </summary>
public class ProductDecorationWxaProductDecorationQueryPressureTestStatusRequest : WechatApiRequest
{

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /product/decoration/wxaproduct_decoration_pressure_test 接口的响应。</para>
/// <para>表示 [POST] /product/decoration/wxaproduct_decoration_query_pressure_test_status 接口的响应。</para>
/// </summary>
public class ProductDecorationWxaProductDecorationQueryPressureTestStatusResponse : WechatApiResponse
{

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /product/sku/add 接口的请求。</para>
/// <para>表示 [POST] /product/sku/update_price 接口的请求。</para>
/// </summary>
public class ProductSKUUpdatePriceRequest : WechatApiRequest
{

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /product/sku/add 接口的响应。</para>
/// <para>表示 [POST] /product/sku/update_price 接口的响应。</para>
/// </summary>
public class ProductSKUUpdatePriceResponse : WechatApiResponse
{

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /product/sku/add 接口的请求。</para>
/// <para>表示 [POST] /product/sku/update 接口的请求。</para>
/// </summary>
public class ProductSKUUpdateRequest : WechatApiRequest
{

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /product/sku/add 接口的响应。</para>
/// <para>表示 [POST] /product/sku/update 接口的响应。</para>
/// </summary>
public class ProductSKUUpdateResponse : WechatApiResponse
{

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /product/spu/del 接口的响应。</para>
/// <para>表示 [POST] /product/spu/listing 接口的响应。</para>
/// </summary>
public class ProductSPUListingResponse : WechatApiResponse
{

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /tcb/sendsms2 接口的请求。</para>
/// <para>表示 [POST] /tcb/sendsmsv2 接口的请求。</para>
/// </summary>
public class TcbSendSmsV2Request : WechatApiRequest
{

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /tcb/sendsms2 接口的响应。</para>
/// <para>表示 [POST] /tcb/sendsmsv2 接口的响应。</para>
/// </summary>
public class TcbSendSmsV2Response : WechatApiResponse
{

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [GET] /wxa/createwxagameroom 接口的请求。</para>
/// <para>表示 [GET] /wxa/getwxagameframe 接口的请求。</para>
/// </summary>
public class WxaGetWxaGameFrameRequest : WechatApiRequest
{

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [GET] /wxa/createwxagameroom 接口的响应。</para>
/// <para>表示 [GET] /wxa/getwxagameframe 接口的响应。</para>
/// </summary>
public class WxaGetWxaGameFrameResponse : WechatApiResponse
{

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /wxaapi/log/jserr_list 接口的请求。</para>
/// <para>表示 [POST] /wxaapi/log/get_performance 接口的请求。</para>
/// </summary>
public class WxaApiLogGetPerformanceRequest : WechatApiRequest
{

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /wxaapi/log/jserr_list 接口的响应。</para>
/// <para>表示 [POST] /wxaapi/log/get_performance 接口的响应。</para>
/// </summary>
public class WxaApiLogGetPerformanceResponse : WechatApiResponse
{

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /wxa/business/gamematch/creatematchrule 接口的请求。</para>
/// <para>表示 [POST] /wxa/business/gamematch/getallmatchrule 接口的请求。</para>
/// </summary>
public class WxaBusinessGameMatchGetAllMatchRuleRequest : WechatApiRequest
{

View File

@ -57,14 +57,14 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.UnitTests
Assert.Equal(0, response.ErrorCode);
}
[Fact(DisplayName = "[GET] /cgi-bin/user")]
public async Task CgibinUserTest()
[Fact(DisplayName = "[GET] /cgi-bin/user/get")]
public async Task CgibinUserGetTest()
{
var request = new Models.CgibinUserRequest()
var request = new Models.CgibinUserGetRequest()
{
AccessToken = TestConfigs.WechatAccessToken
};
var response = await TestClients.Instance.ExecuteCgibinUserAsync(request);
var response = await TestClients.Instance.ExecuteCgibinUserGetAsync(request);
Assert.NotEmpty(response.Data.OpenIdList);
Assert.True(response.Total > 0);