Are you asking how long the layover in PVG or PEK should be?
I guess you'd have several options: you can make it reasonably short, i.e. I'd thing 2 to 3 hours minimum would be safe.
Or, you could go for a LONG layover of 12+ hours and benefit from the [relatively] newly implemented 72 hours visa free transit, and have the added benefit of seeing some of what China has to offer!