12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?php
- namespace refill\chuangyu_ylyw;
- use mtopcard;
- class config
- {
- const ORDER_URL = 'http://120.55.55.137:8080/api/charge';
- const QUERY_URL = 'http://120.55.55.137:8080/api/query';
- const BALANCE_URL = 'http://120.55.55.137:8080/api/balance';
- const MCH_ID = '1008';
- const SECRET_KEY = '7a2118a9cb7ee70f2fa9dd9b9260a239';
- const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_chuangyu_ylyw.php";
- const ExtHeaders = ['Content-Type: application/json'];
- const ProductIdS = [
- mtopcard\ChinaMobileCard =>
- [
- 50 => '10003',
- 100 => '10004',
- 200 => '10005',
- 300 => '10006',
- 500 => '10007',
- ],
- mtopcard\ChinaUnicomCard =>
- [
- 50 => '10011',
- 100 => '10012',
- 200 => '10013',
- 300 => '10014',
- ],
- mtopcard\ChinaTelecomCard =>
- [
- 50 => '10019',
- 100 => '10020',
- 200 => '10021',
- 300 => '10022',
- 500 => '10023',
- ],
- ];
- public static function sign($params)
- {
- ksort($params);
- $content = '';
- foreach ($params as $key => $value) {
- if(self::check_empty($value) === false) {
- $content .= "{$key}={$value}&";
- }
- }
- $content .= 'secret_key=' . config::SECRET_KEY;
- return md5(md5($content));
- }
- public static function check_empty($value)
- {
- if (!isset($value))
- return true;
- if ($value === null)
- return true;
- if (trim($value) === "")
- return true;
- return false;
- }
- }
|