Browse Source

奖励推送给java

lcl 1 month ago
parent
commit
96cc104ce8

+ 8 - 0
Util/HaoDa/ActiveRewardService.cs

@@ -117,6 +117,8 @@ namespace MySystem
                 QueryCount = merchant.Id,
             }).Entity;
             kxsdb.SaveChanges();
+
+            PrizePushHelper.Instance.Do(DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8), "来客吧激活奖", "311", ActPrize, GetUserId, "{\"brand_id\":101,\"user_id\":" + GetUserId + "}");
         }
 
 
@@ -233,6 +235,8 @@ namespace MySystem
                                                     }).Entity;
                                                     kxsdb.SaveChanges();
                                                     Prize = 0;
+
+                                                    PrizePushHelper.Instance.Do(DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8), "来客吧开户奖", "312", Prize, puser.Id, "{\"brand_id\":101,\"user_id\":" + puser.Id + "}");
                                                 }
                                             }
                                         }
@@ -361,6 +365,8 @@ namespace MySystem
                                                     }).Entity;
                                                     kxsdb.SaveChanges();
                                                     Prize = 0;
+
+                                                    PrizePushHelper.Instance.Do(DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8), "来客吧大盟主奖", "313", Prize, puser.Id, "{\"brand_id\":101,\"user_id\":" + puser.Id + "}");
                                                 }
                                             }
                                         }
@@ -485,6 +491,8 @@ namespace MySystem
                                                 }).Entity;
                                                 kxsdb.SaveChanges();
                                                 Prize = 0;
+
+                                                PrizePushHelper.Instance.Do(DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8), "来客吧运营中心奖", "314", Prize, puser.Id, "{\"brand_id\":101,\"user_id\":" + puser.Id + "}");
                                             }
                                         }
                                     }

+ 2 - 0
Util/HaoDa/MerchantStandardService.cs

@@ -225,6 +225,8 @@ namespace MySystem
                 kxsdb.SaveChanges();
                 kxsdb.Dispose();
                 db.Dispose();
+
+                PrizePushHelper.Instance.Do(DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8), "来客吧达标奖", "315", Prize, GetUserId, "{\"brand_id\":101,\"user_id\":" + GetUserId + "}");
             }
             catch (Exception ex)
             {

+ 48 - 0
Util/PrizePushHelper.cs

@@ -0,0 +1,48 @@
+using System;
+using System.Linq;
+using System.Data;
+using System.Threading;
+using Library;
+using LitJson;
+using System.Collections.Generic;
+
+namespace MySystem
+{   
+    public class PrizePushHelper
+    {
+        public readonly static PrizePushHelper Instance = new PrizePushHelper();
+        private PrizePushHelper()
+        {
+        }
+
+        string NoticeUrl = "https://apigateway.kexiaoshuang.com/v1/kxs/userServer/userAccount/sendPrize";
+
+        //要执行的方法
+        public void Do(string batchNo, string prizeName, string prizeCode, decimal prizeAmt, int prizeObjectId, string requestParamField = "")
+        {
+            try
+            {
+                Dictionary<string, object> prizeItem = new Dictionary<string, object>();
+                prizeItem.Add("prize_date", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
+                prizeItem.Add("prize_name", prizeName);
+                prizeItem.Add("prize_code", prizeCode);
+                prizeItem.Add("batch_no", batchNo);
+                prizeItem.Add("request_param_field", requestParamField);
+                List<Dictionary<string, object>> prizeItemList = new List<Dictionary<string, object>>();
+                Dictionary<string, object> prizeItemSub = new Dictionary<string, object>();
+                prizeItemSub.Add("prize_amount", prizeAmt);
+                prizeItemSub.Add("prize_obj", prizeObjectId);
+                prizeItemList.Add(prizeItemSub);
+                prizeItem.Add("prize_list", prizeItemList);
+                string prizeOutContent = Newtonsoft.Json.JsonConvert.SerializeObject(prizeItem);
+                function.WriteLog("请求参数:" + prizeOutContent, "奖励通知返回报文");
+                string noticeJson = function.PostWebRequest(NoticeUrl, prizeOutContent, "application/json");
+                function.WriteLog("返回报文:" + noticeJson + "\n\n\n", "奖励通知返回报文");
+            }
+            catch(Exception ex)
+            {
+                LogHelper.Instance.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString() + "\n\n", "奖励通知返回异常");
+            }
+        }
+    }
+}