예제 #1
0
        /// <summary>
        /// 写入API调用日志
        /// </summary>
        /// <param name="apiRoute">API路由</param>
        /// <param name="sourceUrl">来源URL</param>
        /// <param name="clientIp">客户端IP</param>
        /// <param name="clientAgent">客户端代理信息</param>
        /// <param name="postData">接口输入参数</param>
        /// <param name="returnData">接口返回值</param>
        public void OperatorLog(string apiRoute, string sourceUrl, string clientIp, string clientAgent, string postData, string returnData)
        {
            var log = new APIOperationLog();

            log.APIRoute    = apiRoute;
            log.SourceURL   = sourceUrl;
            log.ClientIP    = clientIp;
            log.ClientAgent = clientAgent;
            log.PostData    = postData;
            log.ReturnData  = returnData;
            log.InDate      = DateTime.Now;

            this.Context.APIOperationLogs.Add(log);
            //this.Context.Configuration.ValidateOnSaveEnabled = false;
            this.Context.SaveChanges();
        }
예제 #2
0
        /// <summary>
        /// 写入API调用日志
        /// </summary>
        /// <param name="apiRoute">API路由</param>
        /// <param name="sourceUrl">来源URL</param>
        /// <param name="clientIp">客户端IP</param>
        /// <param name="clientAgent">客户端代理信息</param>
        /// <param name="postData">接口输入参数</param>
        /// <param name="returnData">接口返回值</param>
        public void OperatorLog(string apiRoute,string sourceUrl,string clientIp,string clientAgent,string postData,string returnData)
        {
            var log = new APIOperationLog();
                log.APIRoute = apiRoute;
                log.SourceURL = sourceUrl;
                log.ClientIP = clientIp;
                log.ClientAgent = clientAgent;
                log.PostData = postData;
                log.ReturnData = returnData;
                log.InDate = DateTime.Now;

                this.Context.APIOperationLogs.Add(log);
                //this.Context.Configuration.ValidateOnSaveEnabled = false;
                this.Context.SaveChanges();
        }