星火微课系统客户端
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.

Interface.cs 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 XHWK.Model;
  8. using XHWK.WKTool.Config;
  9. namespace XHWK.WKTool.DAL
  10. {
  11. public class Interface
  12. {
  13. string APIRequestAddress = FileToolsCommon.GetConfigValue("APIRequestAddress");
  14. string FileRequestAddress = FileToolsCommon.GetConfigValue("FileRequestAddress");
  15. string schoolfileRequestAddress = FileToolsCommon.GetConfigValue("schoolfileRequestAddress");
  16. /// <summary>
  17. /// 登陆
  18. /// </summary>
  19. /// <param name="request"></param>
  20. /// <returns></returns>
  21. public int Login(string loginname, string loginpwd)
  22. {
  23. string url = ZConfig.apiUrl + "/user/login";//地址
  24. Dictionary<string, object> dic = new Dictionary<string, object>
  25. {
  26. { "loginname", loginname},
  27. { "loginpwd", loginpwd}
  28. };
  29. string body = JsonHelper.ToJson(dic);
  30. ResultVo<Model_UserInfo> result = HttpHelper.PostAndRespSignle<ResultVo<Model_UserInfo>>(url, postData: body);
  31. if (result != null)
  32. {
  33. APP.UserInfo = new Model_UserInfo();
  34. APP.ServerMsg = result.msg;
  35. APP.UserInfo = result.obj;
  36. return result.code;
  37. }
  38. else
  39. {
  40. APP.ServerMsg = "网络异常!";
  41. APP.UserInfo =new Model_UserInfo();
  42. return 1;
  43. }
  44. }
  45. }
  46. }