mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-07-15 14:04:32 +08:00
style: clean code
This commit is contained in:
parent
41261206be
commit
b17f6314e1
@ -50,7 +50,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
.CreateRequest(request, HttpMethod.Post, "cv", "img", "qrcode")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
if (!string.IsNullOrEmpty(request.ImageUrl))
|
||||
if (request.ImageUrl != null)
|
||||
flurlReq.SetQueryParam("img_url", request.ImageUrl);
|
||||
|
||||
using var httpContent = CreateRequestHttpContent(request.ImageFileBytes ?? new byte[0]);
|
||||
@ -75,7 +75,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
.CreateRequest(request, HttpMethod.Post, "cv", "img", "superresolution")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
if (!string.IsNullOrEmpty(request.ImageUrl))
|
||||
if (request.ImageUrl != null)
|
||||
flurlReq.SetQueryParam("img_url", request.ImageUrl);
|
||||
|
||||
using var httpContent = CreateRequestHttpContent(request.ImageFileBytes ?? new byte[0]);
|
||||
@ -100,7 +100,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
.CreateRequest(request, HttpMethod.Post, "cv", "img", "aicrop")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
if (!string.IsNullOrEmpty(request.ImageUrl))
|
||||
if (request.ImageUrl != null)
|
||||
flurlReq.SetQueryParam("img_url", request.ImageUrl);
|
||||
|
||||
using var httpContent = CreateRequestHttpContent(request.ImageFileBytes ?? new byte[0]);
|
||||
@ -128,7 +128,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
.SetQueryParam("access_token", request.AccessToken)
|
||||
.SetQueryParam("type", request.ImageMode);
|
||||
|
||||
if (!string.IsNullOrEmpty(request.ImageUrl))
|
||||
if (request.ImageUrl != null)
|
||||
flurlReq.SetQueryParam("img_url", request.ImageUrl);
|
||||
|
||||
using var httpContent = CreateRequestHttpContent(request.ImageFileBytes ?? new byte[0]);
|
||||
@ -154,7 +154,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
.SetQueryParam("access_token", request.AccessToken)
|
||||
.SetQueryParam("type", request.ImageMode);
|
||||
|
||||
if (!string.IsNullOrEmpty(request.ImageUrl))
|
||||
if (request.ImageUrl != null)
|
||||
flurlReq.SetQueryParam("img_url", request.ImageUrl);
|
||||
|
||||
using var httpContent = CreateRequestHttpContent(request.ImageFileBytes ?? new byte[0]);
|
||||
@ -180,7 +180,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
.SetQueryParam("access_token", request.AccessToken)
|
||||
.SetQueryParam("type", request.ImageMode);
|
||||
|
||||
if (!string.IsNullOrEmpty(request.ImageUrl))
|
||||
if (request.ImageUrl != null)
|
||||
flurlReq.SetQueryParam("img_url", request.ImageUrl);
|
||||
|
||||
using var httpContent = CreateRequestHttpContent(request.ImageFileBytes ?? new byte[0]);
|
||||
@ -206,7 +206,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
.SetQueryParam("access_token", request.AccessToken)
|
||||
.SetQueryParam("type", request.ImageMode);
|
||||
|
||||
if (!string.IsNullOrEmpty(request.ImageUrl))
|
||||
if (request.ImageUrl != null)
|
||||
flurlReq.SetQueryParam("img_url", request.ImageUrl);
|
||||
|
||||
using var httpContent = CreateRequestHttpContent(request.ImageFileBytes ?? new byte[0]);
|
||||
@ -232,7 +232,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
.SetQueryParam("access_token", request.AccessToken)
|
||||
.SetQueryParam("type", request.ImageMode);
|
||||
|
||||
if (!string.IsNullOrEmpty(request.ImageUrl))
|
||||
if (request.ImageUrl != null)
|
||||
flurlReq.SetQueryParam("img_url", request.ImageUrl);
|
||||
|
||||
using var httpContent = CreateRequestHttpContent(request.ImageFileBytes ?? new byte[0]);
|
||||
@ -257,7 +257,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
.CreateRequest(request, HttpMethod.Post, "cv", "ocr", "comm")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
if (!string.IsNullOrEmpty(request.ImageUrl))
|
||||
if (request.ImageUrl != null)
|
||||
flurlReq.SetQueryParam("img_url", request.ImageUrl);
|
||||
|
||||
using var httpContent = CreateRequestHttpContent(request.ImageFileBytes ?? new byte[0]);
|
||||
@ -281,7 +281,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
.CreateRequest(request, HttpMethod.Post, "cv", "ocr", "platenum")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
if (!string.IsNullOrEmpty(request.ImageUrl))
|
||||
if (request.ImageUrl != null)
|
||||
flurlReq.SetQueryParam("img_url", request.ImageUrl);
|
||||
|
||||
using var httpContent = CreateRequestHttpContent(request.ImageFileBytes ?? new byte[0]);
|
||||
|
@ -25,7 +25,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (!request.Timestamp.HasValue)
|
||||
if (request.Timestamp == null)
|
||||
request.Timestamp = DateTimeOffset.Now.ToLocalTime().ToUnixTimeSeconds();
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
@ -172,7 +172,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (string.IsNullOrEmpty(request.AppId))
|
||||
if (request.AppId == null)
|
||||
request.AppId = client.Credentials.AppId;
|
||||
|
||||
if (request.CardExtra != null && string.IsNullOrEmpty(request.CardExtra.Nonce))
|
||||
|
@ -24,10 +24,10 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (string.IsNullOrEmpty(request.ComponentAppId))
|
||||
if (request.ComponentAppId == null)
|
||||
request.ComponentAppId = client.Credentials.AppId;
|
||||
|
||||
if (string.IsNullOrEmpty(request.ComponentSecret))
|
||||
if (request.ComponentSecret == null)
|
||||
request.ComponentSecret = client.Credentials.AppSecret;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
@ -49,10 +49,10 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (string.IsNullOrEmpty(request.ComponentAppId))
|
||||
if (request.ComponentAppId == null)
|
||||
request.ComponentAppId = client.Credentials.AppId;
|
||||
|
||||
if (string.IsNullOrEmpty(request.ComponentSecret))
|
||||
if (request.ComponentSecret == null)
|
||||
request.ComponentSecret = client.Credentials.AppSecret;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
@ -74,7 +74,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (string.IsNullOrEmpty(request.ComponentAppId))
|
||||
if (request.ComponentAppId == null)
|
||||
request.ComponentAppId = client.Credentials.AppId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
@ -97,7 +97,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (string.IsNullOrEmpty(request.ComponentAppId))
|
||||
if (request.ComponentAppId == null)
|
||||
request.ComponentAppId = client.Credentials.AppId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
@ -120,7 +120,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (string.IsNullOrEmpty(request.ComponentAppId))
|
||||
if (request.ComponentAppId == null)
|
||||
request.ComponentAppId = client.Credentials.AppId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
@ -143,7 +143,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (string.IsNullOrEmpty(request.ComponentAppId))
|
||||
if (request.ComponentAppId == null)
|
||||
request.ComponentAppId = client.Credentials.AppId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
@ -166,7 +166,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (string.IsNullOrEmpty(request.ComponentAppId))
|
||||
if (request.ComponentAppId == null)
|
||||
request.ComponentAppId = client.Credentials.AppId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
@ -189,7 +189,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (string.IsNullOrEmpty(request.ComponentAppId))
|
||||
if (request.ComponentAppId == null)
|
||||
request.ComponentAppId = client.Credentials.AppId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
@ -212,7 +212,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (string.IsNullOrEmpty(request.ComponentAppId))
|
||||
if (request.ComponentAppId == null)
|
||||
request.ComponentAppId = client.Credentials.AppId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
|
@ -17,12 +17,12 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
if (client == null) throw new ArgumentNullException(nameof(request));
|
||||
if (client == null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (string.IsNullOrEmpty(request.ShopId))
|
||||
if (request.ShopId == null)
|
||||
{
|
||||
request.ShopId = client.Credentials.ImmeDeliveryAppKey;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(request.DeliverySignature))
|
||||
if (request.DeliverySignature == null)
|
||||
{
|
||||
string plainText = $"{request.ShopId}{request.ShopOrderId}{client.Credentials.ImmeDeliveryAppSecret}";
|
||||
request.DeliverySignature = Security.SHA1Utility.Hash(plainText).ToLower();
|
||||
|
@ -111,7 +111,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (string.IsNullOrEmpty(request.AppId))
|
||||
if (request.AppId == null)
|
||||
request.AppId = client.Credentials.AppId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
|
@ -49,9 +49,9 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
.CreateRequest(request, HttpMethod.Get, "cgi-bin", "guide", "getguideacct")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
if (!string.IsNullOrEmpty(request.GuideAccount))
|
||||
if (request.GuideAccount != null)
|
||||
flurlReq.SetQueryParam("guide_account", request.GuideAccount);
|
||||
else if (!string.IsNullOrEmpty(request.GuideOpenId))
|
||||
else if (request.GuideOpenId != null)
|
||||
flurlReq.SetQueryParam("guide_openid", request.GuideOpenId);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinGuideGetGuideAccountResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
|
@ -51,7 +51,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
const string TYPE_VOICE = "voice";
|
||||
const string TYPE_VIDEO = "video";
|
||||
|
||||
if (string.IsNullOrEmpty(request.FileName))
|
||||
if (request.FileName == null)
|
||||
{
|
||||
string ext = "";
|
||||
if (TYPE_IMAGE.Equals(request.Type))
|
||||
@ -66,7 +66,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
request.FileName = Guid.NewGuid().ToString("N").ToLower() + ext;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(request.FileContentType))
|
||||
if (request.FileContentType == null)
|
||||
{
|
||||
if (TYPE_IMAGE.Equals(request.Type) || TYPE_THUMB.Equals(request.Type))
|
||||
request.FileContentType = Utilities.FileNameToContentTypeMapper.GetContentTypeForImage(request.FileName!) ?? "image/png";
|
||||
|
@ -32,7 +32,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
const string TYPE_VOICE = "voice";
|
||||
const string TYPE_VIDEO = "video";
|
||||
|
||||
if (string.IsNullOrEmpty(request.FileName))
|
||||
if (request.FileName == null)
|
||||
{
|
||||
string ext = "";
|
||||
if (TYPE_IMAGE.Equals(request.Type))
|
||||
@ -47,7 +47,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
request.FileName = Guid.NewGuid().ToString("N").ToLower() + ext;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(request.FileContentType))
|
||||
if (request.FileContentType == null)
|
||||
{
|
||||
if (TYPE_IMAGE.Equals(request.Type) || TYPE_THUMB.Equals(request.Type))
|
||||
request.FileContentType = Utilities.FileNameToContentTypeMapper.GetContentTypeForImage(request.FileName!) ?? "image/png";
|
||||
@ -113,10 +113,10 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (string.IsNullOrEmpty(request.FileName))
|
||||
if (request.FileName == null)
|
||||
request.FileName = Guid.NewGuid().ToString("N").ToLower() + ".png";
|
||||
|
||||
if (string.IsNullOrEmpty(request.FileContentType))
|
||||
if (request.FileContentType == null)
|
||||
{
|
||||
request.FileContentType = Utilities.FileNameToContentTypeMapper.GetContentTypeForImage(request.FileName!) ?? "image/png";
|
||||
}
|
||||
|
@ -20,17 +20,17 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
if (reqLoc == null) throw new ArgumentNullException(nameof(reqLoc));
|
||||
if (request == null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (string.IsNullOrEmpty(request.AppId))
|
||||
if (request.AppId == null)
|
||||
{
|
||||
request.AppId = client.Credentials.AppId;
|
||||
}
|
||||
|
||||
if (!request.Timestamp.HasValue)
|
||||
if (request.Timestamp == null)
|
||||
{
|
||||
request.Timestamp = DateTimeOffset.Now.ToLocalTime().ToUnixTimeSeconds();
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(request.Signature))
|
||||
if (request.Signature == null)
|
||||
{
|
||||
IDictionary<string, string> paramMap = new SortedDictionary<string, string>(
|
||||
new Dictionary<string, string>()
|
||||
|
@ -90,7 +90,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
.CreateRequest(request, HttpMethod.Get, "cgi-bin", "user", "get")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
if (!string.IsNullOrEmpty(request.NextOpenId))
|
||||
if (request.NextOpenId != null)
|
||||
flurlReq.SetQueryParam("next_openid", request.NextOpenId);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinUserGetResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
|
@ -658,7 +658,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.MerchantCommonUploadImageResponse> ExecuteMerchantCommonUploadImageAsync(this WechatApiClient client, Models.MerchantCommonUploadImageRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (string.IsNullOrEmpty(request.FileName))
|
||||
if (request.FileName == null)
|
||||
request.FileName = Guid.NewGuid().ToString("N").ToLower() + ".png";
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
|
@ -26,7 +26,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (!request.Timestamp.HasValue)
|
||||
if (request.Timestamp == null)
|
||||
request.Timestamp = DateTimeOffset.Now.ToLocalTime().ToUnixTimeSeconds();
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
@ -69,7 +69,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (string.IsNullOrEmpty(request.AppId))
|
||||
if (request.AppId == null)
|
||||
request.AppId = client.Credentials.AppId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
@ -93,7 +93,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (string.IsNullOrEmpty(request.AppId))
|
||||
if (request.AppId == null)
|
||||
request.AppId = client.Credentials.AppId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
@ -116,7 +116,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (string.IsNullOrEmpty(request.AppId))
|
||||
if (request.AppId == null)
|
||||
request.AppId = client.Credentials.AppId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
@ -139,7 +139,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (string.IsNullOrEmpty(request.AppId))
|
||||
if (request.AppId == null)
|
||||
request.AppId = client.Credentials.AppId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
@ -162,7 +162,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (string.IsNullOrEmpty(request.AppId))
|
||||
if (request.AppId == null)
|
||||
request.AppId = client.Credentials.AppId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
@ -185,7 +185,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (string.IsNullOrEmpty(request.AppId))
|
||||
if (request.AppId == null)
|
||||
request.AppId = client.Credentials.AppId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
@ -208,7 +208,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (string.IsNullOrEmpty(request.AppId))
|
||||
if (request.AppId == null)
|
||||
request.AppId = client.Credentials.AppId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
@ -231,7 +231,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (string.IsNullOrEmpty(request.AppId))
|
||||
if (request.AppId == null)
|
||||
request.AppId = client.Credentials.AppId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
@ -254,7 +254,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (string.IsNullOrEmpty(request.AppId))
|
||||
if (request.AppId == null)
|
||||
request.AppId = client.Credentials.AppId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
@ -277,7 +277,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (string.IsNullOrEmpty(request.AppId))
|
||||
if (request.AppId == null)
|
||||
request.AppId = client.Credentials.AppId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
@ -300,7 +300,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (string.IsNullOrEmpty(request.AppId))
|
||||
if (request.AppId == null)
|
||||
request.AppId = client.Credentials.AppId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
|
@ -31,7 +31,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
.SetQueryParam("access_token", request.AccessToken)
|
||||
.SetQueryParam("resp_type", request.ResponseType);
|
||||
|
||||
if (!string.IsNullOrEmpty(request.ImageUrl))
|
||||
if (request.ImageUrl != null)
|
||||
{
|
||||
flurlReq.SetQueryParam("upload_type", 1)
|
||||
.SetQueryParam("img_url", request.ImageUrl);
|
||||
@ -110,7 +110,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (string.IsNullOrEmpty(request.AppId))
|
||||
if (request.AppId == null)
|
||||
request.AppId = client.Credentials.AppId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
@ -133,7 +133,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (string.IsNullOrEmpty(request.AppId))
|
||||
if (request.AppId == null)
|
||||
request.AppId = client.Credentials.AppId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
|
@ -32,7 +32,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
.SetQueryParam("start_date", request.StartDateString)
|
||||
.SetQueryParam("end_date", request.EndDateString);
|
||||
|
||||
if (!string.IsNullOrEmpty(request.AdSlotName))
|
||||
if (request.AdSlotName != null)
|
||||
flurlReq.SetQueryParam("ad_slot", request.AdSlotName);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.PublisherStatAdposGeneralResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
|
@ -27,7 +27,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (string.IsNullOrEmpty(request.AppId))
|
||||
if (request.AppId == null)
|
||||
request.AppId = client.Credentials.AppId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
|
@ -145,7 +145,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (string.IsNullOrEmpty(request.ComponentAppId))
|
||||
if (request.ComponentAppId == null)
|
||||
request.ComponentAppId = client.Credentials.AppId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
|
@ -209,10 +209,10 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (string.IsNullOrEmpty(request.Nonce))
|
||||
if (request.Nonce == null)
|
||||
request.Nonce = Guid.NewGuid().ToString("N");
|
||||
|
||||
if (!request.Timestamp.HasValue)
|
||||
if (request.Timestamp == null)
|
||||
request.Timestamp = DateTimeOffset.Now.ToLocalTime().ToUnixTimeSeconds();
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
|
@ -141,7 +141,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
if (request.QueryType.HasValue)
|
||||
flurlReq.SetQueryParam("queryType", request.QueryType.Value);
|
||||
|
||||
if (!string.IsNullOrEmpty(request.Query))
|
||||
if (request.Query != null)
|
||||
flurlReq.SetQueryParam("query", request.Query);
|
||||
|
||||
if (request.MaxPrice.HasValue)
|
||||
@ -308,7 +308,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
if (request.EndTimestamp.HasValue)
|
||||
flurlReq.SetQueryParam("endTimestamp", request.EndTimestamp.Value);
|
||||
|
||||
if (!string.IsNullOrEmpty(request.CommissionStatus))
|
||||
if (request.CommissionStatus != null)
|
||||
flurlReq.SetQueryParam("commissionStatus", request.CommissionStatus);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.UnionPromoterOrderSearchResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
|
@ -289,16 +289,16 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
.SetQueryParam("begintime", request.BeginTimestamp)
|
||||
.SetQueryParam("endtime", request.EndTimestamp);
|
||||
|
||||
if (!string.IsNullOrEmpty(request.TraceId))
|
||||
if (request.TraceId != null)
|
||||
flurlReq.SetQueryParam("traceId", request.TraceId);
|
||||
|
||||
if (!string.IsNullOrEmpty(request.PagePath))
|
||||
if (request.PagePath != null)
|
||||
flurlReq.SetQueryParam("url", request.PagePath);
|
||||
|
||||
if (!string.IsNullOrEmpty(request.UserId))
|
||||
if (request.UserId != null)
|
||||
flurlReq.SetQueryParam("id", request.UserId);
|
||||
|
||||
if (!string.IsNullOrEmpty(request.FilterMessage))
|
||||
if (request.FilterMessage != null)
|
||||
flurlReq.SetQueryParam("filterMsg", request.FilterMessage);
|
||||
|
||||
if (request.LogLevel.HasValue)
|
||||
@ -414,7 +414,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
.SetQueryParam("access_token", request.AccessToken)
|
||||
.SetQueryParam("roomId", request.RoomId);
|
||||
|
||||
if (!string.IsNullOrEmpty(request.CustomParameter))
|
||||
if (request.CustomParameter != null)
|
||||
flurlReq.SetQueryParam("params", request.CustomParameter);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.WxaApiBroadcastRoomGetSharedCodeResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
@ -991,7 +991,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
.CreateRequest(request, HttpMethod.Get, "wxaapi", "broadcast", "role", "getrolelist")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
if (!string.IsNullOrEmpty(request.Keyword))
|
||||
if (request.Keyword != null)
|
||||
flurlReq.SetQueryParam("keyword", request.Keyword);
|
||||
|
||||
if (request.Role.HasValue)
|
||||
|
@ -25,7 +25,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (string.IsNullOrEmpty(request.AppId))
|
||||
if (request.AppId == null)
|
||||
request.AppId = client.Credentials.AppId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
|
@ -483,7 +483,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
.CreateRequest(request, HttpMethod.Get, "wxa", "get_qrcode")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
if (!string.IsNullOrEmpty(request.PagePath))
|
||||
if (request.PagePath != null)
|
||||
flurlReq.SetQueryParam("path", request.PagePath);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.WxaGetQrcodeResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
@ -607,7 +607,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
.CreateRequest(request, HttpMethod.Get, "wxa", "revertcoderelease")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
if (!string.IsNullOrEmpty(request.Action))
|
||||
if (request.Action != null)
|
||||
flurlReq.SetQueryParam("action", request.Action);
|
||||
|
||||
if (request.AppVersion.HasValue)
|
||||
|
@ -54,9 +54,9 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
.SetQueryParam("access_token", request.AccessToken)
|
||||
.SetQueryParam("openid", request.OpenId);
|
||||
|
||||
if (!string.IsNullOrEmpty(request.TransactionId))
|
||||
if (request.TransactionId != null)
|
||||
flurlReq.SetQueryParam("transaction_id", request.TransactionId);
|
||||
else if (!string.IsNullOrEmpty(request.OutTradeNumber))
|
||||
else if (request.OutTradeNumber != null)
|
||||
flurlReq.SetQueryParam("mch_id", request.MerchantId)
|
||||
.SetQueryParam("out_trade_no", request.OutTradeNumber);
|
||||
|
||||
@ -403,7 +403,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (string.IsNullOrEmpty(request.AppId))
|
||||
if (request.AppId == null)
|
||||
request.AppId = client.Credentials.AppId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
@ -696,7 +696,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
.CreateRequest(request, HttpMethod.Get, "wxa", "getwxadevinfo")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
if (!string.IsNullOrEmpty(request.Action))
|
||||
if (request.Action != null)
|
||||
flurlReq.SetQueryParam("action", request.Action);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.WxaGetWxaDevInfoResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
|
Loading…
Reference in New Issue
Block a user