index.js 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. import request from '../../utils/request.js'
  2. import { getMobileCache } from '../../utils/user'
  3. class Statistics extends request {
  4. static done(params) {
  5. const accountInfo = wx.getAccountInfoSync()
  6. const pages = getCurrentPages()
  7. const path = pages[pages.length - 1].route
  8. const options = wx.getLaunchOptionsSync()
  9. const referrerInfo = options.referrerInfo || {}
  10. const extraData = referrerInfo.extraData || {}
  11. const department = extraData.department || '';
  12. let postParam = {
  13. source: 'WX_MINI_APP',
  14. channel: params.channel || '',
  15. module: params.module,
  16. action: params.action,
  17. appid: accountInfo.miniProgram.appId,
  18. path,
  19. scene: options.scene,
  20. fromAppid: referrerInfo.appId || '',
  21. department,
  22. mobile: getMobileCache(),
  23. businessId: params.businessId || '',
  24. }
  25. this.postRequest(`${this.BASE_URL}open/statistics/record-app-visit-log`, postParam, true).then(_=>{}).catch(_=>{})
  26. }
  27. }
  28. export default Statistics