星火直播PC
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
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using Common.system;
  2. using Newtonsoft.Json.Linq;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading;
  8. using System.Threading.Tasks;
  9. namespace XHZB.DAL
  10. {
  11. public class Class1
  12. {
  13. /// <summary>
  14. /// API请求地址
  15. /// </summary>
  16. private string APIRequestAddress = FileToolsCommon.GetConfigValue("APIRequestAddress");
  17. /// <summary>
  18. /// 文件请求地址
  19. /// </summary>
  20. private string FileRequestAddress = FileToolsCommon.GetConfigValue("FileRequestAddress");
  21. /// <summary>
  22. /// 测试
  23. /// </summary>
  24. /// <param name="Message"></param>
  25. /// <returns></returns>
  26. public bool test( string FileCode, out string Message)
  27. {
  28. Exception ex = null;
  29. Message = "";//请求重试5次 共5秒
  30. for (int num = 0; num < 5; num++)
  31. {
  32. try
  33. {
  34. JObject jo = HttpHelper.PostFunction(FileRequestAddress + @"/chunkdb/mergechunk", @"application/x-www-form-urlencoded", @"identifier=" + FileCode, "");
  35. if (jo == null)
  36. {
  37. Message = "无法访问文件服务器,请检查网络或文件服务器地址。";
  38. return false;
  39. }
  40. //Model.ResultVo<Model_ResourceAddTwo> resultObj = JsonHelper.JsonToObj<Model.ResultVo<Model_ResourceAddTwo>>(jo.ToString());
  41. //APP.ResourceAddTwo = new Model_ResourceAddTwo();
  42. ////0成功,1失败
  43. //if (resultObj.code == 0 && resultObj.obj != null)
  44. //{
  45. // APP.ResourceAddTwo = resultObj.obj;
  46. // return true;
  47. //}
  48. //else
  49. //{
  50. // //Message = "上传失败!";
  51. // Message = jo["msg"].ToString();
  52. // return false;
  53. //}
  54. }
  55. catch (Exception e)
  56. {
  57. Message = e.Message;
  58. ex = e;
  59. Thread.Sleep(1000);
  60. }
  61. }
  62. string ErrMessage = "【请求失败】(test):请求失败。" + Message;
  63. LogHelper.WriteErrLog(ErrMessage, ex);
  64. return false;
  65. }
  66. }
  67. }