config.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. namespace refill\chanlian;
  3. use mtopcard;
  4. class config
  5. {
  6. //回调地址需 上游配置
  7. const ORDER_URL = 'http://cl.whale123.com/api/do';
  8. const QUERY_URL = 'http://cl.whale123.com/api/queryorder';
  9. const BALANCE_URL = 'http://cl.whale123.com/api/querybalance';
  10. const CP_ID = '69535';
  11. const CP_KEY = '2f86ed2977d0def38';
  12. const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_chanlian.php";
  13. const operator = [
  14. mtopcard\ChinaMobileCard => 1,
  15. mtopcard\ChinaUnicomCard => 2,
  16. mtopcard\ChinaTelecomCard => 3
  17. ];
  18. const Product = [
  19. mtopcard\ChinaMobileCard => [
  20. 100 => 20005,
  21. 200 => 20006,
  22. 300 => 20007,
  23. 500 => 20008
  24. ],
  25. mtopcard\ChinaUnicomCard => [
  26. 50 => 20012,
  27. 100 => 20013,
  28. 200 => 20014,
  29. 300 => 20015,
  30. ],
  31. mtopcard\ChinaTelecomCard => [
  32. 100 => 20021,
  33. 200 => 20022,
  34. 300 => 20023,
  35. 500 => 20024
  36. ],
  37. ];
  38. const ERR_STATUS = ['-10001', '-10002', '-10003', '-10004', '-10013', '-10005', '-10006', '-10007', '-10008', '-10009', '-10011', '-10012', '-10015', '-10016'];
  39. const NET_ERR_STATUS = ['-10010', '-10000', '-999'];
  40. public static function sign($params)
  41. {
  42. ksort($params);
  43. $content = '';
  44. foreach ($params as $key => $value) {
  45. $content .= "{$key}{$value}";
  46. }
  47. $content .= config::CP_KEY;
  48. return md5($content);
  49. }
  50. public static function check_empty($value)
  51. {
  52. if (!isset($value))
  53. return true;
  54. if (trim($value) === "")
  55. return true;
  56. return false;
  57. }
  58. }