ソースを参照

添加存储当前返现金额

lcl 1 年間 前
コミット
d773bd9091
3 ファイル変更46 行追加118 行削除
  1. 0 118
      Util/HaoDa/HaoDaHelper.cs
  2. 41 0
      Util/HaoDa/ProfitHelper.cs
  3. 5 0
      global.json

+ 0 - 118
Util/HaoDa/HaoDaHelper.cs

@@ -65,123 +65,6 @@ namespace MySystem
             return result;
             return result;
         }
         }
 
 
-<<<<<<< HEAD
-        #region 上传图片接口
-        /// <summary>
-        /// 执行带文件上传的HTTP POST请求。
-        /// </summary>
-        /// <param name="url">请求地址</param>
-        /// <param name="textParams">请求文本参数</param>
-        /// <param name="fileParams">请求文件参数</param>
-        /// <param name="charset">编码字符集</param>
-        /// <returns>HTTP响应</returns>
-        public string DoPost(string url, string token, IDictionary<string, string> textParams, IDictionary<string, FileItem> fileParams, string charset = "utf-8")
-        {
-            // 如果没有文件参数,则走普通POST请求
-            if (fileParams == null || fileParams.Count == 0)
-            {
-                return "";
-            }
-
-            string boundary = DateTime.Now.Ticks.ToString("X"); // 随机分隔线
-
-            HttpWebRequest req = GetWebRequest(url, "POST");            
-            req.Headers.Add("X-File-Token", token);
-            req.ContentType = "multipart/form-data;charset=" + charset + ";boundary=" + boundary;
-
-            Stream reqStream = req.GetRequestStream();
-            byte[] itemBoundaryBytes = Encoding.GetEncoding(charset).GetBytes("\r\n--" + boundary + "\r\n");
-            byte[] endBoundaryBytes = Encoding.GetEncoding(charset).GetBytes("\r\n--" + boundary + "--\r\n");
-
-            // 组装文本请求参数
-            string textTemplate = "Content-Disposition:form-data;name=\"{0}\"\r\nContent-Type:text/plain\r\n\r\n{1}";
-            IEnumerator<KeyValuePair<string, string>> textEnum = textParams.GetEnumerator();
-            while (textEnum.MoveNext())
-            {
-                string textEntry = string.Format(textTemplate, textEnum.Current.Key, textEnum.Current.Value);
-                byte[] itemBytes = Encoding.GetEncoding(charset).GetBytes(textEntry);
-                reqStream.Write(itemBoundaryBytes, 0, itemBoundaryBytes.Length);
-                reqStream.Write(itemBytes, 0, itemBytes.Length);
-            }
-
-            // 组装文件请求参数
-            string fileTemplate = "Content-Disposition:form-data;name=\"{0}\";filename=\"{1}\"\r\nContent-Type:{2}\r\n\r\n";
-            IEnumerator<KeyValuePair<string, FileItem>> fileEnum = fileParams.GetEnumerator();
-            while (fileEnum.MoveNext())
-            {
-                string key = fileEnum.Current.Key;
-                FileItem fileItem = fileEnum.Current.Value;
-                string fileEntry = string.Format(fileTemplate, key, fileItem.GetFileName(), fileItem.GetMimeType());
-                byte[] itemBytes = Encoding.GetEncoding(charset).GetBytes(fileEntry);
-                reqStream.Write(itemBoundaryBytes, 0, itemBoundaryBytes.Length);
-                reqStream.Write(itemBytes, 0, itemBytes.Length);
-
-                byte[] fileBytes = fileItem.GetContent();
-                reqStream.Write(fileBytes, 0, fileBytes.Length);
-            }
-
-            reqStream.Write(endBoundaryBytes, 0, endBoundaryBytes.Length);
-            reqStream.Close();
-
-            HttpWebResponse rsp = (HttpWebResponse)req.GetResponse();
-            Encoding encoding = Encoding.GetEncoding(rsp.CharacterSet);
-            return GetResponseAsString(rsp, encoding);
-        }
-
-        public HttpWebRequest GetWebRequest(string url, string method)
-        {
-            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
-            req.ServicePoint.Expect100Continue = false;
-            req.Method = method;
-            req.KeepAlive = true;
-            req.Timeout = 100000;
-            return req;
-        }
-
-        /// <summary>
-        /// 把响应流转换为文本。
-        /// </summary>
-        /// <param name="rsp">响应流对象</param>
-        /// <param name="encoding">编码方式</param>
-        /// <returns>响应文本</returns>
-        public string GetResponseAsString(HttpWebResponse rsp, Encoding encoding)
-        {
-            StringBuilder result = new StringBuilder();
-            Stream stream = null;
-            StreamReader reader = null;
-
-            try
-            {
-                // 以字符流的方式读取HTTP响应
-                stream = rsp.GetResponseStream();
-                reader = new StreamReader(stream, encoding);
-
-                // 按字符读取并写入字符串缓冲
-                int ch = -1;
-                while ((ch = reader.Read()) > -1)
-                {
-                    // 过滤结束符
-                    char c = (char)ch;
-                    if (c != '\0')
-                    {
-                        result.Append(c);
-                    }
-                }
-            }
-            finally
-            {
-                // 释放资源
-                if (reader != null) reader.Close();
-                if (stream != null) stream.Close();
-                if (rsp != null) rsp.Close();
-            }
-
-            return result.ToString();
-        }
-        #endregion
-
-        public Dictionary<string, string> GetHeader(Dictionary<string, object> reqdic)
-=======
         /// <summary>
         /// <summary>
         /// 查询商户审核状态
         /// 查询商户审核状态
         /// </summary>
         /// </summary>
