Skip to content

Commit

Permalink
Merge pull request #2952 from JeffreySu/Developer
Browse files Browse the repository at this point in the history
Developer
  • Loading branch information
JeffreySu authored Nov 28, 2023
2 parents 30296f5 + 094a482 commit d1d8f74
Show file tree
Hide file tree
Showing 16 changed files with 445 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Version>6.7.2</Version>
<Version>6.8.0</Version>
<UserSecretsId>35e58786-0820-4cde-b1ff-f4c6198d00f7</UserSecretsId>
<PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
版本:v@(TempData["SampleVersion"]) (@TempData["BuildTime"])
</p>
<p>&nbsp;</p>
<p>支持 .NET Framework 4.6+ / .NET Core 2.x / .NET Core 3.x / .NET 5 / .NET 6 / <strong>.NET 7</strong></p>
<p>支持 .NET Framework 4.6+ / .NET Core 2.x / .NET Core 3.x / .NET 5 - <strong> .NET 8</strong></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<div class="weixin-bottom-buttons">
Expand Down Expand Up @@ -113,8 +113,8 @@
<th>当前站点运行版本</th>
<th>.NET 4.6.2</th>
@*<th>.NET Standard<br />2.0 / 2.1</th>*@
<th>.NET Core<br />2.x / 3.x</th>
<th>.NET<br />6.0 / 7.0</th>
@* <th>.NET Core<br />2.x / 3.x</th> *@
<th>.NET 8.0(向下兼容)</th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -148,7 +148,7 @@
</td>
<td><img title=".NET 4.6.2" alt=".NET 4.6.2" src="https://img.shields.io/badge/4.6.2-@(YesOrNo(value.SupportNet45)).svg" /></td>
@*<td><img title=".NET Standard 2.0 / 2.1" alt=".NET Standard 2.0 / 2.1" src="https://img.shields.io/badge/standard2.1-@(YesOrNo(value.SupportStandard21)).svg" /></td>*@
<td><img title=".NET Core 2.x / 3.x" alt=".NET Core 2.x / 3.x" src="https://img.shields.io/badge/netcore3.1-@(YesOrNo(value.SupportNetCore31)).svg" /></td>
@* <td><img title=".NET Core 2.x / 3.x" alt=".NET Core 2.x / 3.x" src="https://img.shields.io/badge/netcore3.1-@(YesOrNo(value.SupportNetCore31)).svg" /></td> *@
<td><img title=".NET 6.0 / 8.0" alt=".NET 6.0 / 8.0" src="https://img.shields.io/badge/net8.0-@(YesOrNo(value.SupportNet6)).svg" /></td>
</tr>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
@*<span>2017年6月16日已发布新版本,改进诸多功能,并发布企业微信(Senparc.Weixin.Work)测试版,支持 .net core / .net 4.5。<a href="http://mp.weixin.qq.com/s/G77RaeYnVuk9zciNrop9aA" target="_blank">点击这里查看</a>。</span>*@
@*<span>Senparc 官方微信开发教程《微信开发深度解析:公众号、小程序高效开发秘籍》已经出版,<a href="https://book.weixin.senparc.com/book/link?code=sdk-banner" target="_blank">点击这里购买正版</a>。</span>*@
<span>
Senparc.Weixin SDK 已发布 .NET 7 版本,全面支持 .NET 7(向下兼容)!<br />
Senparc.Weixin SDK 已发布 .NET 8 版本,全面支持 .NET 8(向下兼容)!<br />
Senparc 官方微信开发视频教程《微信公众号+小程序快速开发(一)》已全部上线,<a href="https://book.weixin.senparc.com/book/videolinknetease?code=sdk-banner" target="_blank">【点击这开始学习】</a>。<br />
Senparc 官方微信开发教程《微信开发深度解析:公众号、小程序高效开发秘籍》已经出版(已第 9 次印刷),<a href="https://book.weixin.senparc.com/book/link?code=sdk-banner" target="_blank">【点击这里购买正版】</a>。<br />
@* Sample 项目自动生成工具 v1.6 正式版已发布。<a href="@Url.Action("WeChatSampleBuilder","Home")">【点击这里查看】</a>。<br />*@
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,36 +15,25 @@
/* 注意:TenpayApiV3Controller 为真正微信支付 API V3 的示例 */

