Example #1
0
        /// <summary>
        /// 更新操作,直接推送资源名称至MQ
        /// </summary>
        /// <param name="command">原命令</param>
        /// <returns>更新操作成功魔板</returns>
        public Task <PlainMessage> UpdateCommandHandler(string command)
        {
            var key   = command.Substring(2);
            var reply = Template.RenderUpdateActionResponse(key);

            MQUtil.PublishMQ(key);
            return(Task.FromResult(new PlainMessage(reply)));
        }
Example #2
0
        /// <summary>
        /// 查找资源,无资源则推送搜索命令
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        public async Task <PlainMessage> ResouceCommandHandler(string command)
        {
            var key   = command.Substring(1);
            var model = await ResourceAcquisition.SearchResourceFromQP(key);

            var reply = Template.RenderSearchResponse(key, model);

            reply.LogInfo();
            if (!model.Datas.Any())
            {
                MQUtil.PublishMQ(key);
            }
            return(new PlainMessage(reply));
        }