Esempio n. 1
0
 protected override WxMsgProcessor GetCustomProcessor(string msgType, string eventName, IDictionary <string, string> msgInfo)
 {
     if (msgInfo.ContainsKey("ComponentVerifyTicket"))
     {
         return(new WxMsgProcessor <VerifComponentTicketRecMsg>()
         {
             RecInsCreater = () => new VerifComponentTicketRecMsg(),
             ProcessFunc = msg =>
             {
                 var res = DirConfigUtil.SetDirConfig <TicketMo>($"{ApiConfig.AppId}_component_verify_ticket",
                                                                 new TicketMo {
                     ticket = msg.ComponentVerifyTicket
                 });
                 return WxNoneReplyMsg.None;
             }
         });
     }
     return(null);
 }
Esempio n. 2
0
        static WxBaseTests()
        {
            // 可以在这里初始化appid 等配置信息,也可以在下边直接赋值
            // DirConfigUtil.SetDirConfig("my_weixin_appconfig",new TestConfigInfo(){})
            var config = DirConfigUtil.GetDirConfig <TestConfigInfo>("my_weixin_appconfig");

            if (config == null)
            {
                throw new ArgumentException("请将下边的配置信息直接赋值,或者通过DirConfigUtil.SetDirConfig初始化一下基础配置信息");
            }
            m_Config = config.WxConfig;

            OsConfig.CacheProvider = moduleName =>
            {
                if (config != null)
                {
                    return(new RedisCache(0, config.RedisConnectionStr));
                }
                return(null);//  如果为空会走系统缓存
            };
        }