123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261 |
- using Common.system;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using XHZB.Model;
-
- namespace XHZB.Desktop.Utils
- {
- //接口调用
- public class RegisterController
- {
- /// <summary>
- /// 登陆
- /// </summary>
- /// <param name="request"></param>
- /// <returns></returns>
- public int Login(string loginname, string loginpwd)
- {
- string url = APP.apiUrl + "/user/login";//地址
- Dictionary<string, object> dic = new Dictionary<string, object>
- {
- { "loginname", loginname},
- { "loginpwd", loginpwd}
- };
- string body = JsonHelper.ToJson(dic);
- ResultVo<LoginModel> result = HttpHelper.PostAndRespSignle<ResultVo<LoginModel>>(url, postData: body);
- if (result != null)
- {
- APP.ErrorMessage = result.msg;
- APP.LoginUser = result.obj;
- return result.code;
- }
- else
- {
- APP.ErrorMessage = "网络异常!";
- APP.LoginUser = new LoginModel();
- return 1;
- }
- }
- /// <summary>
- /// 开始直播
- /// </summary>
- /// <param name="request"></param>
- /// <returns></returns>
- public int UpdateState()
- {
- string url = APP.apiUrl + "/course/update_state";//地址
- Dictionary<string, int> dic = new Dictionary<string, int>
- {
- { "courseid", 1},
- { "loginpwd", 2}
- };
- string body = JsonHelper.ToJson(dic);
- ResultVo<CisectionidModel> result = HttpHelper.PostAndRespSignle<ResultVo<CisectionidModel>>(url, postData: body);
- if (result != null)
- {
- APP.ErrorMessage = result.msg;
- return result.code;
- }
- else
- {
- APP.ErrorMessage = "网络异常!";
- return 1;
- }
- }
- /// <summary>
- /// 教师任教班级
- /// </summary>
- /// <param name="request"></param>
- /// <returns></returns>
- public int ClassList()
- {
- try
- {
- string url = APP.apiUrl + "/class_teacher/tclist";//地址
- Dictionary<string, int> dic = new Dictionary<string, int>
- {
- { "createid", APP.LoginUser.userid},
- { "year", APP.LoginUser.year}
- };
- string body = JsonHelper.ToJson(dic);
- ResultVo<List<ClassListModel>> result = HttpHelper.PostAndRespSignle<ResultVo<List<ClassListModel>>>(url, postData: body);
- if (result != null)
- {
- APP.ErrorMessage = result.msg;
- APP.ClassList = result.obj;
- return result.code;
- }
- else
- {
- APP.ErrorMessage = "网络异常!";
- return 1;
- }
- }
- catch (Exception ex)
- {
- LogHelper.WriteErrLog("【调用接口(RegisterController)】错误日志:" + ex.Message, ex);
- return 1;
- }
- }
- /// <summary>
- /// 教师教材列表
- /// </summary>
- /// <param name="request"></param>
- /// <returns></returns>
- public int TsubjectbookList()
- {
- try
- {
- string url = APP.apiUrl + "/tsubjectbook/list";//地址
- Dictionary<string, int> dic = new Dictionary<string, int>
- {
- { "teacherid",APP.LoginUser.userid}
- };
- string body = JsonHelper.ToJson(dic);
- ResultVo<List<TsubjectbookListModel>> result = HttpHelper.PostAndRespSignle<ResultVo<List<TsubjectbookListModel>>>(url, postData: body);
- if (result != null)
- {
- APP.ErrorMessage = result.msg;
- APP.TsubjectbookList = result.obj;
- return result.code;
- }
- else
- {
- APP.ErrorMessage = "网络异常!";
- return 1;
- }
- }
- catch (Exception ex)
- {
- LogHelper.WriteErrLog("【调用接口(RegisterController)】错误日志:" + ex.Message, ex);
- return 1;
- }
- }
- /// <summary>
- /// 章节--列表
- /// </summary>
- /// <param name="request"></param>
- /// <returns></returns>
- public int DirectorList(int lsbid,int directortype,int createid)
- {
- try
- {
- string url = APP.apiUrl + "/director/list";//地址
- Dictionary<string, int> dic = new Dictionary<string, int>
- {
- { "lsbid", lsbid },
- { "directortype", directortype },
- { "createid", createid }
- };
- string body = JsonHelper.ToJson(dic);
- ResultVo<List<DirectorListModel>> result = HttpHelper.PostAndRespSignle<ResultVo<List<DirectorListModel>>>(url, postData: body);
- if (result != null)
- {
- APP.ErrorMessage = result.msg;
- APP.DirectorList = result.obj;
- return result.code;
- }
- else
- {
- APP.ErrorMessage = "网络异常!";
- return 1;
- }
- }
- catch (Exception ex)
- {
- LogHelper.WriteErrLog("【调用接口(RegisterController)】错误日志:" + ex.Message, ex);
- return 1;
- }
- }
- /// <summary>
- /// 我的备课--列表
- /// </summary>
- /// <param name="request"></param>
- /// <returns></returns>
- public int ResourceMyList(int _lsbid, int _directorid, int _resourceclass)
- {
- try
- {
- string url = APP.apiUrl + "/resource/my_list2";//地址
- Dictionary<string, int> dic = new Dictionary<string, int>
- {
- { "lsbid", _lsbid},
- { "directorid", _directorid},
- { "resourceclass", _resourceclass},
- { "resourcetype", 0},
- { "readcount", 0},
- { "createid", APP.LoginUser.userid},
- { "schoolid", APP.LoginUser.schoolid}
- };
- string body = DataProvider.SerializeDictionaryToJsonString(dic);
- string xmlDoc = DataProvider.HttpPost(body, url);
-
- if (string.IsNullOrEmpty(xmlDoc))
- {
- APP.ErrorMessage = "网络异常!";
- return 1;
- }
- else
- {
- ResultListVo<ResourceMyListsModel> obj = JsonHelper.JsonToObj<ResultListVo<ResourceMyListsModel>>(xmlDoc);
- if (obj != null)
- {
- APP.ResourceMyList.obj = new List<ResourceMyListsModel>();
- APP.ResourceMyList.obj = obj.obj;
- return 0;
- }
- else
- {
- APP.ErrorMessage = "网络异常!";
- return 1;
- }
- }
- }
- catch (Exception ex)
- {
- LogHelper.WriteErrLog("我的备课接口" + ex.Message, ex);
- }
- return 0;
- }
- ///// <summary>
- ///// 班级学生--列表
- ///// </summary>
- ///// <param name="request"></param>
- ///// <returns></returns>
- //public int ClassStudentList(ref TeachingData teachingData)
- //{
- // try
- // {
- // string url = ZConfig.apiUrl + "/room/list_student";//地址
- // Dictionary<string, int> dic = new Dictionary<string, int>
- // {
- // { "classid", ZCommonData.classid },
- // {"lsbid",ZCommonData.lsbid }
- // };
- // string body = ZJsonHelper.ToJson(dic);
- // ResultVo<List<RESP_ClassStudentList>> result = ZHttpUtil.PostAndRespSignle<ResultVo<List<RESP_ClassStudentList>>>(url, postData: body);
- // Shared.ServerMsg = result?.msg;
- // int code = 0;
- // if (result != null)
- // {
- // Shared.TeachingData.RESP_ClassStudentList = result?.obj;
- // }
- // else
- // {
- // code = 1;
- // Shared.ServerMsg = "网络异常";
- // }
-
- // return code;
- // }
- // catch (Exception ex)
- // {
- // LogHelper.WriteErrLog("【调用接口(RegisterController)】错误日志:" + ex.Message, ex);
- // }
- // return 0;
- //}
- }
- }
|