config.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace refill\bailian;
  3. use mtopcard;
  4. class config
  5. {
  6. const ORDER_URL = 'http://101.37.252.250/cg/api/Owned/Charge';
  7. const QUERY_URL = 'http://101.37.252.250/cg/api/Owned/Query';
  8. const BALANCE_URL = 'http://101.37.252.250/cg/api/MacInfo/Balance';
  9. const MAC_ID = '1646476170480002';
  10. const KEY = 'ffcb6768ad0a8b631acd29355a31b50d';
  11. const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_bailian.php";
  12. const PRODUCT = [
  13. mtopcard\SinopecCard => [
  14. 500 => 100004,
  15. 1000 => 100005
  16. ]
  17. ];
  18. const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;charset=utf-8'];
  19. public static function sign($params)
  20. {
  21. ksort($params);
  22. $content = '';
  23. foreach ($params as $key => $value) {
  24. if(self::check_empty($value) === false) {
  25. $content .= "{$key}{$value}";
  26. }
  27. }
  28. $content .= config::KEY;
  29. return md5($content);
  30. }
  31. public static function check_empty($value)
  32. {
  33. if (!isset($value))
  34. return true;
  35. if ($value === null)
  36. return true;
  37. if (trim($value) === "")
  38. return true;
  39. return false;
  40. }
  41. }