Open AlexZ33 opened 4 years ago
采用后端打点
module.exports = app => {
return class QrcodeController extends app.Controller {
async qrDownload() {
const { ctx, logger} = this;
const query = ctx.query;
logger.info('Controller/qrcode/qrDownload:请求request: %s ', JSON.stringify(ctx.request));
ctx.service.util.sendStatistic({
data: JSON.stringify({
cur_page: 'qrcode_download', //页面
channel: query.c,
gameId: query.g,
package: query.p
})
})
const userAgent = ctx.userAgent;
if (userAgent.isiPhone || userAgent.isiPad || userAgent.isWeiXin) {
return await ctx.render('tv/landing.js', {})
}
ctx.redirect(query.uri)
}
}
}
```javascript
sendStatistic(para) {
let uri = '打点地址';
if (!para) {
return;
}
let str = '',
prop;
for (prop in para) {
if (hasOwnProperty.call(para, prop)) {
str += '&' + prop + '=' + para[prop];
}
}
uri += str + '&_=' + (new Date()).getTime();
return axios.get(uri)
}
前端二维码生成f分享