12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?php
- namespace refill\weisanhuo;
- use mtopcard;
- class config
- {
- const ORDER_URL = 'http://124.70.69.117:50050/api/v1/rest/multi/charge/single';
- const QUERY_URL = 'http://124.70.69.117:50050/api/v1/rest/multi/charge/report/query';
- const BALANCE_URL = 'http://124.70.69.117:50050/api/v1/rest/multi/charge/balance';
- const SECRET_ID = '231c9717118f4413b1611a3a87221795';
- const SECRET_KEY = '0109d2f30b414832a0f1e8c29720eff3';
- const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_weisanhuo.php";
- const ExtHeaders = ['Content-Type: application/json;charset=UTF-8'];
- const ProductIdS = [
- mtopcard\ChinaMobileCard =>
- [
- 30 => 'k-yd-30',
- 50 => 'k-yd-50',
- 100 => 'k-yd-100',
- 200 => 'k-yd-200',
- 300 => 'k-yd-300',
- 500 => 'k-yd-500'
- ],
- mtopcard\ChinaUnicomCard =>
- [
- 30 => 'k-lt-30',
- 50 => 'k-lt-50',
- 100 => 'k-lt-100',
- 200 => 'k-lt-200'
- ],
- mtopcard\ChinaTelecomCard =>
- [
- 30 => 'k-dx-30',
- 50 => 'k-dx-50',
- 100 => 'k-dx-100',
- 200 => 'k-dx-200'
- ]
- ];
- public static function sign(array $params, array $ignore = []): string
- {
- ksort($params);
- $content = '';
- foreach ($params as $key => $value) {
- if (in_array($key, $ignore)) {
- continue;
- }
- if(self::check_empty($value) === false) {
- $key = strtolower($key);
- $value = urlencode($value);
- $content .= "$key=$value&";
- }
- }
- $content .= "secretkey=" . config::SECRET_KEY;
- return md5($content);
- }
- public static function check_empty($value): bool
- {
- if (!isset($value))
- return true;
- if (trim($value) === "null")
- return true;
- return false;
- }
- }
|