config.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace refill\feinimoshu_hf;
  3. class config
  4. {
  5. const CHANNEL_HOST = 'http://122.114.168.35';
  6. const ORDER_URL = config::CHANNEL_HOST . '/gateway/api.run/submit';
  7. const QUERY_URL = config::CHANNEL_HOST . '/gateway/api.run/order';
  8. const BALANCE_URL = config::CHANNEL_HOST . '/gateway/api.run/account';
  9. const APPID = 'CZ30533982';
  10. const APPKEY = 'lvrg4xoqvrozuq2irjza2a6dlenrsv';
  11. const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_feinimoshu_hf.php";
  12. public static function body($params)
  13. {
  14. ksort($params);
  15. $body = "";
  16. $i = 0;
  17. foreach ($params as $k => $v)
  18. {
  19. if (false === self::check_empty($v) && "@" != substr($v, 0, 1))
  20. {
  21. if ($i == 0) {
  22. $body .= "{$k}" . "=" . urlencode($v);
  23. } else {
  24. $body .= "&" . "{$k}" . "=" . urlencode($v);
  25. }
  26. $i++;
  27. }
  28. }
  29. return $body;
  30. }
  31. private 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. }