コード例 #1
0
        public void SendMessageOnFindPassWord(long userId, Core.Plugins.Message.MessageUserInfo info)
        {
            var message = PluginsManagement.GetPlugins <IMessagePlugin>().ToList();

            foreach (var msg in message)
            {
                if (msg.Biz.GetStatus(MessageTypeEnum.FindPassWord) == StatusEnum.Open)
                {
                    string destination = GetDestination(userId, msg.PluginInfo.PluginId, MemberContactsInfo.UserTypes.General);
                    if (!msg.Biz.CheckDestination(destination))
                    {
                        throw new HimallException(msg.Biz.ShortName + "错误");
                    }
                    var content = msg.Biz.SendMessageOnFindPassWord(destination, info);
                    if (msg.Biz.EnableLog)
                    {
                        Context.MessageLog.Add(new MessageLog()
                        {
                            SendTime = DateTime.Now, ShopId = 0, MessageContent = content, TypeId = "短信"
                        });
                        Context.SaveChanges();
                    }
                }
            }
        }
コード例 #2
0
        public void SendMessageCode(string destination, string pluginId, Core.Plugins.Message.MessageUserInfo info)
        {
            var messagePlugin = PluginsManagement.GetPlugin <IMessagePlugin>(pluginId);

            if (string.IsNullOrEmpty(destination) || !messagePlugin.Biz.CheckDestination(destination))
            {
                throw new HimallException(messagePlugin.Biz.ShortName + "错误");
            }
            var content = messagePlugin.Biz.SendMessageCode(destination, info);

            if (messagePlugin.Biz.EnableLog)
            {
                Context.MessageLog.Add(new MessageLog()
                {
                    SendTime = DateTime.Now, ShopId = 0, MessageContent = content, TypeId = "短信"
                });
                Context.SaveChanges();
            }
        }