星火微课系统客户端
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. using Common.system;
  2. using Newtonsoft.Json.Linq;
  3. using System;
  4. using System.Collections.Generic;
  5. using XHWK.Model;
  6. namespace XHWK.WKTool.DAL
  7. {
  8. public class Interface
  9. {
  10. //private string APIRequestAddress = FileToolsCommon.GetConfigValue("APIRequestAddress");
  11. //private string FileRequestAddress = FileToolsCommon.GetConfigValue("FileRequestAddress");
  12. //private string schoolfileRequestAddress = FileToolsCommon.GetConfigValue("schoolfileRequestAddress");
  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<Model_UserInfo> result = HttpHelper.PostAndRespSignle<ResultVo<Model_UserInfo>>(url, postData: body);
  28. if (result != null)
  29. {
  30. APP.UserInfo = new Model_UserInfo();
  31. APP.ServerMsg = result.msg;
  32. APP.UserInfo = result.obj;
  33. return result.code;
  34. }
  35. else
  36. {
  37. APP.ServerMsg = "网络异常!";
  38. APP.UserInfo = new Model_UserInfo();
  39. return 1;
  40. }
  41. }
  42. /// <summary>
  43. /// 教师教材列表
  44. /// </summary>
  45. /// <param name="request"></param>
  46. /// <returns></returns>
  47. public int TsubjectbookList()
  48. {
  49. APP.TsubjectbookList = new List<Model_TsubjectbookList>();
  50. try
  51. {
  52. string url = APP.apiUrl + "/tsubjectbook/list";//地址
  53. Dictionary<string, int> dic = new Dictionary<string, int>
  54. {
  55. { "teacherid",APP.UserInfo.Userid}
  56. };
  57. string body = JsonHelper.ToJson(dic);
  58. ResultVo<List<Model_TsubjectbookList>> result = HttpHelper.PostAndRespSignle<ResultVo<List<Model_TsubjectbookList>>>(url, postData: body);
  59. if (result != null)
  60. {
  61. APP.ServerMsg = result.msg;
  62. APP.TsubjectbookList = result.obj;
  63. return result.code;
  64. }
  65. else
  66. {
  67. APP.ServerMsg = "网络异常!";
  68. return 1;
  69. }
  70. }
  71. catch (Exception ex)
  72. {
  73. LogHelper.WriteErrLog("【调用接口(RegisterController)】错误日志:" + ex.Message, ex);
  74. return 1;
  75. }
  76. }
  77. /// <summary>
  78. /// 章节--列表
  79. /// </summary>
  80. /// <param name="request"></param>
  81. /// <returns></returns>
  82. public int DirectorList(int lsbid, int directortype, int createid)
  83. {
  84. APP.DirectorList = new List<Model_DirectorList>();
  85. try
  86. {
  87. string url = APP.apiUrl + "/director/list";//地址
  88. Dictionary<string, int> dic = new Dictionary<string, int>
  89. {
  90. { "lsbid", lsbid },
  91. { "directortype", directortype },
  92. { "createid", createid }
  93. };
  94. string body = JsonHelper.ToJson(dic);
  95. ResultVo<List<Model_DirectorList>> result = HttpHelper.PostAndRespSignle<ResultVo<List<Model_DirectorList>>>(url, postData: body);
  96. if (result != null)
  97. {
  98. APP.ServerMsg = result.msg;
  99. APP.DirectorList = result.obj;
  100. return result.code;
  101. }
  102. else
  103. {
  104. APP.ServerMsg = "网络异常!";
  105. return 1;
  106. }
  107. }
  108. catch (Exception ex)
  109. {
  110. LogHelper.WriteErrLog("【调用接口(RegisterController)】错误日志:" + ex.Message, ex);
  111. return 1;
  112. }
  113. }
  114. /// <summary>
  115. /// 资源--添加
  116. /// </summary>
  117. /// <param name="request"></param>
  118. /// <returns></returns>
  119. public int ResourceAdd(Model_ResourceAdd model)
  120. {
  121. APP.DirectorList = new List<Model_DirectorList>();
  122. try
  123. {
  124. string url = APP.apiUrl + "/resource/add";//地址
  125. Dictionary<string, object> dic = new Dictionary<string, object>
  126. {
  127. // converted: 0
  128. //createid: 80
  129. //directorid: 1009
  130. //duration: 39
  131. //imgUrl: ""
  132. //level: 2
  133. //lsbid: 40
  134. //mp4code: "h264"
  135. //resourcebelong: 3
  136. //resourceclass: 2
  137. //resourcecover: "12/resource/20200917/4f297df0-f8c0-11ea-adf5-81f24b97d4ff/weather_pic.jpg"
  138. //resourcename: "weather_pic"
  139. //resourcesize: 6105268
  140. //resourcetype: 0
  141. //resourceurl: "12/resource/20200917/4f297df0-f8c0-11ea-adf5-81f24b97d4ff/weather_pic.mp4"
  142. //schoolid: 12
  143. //suffix: "mp4"
  144. //uid: 80
  145. { "converted", model.converted },
  146. { "createid", model.createid }
  147. };
  148. if (model.directorid != 999999)//章节上传可以不选
  149. {
  150. dic.Add("directorid", model.directorid);
  151. }
  152. dic.Add("duration", model.duration);
  153. dic.Add("imgUrl", model.imgUrl);
  154. dic.Add("level", model.level);
  155. dic.Add("lsbid", model.lsbid);
  156. dic.Add("mp4code", model.mp4code);
  157. dic.Add("resourcebelong", model.resourcebelong);
  158. dic.Add("resourceclass", model.resourceclass);
  159. dic.Add("resourcecover", model.resourcecover);
  160. dic.Add("resourcename", model.resourcename);
  161. dic.Add("resourcesize", model.resourcesize);
  162. dic.Add("resourcetype", model.resourcetype);
  163. dic.Add("resourceurl", model.resourceurl);
  164. dic.Add("schoolid", model.schoolid);
  165. dic.Add("suffix", model.suffix);
  166. //dic.Add("uid", model.uid);
  167. string body = JsonHelper.ToJson(dic);
  168. string xmlDoc = HttpHelper.HttpPost(body, url);
  169. JObject obj = JObject.Parse(xmlDoc);
  170. if (obj != null)
  171. {
  172. APP.ServerMsg = obj["msg"].ToString();
  173. return Convert.ToInt32(obj["code"].ToString());
  174. }
  175. else
  176. {
  177. APP.ServerMsg = "网络异常!";
  178. return 1;
  179. }
  180. }
  181. catch (Exception ex)
  182. {
  183. LogHelper.WriteErrLog("【调用接口(RegisterController)】错误日志:" + ex.Message, ex);
  184. return 1;
  185. }
  186. }
  187. }
  188. }