• jsonp 监控简陋代码


      url: window.location.href

     Agent: navigator.userAgent

    var tkInfo = {                   

       VisitUrl: window.location.href,          

       UserAgent: Visit.Agent,            

       SolutionCatalogId: Visit.SolId        

    }

          $.ajax({          

       url: _urlBase + "/Track/AddTrackInfo",           

      data: { jsonData: JSON.stringify(tkInfo) },       

          type: 'get',            

    jsonp: "jsonpcallback",            

    success: function (data) {               

      console.log(data);            

    }        

    })

     using (MSDBcontext db = new MSDBcontext())
                    {
                        string result = String.Empty;
                        //服务端获取IP地址
                        result = HttpContext.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
                        if (string.IsNullOrEmpty(result))
                        {
                            result = HttpContext.Request.ServerVariables["REMOTE_ADDR"];
                        }
                        if (string.IsNullOrEmpty(result))
                        {
                            result = HttpContext.Request.UserHostAddress;
                        }
                       
                        var tkInfo = new TrackInfo
                        {
                            UserId = trackInfo.UserId,
                            FromId = Guid.Parse(trackInfo.FromId),
                            FromUserId = trackInfo.FromUserId,
                            VisitorName = trackInfo.VisitorName,
                            VisitUrl = trackInfo.VisitUrl,
                            UserAgent = trackInfo.UserAgent,
                            VisitorIP = Request.UserHostName,

          }

    return JavaScript(string.Format("{0}({1});", jsonpcallback, Newtonsoft.Json.JsonConvert.SerializeObject(jsonResult)));

    //自增

    db.Database.ExecuteSqlCommand("UPDATE TrackSta SET ShareCount=ShareCount+1 WHERE  Id = {0};", tStaInfo.Id);

     string str="select YEAR(CreateTime) as Y,month(CreateTime) as M,day(CreateTime) as D,datepart(Hour,createtime) as H, COUNT(*) as C,sum(case IsPay when 0 then 1  when 1 then 0 end ) as 'UnPay', sum(case IsPay when 1 then 1 when 0 then 0  end) as 'Pay' from orders where YEAR(CreateTime)='2015' group by YEAR(CreateTime),month(CreateTime),day(CreateTime), datepart(Hour,createtime)";
                   var v =db.Database.SqlQuery(typeof(OrderChart), str, "");

    3.json 格式 对应

      $.ajax({
            url: _BaseUrl + '/Video/GetLoadVideoData',
            type: 'post',
            datatype: 'json',
            data: {},
            success: function (data) {
                if (data != null) {
                    //常规了解
                    if (data.Data.RoutineDataList.length > 0) {

                     }

                  }}

       }

      public ActionResult GetLoadVideoData(string type)        

      {            

         AjaxResult<LoadVideoData> result = new AjaxResult<LoadVideoData>           

         {                

           Status = -1,                 Message = "获取失败。",                

          Data = new LoadVideoData                

         {                     CaseDataList = null,                     ServiceDataList = null,                     RoutineDataList = null,                     TrainDataList = null                 }             };             using (AzureWeChatDbContext context = new AzureWeChatDbContext())             {                 var routineDataList = context.Database.SqlQuery<VisitDataListModel>("exec GetRoutineDataList").ToList();                 var serviceDataList = context.Database.SqlQuery<VisitDataListModel>("exec GetServiceDataList").ToList();                 var caseDataList = context.Database.SqlQuery<VisitDataListModel>("exec GetCaseDataList").ToList();                 var trainDataList = context.Database.SqlQuery<VisitDataListModel>("exec GetTrainDataList").ToList();                 //var LecturerDataList = context.Database.SqlQuery<VisitDataListModel>("exec GetLecturerDataList").ToList();

                    result.Data.CaseDataList = caseDataList;                 result.Data.ServiceDataList = serviceDataList;                 result.Data.RoutineDataList = routineDataList;                 result.Data.TrainDataList = trainDataList;                 result.Status = 1;                 result.Message = "获取成功";             }             JsonResult jsonData = new JsonResult { Data = result, JsonRequestBehavior = JsonRequestBehavior.AllowGet };             return jsonData;         }

  • 相关阅读:
    Sublime Text 无法使用Package Control或插件安装失败的解决方法
    phpstorm破解
    require
    在线支付
    解决华为手机用rem单位,内容超出屏幕宽度问题
    JS如何判断是不是iphoneX
    iPhoneX页面安全区域与内容重叠问题
    .NET 大数据量并发解决方案
    js 弹出div窗口 可移动 可关闭
    colgroup 整行变色
  • 原文地址:https://www.cnblogs.com/hanxingli/p/5509358.html
Copyright © 2020-2023  润新知