利用user-agent,判断请求是移动端的还是pc端的。
const checkPhone = (ctx) => {
let userAgent = ctx.request.header['user-agent'].toLowerCase();
let pat_phone = /ipad|iphone os|midp|rv:1.2.3.4|ucweb|android|windows ce|windows mobile/;
return pat_phone.test(userAgent);
}