星火直播PC
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

RegisterController.cs 9.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. using Common.system;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using XHZB.Model;
  8. namespace XHZB.Desktop.Utils
  9. {
  10. //接口调用
  11. public class RegisterController
  12. {
  13. /// <summary>
  14. /// 登陆
  15. /// </summary>
  16. /// <param name="request"></param>
  17. /// <returns></returns>
  18. public int Login(string loginname, string loginpwd)
  19. {
  20. string url = APP.apiUrl + "/user/login";//地址
  21. Dictionary<string, object> dic = new Dictionary<string, object>
  22. {
  23. { "loginname", loginname},
  24. { "loginpwd", loginpwd}
  25. };
  26. string body = JsonHelper.ToJson(dic);
  27. ResultVo<LoginModel> result = HttpHelper.PostAndRespSignle<ResultVo<LoginModel>>(url, postData: body);
  28. if (result != null)
  29. {
  30. APP.ErrorMessage = result.msg;
  31. APP.LoginUser = result.obj;
  32. return result.code;
  33. }
  34. else
  35. {
  36. APP.ErrorMessage = "网络异常!";
  37. APP.LoginUser = new LoginModel();
  38. return 1;
  39. }
  40. }
  41. /// <summary>
  42. /// 开始直播
  43. /// </summary>
  44. /// <param name="request"></param>
  45. /// <returns></returns>
  46. public int UpdateState()
  47. {
  48. string url = APP.apiUrl + "/course/update_state";//地址
  49. Dictionary<string, int> dic = new Dictionary<string, int>
  50. {
  51. { "courseid", 1},
  52. { "loginpwd", 2}
  53. };
  54. string body = JsonHelper.ToJson(dic);
  55. ResultVo<CisectionidModel> result = HttpHelper.PostAndRespSignle<ResultVo<CisectionidModel>>(url, postData: body);
  56. if (result != null)
  57. {
  58. APP.ErrorMessage = result.msg;
  59. return result.code;
  60. }
  61. else
  62. {
  63. APP.ErrorMessage = "网络异常!";
  64. return 1;
  65. }
  66. }
  67. /// <summary>
  68. /// 教师任教班级
  69. /// </summary>
  70. /// <param name="request"></param>
  71. /// <returns></returns>
  72. public int ClassList()
  73. {
  74. try
  75. {
  76. string url = APP.apiUrl + "/class_teacher/tclist";//地址
  77. Dictionary<string, int> dic = new Dictionary<string, int>
  78. {
  79. { "createid", APP.LoginUser.userid},
  80. { "year", APP.LoginUser.year}
  81. };
  82. string body = JsonHelper.ToJson(dic);
  83. ResultVo<List<ClassListModel>> result = HttpHelper.PostAndRespSignle<ResultVo<List<ClassListModel>>>(url, postData: body);
  84. if (result != null)
  85. {
  86. APP.ErrorMessage = result.msg;
  87. APP.ClassList = result.obj;
  88. return result.code;
  89. }
  90. else
  91. {
  92. APP.ErrorMessage = "网络异常!";
  93. return 1;
  94. }
  95. }
  96. catch (Exception ex)
  97. {
  98. LogHelper.WriteErrLog("【调用接口(RegisterController)】错误日志:" + ex.Message, ex);
  99. return 1;
  100. }
  101. }
  102. /// <summary>
  103. /// 教师教材列表
  104. /// </summary>
  105. /// <param name="request"></param>
  106. /// <returns></returns>
  107. public int TsubjectbookList()
  108. {
  109. try
  110. {
  111. string url = APP.apiUrl + "/tsubjectbook/list";//地址
  112. Dictionary<string, int> dic = new Dictionary<string, int>
  113. {
  114. { "teacherid",APP.LoginUser.userid}
  115. };
  116. string body = JsonHelper.ToJson(dic);
  117. ResultVo<List<TsubjectbookListModel>> result = HttpHelper.PostAndRespSignle<ResultVo<List<TsubjectbookListModel>>>(url, postData: body);
  118. if (result != null)
  119. {
  120. APP.ErrorMessage = result.msg;
  121. APP.TsubjectbookList = result.obj;
  122. return result.code;
  123. }
  124. else
  125. {
  126. APP.ErrorMessage = "网络异常!";
  127. return 1;
  128. }
  129. }
  130. catch (Exception ex)
  131. {
  132. LogHelper.WriteErrLog("【调用接口(RegisterController)】错误日志:" + ex.Message, ex);
  133. return 1;
  134. }
  135. }
  136. /// <summary>
  137. /// 章节--列表
  138. /// </summary>
  139. /// <param name="request"></param>
  140. /// <returns></returns>
  141. public int DirectorList(int lsbid,int directortype,int createid)
  142. {
  143. try
  144. {
  145. string url = APP.apiUrl + "/director/list";//地址
  146. Dictionary<string, int> dic = new Dictionary<string, int>
  147. {
  148. { "lsbid", lsbid },
  149. { "directortype", directortype },
  150. { "createid", createid }
  151. };
  152. string body = JsonHelper.ToJson(dic);
  153. ResultVo<List<DirectorListModel>> result = HttpHelper.PostAndRespSignle<ResultVo<List<DirectorListModel>>>(url, postData: body);
  154. if (result != null)
  155. {
  156. APP.ErrorMessage = result.msg;
  157. APP.DirectorList = result.obj;
  158. return result.code;
  159. }
  160. else
  161. {
  162. APP.ErrorMessage = "网络异常!";
  163. return 1;
  164. }
  165. }
  166. catch (Exception ex)
  167. {
  168. LogHelper.WriteErrLog("【调用接口(RegisterController)】错误日志:" + ex.Message, ex);
  169. return 1;
  170. }
  171. }
  172. /// <summary>
  173. /// 我的备课--列表
  174. /// </summary>
  175. /// <param name="request"></param>
  176. /// <returns></returns>
  177. public int ResourceMyList(int _lsbid, int _directorid, int _resourceclass)
  178. {
  179. try
  180. {
  181. string url = APP.apiUrl + "/resource/my_list2";//地址
  182. Dictionary<string, int> dic = new Dictionary<string, int>
  183. {
  184. { "lsbid", _lsbid},
  185. { "directorid", _directorid},
  186. { "resourceclass", _resourceclass},
  187. { "resourcetype", 0},
  188. { "readcount", 0},
  189. { "createid", APP.LoginUser.userid},
  190. { "schoolid", APP.LoginUser.schoolid}
  191. };
  192. string body = DataProvider.SerializeDictionaryToJsonString(dic);
  193. string xmlDoc = DataProvider.HttpPost(body, url);
  194. if (string.IsNullOrEmpty(xmlDoc))
  195. {
  196. APP.ErrorMessage = "网络异常!";
  197. return 1;
  198. }
  199. else
  200. {
  201. ResultListVo<ResourceMyListsModel> obj = JsonHelper.JsonToObj<ResultListVo<ResourceMyListsModel>>(xmlDoc);
  202. if (obj != null)
  203. {
  204. APP.ResourceMyList.obj = new List<ResourceMyListsModel>();
  205. APP.ResourceMyList.obj = obj.obj;
  206. return 0;
  207. }
  208. else
  209. {
  210. APP.ErrorMessage = "网络异常!";
  211. return 1;
  212. }
  213. }
  214. }
  215. catch (Exception ex)
  216. {
  217. LogHelper.WriteErrLog("我的备课接口" + ex.Message, ex);
  218. }
  219. return 0;
  220. }
  221. ///// <summary>
  222. ///// 班级学生--列表
  223. ///// </summary>
  224. ///// <param name="request"></param>
  225. ///// <returns></returns>
  226. //public int ClassStudentList(ref TeachingData teachingData)
  227. //{
  228. // try
  229. // {
  230. // string url = ZConfig.apiUrl + "/room/list_student";//地址
  231. // Dictionary<string, int> dic = new Dictionary<string, int>
  232. // {
  233. // { "classid", ZCommonData.classid },
  234. // {"lsbid",ZCommonData.lsbid }
  235. // };
  236. // string body = ZJsonHelper.ToJson(dic);
  237. // ResultVo<List<RESP_ClassStudentList>> result = ZHttpUtil.PostAndRespSignle<ResultVo<List<RESP_ClassStudentList>>>(url, postData: body);
  238. // Shared.ServerMsg = result?.msg;
  239. // int code = 0;
  240. // if (result != null)
  241. // {
  242. // Shared.TeachingData.RESP_ClassStudentList = result?.obj;
  243. // }
  244. // else
  245. // {
  246. // code = 1;
  247. // Shared.ServerMsg = "网络异常";
  248. // }
  249. // return code;
  250. // }
  251. // catch (Exception ex)
  252. // {
  253. // LogHelper.WriteErrLog("【调用接口(RegisterController)】错误日志:" + ex.Message, ex);
  254. // }
  255. // return 0;
  256. //}
  257. }
  258. }