This commit is contained in:
CortexCore 2024-07-29 16:14:23 +08:00
parent c6b591ede9
commit d291923276
36 changed files with 361 additions and 173 deletions

View File

@ -1,35 +0,0 @@
using System.Text.Json.Serialization;
using Newtonsoft.Json;
namespace WeChatSharp.Interfaces;
/// <summary>
/// 微信模板消息接口定义
/// </summary>
public interface IWeChatTemplateMessage
{
/// <summary>
/// 接收者(用户)的 openid
/// </summary>
[JsonProperty("touser")]
string ToUser { get; }
/// <summary>
/// 模板Id
/// </summary>
[JsonProperty("template_id")]
string TemplateId { get; }
/// <summary>
/// 消息的Url
/// </summary>
[JsonProperty("url")]
string Url { get; }
/// <summary>
/// 消息的id,通常为Guid.New
/// </summary>
[JsonProperty("client_msg_id")]
string ClientMsgId { get; }
/// <summary>
/// 模板消息的数据
/// </summary>
[JsonProperty("data")]
IDictionary<string, WeChatTemplateMessageData> Data { get; }
}

View File

@ -1,9 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace WeChatSharp.Interfaces.Topic;
public interface ITopModel
{
[Key]
Guid id { get; }
}

View File

@ -1,6 +0,0 @@
namespace WeChatSharp.Interfaces.Topic;
public interface ITopicService
{
}

View File

@ -1,52 +0,0 @@
using System.Text.Json.Serialization;
using Newtonsoft.Json;
using WeChatSharp.Interfaces;
namespace WeChatSharp;
public struct WeChatTemplateMessageData
{
public WeChatTemplateMessageData(string value)
{
this.value = value;
}
/// <summary>
/// 值
/// </summary>
public string value { get; set; }
}
public struct WeChatTemplateMessage: IWeChatTemplateMessage
{
[JsonProperty("touser")]
public string ToUser { get; set; }
[JsonProperty("template_id")]
public string TemplateId { get; set; }
[JsonProperty("url")]
public string Url { get; set; }
[JsonProperty("client_msg_id")]
public string ClientMsgId { get; set; }
[JsonProperty("data")]
public IDictionary<string, WeChatTemplateMessageData> Data { get; set; }
}
// {
// "touser":"oY0tZ6_aqq_MEWsej9zJEY6OVspI",
// "template_id":"TA6ogf8kMiB31M0oQ8WCxteITUauajrtuGL1LtptNg0",
// "url":"http://weixin.qq.com/download",
// "client_msg_id":"MSG_000002",
// "data":{
//
// "character_string5":{
// "value":"202307251515"
// },
// "thing4": {
// "value":"已创建"
// },
// "thing9": {
// "value":"CAICT"
// },
// "phrase13":{
// "value":"手动提交"
// }
// }
// }

View File

@ -1,71 +0,0 @@
using Newtonsoft.Json;
namespace WeChatSharp;
[Serializable]
public record WeChatUserInfo
{
[JsonProperty(propertyName: "subscribe")]
public int Subscribe;
[JsonProperty(propertyName: "openid")] public string OpenId;
[JsonProperty(propertyName: "nickname")]
public string NickName;
[JsonProperty(propertyName: "sex")] public int Sex;
[JsonProperty(propertyName: "language")]
public string Language;
[JsonProperty(propertyName: "city")] public string City;
[JsonProperty(propertyName: "province")]
public string Province;
[JsonProperty(propertyName: "country")]
public string Country;
[JsonProperty(propertyName: "headimgurl")]
public string HeadImgUrl;
[JsonProperty(propertyName: "subscribe_time")]
public int SubscribeTime;
[JsonProperty(propertyName: "remark")] public string Remark;
[JsonProperty(propertyName: "groupid")]
public int GroupId;
[JsonProperty(propertyName: "tagid_list")]
public string[] TagIdList;
[JsonProperty(propertyName: "subscribe_scene")]
public string SubscribeScene;
[JsonProperty(propertyName: "qr_scene")]
public int QrScene;
[JsonProperty(propertyName: "qr_scene_str")]
public string QrSceneStr;
}
/*
{
"subscribe": 1,
"openid": "oY0tZ6_aqq_MEWsej9zJEY6OVspI",
"nickname": "",
"sex": 0,
"language": "zh_CN",
"city": "",
"province": "",
"country": "",
"headimgurl": "",
"subscribe_time": 1687668622,
"remark": "Root",
"groupid": 0,
"tagid_list": [],
"subscribe_scene": "ADD_SCENE_SEARCH",
"qr_scene": 0,
"qr_scene_str": ""
}
*/

