taobaoTmcTest.cs 1.5 KB

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