예제 #1
0
 public static string CreateZK(string path, string connStr, ref string ErrorMessage)
 {
     try
     {
         ZooKeeper zooKeeper = ZooKClient.GetZooKeeper();
         string    strResult = zooKeeper.Create(path, connStr.GetBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.Persistent);
         return(strResult);
     }
     catch (Exception exception)
     {
         ErrorMessage = exception.Message + "|" + exception.StackTrace;
     }
     return("");
 }
예제 #2
0
        public static string GetZK(string path, ref string ErrorMessage)
        {
            string str = string.Empty;

            try
            {
                ZooKeeper zooKeeper = ZooKClient.GetZooKeeper();
                str = UserInfoSecurity.DBDecy(Encoding.UTF8.GetString(zooKeeper.GetData(path, null, null)));
            }
            catch (Exception exception)
            {
                ErrorMessage = exception.Message + "|" + exception.StackTrace;
            }
            return(str);
        }
예제 #3
0
 public decimal?GetExtendEarn(Guid userid)
 {
     #region 昨日佣金java接口版
     string errorMsg = "";
     string Url      = System.Configuration.ConfigurationManager.AppSettings["CommissionApiUrl"] ?? ZooKClient.GetValueForZK("/url/CommissionApiUrl", ref errorMsg);
     if (string.IsNullOrWhiteSpace(errorMsg))
     {
         if (!string.IsNullOrWhiteSpace(Url))
         {
             string startDate     = "";
             string endDate       = "";
             string newUserAPIURL = string.Format("{0}/commission/{1}/totalEarn", Url, userid.ToString());
             try
             {
                 string result = "";
                 errorMsg = string.Empty;
                 result   = HttpClient.HttpUtil.HttpGet(TdConfig.ApplicationName, newUserAPIURL, "", out errorMsg,
                                                        null, 2);
                 CommissionApiResponse <EarnMoneyResponse> commissionInfo = JsonConvert.DeserializeObject <CommissionApiResponse <EarnMoneyResponse> >(result);
                 if (commissionInfo != null && commissionInfo.code == "SUCCESS")//如果返回银行卡为空,返回默认值
                 {
                     return(commissionInfo.data.earnMoneyTotal);
                 }
                 else if (commissionInfo == null)
                 {
                     TuanDai.LogSystem.LogClient.LogClients.ErrorLog(TdConfig.ApplicationName, "DailyCommission.aspx", "commissionInfo为空", Url);
                     return(null);
                 }
                 else
                 {
                     if (commissionInfo != null && commissionInfo.code != "SEARCH_USER_ID_NOT_FOUND_ERROR")
                     {
                         TuanDai.LogSystem.LogClient.LogClients.TraceLog(TdConfig.ApplicationName, "DailyCommission.aspx", "用户不存在", "json=" + result);
                         return(null);
                     }
                     else
                     {
                         TuanDai.LogSystem.LogClient.LogClients.ErrorLog(TdConfig.ApplicationName, "DailyCommission.aspx", "数据异常", "json=" + result);
                         return(null);
                     }
                 }
             }
             catch (Exception ex)
             {
                 TuanDai.LogSystem.LogClient.LogClients.ErrorLog(TdConfig.ApplicationName, "DailyCommission.aspx", "获取数据异常", ex.Message + "  |  " + ex.StackTrace);
                 return(null);
             }
         }
         else
         {
             TuanDai.LogSystem.LogClient.LogClients.ErrorLog(TdConfig.ApplicationName, "DailyCommission.aspx", "Url为空", Url);
             return(null);
         }
     }
     else
     {
         TuanDai.LogSystem.LogClient.LogClients.ErrorLog(TdConfig.ApplicationName, "DailyCommission.aspx", "获取CommissionApiUrl失败", errorMsg);
         return(null);
     }
     #endregion
 }