using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MyCode.Project.Domain.Message.Response.Wechat
{
///
/// 模板实体
///
public class WxTemplateModel
{
///
/// 接受者openid
///
public string Openid { get; set; }
///
/// 模板ID
///
public string TemplateId { get; set; }
///
/// 模板跳转链接
///
public string Url { get; set; }
///
/// 模板项数据
///
public List Data { get; set; }
///
/// 关键字索引
///
private int _keywordIndex;
///
/// 初始化一个
///
/// 接受者openid
/// 模板ID
/// 模板跳转链
public WxTemplateModel(string openid, string templateId, string url = "")
{
this.Openid = openid;
this.TemplateId = templateId;
this.Url = url;
this.Data = new List();
this._keywordIndex = 0;
}
///
/// 添加模板前置语
///
/// 值
///
public WxTemplateModel First(string value)
{
this.AddData("first", value);
return this;
}
///
/// 添加模板关键字
///
/// 值
///
public WxTemplateModel Keyword(string value)
{
this._keywordIndex++;
this.AddData("keyword" + _keywordIndex, value);
return this;
}
///
/// 添加模板后置语
///
/// 值
///
public WxTemplateModel Remark(string value)
{
this.AddData("remark", value);
return this;
}
///
/// 添加模板项数据
///
/// 键
/// 值
///
private void AddData(string key, string value)
{
this.Data.Add(new TemplateItem(key, value));
}
}
}