req_params($phone,$amount,$order_sn); $time = time(); $api_user_name = config::API_USER_NAME; $sign = $this->sign($time); $header = [ 'Content-Type: application/json', "API-USER-NAME: {$api_user_name}", "API-NAME: OrderCreate", "API-TIMESTAMP: {$time}", "API-SIGNATURE: {$sign}", ]; $resp = http_post_data(config::REQUEST_URL,$params,$header); if($resp === false) { return [false,'系统错误']; } else { Log::record($resp,Log::DEBUG); $resp = json_decode($resp,true); if($resp['state'] == 0) { return [true,$resp['data']]; } else { return [false,$resp['msg']]; } } } private function sign($time) { $ip = config::API_IP; $cert = config::API_CERT; $content = $ip.$time.$cert; return md5($content); } }