In China the sex industry is closely intertwined with corruption, and the government's long-running anti-corruption campaigns keep it under constant pressure. Shanghai was for years one of the easier cities to find adult entertainment, but a series of police crackdowns — the large sweeps at the end of 2017 in particular — closed most of the well-known venues, and the scene has never returned to its former scale.
Keep in mind that some activities carry a real risk of an encounter with law enforcement. Saunas and massage parlours in particular are raided from time to time, and being on the premises as a customer when that happens can be enough to get you arrested for buying sexual services.
Paid sexual services of any kind are illegal in China. A customer who is caught risks a fine of up to several thousand RMB, up to two weeks of administrative detention and — as a foreigner — cancellation of his visa, deportation and being blacklisted for future visas. An escort who is arrested faces similar fines and detention. The law comes down much harder on middlemen: introducing customers to prostitutes can carry a prison sentence of around five years, and actively organizing prostitution up to ten years.
The safest option by far is to book an independent outcall escort and receive her in your own hotel room or apartment. An independent escort is somewhat pricier than a bar or sauna, but you never set foot in a venue that could be raided. Hotel staff generally do not care what you do in your room, as long as you keep things quiet, tidy and free of trouble — see our hotel guide for practical advice on receiving a visitor discreetly.