JAELYS 6 gadi atpakaļ
vecāks
revīzija
083c869184

+ 89 - 0
TEAMModelOS/Controllers/Analysis/ClassController.cs

@@ -0,0 +1,89 @@
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Mvc;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+using TEAMModelOS.Helper.Common.FileHelper;
+using TEAMModelOS.SDK.Extension.DataResult.JsonRpcResponse;
+using TEAMModelOS.SDK.Helper.Common.JsonHelper;
+
+namespace TEAMModelOS.Starter.CloudServer.Controllers.AnalysisControllers
+{
+    [Route("api/[controller]")]
+    [ApiController]
+    public class ClassController: Controller
+    {
+        IHostingEnvironment _hostingEnvironment;
+
+        public ClassController(IHostingEnvironment hostingEnvironment)
+        {
+            _hostingEnvironment = hostingEnvironment;
+        }
+        /// <summary>
+        /// 获取年级菜单
+        /// </summary>
+        /// <param name="identity"></param>
+        /// <returns></returns>
+        [HttpGet("getGrade")]
+        public BaseJosnRPCResponse getGrade(string identity)
+        {
+            string contentRootPath = _hostingEnvironment.ContentRootPath;
+            //identity = "grade";
+            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
+            string data = FileTool.getJson(contentRootPath,identity);
+            builder.Data(JsonConvert.DeserializeObject(data));
+            return builder.build();
+        }
+
+        /// <summary>
+        /// 获取学期菜单
+        /// </summary>
+        /// <param name="identity"></param>
+        /// <returns></returns>
+        [HttpGet("getTerm")]
+        public BaseJosnRPCResponse getTerm(string identity)
+        {
+            string contentRootPath = _hostingEnvironment.ContentRootPath;
+            identity = "term";
+            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
+            string data = FileTool.getJson(contentRootPath, identity);
+            builder.Data(JsonConvert.DeserializeObject(data));
+            return builder.build();
+        }
+        /// <summary>
+        /// 获取考试列表
+        /// </summary>
+        /// <param name="identity"></param>
+        /// <returns></returns>
+        [HttpGet("getExam")]
+        public BaseJosnRPCResponse getExam(string identity)
+        {
+            string contentRootPath = _hostingEnvironment.ContentRootPath;
+            identity = "exam";
+            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
+            string data = FileTool.getJson(contentRootPath, identity);
+            builder.Data(JsonConvert.DeserializeObject(data));
+            return builder.build();
+        }
+
+        /// <summary>
+        /// 获取基础信息
+        /// </summary>
+        /// <param name="identity"></param>
+        /// <returns></returns>
+        [HttpGet("getBase")]
+        public BaseJosnRPCResponse getBase(string identity)
+        {
+            string contentRootPath = _hostingEnvironment.ContentRootPath;
+            identity = "Base";
+            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
+            string data = FileTool.getJson(contentRootPath, identity);
+            builder.Data(JsonConvert.DeserializeObject(data));
+            return builder.build();
+        }
+    }
+}

+ 1 - 1
TEAMModelOS/Controllers/AnalysisControllers/FileTool.cs

@@ -17,7 +17,7 @@ namespace TEAMModelOS.Helper.Common.FileHelper
             
             try
             {
-                String path = contentRootPath + "/JsonFiled/" + name + ".json";
+                String path = contentRootPath + "/JsonFile/" + name + ".json";
                 //获取正在占用的文件
                 FileStream fs = new FileStream(path, System.IO.FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
                 StreamReader sr = new StreamReader(fs, System.Text.Encoding.ASCII);

BIN
TEAMModelOS/JsonFile/Base.json


BIN
TEAMModelOS/JsonFile/Echars-l.json


BIN
TEAMModelOS/JsonFile/Echars-y.json


BIN
TEAMModelOS/JsonFile/Echars-z.json


BIN
TEAMModelOS/JsonFile/Echars-zx.json


BIN
TEAMModelOS/JsonFile/Exam.json


BIN
TEAMModelOS/JsonFile/ExamType.json


TEAMModelOS/JsonFile/menu.json → TEAMModelOS/JsonFile/Grade.json


BIN
TEAMModelOS/JsonFile/term.json