82 lines
2.0 KiB
C#
82 lines
2.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace MyCode.Project.Domain.Message.Response.Wechat
|
|
{
|
|
/// <summary>
|
|
/// 模板实体
|
|
/// </summary>
|
|
public class TemplateModel
|
|
{
|
|
/// <summary>
|
|
/// 用户ID
|
|
/// </summary>
|
|
public Guid UserID { get; set; }
|
|
|
|
/// <summary>
|
|
/// 模板ID
|
|
/// </summary>
|
|
public string TemplateId { get; set; }
|
|
|
|
/// <summary>
|
|
/// 模板跳转链接
|
|
/// </summary>
|
|
public string Url { get; set; }
|
|
|
|
/// <summary>
|
|
/// 模板项数据
|
|
/// </summary>
|
|
public List<TemplateItem> Data { get; set; }
|
|
|
|
/// <summary>
|
|
/// 关键字索引
|
|
/// </summary>
|
|
private int _keywordIndex;
|
|
|
|
/// <summary>
|
|
/// 初始化一个<see cref="TemplateModel"/>
|
|
/// </summary>
|
|
/// <param name="memberId">用户Id</param>
|
|
/// <param name="templateId">模板ID</param>
|
|
/// <param name="url">模板跳转链</param>
|
|
public TemplateModel(Guid UserID, string templateId, string url = "")
|
|
{
|
|
this.TemplateId = templateId;
|
|
this.Url = url;
|
|
this.Data = new List<TemplateItem>();
|
|
this.UserID = UserID;
|
|
this._keywordIndex = 0;
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 添加模板关键字
|
|
/// </summary>
|
|
/// <param name="value">值</param>
|
|
/// <returns></returns>
|
|
public TemplateModel Keyword(string value)
|
|
{
|
|
this._keywordIndex++;
|
|
this.AddData("keyword" + _keywordIndex, value);
|
|
return this;
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 添加模板项数据
|
|
/// </summary>
|
|
/// <param name="key">键</param>
|
|
/// <param name="value">值</param>
|
|
/// <returns></returns>
|
|
private void AddData(string key, string value)
|
|
{
|
|
this.Data.Add(new TemplateItem(key, value));
|
|
}
|
|
}
|
|
}
|