config.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. namespace refill\suhu_wozhifu;
  3. class config
  4. {
  5. const MEMBER_ID = '24622';
  6. const KEY = 'eh7hd6sixx8tgarb1gkrnmxjs4sixyjf';
  7. const ORDER_URL = 'http://api.kuaijiaofei.com/submitRechargeOrder';
  8. const QUERY_URL = 'http://api.kuaijiaofei.com/queryRechargeOrder';
  9. const BALANCE_URL = 'http://api.kuaijiaofei.com/queryRechargeMember';
  10. //需要速交费技术记录地址
  11. const NOTIFY_URL = BASE_SITE_URL . "/racc/callback/mh/suhu_wozhifu.php";
  12. const ERRCODES = [101, 102, 103, 104, 105, 106, 107, 108, 109];
  13. private static $stStoreProducts = [
  14. 50 => [ 4=> '10314', 5 => '10308'],
  15. 100 => [ 4=> '10315', 5 => '10309'],
  16. 200 => [ 4=> '10316', 5 => '10310'],
  17. 300 => [ 4=> '10317', 5 => '10311']
  18. ];
  19. public static function sign($params)
  20. {
  21. if (is_object($params)) { //对象转数组
  22. $params = json_decode(json_encode($params), true);
  23. }
  24. $params['sign_key'] = config::KEY;
  25. ksort($params);
  26. $formatData = [];
  27. foreach ($params as $k => $v) {
  28. if (is_array($v) || is_object($v)) {
  29. $v = json_encode($v, JSON_UNESCAPED_UNICODE);
  30. }
  31. if ((!empty($v) || (string)$v === '0') && $k != 'sign') {
  32. $formatData[] = "$k=$v";
  33. }
  34. }
  35. $signStr = implode('&', $formatData);
  36. return md5($signStr);
  37. }
  38. public static function sku_code($card_type, $amount)
  39. {
  40. if (array_key_exists($amount, self::$stStoreProducts)) {
  41. if (array_key_exists($card_type, self::$stStoreProducts[$amount])) {
  42. return self::$stStoreProducts[$amount][$card_type];
  43. }
  44. }
  45. return false;
  46. }
  47. }