123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <?php
- namespace refill\weisanhuo_normal;
- use mtopcard;
- class config
- {
- const ORDER_URL = 'http://124.70.91.73:50050/api/v1/rest/multi/charge/single';
- const QUERY_URL = 'http://124.70.91.73:50050/api/v1/rest/multi/charge/report/query';
- const BALANCE_URL = 'http://124.70.91.73:50050/api/v1/rest/multi/charge/balance';
- const SECRET_ID = '9aebda54f899419a80f315b33b6ed395';
- const SECRET_KEY = '14d56f3637ba4618b50e91f444d1a029';
- const NOTIFY_URL = BASE_SITE_URL . "/racc/callback/mh/weisanhuo_normal.php";
- const ExtHeaders = ['Content-Type: application/json;charset=UTF-8'];
- const ProductIdS = [
- mtopcard\ChinaMobileCard =>
- [
- 1 => 'cshf1', //测试
- //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'
- ]
- ];
- 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;
- }
- }
|