Exemple #1
0
        public TokenEntity GetToken(string AgentID)
        {
            TokenEntity entity = new TokenEntity();

            if (dic.ContainsKey(AgentID))
            {
                entity = dic[AgentID];
            }
            else
            {
                entity = state.Handle(AgentID);
                dic.Add(AgentID, entity);
            }
            return(entity);
        }
Exemple #2
0
        public TokenEntity Handle(string AgentID)
        {
            TokenEntity   entity  = new TokenEntity();
            WeiXinSection section = WeiXinSection.GetInstance();

            entity.CorpID = section.CorpID;
            WeiXinCollection      keyValues = section.KeyValues;
            WeiXinKeyValueSetting keyItem   = keyValues[AgentID];

            entity.AgentID        = AgentID;
            entity.Token          = keyItem.Token;
            entity.EncodingAESKey = keyItem.EncodingAESKey;
            entity.Secret         = keyItem.Secret;
            entity.Name           = keyItem.Name;
            return(entity);
        }