Bee.WeiXin/InvokeTreeManager.cs

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Bee.Data;
using System.Data;
using Bee.Util;
using Bee.Core;
using Bee.WeiXin.Models;

namespace Bee.WeiXin
{
    public class InvokeTreeManager
    {
        private static InvokeTreeManager instance = new InvokeTreeManager();

        private List<WeiXinInvokeTree> invokeTreeList = new List<WeiXinInvokeTree>();

        private InvokeTreeManager()
        {
            Refresh();
        }

        public static InvokeTreeManager Instance
        {
            get
            {
                return instance;
            }
        }

        public void Refresh()
        {
            using (DbSession dbSession = new DbSession(WeiXinConstants.WeiXinConnString))
            {
                invokeTreeList = dbSession.Query<WeiXinInvokeTree>(SqlCriteria.New.Equal("delflag", false));
            }

        }

        private WeiXinInvokeTree FindChild(int parentId, string command)
        {
            return (from invokeItem in invokeTreeList
                    where invokeItem.ParentId == parentId && invokeItem.Name == command
                    select invokeItem).FirstOrDefault();
        }

        private WeiXinInvokeTree FindCurrentInvoke(BeeDataAdapter dataAdapter)
        {
            WeiXinInvokeTree result = null;

            string fromUserName = dataAdapter.TryGetValue<string>("fromusername", string.Empty);
            InvokeContext currentContext = InvokeContextManager.Instance.CurrentContext(fromUserName);

            // 调用链目前仅仅关心到菜单起始的文本输入链
            string currentCommand = dataAdapter.TryGetValue<string>("content", string.Empty);
            if (string.IsNullOrEmpty(currentCommand))
            {
                currentCommand = dataAdapter.TryGetValue<string>("eventkey", string.Empty);
            }
后面还有 94 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。