//DPBMARK_FILE TenPay
using Microsoft.AspNetCore.Http;
using System.Collections.Concurrent;
using System.Text;
using Microsoft.AspNetCore.Mvc;
using Senparc.CO2NET.Extensions;
using Senparc.CO2NET.HttpUtility;
using Senparc.CO2NET.Utilities;
using Senparc.Weixin.Entities;
using Senparc.Weixin.Exceptions;
using Senparc.Weixin.Helpers;
using Senparc.Weixin.Sample.TenPayV3.Controllers;
using Senparc.Weixin.MP.AdvancedAPIs;
//DPBMARK MP
using Senparc.Weixin.Sample.TenPayV3.Filters;
using Senparc.Weixin.Sample.TenPayV3.Models;
using Senparc.Weixin.TenPayV3;
using Senparc.Weixin.Sample.TenPayV3.Utilities;
using Senparc.Weixin.TenPayV3.Apis;
using Senparc.Weixin.TenPayV3.Apis.BasePay;
using Senparc.Weixin.TenPayV3.Apis.BasePay.Entities;
using Senparc.Weixin.TenPayV3.Apis.Entities;
using Senparc.Weixin.TenPayV3.Entities;
using Senparc.Weixin.TenPayV3.Helpers;
using System;
using System.Collections.Concurrent;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

//DPBMARK MP
using Senparc.Weixin.MP;
using Senparc.Weixin.Sample.TenPayV3.Filters;
using Senparc.Weixin.MP.AdvancedAPIs;
using Senparc.CO2NET.HttpUtility;
using Senparc.Weixin.Sample.TenPayV3.Utilities;
using ZXing;
//DPBMARK_END

