Exemple #1
0
 protected void Application_Start()
 {
     GlobalConfiguration.Configuration.EnableCors();
     AreaRegistration.RegisterAllAreas();
     GlobalConfiguration.Configure(WebApiConfig.Register);
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     Task.Run <Respond>(() =>
     {
         var client = new FeedbackServiceInterfaceClient();
         //Task.Delay(5000).Wait();
         return(client.GetEvaluate(new List <string>()
         {
             "1"
         }));
     });
 }
Exemple #2
0
        /// <summary>
        /// 获取点赞评价修改排序得分
        /// </summary>
        /// <param name="cinfo"></param>
        /// <param name="coefficient"></param>
        /// <param name="qdc"></param>
        /// <param name="IDs"></param>
        private static void AddScoreByEvaluate(ClientInfo cinfo, double coefficient, QueryDataContainer qdc, List <string> IDs)
        {
            try
            {
                Respond rspdata = null;
                double  et;
                rspdata = CBase.Log.FuncCatch.Catch <Respond>(delegate
                {
                    return(TimedTask.CallActionWithTimeoutSync(200, delegate
                    {
                        var client = new FeedbackServiceInterfaceClient();
                        //Task.Delay(2000).Wait();
                        return client.GetEvaluate(IDs);
                    }, "FeedbackService", cinfo));
                }, out et);

                qdc.ElapsedList.Add(new FuncElapsed("FeedbackService", et));
                if (rspdata == null)
                {
                    return;
                }

                var data = rspdata.Data;
                int max  = rspdata.MaxCount;
                if (data != null && max > 10)
                {
                    foreach (var d in data)
                    {
                        var count = d.count;
                        var id    = d.ahash;
                        var qdata = qdc.MetaList.Where(p => p.ID == id).FirstOrDefault();
                        if (qdata != null)
                        {
                            qdata.OrderBy = qdata.OrderBy + (1 - coefficient) * (Math.Log(count + 1, Math.E) / Math.Log(max + 1, Math.E));
                            //qdata.OrderBy = qdata.OrderBy + (1 - coefficient) * Math.Log(count + 1, Math.E);
                        }
                    }
                }
            }
            catch { }
        }