忽略
This commit is contained in:
@@ -1,129 +1,129 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Hncore.Wx.Open
|
||||
{
|
||||
public class TemplateBaseModel
|
||||
{
|
||||
public string touser { get; set; }
|
||||
public string template_id { get; set; }
|
||||
public List<TemplateDataItem> Items { get; set; } = new List<TemplateDataItem>();
|
||||
|
||||
//{
|
||||
// "touser":"touser",
|
||||
// "template_id": "TEMPLATE_ID",
|
||||
// "data": {
|
||||
// "keyword1": {
|
||||
// "value": "339208499"
|
||||
// },
|
||||
// "keyword2": {
|
||||
// "value": "2015年01月05日 12:30"
|
||||
// },
|
||||
// "keyword3": {
|
||||
// "value": "腾讯微信总部"
|
||||
// } ,
|
||||
// "keyword4": {
|
||||
// "value": "广州市海珠区新港中路397号"
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
public virtual Dictionary<string, Object> ToData()
|
||||
{
|
||||
var data = new Dictionary<string, Object>() {
|
||||
{ "touser",touser},
|
||||
{"template_id",template_id}
|
||||
};
|
||||
var index = 1;
|
||||
var dataItems = new Dictionary<string, Object>() { };
|
||||
Items.ForEach(m =>
|
||||
{
|
||||
dataItems[$"keyword{index}"] = m;
|
||||
index++;
|
||||
});
|
||||
data["data"] = dataItems;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
public class TemplateMPModel: TemplateBaseModel
|
||||
{
|
||||
public string Url { get; set; }
|
||||
public string MiniAppId { get; set; }
|
||||
public TemplateDataItem first { get; set; }
|
||||
public TemplateDataItem remark { get; set; }
|
||||
public override Dictionary<string, Object> ToData()
|
||||
{
|
||||
var ret = base.ToData();
|
||||
var data = ret ["data"] as Dictionary<string, Object>;
|
||||
if (first != null) data["first"] = first;
|
||||
if (remark != null) data["remark"] = remark;
|
||||
if (!string.IsNullOrWhiteSpace(Url)) ret["url"] = Url;
|
||||
if (!string.IsNullOrWhiteSpace(MiniAppId)) ret["miniprogram"] = new
|
||||
{
|
||||
appid = MiniAppId,
|
||||
pagepath = Url
|
||||
};
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
public class TemplateMiniAppModel : TemplateBaseModel
|
||||
{
|
||||
public string page { get; set; }
|
||||
public string form_id { get; set; }
|
||||
public string emphasis_keyword { get; set; }
|
||||
public override Dictionary<string, Object> ToData()
|
||||
{
|
||||
var ret = base.ToData();
|
||||
if (!string.IsNullOrWhiteSpace(page)) ret["page"] = page;
|
||||
if (!string.IsNullOrWhiteSpace(form_id)) ret["form_id"] = form_id;
|
||||
if (!string.IsNullOrWhiteSpace(emphasis_keyword)) ret["emphasis_keyword"] = emphasis_keyword;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
public class TemplateDataItem
|
||||
{
|
||||
public TemplateDataItem(string v, string c = "#173177")
|
||||
{
|
||||
value = v;
|
||||
color = c;
|
||||
}
|
||||
|
||||
public string name { get; set; }
|
||||
public string value { get; set; }
|
||||
//
|
||||
// 摘要:
|
||||
// 16进制颜色代码,如:#FF0000
|
||||
public string color { get; set; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 小程序订阅消息
|
||||
/// </summary>
|
||||
public class SubscribeMiniAppModel : TemplateBaseModel
|
||||
{
|
||||
public string page { get; set; }
|
||||
public override Dictionary<string, Object> ToData()
|
||||
{
|
||||
var ret = base.ToData();
|
||||
|
||||
var data = new Dictionary<string, Object>() {
|
||||
{ "touser",touser},
|
||||
{"template_id",template_id}
|
||||
};
|
||||
var index = 1;
|
||||
var dataItems = new Dictionary<string, Object>() { };
|
||||
Items.ForEach(m =>
|
||||
{
|
||||
var num = index.ToString().PadLeft(2, '0');
|
||||
dataItems[m.name] = new { value = m.value };
|
||||
index++;
|
||||
});
|
||||
data["data"] = dataItems;
|
||||
if (!string.IsNullOrWhiteSpace(page)) ret["page"] = page;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Hncore.Wx.Open
|
||||
{
|
||||
public class TemplateBaseModel
|
||||
{
|
||||
public string touser { get; set; }
|
||||
public string template_id { get; set; }
|
||||
public List<TemplateDataItem> Items { get; set; } = new List<TemplateDataItem>();
|
||||
|
||||
//{
|
||||
// "touser":"touser",
|
||||
// "template_id": "TEMPLATE_ID",
|
||||
// "data": {
|
||||
// "keyword1": {
|
||||
// "value": "339208499"
|
||||
// },
|
||||
// "keyword2": {
|
||||
// "value": "2015年01月05日 12:30"
|
||||
// },
|
||||
// "keyword3": {
|
||||
// "value": "腾讯微信总部"
|
||||
// } ,
|
||||
// "keyword4": {
|
||||
// "value": "广州市海珠区新港中路397号"
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
public virtual Dictionary<string, Object> ToData()
|
||||
{
|
||||
var data = new Dictionary<string, Object>() {
|
||||
{ "touser",touser},
|
||||
{"template_id",template_id}
|
||||
};
|
||||
var index = 1;
|
||||
var dataItems = new Dictionary<string, Object>() { };
|
||||
Items.ForEach(m =>
|
||||
{
|
||||
dataItems[$"keyword{index}"] = m;
|
||||
index++;
|
||||
});
|
||||
data["data"] = dataItems;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
public class TemplateMPModel: TemplateBaseModel
|
||||
{
|
||||
public string Url { get; set; }
|
||||
public string MiniAppId { get; set; }
|
||||
public TemplateDataItem first { get; set; }
|
||||
public TemplateDataItem remark { get; set; }
|
||||
public override Dictionary<string, Object> ToData()
|
||||
{
|
||||
var ret = base.ToData();
|
||||
var data = ret ["data"] as Dictionary<string, Object>;
|
||||
if (first != null) data["first"] = first;
|
||||
if (remark != null) data["remark"] = remark;
|
||||
if (!string.IsNullOrWhiteSpace(Url)) ret["url"] = Url;
|
||||
if (!string.IsNullOrWhiteSpace(MiniAppId)) ret["miniprogram"] = new
|
||||
{
|
||||
appid = MiniAppId,
|
||||
pagepath = Url
|
||||
};
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
public class TemplateMiniAppModel : TemplateBaseModel
|
||||
{
|
||||
public string page { get; set; }
|
||||
public string form_id { get; set; }
|
||||
public string emphasis_keyword { get; set; }
|
||||
public override Dictionary<string, Object> ToData()
|
||||
{
|
||||
var ret = base.ToData();
|
||||
if (!string.IsNullOrWhiteSpace(page)) ret["page"] = page;
|
||||
if (!string.IsNullOrWhiteSpace(form_id)) ret["form_id"] = form_id;
|
||||
if (!string.IsNullOrWhiteSpace(emphasis_keyword)) ret["emphasis_keyword"] = emphasis_keyword;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
public class TemplateDataItem
|
||||
{
|
||||
public TemplateDataItem(string v, string c = "#173177")
|
||||
{
|
||||
value = v;
|
||||
color = c;
|
||||
}
|
||||
|
||||
public string name { get; set; }
|
||||
public string value { get; set; }
|
||||
//
|
||||
// 摘要:
|
||||
// 16进制颜色代码,如:#FF0000
|
||||
public string color { get; set; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 小程序订阅消息
|
||||
/// </summary>
|
||||
public class SubscribeMiniAppModel : TemplateBaseModel
|
||||
{
|
||||
public string page { get; set; }
|
||||
public override Dictionary<string, Object> ToData()
|
||||
{
|
||||
var ret = base.ToData();
|
||||
|
||||
var data = new Dictionary<string, Object>() {
|
||||
{ "touser",touser},
|
||||
{"template_id",template_id}
|
||||
};
|
||||
var index = 1;
|
||||
var dataItems = new Dictionary<string, Object>() { };
|
||||
Items.ForEach(m =>
|
||||
{
|
||||
var num = index.ToString().PadLeft(2, '0');
|
||||
dataItems[m.name] = new { value = m.value };
|
||||
index++;
|
||||
});
|
||||
data["data"] = dataItems;
|
||||
if (!string.IsNullOrWhiteSpace(page)) ret["page"] = page;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user