接口文件
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
namespace MsgCenterClient.WechatMpTplMsg
|
||||
{
|
||||
/// <summary>
|
||||
/// 访客审核通知
|
||||
/// 模板编号:ku4vArgTpMOvwBeKQpjj6iE1nhVJyHL9xeQUjkUv5sY
|
||||
/// 公众号模板库模板标题:认证成功通知
|
||||
/// </summary>
|
||||
public class FangKeShenHeMsg : MiniAppMsgBase
|
||||
{
|
||||
public FangKeShenHeMsg(int ownerId, string appId, string openId)
|
||||
: base("ku4vArgTpMOvwBeKQpjj6iE1nhVJyHL9xeQUjkUv5sY", ownerId, appId, openId)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 审核结果
|
||||
/// </summary>
|
||||
[DataBody(1)]
|
||||
public DataItem ShenHeJieGuo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 受访单位
|
||||
/// </summary>
|
||||
[DataBody(2)]
|
||||
public DataItem ShouFangDanWei { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 事由
|
||||
/// </summary>
|
||||
[DataBody(3)]
|
||||
public DataItem ShiYou { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 访客姓名
|
||||
/// </summary>
|
||||
[DataBody(4)]
|
||||
public DataItem FangKeXingMing { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 手机号
|
||||
/// </summary>
|
||||
[DataBody(5)]
|
||||
public DataItem ShouJi { get; set; }
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
[DataBody(6)]
|
||||
public DataItem BeiZhu { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace MsgCenterClient.WechatMpTplMsg
|
||||
{
|
||||
public class MiniAppMsgBase
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="templateId">模板Id</param>
|
||||
/// <param name="ownerId">物业Id</param>
|
||||
/// <param name="appId">公众号AppId</param>
|
||||
/// <param name="openId">用户OpenId</param>
|
||||
public MiniAppMsgBase(string templateId, int ownerId, string appId, string openId)
|
||||
{
|
||||
TemplateId = templateId;
|
||||
OwnerId = ownerId;
|
||||
AppId = appId;
|
||||
OpenId = openId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 模板Id
|
||||
/// </summary>
|
||||
public string TemplateId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 物业Id
|
||||
/// </summary>
|
||||
public int OwnerId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 公众号AppId
|
||||
/// </summary>
|
||||
public string AppId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户openId
|
||||
/// </summary>
|
||||
public string OpenId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 跳转的小程序页面
|
||||
/// </summary>
|
||||
public string Page { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表单id
|
||||
/// </summary>
|
||||
public string FormId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 强调的字,可以为空
|
||||
/// </summary>
|
||||
public string EmphasisKeyword { get; set; }
|
||||
|
||||
public object ToRequestObject()
|
||||
{
|
||||
SortedDictionary<int, DataItem> bodyDic = new SortedDictionary<int, DataItem>();
|
||||
|
||||
var type = GetType();
|
||||
var properties = type.GetProperties();
|
||||
|
||||
foreach (var property in properties)
|
||||
{
|
||||
var bodyAttr = property.GetCustomAttributes(typeof(DataBodyAttribute), false);
|
||||
|
||||
if (!bodyAttr.Any())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
int order = ((DataBodyAttribute) bodyAttr[0]).Order;
|
||||
|
||||
DataItem value = property.GetValue(this, null) as DataItem;
|
||||
|
||||
if (value == null)
|
||||
{
|
||||
value = new DataItem();
|
||||
}
|
||||
|
||||
bodyDic[order] = value;
|
||||
}
|
||||
|
||||
return new
|
||||
{
|
||||
key = TemplateId,
|
||||
OwnerId = OwnerId,
|
||||
From = AppId,
|
||||
To = OpenId,
|
||||
Content = new
|
||||
{
|
||||
page=this.Page,
|
||||
form_id=this.FormId,
|
||||
emphasis_keyword=this.EmphasisKeyword,
|
||||
items = bodyDic.Values.Select(t => new {value = t.Value, color = t.Color}).ToList()
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user