config.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. namespace refill\weisanhuo_normal;
  3. use mtopcard;
  4. class config
  5. {
  6. const ORDER_URL = 'http://124.70.91.73:50050/api/v1/rest/multi/charge/single';
  7. const QUERY_URL = 'http://124.70.91.73:50050/api/v1/rest/multi/charge/report/query';
  8. const BALANCE_URL = 'http://124.70.91.73:50050/api/v1/rest/multi/charge/balance';
  9. const SECRET_ID = '9aebda54f899419a80f315b33b6ed395';
  10. const SECRET_KEY = '14d56f3637ba4618b50e91f444d1a029';
  11. const NOTIFY_URL = BASE_SITE_URL . "/racc/callback/mh/weisanhuo_normal.php";
  12. const ExtHeaders = ['Content-Type: application/json;charset=UTF-8'];
  13. const ProductIdS = [
  14. mtopcard\ChinaMobileCard =>
  15. [
  16. 1 => 'cshf1', //测试
  17. //50 => 'k-yd-50',
  18. 100 => 'k-yd-100',
  19. 200 => 'k-yd-200',
  20. 300 => 'k-yd-300',
  21. 500 => 'k-yd-500'
  22. ],
  23. mtopcard\ChinaUnicomCard =>
  24. [
  25. 30 => 'k-lt-30',
  26. 50 => 'k-lt-50',
  27. 100 => 'k-lt-100',
  28. 200 => 'k-lt-200'
  29. ]
  30. ];
  31. public static function sign(array $params, array $ignore = []): string
  32. {
  33. ksort($params);
  34. $content = '';
  35. foreach ($params as $key => $value) {
  36. if (in_array($key, $ignore)) {
  37. continue;
  38. }
  39. if(self::check_empty($value) === false) {
  40. $key = strtolower($key);
  41. $value = urlencode($value);
  42. $content .= "$key=$value&";
  43. }
  44. }
  45. $content .= "secretkey=" . config::SECRET_KEY;
  46. return md5($content);
  47. }
  48. public static function check_empty($value): bool
  49. {
  50. if (!isset($value))
  51. return true;
  52. if (trim($value) === "null")
  53. return true;
  54. return false;
  55. }
  56. }