[4 => 'G33821662484640520', 5 => 'G33821662494880600', 6 => 'G33821662489760560'], 100 => [4 => 'G33821662486176432', 5 => 'G33821662496416512', 6 => 'G33821662491296472'], 200 => [4 => 'G33821662487712344', 5 => 'G33821662498464728', 6 => 'G33821662492832384'] ]; 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; } } }