@@ -720,7 +603,6 @@ namespace MySystem
         }
         }
 
 
         public Dictionary<string, string> GetHeader(string req)
         public Dictionary<string, string> GetHeader(string req)
->>>>>>> DuGuYang
         {
         {
             Dictionary<string, string> headdic = new Dictionary<string, string>();
             Dictionary<string, string> headdic = new Dictionary<string, string>();
             string timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
             string timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

+ 41 - 0
Util/HaoDa/ProfitHelper.cs

@@ -7,6 +7,7 @@ using Library;
 using System.Threading;
 using System.Threading;
 using Microsoft.Extensions.Hosting;
 using Microsoft.Extensions.Hosting;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
+using LitJson;
 
 
 namespace MySystem
 namespace MySystem
 {
 {
@@ -499,5 +500,45 @@ namespace MySystem
             return dt;
             return dt;
         }
         }
         #endregion
         #endregion
+
+
+
+
+        public void StartSetDivi()
+        {
+            Thread th = new Thread(StartSetDiviDo);
+            th.IsBackground = true;
+            th.Start();
+        }
+        public void StartSetDiviDo()
+        {
+            while (true)
+            {
+                string content = RedisDbconn.Instance.RPop<string>("ConsumerOrdersSetDivi");
+                if (!string.IsNullOrEmpty(content))
+                {
+                    SetDivi(content);
+                }
+                else
+                {
+                    Thread.Sleep(10000);
+                }
+            }
+        }
+
+        public void SetDivi(string content)
+        { 
+            JsonData jsonObj = JsonMapper.ToObject(content);
+            int orderId = int.Parse(jsonObj["OrderId"].ToString());
+            decimal diviAmt = int.Parse(jsonObj["DiviAmt"].ToString());
+            WebCMSEntities db = new WebCMSEntities();
+            ConsumerOrders order = db.ConsumerOrders.FirstOrDefault(m => m.Id == orderId);
+            if(order != null)
+            {
+                order.CurDivi = diviAmt;
+                db.SaveChanges();
+            }
+            db.Dispose();
+        }
     }
     }
 }
 }

+ 5 - 0
global.json

@@ -0,0 +1,5 @@
+{
+  "sdk": {
+    "version": "3.0.100"
+  }
+}