taobaoTmcTest.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using BizCom;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Data;
  5. namespace SiteCore
  6. {
  7. public class taobaoTmcTest
  8. {
  9. private static bool isGet = false;
  10. public static void getInfo()
  11. {
  12. if (isGet) return;
  13. isGet = true;
  14. try
  15. {
  16. string sql = "select top 30 * from S_TaoBaoTmc2 order by id asc";
  17. DataTable dt = SqlHelper.ExecuteDataSet(sql).Tables[0];
  18. List<string> idLst = new List<string>();
  19. foreach (DataRow dr in dt.Rows)
  20. {
  21. idLst.Add(dr["id"].ToString());
  22. try
  23. {
  24. string dotype = dr["Topic"].ToString();
  25. if (dotype == "create")
  26. {
  27. tmcHelper.Api_TmcTradeMsg_Create(dr["message"].ToString());
  28. }
  29. else
  30. tmcHelper.Api_TmcTradeMsg(dr["message"].ToString());
  31. }
  32. catch (Exception ex)
  33. {
  34. XLog.SaveLog(0, dr["message"].ToString() + "------" + ex.Message);
  35. //tmcHelper.Api_TmcTradeMsg(dr["message"].ToString());
  36. }
  37. }
  38. if (idLst.Count > 0)
  39. {
  40. sql = "delete from S_TaoBaoTmc2 where id in (" + string.Join(",", idLst.ToArray()) + ") ;";
  41. SqlHelper.ExecuteNonQuery(sql);
  42. }
  43. }
  44. catch (Exception ex)
  45. {
  46. XLog.SaveLog(0, "getinfo" + ex.Message);
  47. }
  48. finally
  49. {
  50. isGet = false;
  51. }
  52. }
  53. }
  54. }