Closed totothink closed 7 years ago
我用rails5,在上传token中加入了下面的回调参数:
options = { callback_url: admin_videos_url, callback_body: { title: '$(x:title)', category: '$(x:category)', summary: '$(x:summary)', fname: '$(fname)', key: '$(key)', hash: '$(etag)', fsize: '$(fsize)', mime_type: '$(mimeType)', avinfo: '$(avinfo)' }.to_json, save_key: 'videos/$(year)/$(fname)' }
在回调接口收到的参数如下:
Parameters: {"{\"title\":\"视频实验\",\"category\":\"1\",\"summary\":\"摘要信息\",\"fname\":\"IMGbc8556c8787343627608119.jpg\",\"key\":\"videos/2017/IMGbc8556c8787343627608119.jpg\",\"hash\":\"FnwkQNuUxZbnDXNXFedG0TabHCiC\",\"fsize\":\"50464\",\"mime_type\":\"image/jpeg\",\"avinfo\":\"{\"MultiAudios\":false,\"audio\":null,\"format\":{\"bit_rate\":\"\",\"duration\":\"\",\"format_long_name\":\"piped jpeg sequence\",\"format_name\":\"jpeg_pipe\",\"nb_streams\":1,\"size\":\"50464\",\"start_time\":\"\",\"tags\":{}},\"subtitle\":null,\"video\":{\"Disposition\":{\"attached_pic\":0},\"avg_frame_rate\":\"0/0\",\"bit_rate\":\"\",\"codec_name\":\"mjpeg\",\"codec_type\":\"video\",\"display_aspect_ratio\":\"640:853\",\"duration\":\"\",\"height\":853,\"index\":0,\"nb_frames\":\"\",\"pix_fmt\":\"yuvj420p\",\"r_frame_rate\":\"25/1\",\"sample_aspect_ratio\":\"1:1\",\"start_time\":\"\",\"tags\":{},\"width\":640}}\"}"=>nil}
整个参数作为key了。
从request.env['rack.input'].string取到的值是:
{"title":"%E8%A7%86%E9%A2%91%E5%AE%9E%E9%AA%8C","category":"1","summary":"%E6%91%98%E8%A6%81%E4%BF%A1%E6%81%AF","fname":"IMGbc8556c8787343627608119.jpg","key":"videos%2F2017%2FIMGbc8556c8787343627608119.jpg","hash":"FnwkQNuUxZbnDXNXFedG0TabHCiC","fsize":"50464","mime_type":"image%2Fjpeg","avinfo":"%7B%22MultiAudios%22%3Afalse%2C%22audio%22%3Anull%2C%22format%22%3A%7B%22bit_rate%22%3A%22%22%2C%22duration%22%3A%22%22%2C%22format_long_name%22%3A%22piped+jpeg+sequence%22%2C%22format_name%22%3A%22jpeg_pipe%22%2C%22nb_streams%22%3A1%2C%22size%22%3A%2250464%22%2C%22start_time%22%3A%22%22%2C%22tags%22%3A%7B%7D%7D%2C%22subtitle%22%3Anull%2C%22video%22%3A%7B%22Disposition%22%3A%7B%22attached_pic%22%3A0%7D%2C%22avg_frame_rate%22%3A%220%2F0%22%2C%22bit_rate%22%3A%22%22%2C%22codec_name%22%3A%22mjpeg%22%2C%22codec_type%22%3A%22video%22%2C%22display_aspect_ratio%22%3A%22640%3A853%22%2C%22duration%22%3A%22%22%2C%22height%22%3A853%2C%22index%22%3A0%2C%22nb_frames%22%3A%22%22%2C%22pix_fmt%22%3A%22yuvj420p%22%2C%22r_frame_rate%22%3A%2225%2F1%22%2C%22sample_aspect_ratio%22%3A%221%3A1%22%2C%22start_time%22%3A%22%22%2C%22tags%22%3A%7B%7D%2C%22width%22%3A640%7D%7D"}
应该怎样配置才能获得正确的参数?
我用rails5,在上传token中加入了下面的回调参数:
在回调接口收到的参数如下:
整个参数作为key了。
从request.env['rack.input'].string取到的值是:
应该怎样配置才能获得正确的参数?