官网:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/access-token/auth.getAccessToken.htmlhttps://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/access-token/auth.getAccessToken.html
接口调试地址:http://mp.weixin.qq.com/debug/http://mp.weixin.qq.com/debug/
准备工作:
1.注册微信服务号,每年年费300.00块钱,到期续费。注册完了登录微信服务号获取 微信服务号的AppID和AppSecret。
并配置白名单:只有配置白名单中的IP地址的服务才允许别请求。
2.接口准备。需要的接口有4个。分别为:
///
/// 获取access_token的Url
/// 两个参数
/// {0}:微信公众号的AppID
/// {1}:微信公众号的AppSecret
///
[CustField("AccessToken")]
public const string AccessTokenUrl = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={0}&secret={1}";
///
/// 获取用户信息的Url
/// 两个参数
/// {0}:获取到的access_token
/// {1}:用户的OpenID
///
[CustField("UserInfo")]
public const string UserInfoUrl = "https://api.weixin.qq.com/cgi-bin/user/info?access_token={0}&openid={1}&lang=zh_CN";
返回说明
正常情况下,微信会返回下述 JSON 数据包给公众号:
{
"subscribe": 1,
"openid": "o6_bmjrPTlm6_2sgVt7hMZOPfL2M",
"language": "zh_CN",
"subscribe_time": 1382694957,
"unionid": " o6_bmasdasdsad6_2sgVt7hMZOPfL",
"remark": "",
"groupid": 0,
"tagid_list":[128,2],
"subscribe_scene": "ADD_SCENE_QR_CODE",
"qr_scene": 98765,
"qr_scene_str": ""
}
///
/// 获取公众号关注者列表的Url
/// 两个参数
/// {0}:获取到的access_token
/// {1}:获取关注用户列表偏移量,不填默认从头开始拉取 可传空值
///
[CustField("UserList")]
public const string UserListUrl = "https://api.weixin.qq.com/cgi-bin/user/get?access_token={0}&next_openid={1}";
ps:2021年开始,根据相关法律法规,为保障用户合法权益,该接口不再输出用户昵称、头像信息:相关字段返回空值(网页授权不受此调整影响)。微信出于用户数据保密安全出发,在获取服务号关注信息时不在返回隐私信息,只返回opend和remark字段。建议使用 https://api.weixin.qq.com/cgi-bin/user/info/updateremark?access_token=ACCESS_TOKEN 接口配置备注。也可登录公众平台手动备注。https://api.weixin.qq.com/cgi-bin/user/info/updateremark?access_token=ACCESS_TOKEN
///
/// 发送模板消息的Url
/// 一个参数
/// {0}:获取到的access_token
///
[CustField("SendTemplate")]
public const string SendTemplateUrl = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token={0}";
ps:需要管理员登录微信公众平台后台 配置模板。也可自定化模板,需要审核一般2周之内。
发送微信6位随机数验证码示例:
[HttpPost]
public void getWXCode(string UsrName)
{
validateCode vCode = new validateCode();
string code = vCode.CreateValidateCode(6);
Session["WXCode"] = code;
Session.Timeout = 5;//设置过期时间5分钟
string SStation = "";
Template template = new Template();
template.color = "#173177";
template.template_id = "I6-jnpVqirQ6h3JvCM2-PrEsOfzfH8SggiFRmuzQbNQ";//模板ID
Yw_UserDao dao = new Yw_UserDao();
try
{
string access_token = dao.CurDbSession.From
List
List
//List
List
foreach (var syspushType in sysList)
{
syspushType.SStation = "";// StationList.Where(a => a.SStation == SStation).First().SStationName; //20220621原来是这个SStation;
syspushType.SStationName = "";// StationList.Where(a => a.SStation == SStation).First().SStationName;
syspushType.Content = "验证码"+code+",5分钟内有效,请勿泄露!";// syspushType.SStationName + "临时接入了,请注意了!(时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ")";
}
pushTypesList.AddRange(sysList);
var OpIdGroupList = pushTypesList.GroupBy(a => a.OpenId).ToList();
foreach (var id in OpIdGroupList)
{
//消息内容
string content = id.ToList().Aggregate("", (current, item) => current + item.Content);
//站点
string stationName = id.ToList()
.Aggregate("", (current, item) => current + (item.SStationName + ","),
current => current.Substring(0, current.Length - 1));
template.touser = id.Key;//推送人
template.data =
new
{
first = new { value = content, color = "#173177" },
keyword1 = new { value = "微信验证码", color = "#173177" },
keyword2 = new { value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), color = "#173177" },
keyword3 = new { value = "微信验证码", color = "#173177" }
};
Rate.Air.Dao.Business.WeiXinUtil.Instance.SendTemplateMsg(access_token, template);
}
//HttpContext.Response.ContentType = "application/json;charset=utf-8";
//HttpContext.Response.Write(JsonConvert.SerializeObject(new ReturnMessage() { code = "400", msg = "推送完成" }));
//HttpContext.Response.End();
}
catch (Exception ex)
{
//HttpContext.Response.ContentType = "application/json;charset=utf-8";
//HttpContext.Response.Write(JsonConvert.SerializeObject(new ReturnMessage() { code = "404", msg = "推送失败" }));
//HttpContext.Response.End();
}
}
//6位验证码类
public class validateCode
{
public string CreateValidateCode(int length)
{
int[] randMembers = new int[length];
int[] validateNums = new int[length];
string validateNumberStr = "";
//生成起始序列值
int seekSeek = unchecked((int)DateTime.Now.Ticks);
Random seekRand = new Random(seekSeek);
int beginSeek = (int)seekRand.Next(0, Int32.MaxValue - length * 10000);
int[] seeks = new int[length];
for (int i = 0; i < length; i++)
{
beginSeek += 10000;
seeks[i] = beginSeek;
}
//生成随机数字
for (int i = 0; i < length; i++)
{
Random rand = new Random(seeks[i]);
int pownum = 1 * (int)Math.Pow(10, length);
randMembers[i] = rand.Next(pownum, Int32.MaxValue);
}
//抽取随机数字
for (int i = 0; i < length; i++)
{
string numStr = randMembers[i].ToString();
int numLength = numStr.Length;
Random rand = new Random();
int numPosition = rand.Next(0, numLength - 1);
validateNums[i] = Int32.Parse(numStr.Substring(numPosition, 1));
}
//生成验证码
for (int i = 0; i < length; i++)
{
validateNumberStr += validateNums[i].ToString();
}
return validateNumberStr;
}
public byte[] CreateValidateGraphic(string validateCode)
{
Bitmap image = new Bitmap((int)Math.Ceiling(validateCode.Length * 12.0), 22);
Graphics g = Graphics.FromImage(image);
try
{
//生成随机生成器
Random random = new Random();
//清空图片背景色
g.Clear(Color.White);
//画图片的干扰线
for (int i = 0; i < 25; i++)
{
int x1 = random.Next(image.Width);
int x2 = random.Next(image.Width);
int y1 = random.Next(image.Height);
int y2 = random.Next(image.Height);
g.DrawLine(new Pen(Color.Silver), x1, y1, x2, y2);
}
Font font = new Font("Arial", 12, (FontStyle.Bold | FontStyle.Italic));
LinearGradientBrush brush = new LinearGradientBrush(new Rectangle(0, 0, image.Width, image.Height),
Color.Blue, Color.Red, 1.2f, true);
g.DrawString(validateCode, font, brush, 3, 2);
//画图片的前景干扰点
for (int i = 0; i < 100; i++)
{
int x = random.Next(image.Width);
int y = random.Next(image.Height);
image.SetPixel(x, y, Color.FromArgb(random.Next()));
}
//画图片的边框线
g.DrawRectangle(new Pen(Color.Silver), 0, 0, image.Width - 1, image.Height - 1);
//保存图片数据
MemoryStream stream = new MemoryStream();
image.Save(stream, ImageFormat.Jpeg);
//输出图片流
return stream.ToArray();
}
finally
{
g.Dispose();
image.Dispose();
}
}
}
3.由于微信第三方机制的原因,每次获取微信access_token的有效时间是7200秒(2小时)。需要缓存access_token,可以存文件,数据库,内存中。博主这里已数据库为例。 存完之后每次调佣接口前验证access_token是否到期,如果到期则重新获取,否则直接读取。
4.微信公众平台SDK! Senparc.Weixin.MP.dll
官网地址: 微信公众平台SDK,微信SDK - Senparc.Weixin SDK - 公众号 小程序 企业号 开放平台 - 微信公众平台 企业号 开放平台 微信支付 SDK JSSDK Senparc.Weixin.MP 盛派网络 盛派公众号
[原创][下载]Senparc.Weixin.MP-微信公众平台SDK(C#) - 已支持微信7.x API - SZW - 博客园
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Rate.Air.Model
{
///
/// API调用链接
///
public class APIUrl
{
///
/// 获取access_token的Url
/// 两个参数
/// {0}:微信公众号的AppID
/// {1}:微信公众号的AppSecret
///
[CustField("AccessToken")]
public const string AccessTokenUrl = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={0}&secret={1}";
///
/// 获取公众号关注者列表的Url
/// 两个参数
/// {0}:获取到的access_token
/// {1}:获取关注用户列表偏移量,不填默认从头开始拉取 可传空值
///
[CustField("UserList")]
public const string UserListUrl = "https://api.weixin.qq.com/cgi-bin/user/get?access_token={0}&next_openid={1}";
///
/// 获取用户信息的Url
/// 两个参数
/// {0}:获取到的access_token
/// {1}:用户的OpenID
///
[CustField("UserInfo")]
public const string UserInfoUrl = "https://api.weixin.qq.com/cgi-bin/user/info?access_token={0}&openid={1}&lang=zh_CN";
///
/// 发送模板消息的Url
/// 一个参数
/// {0}:获取到的access_token
///
[CustField("SendTemplate")]
public const string SendTemplateUrl = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token={0}";
}
///
/// 微信公众号信息
///
public class GZHInfo
{
///
/// 微信公众号的AppID
///
[CustField("AppId")]
public const string AppId = "**********";
///
/// 微信公众号的AppSecret
///
[CustField("AppSecret")]
public const string AppSecret = "*******************";
}
///
/// access_token类
///
public class AccessToken
{
///
/// 获取到的凭证access_token
///
public string access_token { get; set; }
///
/// 凭证有效时间,单位:秒
///
public int expires_in { get; set; }
///
/// 凭证的到期时间
///
public DateTime expireTime { get; set; }
}
///
/// 公众号关注者列表模型类
///
public class UserList
{
///
/// 关注该公众账号的总用户数
///
public int total { get; set; }
///
/// 拉取的OPENID个数,最大值为10000
///
public int count { get; set; }
///
/// 列表数据,OPENID的列表
///
public object data { get; set; }
///
/// 拉取列表的后一个用户的OPENID
///
public string next_openid { get; set; }
}
///
/// 模板消息类
///
public class Template
{
///
/// 接收者openid
///
public string touser { get; set; }
///
/// 模板ID
///
public string template_id { get; set; }
///
/// 模板跳转链接(可空)
///
public string url { get; set; }
///
/// 模板数据
///
public object data { get; set; }
///
/// 模板内容字体颜色,不填默认为黑色
///
public string color { get; set; }
}
}
其中关于WebClient类WebApi下载文件以后专门写一个。
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Web.Script.Serialization;
using Dos.Common;
using Newtonsoft.Json;
using Rate.Air.Model;
using Rate.Air.Model.Common;
namespace Rate.Air.Dao.Business
{
public class WeiXinUtil
{
//实例对象
private static WeiXinUtil _instance = null;
public static WeiXinUtil Instance
{
get
{
if (_instance == null)
{
_instance = new WeiXinUtil();
}
return _instance;
}
}
///
/// 获取access_token
///
///
public AccessToken GetAccessToken()
{
//获取access_token接口链接
string url = string.Format(APIUrl.AccessTokenUrl, GZHInfo.AppId, GZHInfo.AppSecret);
//获取access_token对象
AccessToken accessToken = GetJson
if (accessToken != null)
{
//accessToken.expireTime = DateTime.Now.AddSeconds(accessToken.expires_in);
accessToken.expireTime = DateTime.Now.AddSeconds(300);
}
//返回access_token值
return accessToken;
}
///
/// 获取关注用户列表
///
/// access_token
/// 用户的openId:从该用户的开始获取,为空从头开始拉取
public List
{
//获取关注用户列表的链接
string url = string.Format(APIUrl.UserListUrl, accesstoken, nextOpenid);
//获取用户列表对象
UserList openList = GetJson
if (openList == null) return null;
//定义用户信息集合
List
//从获取到的用户列表对象中,取得用户openID的集合
Dictionary
object[] objArr = oIdList.Values.ToArray();
Sys_GZHUsrInfo usrInfo;
//遍历用户openID集合,获取用户信息
for (int i = 0; i < ((object[])objArr[0]).Length; i++)
{
usrInfo = GetUserInfo(accesstoken, ((object[]) (objArr[0]))[i].ToString());
if (usrInfo == null) continue;
listuUsrInfos.Add(usrInfo);
}
//返回用户信息列表
return listuUsrInfos;
}
///
/// 获取用户信息
///
/// access_token
/// 用户的openId
///
public Sys_GZHUsrInfo GetUserInfo(string accesstoken, string openId)
{
//获取用户信息的链接
string url = string.Format(APIUrl.UserInfoUrl, accesstoken, openId);
//获取用户对象
Sys_GZHUsrInfo user = GetJson
return user;
}
///
/// 发送模板消息
///
/// access_token
/// 模板模型
///
public bool SendTemplateMsg(string accesstoken, Template template)
{
bool isSuccess;
//发送模板消息请求链接
string url = string.Format(APIUrl.SendTemplateUrl, accesstoken);
//发送的数据
string postData = JsonConvert.SerializeObject(template);
//发送HttpPost请求
isSuccess = HttpPostData(url, postData);
return isSuccess;
}
///
/// 调用接口并将获取的Json转对象
///
/// 请求链接
///
public T GetJson
{
WebClient wc = new WebClient();
wc.Credentials = CredentialCache.DefaultCredentials;
wc.Encoding = Encoding.UTF8;
//返回结果
string returnText = wc.DownloadString(url);
//如果返回的有错误码
if (returnText.Contains("errcode"))
{
return null;
}
//序列化json对象
JavaScriptSerializer serializer = new JavaScriptSerializer();
var objs = serializer.Deserialize
return objs;
}
///
/// 发送HttpPost请求
///
/// 请求链接
/// 发送的数据
///
public bool HttpPostData(string posturl, string postData)
{
Stream outstream = null;
Stream instream = null;
StreamReader sr = null;
HttpWebResponse response = null;
HttpWebRequest request = null;
Encoding encoding = Encoding.UTF8;
byte[] data = encoding.GetBytes(postData);
// 准备请求...
try
{
// 设置参数
request = WebRequest.Create(posturl) as HttpWebRequest;
CookieContainer cookieContainer = new CookieContainer();
request.CookieContainer = cookieContainer;
request.AllowAutoRedirect = true;
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = data.Length;
outstream = request.GetRequestStream();
outstream.Write(data, 0, data.Length);
outstream.Close();
//发送请求并获取相应回应数据
response = request.GetResponse() as HttpWebResponse;
//直到request.GetResponse()程序才开始向目标网页发送Post请求
instream = response.GetResponseStream();
sr = new StreamReader(instream, encoding);
//返回结果网页(html)代码
string content = sr.ReadToEnd();
if (content.Contains("\"errmsg\":\"ok\""))
{
return true;
}
string err = string.Empty;
//Response.Write(content);
return false;
}
catch (Exception ex)
{
LogHelper.Error("微信推送" + ex.Message);
string err = ex.Message;
return false;
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Web;
using System.Web.Mvc;
using System.Web.Services.Description;
using AirManagement.Controllers;
using Rate.Air.Dao.Business;
using Rate.Air.Dao.Custom;
using Rate.Air.Model;
using Rate.Air.Model.Common;
using Rate.Tools;
namespace Rate.Air.MaintainceApp.Controllers.SysManagement
{
public class SysWeiXinController : BaseController
{
public ActionResult WeiXinPush()
{
return View();
}
///
/// 微信报送
///
///
public ActionResult WeiXinReport()
{
return View();
}
///
/// 微信分组
///
///
public ActionResult WeiXinGroup()
{
return View();
}
///
/// 微信报送分页查询
///
///
///
///
///
public ActionResult GZHUsrInfoList_FindByPage(Sys_GZHUsrInfo model, int page, int rows)
{
var pager = new PagerBase() { CurrentPageIndex = page, PageSize = rows };
var list = Sys_WeiXinDao.Instance.FindByPage(model, ref pager);
return Json(new { total = pager.TotalItemCount, rows = list }, JsonRequestBehavior.AllowGet);
}
///
/// 同步微信用户列表
///
///
public ActionResult SyncWeiXinUsr()
{
string access_token = LogHelper.ReadAccessToken();
//string access_token = "";
if(string.IsNullOrEmpty(access_token))
{
AccessToken accessToken = WeiXinUtil.Instance.GetAccessToken();
access_token = accessToken.access_token;
LogHelper.WriteAccessToken(access_token);
}
//测试使用
//_AccessToken =new AccessToken();
//_AccessToken.access_token = Request["access_token"];
int a =0;
List
//先清空表
Sys_WeiXinDao.Instance.Delete();
a=Sys_WeiXinDao.Instance.Insert
return Json(new { IsSuccess = true });
}
///
/// 发送模板消息
///
///
public ActionResult SendTemplate()
{
string openId = Request["openId"];
string content = Request["content"];
if (string.IsNullOrEmpty(openId))
{
return Json(new { IsSuccess = false, Message = "发送失败" });
}
if (string.IsNullOrEmpty(content))
{
return Json(new { IsSuccess = false, Message = "请输入发送内容!" });
}
string access_token = LogHelper.ReadAccessToken();
if(string.IsNullOrEmpty(access_token))
{
AccessToken accessToken = WeiXinUtil.Instance.GetAccessToken();
access_token = accessToken.access_token;
LogHelper.WriteAccessToken(access_token);
}
content = content.Replace("PM10", "PM₁₀")
.Replace("PM2.5", "PM₂.₅")
.Replace("SO2", "SO₂")
.Replace("NO2", "NO₂")
.Replace("O3", "O₃")
.Replace("m3", "m³");//处理上下标
Template template = new Template();
template.touser = openId;//推送人
template.color = "#173177";
template.template_id = "YqG6JcQmKdmDXiarkpL2TFbxbDOICqcOcuKJbDZiG74";//模板ID
//template.url = "http://cityAirPublish.leitechina.com.cn:8032";//跳转链接
template.data =
new
{
first = new { value = "空气质量统计信息", color = "#173177" },
keyword1 = new { value = "湖南省生态环境监测中心", color = "#173177" },
keyword2 = new { value = DateTime.Now.ToString(), color = "#173177" },
keyword3 = new { value = content, color = "#173177" }
};
//测试使用
//_AccessToken = new AccessToken();
//_AccessToken.access_token = Request["access_token"];
bool result = WeiXinUtil.Instance.SendTemplateMsg(access_token, template);
return Json(new { IsSuccess = result, Message = result ? "发送成功" : "发送失败" });
}
///
/// 群推日报模板消息
///
///
public ActionResult PushTemplateByType(string content)
{
if (string.IsNullOrEmpty(content))
{
return Json(new { IsSuccess = false, Message = "请输入发送内容!" });
}
string access_token = LogHelper.ReadAccessToken();
if(string.IsNullOrEmpty(access_token))
{
AccessToken accessToken = WeiXinUtil.Instance.GetAccessToken();
access_token = accessToken.access_token;
LogHelper.WriteAccessToken(access_token);
}
//测试使用
//_AccessToken = new AccessToken();
//_AccessToken.access_token = Request["access_token"];
//推送消息得到成功个数
int successCount = 0;
int failCount = 0;
Sys_WeiXinDao.Instance.PushTemplateMsgByType(content, access_token, ref successCount, ref failCount);
return Json(new { IsSuccess = true, Message = string.Format("成功发送{0}个", successCount) });
}
///
/// 配置推送信息
///
///
///
public ActionResult PushTypeConfig(Sys_GZHPushType model)
{
bool result = Sys_WeiXinDao.Instance.SetPushType(model);
return Json(new { IsSuccess = result, Message = result ? "配置成功" : "配置失败" });
}
///
/// 获取日报消息
///
///
///
public ActionResult GetDailyMsg(string queryTime)
{
string content = Sys_WeiXinDao.Instance.GetPushDailyMsgContent(queryTime, CurUser.UserName);
if (!string.IsNullOrEmpty(content))
{
content = content.Replace("PM10", "PM₁₀")
.Replace("PM2.5", "PM₂.₅")
.Replace("SO2", "SO₂")
.Replace("NO2", "NO₂")
.Replace("O3", "O₃")
.Replace("m3", "m³");//处理上下标
}
return Json(new { Content = content });
}
///
/// 验证
///
///
///
///
public ActionResult CheckUser(Sys_Usr obj, string OpenId)
{
bool result = true;
var list = Sys_WeiXinDao.Instance.CheckUser(obj);
if (list.Count == 0)
{
return Json(new { IsSuccess = false, Message = "系统账号跟手机号不一致!" });
}
else
{
Sys_GZHPushType model = new Sys_GZHPushType();
model.OpenId = OpenId;
model.UserId = list[0].Id;
model.UserName = list[0].RealName;
result = Sys_WeiXinDao.Instance.GZHPushTypeEdit(model) > 0;
}
return Json(new { IsSuccess = result, Message = result ? "验证成功" : "验证失败" });
}
///
/// 查询绑定账号跟手机号
///
///
///
public ActionResult Usr_GetAll(string OpenId)
{
var list = Sys_WeiXinDao.Instance.CheckUser(OpenId);
return Json(new { Data = list }, JsonRequestBehavior.AllowGet);
}
///
/// 微信分组分页查询
///
///
///
///
///
public ActionResult GZHGroupList_FindByPage(Sys_GZHGroup model, int page, int rows)
{
var pager = new PagerBase() { CurrentPageIndex = page, PageSize = rows };
var list = Sys_WeiXinDao.Instance.GroupFindByPage(model, ref pager);
return Json(new { total = pager.TotalItemCount, rows = list }, JsonRequestBehavior.AllowGet);
}
///
/// 保存分组
///
///
///
public ActionResult SaveGroup(Sys_GZHGroup obj, int optType)
{
bool isSucc = false;
if (optType == OptType.Add) //新增
{
obj.CreatedTime = DateTime.Now;
obj.CreatedBy = CurUser.UserName;
var list = Sys_WeiXinDao.Instance.CheckGroupName(obj, optType);
if (list.Count > 0)
{
return Json(new { IsSuccess = false, Message = "该分组名已存在" });
}
isSucc = Sys_WeiXinDao.Instance.InsertMain(obj) > 0;
}
else if (optType == OptType.Edit) //修改
{
var list = Sys_WeiXinDao.Instance.CheckGroupName(obj, optType);
if (list.Count > 0)
{
return Json(new { IsSuccess = false, Message = "该分组名已存在" });
}
isSucc = Sys_WeiXinDao.Instance.UpdateMain(obj) > 0;
}
return Json(new { IsSuccess = isSucc, Message = isSucc ? "操作成功!" : "操作失败!" });
}
///
/// 删除分组
///
///
///
public ActionResult GZHGroup_Delete(Sys_GZHGroup obj)
{
if (obj.GroupId < 0)
{
return Json(new { IsSuccess = false, Message = "请选择需要删除的记录!" });
}
bool isSucc = Sys_WeiXinDao.Instance.Group_Delete(obj) > 0;
return Json(new { IsSuccess = isSucc, Message = isSucc ? "操作成功!" : "操作失败!" });
}
}
}
Sys_GZHUsrInfo:公众号关注用户表。
Sys_GZHPushType:消息类型配置表。
Wx_Token:微信token存储表。
Sys_News:消息记录表。
Sys_PushConfig:配置用户openid的消息类型。
Sys_PushType:消息类型。