namespace Senparc.Weixin.Sample.TenPayV3.Controllers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public void GetIndustryTest()
public void AddtemplateTest()
{
var accessToken = AccessTokenContainer.GetAccessToken(_appId);
var result = TemplateApi.Addtemplate(accessToken, "OPENTM207498902");
var result = TemplateApi.AddTemplate(accessToken, "OPENTM207498902", null);
Assert.AreEqual(ReturnCode.请求成功, result.errcode);
Assert.IsNotNull(result.template_id);
Console.WriteLine(result.template_id);
Expand All @@ -246,7 +246,7 @@ public void DelPrivateTemplateTest()
//var accessToken = AccessTokenContainer.GetAccessToken(_appId);

//添加模板
var addResult = TemplateApi.Addtemplate(_appId, "OPENTM206164559");
var addResult = TemplateApi.AddTemplate(_appId, "OPENTM206164559", null);
var templateId = addResult.template_id;
Assert.IsNotNull(templateId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,53 @@ public void RequestMessageEvent_Change_Contact_User_Create()

}


/// <summary>
/// 创建成员
/// </summary>
[TestMethod]
public async Task RequestMessageEvent_Change_External_Chat_Update()
{
//官方提供
var xml = @"<xml>
<ToUserName><![CDATA[wwea4ccebadeefd11a]]></ToUserName>
<FromUserName><![CDATA[sys]]></FromUserName>
<CreateTime>1700642907</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[change_external_chat]]></Event>
<ChatId><![CDATA[wree9uDgAAfxkLu5-lEbsmQBjsb7V8Cg]]></ChatId>
<ChangeType><![CDATA[update]]></ChangeType>
<UpdateDetail><![CDATA[change_name]]></UpdateDetail>
<JoinScene>0</JoinScene>
<MemChangeCnt>2</MemChangeCnt>
<LastMemVer><![CDATA[6ebe7c3f89cb839ec2e1720f04eae2e0]]></LastMemVer>
<CurMemVer><![CDATA[15722766561cf8bce92480a3d1457654]]></CurMemVer>
</xml>";

var postModel = new PostModel()
{
Msg_Signature = "22cb38c34ae9ba4bdec938405b931ad3ece7e19e",
Timestamp = "1644320363",
Nonce = "1645172247",

Token = "",
EncodingAESKey = "",
CorpId = ""
};

var messageHandler = new CustomMessageHandlers(XDocument.Parse(xml), postModel, 10);

await Console.Out.WriteLineAsync(messageHandler.RequestMessage.ToJson(true));

await messageHandler.ExecuteAsync(new System.Threading.CancellationToken());
var responseMessage = messageHandler.ResponseDocument;

Assert.IsNotNull(messageHandler.RequestMessage);
Assert.AreEqual(RequestMsgType.Event, messageHandler.RequestMessage.MsgType);
Assert.IsInstanceOfType(messageHandler.RequestMessage, typeof(RequestMessageEvent_Change_External_Chat_Update));

var requestMessage = messageHandler.RequestMessage as RequestMessageEvent_Change_External_Chat_Update;
Console.WriteLine(requestMessage.MemberChangeList.ToJson(true));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ and limitations under the License.
创建标识:lishewen - 20200318
修改标识:XiaoPoTian - 20231122
修改描述:v3.18.1 添加“当前群成员版本号。可以配合客户群变更事件减少主动调用本接口的次数”(member_version)
----------------------------------------------------------------*/

Expand Down Expand Up @@ -78,6 +81,11 @@ public class Group_Chat
/// </summary>
public string notice { get; set; }

/// <summary>
/// 当前群成员版本号。可以配合客户群变更事件减少主动调用本接口的次数
/// </summary>
public string member_version { get; set; }

/// <summary>
/// 群成员列表
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
using System.Collections.Generic;
/*----------------------------------------------------------------
Copyright (C) 2023 Senparc
文件名:ApprovalCreateTemplateRequest.cs
文件功能描述:创建审批模板 请求
创建标识:Senparc - 20230224
修改标识:Senparc - 20231128
修改描述:修复:template_names 命名更正为:template_name
----------------------------------------------------------------*/
using System.Collections.Generic;

namespace Senparc.Weixin.Work.AdvancedAPIs.OA.OAJson
{
/// <summary>
///
/// 创建审批模板 请求
/// </summary>
public class ApprovalCreateTemplateRequest
{
/// <summary>
///
/// </summary>
public List<ApprovalCreateTemplateRequest_TextAndLang> template_names { get; set; }
public List<ApprovalCreateTemplateRequest_TextAndLang> template_name { get; set; }

/// <summary>
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
修改标识:Senparc - 20231026
修改描述:v3.17.0 成员对外联系 > 客户消息通知处理
修改标识:XiaopPoTian - 20231121
修改描述:v3.18.1 删除企业客户事件 > 新加Source,删除客户的操作来源
----------------------------------------------------------------*/

namespace Senparc.Weixin.Work.Entities.Request.Event
Expand Down Expand Up @@ -117,6 +120,11 @@ public class RequestMessageEvent_Change_ExternalContact_Del : RequestMessageEven
/// 外部联系人的userid
/// </summary>
public string ExternalUserID { get; set; }
/// <summary>
/// 删除客户的操作来源,DELETE_BY_TRANSFER表示此客户是因在职继承自动被转接成员删除
///
/// </summary>
public string Source { get; set; }
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,16 @@
修改标识:WangDrama - 20210630
修改描述:v3.9.600 添加群直播回调事件
修改标识:XiaoPoTian - 20231122
修改描述:v3.18.1 添加客户群变更事件(MemChangeList,LastMemVer,CurMemVer)
----------------------------------------------------------------*/

using Senparc.CO2NET.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;

namespace Senparc.Weixin.Work.Entities
{
Expand All @@ -32,21 +39,24 @@ public override Event Event
/// <summary>
/// 群ID
/// </summary>
public string ChatId { get; set; }
public string ChatId { get; set; }

public virtual ExternalChatChangeType ChangeType { get { return ExternalChatChangeType.create; } }
}

public class RequestMessageEvent_Change_External_Chat_Create: RequestMessageEvent_Change_External_Chat_Base
public class RequestMessageEvent_Change_External_Chat_Create : RequestMessageEvent_Change_External_Chat_Base
{

}

public class RequestMessageEvent_Change_External_Chat_Update : RequestMessageEvent_Change_External_Chat_Base
{
public RequestMessageEvent_Change_External_Chat_Update(string UpdateDetailStr)
public RequestMessageEvent_Change_External_Chat_Update(XElement memChangeListElement)
{
UpdateDetail = (ExternalChatUpdateDetailType)Enum.Parse(typeof(ExternalChatUpdateDetailType), UpdateDetailStr, true);
if(memChangeListElement != null)
{
MemberChangeList = memChangeListElement.Elements().Select(u => u.Value).ToArray();
}
}
public override ExternalChatChangeType ChangeType => ExternalChatChangeType.update;
/// <summary>
Expand All @@ -67,19 +77,33 @@ public RequestMessageEvent_Change_External_Chat_Update(string UpdateDetailStr)
/// 当是成员入群或退群时有值。表示成员变更数量
/// </summary>
public int MemChangeCnt { get; set; }
/// <summary>
/// 当是成员入群或退群时有值。变更的成员列表
/// </summary>
public string[] MemberChangeList { get; set; }
/// <summary>
/// 当是成员入群或退群时有值。 变更前的群成员版本号
/// </summary>
public string LastMemVer { get; set; }
/// <summary>
/// 当是成员入群或退群时有值。变更后的群成员版本号
/// </summary>
public string CurMemVer { get; set; }

}
public class RequestMessageEvent_Change_External_Chat_Dismiss : RequestMessageEvent_Change_External_Chat_Base
{
public override ExternalChatChangeType ChangeType => ExternalChatChangeType.dismiss;
}

public enum ExternalChatChangeType
{
create,
update,
dismiss
}


public enum ExternalChatUpdateDetailType
{
/// <summary>
Expand Down
Loading

0 comments on commit d1d8f74

Please sign in to comment.