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

@@ -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,25 @@
using Newtonsoft.Json;
namespace WeChatSharp
{
public class WeChatAccessToken
{
[JsonProperty("access_token")]
public string AccessToken { get; set; }
[JsonProperty("expires_in")]
public int ExpiresIn { get; set; }
[JsonProperty("refresh_token")]
public string RefreshToken { get; set; }
[JsonProperty("openid")]
public string OpenId { get; set; }
[JsonProperty("scope")]
public string Scope { get; set; }
[JsonProperty("unionid")]
public string UnionId { get; set; }
}
}

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: