Ver Fonte

添加json对象为null返回空字符串方法

DuGuYang há 1 ano atrás
pai
commit
ac8242cdea

Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
Areas/Api/Controllers/Main/MerchantAddInfoController.cs


+ 22 - 0
Util/Extension/JsonDataExtension.cs

@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using LitJson;
+
+namespace MySystem
+{
+    public static class JsonDataExtension
+    {
+        
+        #region 获取是否存在Key, isFlag判断是抛出异常还是返回""
+        public static object getItem(this JsonData input, string key) 
+        {
+            string jsonString = input.ToJson();
+            if(jsonString.Contains("\"" + key + "\""))
+            {
+                return input[key];
+            }
+            return "";
+        }
+        #endregion
+    }
+}

+ 17 - 0
Util/Extension/StringExtension.cs

@@ -0,0 +1,17 @@
+
+namespace MySystem
+{
+    public static class StringExtension
+    {
+        #region sql条件拼装
+        public static string Like(this string input, string Field, string Value) 
+        {
+            if (!string.IsNullOrEmpty(Value))
+            {
+                input += " and " + Field + " like '%" + Value + "%'";
+            }
+            return input;
+        }
+        #endregion
+    }
+}

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff