12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?php
- namespace refill\feimingyu;
- use mtopcard;
- class config
- {
- const ORDER_URL = 'http://119.91.194.222:9999/api/v1/order/submit';
- const QUERY_URL = 'http://119.91.194.222:9999/api/v1/order/query';
- const BALANCE_URL = 'http://119.91.194.222:9999/api/v1/agent/balance';
- const APP_ID = 'VIP006';
- const APP_SECRET = 'Ik5APKkMhUJ9NQ6ntJ2R7g==';
- const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_feimingyu.php";
- const PRODUCT = [
- mtopcard\ChinaMobileCard => [
- 30 => 334,
- 50 => 335,
- 100 => 336,
- 200 => 337,
- ],
- mtopcard\ChinaUnicomCard => [
- 30 => 331,
- 50 => 330,
- 100 => 332,
- 200 => 333,
- ],
- mtopcard\ChinaTelecomCard => [
- 30 => 338,
- 50 => 339,
- 100 => 340,
- 200 => 341,
- ]
- ];
- const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;charset=utf-8'];
- public static function sign($params)
- {
- $params['appSecret'] = config::APP_SECRET;
- ksort($params);
- $content = '';
- foreach ($params as $key => $value) {
- if(self::check_empty($value) === false) {
- $content .= "{$key}={$value}&";
- }
- }
- $content = rtrim($content, '&');
- return 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;
- }
- }
|