Quellcode durchsuchen

修复机具管理-已绑定机具列表中的商户显示问题
绑定收款码接口,部分换service的写法

lcl vor 1 Jahr
Ursprung
Commit
53d4d7e668

+ 24 - 13
Areas/Api/Controllers/v1/MainServer/MerchantQrCodeController.cs

@@ -103,13 +103,17 @@ namespace MySystem.Areas.Api.Controllers.v1
                     return new AppResultJson() { Status = "-1", Info = "此二维码已被绑定,请勿重复绑定" };
                 }
             }
-            query = maindb.MerchantQrCode.Add(new MerchantQrCode()
-            {
-                CreateDate = DateTime.Now, //绑定时间
-                MerchantId = MerchantId, //商户
-                SnNo = SnNo,
-            }).Entity;
-            maindb.SaveChanges();
+            Dictionary<string, object> fields = new Dictionary<string, object>();
+            fields.Add("MerchantId", MerchantId);
+            fields.Add("SnNo", SnNo);
+            new MerchantQrCodeService().Add(fields);
+            // query = maindb.MerchantQrCode.Add(new MerchantQrCode()
+            // {
+            //     CreateDate = DateTime.Now, //绑定时间
+            //     MerchantId = MerchantId, //商户
+            //     SnNo = SnNo,
+            // }).Entity;
+            // maindb.SaveChanges();
             string DataId = query.Id + "_0";
             MachineForQrCode forQrCode = maindb.MachineForQrCode.FirstOrDefault(m => m.DataId == DataId);
             if (forQrCode == null)
@@ -130,12 +134,19 @@ namespace MySystem.Areas.Api.Controllers.v1
                 forQrCode.MerchantId = MerchantId;
             }
             maindb.SaveChanges();
-            pos.BuyUserId = merchant.UserId;
-            pos.UserId = merchant.UserId;
-            pos.BindingTime = DateTime.Now;
-            pos.BindingState = 1;
-            pos.BindMerchantId = MerchantId;
-            maindb.SaveChanges();
+            fields = new Dictionary<string, object>();
+            fields.Add("BuyUserId", merchant.UserId);
+            fields.Add("UserId", merchant.UserId);
+            fields.Add("BindingTime", DateTime.Now);
+            fields.Add("BindingState", 1);
+            fields.Add("BindMerchantId", MerchantId);
+            new PosMachinesTwoService().Edit(fields, pos.Id);
+            // pos.BuyUserId = merchant.UserId;
+            // pos.UserId = merchant.UserId;
+            // pos.BindingTime = DateTime.Now;
+            // pos.BindingState = 1;
+            // pos.BindMerchantId = MerchantId;
+            // maindb.SaveChanges();
 
             PublicFunction.BindUserMachineData(maindb, merchant.UserId, 0, 1, SnNo);
             

+ 2 - 1
Areas/Api/Controllers/v1/MainServer/PosMachinesController.cs

@@ -340,7 +340,8 @@ namespace MySystem.Areas.Api.Controllers.v1
                     Deposit = decimal.Parse(function.CheckNum(subdata.PrizeParams));
                 }
                 curData.Add("Deposit", Deposit);
-                curData.Add("BindedMerchant", subdata.BuyUserId != subdata.UserId ? 1 : 0); //是否已绑定商户型创客
+                MerchantAddInfo merchant = maindb.MerchantAddInfo.FirstOrDefault(m => m.Id == subdata.BindMerchantId) ?? new MerchantAddInfo();
+                curData.Add("BindedMerchant", merchant.CertMerchantName);
                 curData.Add("IsLeader",IsLeader);
                 dataList.Add(curData);
             }