12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <?php
- namespace refill\yuanrun;
- use mtopcard;
- class config
- {
- //回调地址需 上游配置
- const ORDER_URL = 'http://121.89.202.158/api/do';
- const QUERY_URL = 'http://121.89.202.158/api/queryorder';
- const BALANCE_URL = 'http://121.89.202.158/api/querybalance';
- const CP_ID = '49449';
- const CP_KEY = '1a3239f76e20480fa';
- const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_yuanrun.php";
- const operator = [
- mtopcard\ChinaMobileCard => 1,
- mtopcard\ChinaUnicomCard => 2,
- mtopcard\ChinaTelecomCard => 3
- ];
- const Product = [
- mtopcard\ChinaMobileCard => [
- 10 => 20001,
- 20 => 20002,
- 30 => 20003,
- 50 => 20004,
- 100 => 20005,
- 200 => 20006,
- 300 => 20007,
- 500 => 20008
- ],
- mtopcard\ChinaUnicomCard => [
- 10 => 20009,
- 20 => 20010,
- 30 => 20011,
- 50 => 20012,
- 100 => 20013,
- 200 => 20014,
- 300 => 20015,
- 500 => 20016
- ],
- mtopcard\ChinaTelecomCard => [
- 10 => 20017,
- 20 => 20018,
- 30 => 20019,
- 50 => 20020,
- 100 => 20021,
- 200 => 20022,
- 300 => 20023,
- 500 => 20024
- ],
- ];
- const ERR_STATUS = ['-10001', '-10002', '-10003', '-10004', '-10013', '-10005', '-10006', '-10007', '-10008', '-10009', '-10011', '-10012', '-10015', '-10016'];
- const NET_ERR_STATUS = ['-10010', '-10000', '-999'];
- public static function sign($params)
- {
- ksort($params);
- $content = '';
- foreach ($params as $key => $value) {
- if(self::check_empty($value) === false) {
- $content .= "{$key}{$value}";
- }
- }
- $content .= config::CP_KEY;
- 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;
- }
- }
|