DuGuYang 3 lat temu
rodzic
commit
0b3acc44b7

+ 5 - 2
Areas/Admin/Controllers/MainServer/SysToolsController.cs

@@ -899,8 +899,11 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 return "创客编号不存在";
             }
-            PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.KqSnNo == PosSn);
-            
+            PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.KqSnNo == PosSn) ?? new PosMerchantInfo();
+            if (merchant.Id == 0)
+            {
+                return "机具" + PosSn + "对应的商户不存在";
+            }
             else if (merchant.MerUserType == 1 && merchant.UserId == user.Id)
             {
                 pos.UserId = pos.BuyUserId;