config.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace refill\feimingyu;
  3. use mtopcard;
  4. class config
  5. {
  6. const ORDER_URL = 'http://119.91.194.222:9999/api/v1/order/submit';
  7. const QUERY_URL = 'http://119.91.194.222:9999/api/v1/order/query';
  8. const BALANCE_URL = 'http://119.91.194.222:9999/api/v1/agent/balance';
  9. const APP_ID = 'VIP006';
  10. const APP_SECRET = 'Ik5APKkMhUJ9NQ6ntJ2R7g==';
  11. const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_feimingyu.php";
  12. const PRODUCT = [
  13. mtopcard\ChinaMobileCard => [
  14. 30 => 334,
  15. 50 => 335,
  16. 100 => 336,
  17. 200 => 337,
  18. ],
  19. mtopcard\ChinaUnicomCard => [
  20. 30 => 331,
  21. 50 => 330,
  22. 100 => 332,
  23. 200 => 333,
  24. ],
  25. mtopcard\ChinaTelecomCard => [
  26. 30 => 338,
  27. 50 => 339,
  28. 100 => 340,
  29. 200 => 341,
  30. ]
  31. ];
  32. const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;charset=utf-8'];
  33. public static function sign($params)
  34. {
  35. $params['appSecret'] = config::APP_SECRET;
  36. ksort($params);
  37. $content = '';
  38. foreach ($params as $key => $value) {
  39. if(self::check_empty($value) === false) {
  40. $content .= "{$key}={$value}&";
  41. }
  42. }
  43. $content = rtrim($content, '&');
  44. return md5($content);
  45. }
  46. public static function check_empty($value)
  47. {
  48. if (!isset($value))
  49. return true;
  50. if ($value === null)
  51. return true;
  52. if (trim($value) === "")
  53. return true;
  54. return false;
  55. }
  56. }