AlipayServices.cs 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. using EMIS.ViewModel;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. namespace EMIS.CommonLogic.SystemServices
  7. {
  8. public class AlipayServices : BaseServices, IAlipayServices
  9. {
  10. public Lazy<IParameterServices> ParameterServices { get; set; }
  11. public string GetProductId()
  12. {
  13. DateTime today = DateTime.Today;
  14. string productId = ParameterServices.Value.GetParameterValue(CF_ParameterType.AlipayProductId);
  15. int seed = 1;
  16. if (productId != null)
  17. {
  18. if (productId.Substring(2, 8) == today.ToString("yyyyMMdd"))
  19. {
  20. seed = Convert.ToInt32(productId.Substring(10, productId.Length - 10)) + 1;
  21. }
  22. }
  23. productId = "ap" + today.ToString("yyyyMMdd") + seed.ToString().PadLeft(6, '0');
  24. ParameterServices.Value.SaveTo(CF_ParameterType.AlipayProductId, productId);
  25. return productId;
  26. }
  27. }
  28. }