config.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. namespace refill\kuaikuai;
  3. use mtopcard;
  4. class config
  5. {
  6. const ORDER_URL = 'http://119.23.55.151:8181/mpayment/client/recharge/commit';
  7. const QUERY_URL = 'http://119.23.55.151:8181/mpayment/client/recharge/queryOrder';
  8. const BALANCE_URL = 'http://119.23.55.151:8181/mpayment/client/recharge/searchAmount';
  9. const UID = '2c922ab97f2683b5017f3e5ea24c1af9';
  10. const KEY = 'c6dfcca5df320fa224fcfba865d96800';
  11. const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_kuaikuai.php";
  12. const ExtHeaders = ['Content-Type: application/json'];
  13. const PRODUCT = [
  14. mtopcard\ChinaMobileCard => [
  15. ],
  16. mtopcard\ChinaUnicomCard => [
  17. 30 => '2c922ab97f2683b5017f3eef25b057b8',
  18. 50 => '2c922ab97f2683b5017f3eef25b457ba',
  19. 100 => '2c922ab97f2683b5017f3eef25b757bc',
  20. 200 => '2c922ab97f2683b5017f3eef25ba57be',
  21. 300 => '2c922ab97f2683b5017f3eef25bd57c0',
  22. ],
  23. mtopcard\ChinaTelecomCard => [
  24. 10 => '2c922ab97f2683b5017f3ef2f5d659db',
  25. 20 => '2c922ab97f2683b5017f3ef2f5da59dd',
  26. ],
  27. ];
  28. public static function sign($params)
  29. {
  30. ksort($params);
  31. $content = '';
  32. foreach ($params as $key => $value) {
  33. if(self::check_empty($value) === false) {
  34. $content .= "{$key}={$value}&";
  35. }
  36. }
  37. $content .= 'key='.config::KEY;
  38. return md5($content);
  39. }
  40. public static function check_empty($value)
  41. {
  42. if (!isset($value))
  43. return true;
  44. if ($value === null)
  45. return true;
  46. if (trim($value) === "")
  47. return true;
  48. return false;
  49. }
  50. }