config.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace refill\binyu;
  3. class config
  4. {
  5. //https://docs.qq.com/doc/DZU9xSUhXYVBNRXhj
  6. const ORDER_URL = 'https://phone.shanghaibinyu.top/api/charge';
  7. const QUERY_URL = 'https://phone.shanghaibinyu.top/api/query';
  8. const BALANCE_URL = 'https://phone.shanghaibinyu.top/api/balance';
  9. const MCH_ID = '4';
  10. const SECRET_KEY = '781b78f0cc0817afab0e017cbb314308';
  11. const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_binyu.php";
  12. const ExtHeaders = ['Content-Type: application/json'];
  13. public static function sign($params)
  14. {
  15. ksort($params);
  16. $content = '';
  17. foreach ($params as $key => $value) {
  18. if(self::check_empty($value) === false) {
  19. $content .= "{$key}={$value}&";
  20. }
  21. }
  22. $content .= 'secret_key=' . config::SECRET_KEY;
  23. return md5(md5($content));
  24. }
  25. public static function check_empty($value)
  26. {
  27. if (!isset($value))
  28. return true;
  29. if ($value === null)
  30. return true;
  31. if (trim($value) === "")
  32. return true;
  33. return false;
  34. }
  35. }