[4 => 'G36211237846176976', 5 => 'G36211237856416056', 6 => 'G36211237851296016'], 100 => [4 => 'G36211237847712888', 5 => 'G36211237857952968', 6 => 'G36211237852832928'], 200 => [4 => 'G36211237849760104', 5 => 'G36211237859488880', 6 => 'G36211237854880144'] ]; public static function sign($params) { if (is_object($params)) { //对象转数组 $params = json_decode(json_encode($params), true); } $params['sign_key'] = config::KEY; ksort($params); $formatData = []; foreach ($params as $k => $v) { if (is_array($v) || is_object($v)) { $v = json_encode($v, JSON_UNESCAPED_UNICODE); } if ((!empty($v) || (string)$v === '0') && $k != 'sign') { $formatData[] = "$k=$v"; } } $signStr = implode('&', $formatData); return md5($signStr); } public static function sku_code($card_type,$amount) { if(config::IS_DEBUG) { if($card_type === mtopcard\ChinaMobileCard) { switch ($amount) { case 50: return 'G34707828905632832'; } } elseif($card_type === mtopcard\ChinaUnicomCard) { switch ($amount) { case 50: return 'G34707828917408824'; } } } else { if(array_key_exists($amount,self::$stStoreProducts)) { if(array_key_exists($card_type,self::$stStoreProducts[$amount])) { return self::$stStoreProducts[$amount][$card_type]; } } return false; } } }