config.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. namespace refill\yuanrun;
  3. use mtopcard;
  4. class config
  5. {
  6. //回调地址需 上游配置
  7. const ORDER_URL = 'http://121.89.202.158/api/do';
  8. const QUERY_URL = 'http://121.89.202.158/api/queryorder';
  9. const BALANCE_URL = 'http://121.89.202.158/api/querybalance';
  10. const CP_ID = '49449';
  11. const CP_KEY = '1a3239f76e20480fa';
  12. const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_yuanrun.php";
  13. const operator = [
  14. mtopcard\ChinaMobileCard => 1,
  15. mtopcard\ChinaUnicomCard => 2,
  16. mtopcard\ChinaTelecomCard => 3
  17. ];
  18. const Product = [
  19. mtopcard\ChinaMobileCard => [
  20. 10 => 20001,
  21. 20 => 20002,
  22. 30 => 20003,
  23. 50 => 20004,
  24. 100 => 20005,
  25. 200 => 20006,
  26. 300 => 20007,
  27. 500 => 20008
  28. ],
  29. mtopcard\ChinaUnicomCard => [
  30. 10 => 20009,
  31. 20 => 20010,
  32. 30 => 20011,
  33. 50 => 20012,
  34. 100 => 20013,
  35. 200 => 20014,
  36. 300 => 20015,
  37. 500 => 20016
  38. ],
  39. mtopcard\ChinaTelecomCard => [
  40. 10 => 20017,
  41. 20 => 20018,
  42. 30 => 20019,
  43. 50 => 20020,
  44. 100 => 20021,
  45. 200 => 20022,
  46. 300 => 20023,
  47. 500 => 20024
  48. ],
  49. ];
  50. const ERR_STATUS = ['-10001', '-10002', '-10003', '-10004', '-10013', '-10005', '-10006', '-10007', '-10008', '-10009', '-10011', '-10012', '-10015', '-10016'];
  51. const NET_ERR_STATUS = ['-10010', '-10000', '-999'];
  52. public static function sign($params)
  53. {
  54. ksort($params);
  55. $content = '';
  56. foreach ($params as $key => $value) {
  57. if(self::check_empty($value) === false) {
  58. $content .= "{$key}{$value}";
  59. }
  60. }
  61. $content .= config::CP_KEY;
  62. return md5($content);
  63. }
  64. public static function check_empty($value)
  65. {
  66. if (!isset($value))
  67. return true;
  68. if ($value === null)
  69. return true;
  70. if (trim($value) === "")
  71. return true;
  72. return false;
  73. }
  74. }