Browse Source

新增控制器积累 JsonView(bool,string,obj)

wangh 2 years ago
parent
commit
19fb4a0de2
1 changed files with 11 additions and 0 deletions
  1. 11 0
      OASystem/OASystem.Api/Controllers/BaseController.cs

+ 11 - 0
OASystem/OASystem.Api/Controllers/BaseController.cs

@@ -49,6 +49,17 @@ public class ControllerBase : Microsoft.AspNetCore.Mvc.ControllerBase
             return new JsonView { Code = StatusCodes.Status400BadRequest, Msg = msg };
         }
     }
+    protected virtual JsonView JsonView(bool s, string msg, object obj)
+    {
+        if (s)
+        {
+            return new JsonView { Code = StatusCodes.Status200OK, Msg = msg,Data= obj };
+        }
+        else
+        {
+            return new JsonView { Code = StatusCodes.Status400BadRequest, Msg = msg };
+        }
+    }
     protected virtual JsonView JsonView(int code, string msg, object obj)
     {
         return new JsonView { Code = code, Msg = msg, Data = obj };