8
Src/Commands.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: cadc6681b7ee58e4e8ae57a4784a25b9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7c7fbd0297b3ffa4290de1be763c6960
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Src/Extensions.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: eb08a656d9668574389decbedbec6ce2
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1c271aafe92f01547bb4f1f4f411f935
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Src/Models.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 685f9f54d2f0ccb4da01908178cf26b0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 306d4bda8b5dfee41b36437cf4684383
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,41 @@
using System.Collections.Generic;
using Newtonsoft.Json;
namespace WeChatSharp
{
/// <summary>
/// 微信模板消息接口定义
/// </summary>
public interface IWeChatTemplateMessage
{
/// <summary>
/// 接收者(用户)的 openid
/// </summary>
[JsonProperty("touser")]
string ToUser { get; }
/// <summary>
/// 模板Id
/// </summary>
[JsonProperty("template_id")]
string TemplateId { get; }
/// <summary>
/// 消息的Url
/// </summary>
[JsonProperty("url")]
string Url { get; }
/// <summary>
/// 消息的id,通常为Guid.New
/// </summary>
[JsonProperty("client_msg_id")]
string ClientMsgId { get; }
/// <summary>
/// 模板消息的数据
/// </summary>
[JsonProperty("data")]
IDictionary<string, WeChatTemplateMessageData> Data { get; }
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3818fa8c896531a489272a81e6f04e78
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f93beebe428073d47b08c001d80749bd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,14 @@
{
"name": "WeChatSharp",
"rootNamespace": "",
"references": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": true
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 6ff759f134ec63c408c65b69f8fa11a7
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,49 @@
using System.Collections.Generic;
using Newtonsoft.Json;
namespace WeChatSharp
{
public struct WeChatTemplateMessageData
{
public WeChatTemplateMessageData(string value)
{
this.value = value;
}
/// <summary>
/// 值
/// </summary>
public string value { get; set; }
}
public struct WeChatTemplateMessage : IWeChatTemplateMessage
{
[JsonProperty("touser")] public string ToUser { get; set; }
[JsonProperty("template_id")] public string TemplateId { get; set; }
[JsonProperty("url")] public string Url { get; set; }
[JsonProperty("client_msg_id")] public string ClientMsgId { get; set; }
[JsonProperty("data")] public IDictionary<string, WeChatTemplateMessageData> Data { get; set; }
}
// {
// "touser":"oY0tZ6_aqq_MEWsej9zJEY6OVspI",
// "template_id":"TA6ogf8kMiB31M0oQ8WCxteITUauajrtuGL1LtptNg0",
// "url":"http://weixin.qq.com/download",
// "client_msg_id":"MSG_000002",
// "data":{
//
// "character_string5":{
// "value":"202307251515"
// },
// "thing4": {
// "value":"已创建"
// },
// "thing9": {
// "value":"CAICT"
// },
// "phrase13":{
// "value":"手动提交"
// }
// }
// }
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7d3b667edd95b85458a29992a4f3acd0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,74 @@
using System;
using Newtonsoft.Json;
namespace WeChatSharp
{
[Serializable]
public record WeChatUserInfo
{
[JsonProperty(propertyName: "subscribe")]
public int Subscribe;
[JsonProperty(propertyName: "openid")] public string OpenId;
[JsonProperty(propertyName: "nickname")]
public string NickName;
[JsonProperty(propertyName: "sex")] public int Sex;
[JsonProperty(propertyName: "language")]
public string Language;
[JsonProperty(propertyName: "city")] public string City;
[JsonProperty(propertyName: "province")]
public string Province;
[JsonProperty(propertyName: "country")]
public string Country;
[JsonProperty(propertyName: "headimgurl")]
public string HeadImgUrl;
[JsonProperty(propertyName: "subscribe_time")]
public int SubscribeTime;
[JsonProperty(propertyName: "remark")] public string Remark;
[JsonProperty(propertyName: "groupid")]
public int GroupId;
[JsonProperty(propertyName: "tagid_list")]
public string[] TagIdList;
[JsonProperty(propertyName: "subscribe_scene")]
public string SubscribeScene;
[JsonProperty(propertyName: "qr_scene")]
public int QrScene;
[JsonProperty(propertyName: "qr_scene_str")]
public string QrSceneStr;
}
/*
{
"subscribe": 1,
"openid": "oY0tZ6_aqq_MEWsej9zJEY6OVspI",
"nickname": "",
"sex": 0,
"language": "zh_CN",
"city": "",
"province": "",
"country": "",
"headimgurl": "",
"subscribe_time": 1687668622,
"remark": "Root",
"groupid": 0,
"tagid_list": [],
"subscribe_scene": "ADD_SCENE_SEARCH",
"qr_scene": 0,
"qr_scene_str": ""
}
*/
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2c6408b8b167de0418a4f9a642fb492c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Src/Services.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3a97aa7f0cdbf9948a0916f82f7a755f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 74ea767399428324097e7dbab4f35698
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5abd85a5465eed24da3a7589d0fe017b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8a90d347df361134faa0c154b467723e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0d4b3b16602b9484fbd4aef30d2ed627
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0d3fadf37baa969479b11a2b4fa504be
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Src/package.json Normal file
View File

@ -0,0 +1,8 @@
{
"name": "com.bitkit.wechat",
"displayName": "WeChatSharp",
"version": "2024.3.31",
"unity": "2022.3",
"description": "WeChat,微信SDK支持",
"dependencies": {}
}

7
Src/package.json.meta Normal file
View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 7eed4d66378d235449ef9c609e45a102
PackageManifestImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: