config.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace refill\gy_normal;
  3. class config
  4. {
  5. public const MCH_ID = 10503;
  6. public const KEY = 'beaf87f87c6bcb8a98b853c207ca9aef';
  7. public const ORDER_URL = 'https://www.xyzshops.cn/mobile/index.php';
  8. public const NOTIFY_URL = BASE_SITE_URL . "/racc/callback/mh/gy_normal.php";
  9. public static function sign($params)
  10. {
  11. $empty_checker = function ($value)
  12. {
  13. if (!isset($value))
  14. return true;
  15. if ($value === null)
  16. return true;
  17. if (trim($value) === "")
  18. return true;
  19. return false;
  20. };
  21. ksort($params);
  22. $body = "";
  23. $i = 0;
  24. foreach ($params as $k => $v)
  25. {
  26. if (false === $empty_checker($v) && "@" != substr($v, 0, 1))
  27. {
  28. if ($i == 0) {
  29. $body .= "$k" . "=" . urlencode($v);
  30. } else {
  31. $body .= "&" . "$k" . "=" . urlencode($v);
  32. }
  33. $i++;
  34. }
  35. }
  36. $body .= "&key=".config::KEY;
  37. return md5($body);
  38. }
  39. }