Esempio n. 1
0
        public async Task <IApiResult <string> > Hello()
        {
            var(res, state) = await MessagePoster.CallApiAsync <string>("test2", "test");

            FlowTracer.MonitorInfomation("hello");
            return(ApiResultHelper.Helper.Succees($"hello1:{res.ResultData}"));
        }
Esempio n. 2
0
        /// <summary>
        /// 准备
        /// </summary>
        /// <param name="service">当前服务</param>
        /// <param name="message">当前消息</param>
        /// <param name="tag">扩展信息</param>
        /// <returns></returns>
        async Task <bool> IMessageMiddleware.Prepare(IService service, IInlineMessage message, object tag)
        {
            if (!(tag is HttpContext context))
            {
                return(true);
            }

            string GetHeader(string name)
            {
                if (!context.Request.Headers.TryGetValue(name, out var head))
                {
                    return(null);
                }
                return(head.ToString());
            }

            try
            {
                await MessagePoster.CallApiAsync(ToolsOption.Instance.PageInfoService, ToolsOption.Instance.PageInfoApi, new
                {
                    ApiUrl      = context.Request.Path.Value,
                    Appid       = GetHeader("x-zmvc-app"),
                    ActionName  = GetHeader("x-zmvc-action-code"),
                    PageUrl     = GetHeader("Referer"),
                    PageTitle   = HttpUtility.UrlDecode(GetHeader("x-zmvc-page-title")),
                    ActionTitle = HttpUtility.UrlDecode(GetHeader("x-zmvc-action-title"))
                }.ToJson());
            }
            catch
            {
            }
            return(true);
        }
Esempio n. 3
0
        async Task Debug(int step, object a, object b)
        {
            await MessagePoster.CallApiAsync("test3", "Hello2");

            var builder = new StringBuilder();

            builder.Append(step);
            builder.Append('.');
            builder.Append(a == b ? "链接" : "断开");
            builder.Append($"{ Task: {Task.CurrentId}");
            builder.Append($" Thread: {Thread.CurrentThread.ManagedThreadId}");
            builder.Append($" HashCode: {a?.GetHashCode()}|{b?.GetHashCode()}}");
            Logger.Information(builder.ToString());
        }