Browse Source

修复设置服务费接口

lcl 9 months ago
parent
commit
85940aaed5
2 changed files with 34 additions and 15 deletions
  1. BIN
      .DS_Store
  2. 34 15
      Areas/Api/Controllers/DepositController.cs

BIN
.DS_Store


+ 34 - 15
Areas/Api/Controllers/DepositController.cs

@@ -40,25 +40,44 @@ namespace MySystem.Areas.Api.Controllers.v1
                 string sn = data["sn"].ToString();
                 string serviceFee = data["serviceFee"].ToString();
 
-                WebCMSEntities db = new WebCMSEntities();
-                PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.PosSn == sn);
-                if(pos != null)
+                Dictionary<string, object> req = new Dictionary<string, object>();
+                string PosSn = data["sn"].ToString();
+                req.Add("PosSn", PosSn);
+                req.Add("BrandId", "12");
+                req.Add("Deposit", data["serviceFee"].ToString());
+                string UserId = "0";
+                if(requestMes.Contains("\"userId\""))
                 {
-                    Dictionary<string, object> req = new Dictionary<string, object>();
-                    req.Add("PosSnId", pos.Id);
-                    req.Add("BrandId", 12);
-                    req.Add("Deposit", serviceFee);
-                    RedisDbconn.Instance.AddList("ChangePosFeeQueue", Newtonsoft.Json.JsonConvert.SerializeObject(req));
-                    result.Add("code", 0);
-                    result.Add("status", "success");
-                    result.Add("msg", "成功");
+                    UserId = data["userId"].ToString();
                 }
-                else
+                req.Add("UserId", UserId);
+                string CallBackUrl = "";
+                if(requestMes.Contains("\"callBackUrl\""))
                 {
-                    result.Add("code", 1);
-                    result.Add("status", "fail");
-                    result.Add("msg", "机具号不存在");
+                    CallBackUrl = data["callBackUrl"].ToString();
                 }
+                req.Add("CallBackUrl", CallBackUrl);
+                RedisDbconn.Instance.AddList("ChangePosFeeQueue", Newtonsoft.Json.JsonConvert.SerializeObject(req));
+
+                // WebCMSEntities db = new WebCMSEntities();
+                // PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.PosSn == sn);
+                // if(pos != null)
+                // {
+                //     Dictionary<string, object> req = new Dictionary<string, object>();
+                //     req.Add("PosSnId", pos.Id);
+                //     req.Add("BrandId", 12);
+                //     req.Add("Deposit", serviceFee);
+                //     RedisDbconn.Instance.AddList("ChangePosFeeQueue", Newtonsoft.Json.JsonConvert.SerializeObject(req));
+                //     result.Add("code", 0);
+                //     result.Add("status", "success");
+                //     result.Add("msg", "成功");
+                // }
+                // else
+                // {
+                //     result.Add("code", 1);
+                //     result.Add("status", "fail");
+                //     result.Add("msg", "机具号不存在");
+                // }
             }
             catch(Exception ex)
             {