formIdCollectRequest.js 869 Bytes

import Promise from '../vendors/es6-promise';
import { API_HOST, SERVICE_HOST } from './config';
import { GET, POST } from './request';
import { getYHStorageSync } from '../utils/util';

function postFormId(formId,position) {
  let app = getApp();
  let that = this;
  //如果没有uid,不上报,否则接口报500
  if (!app.getUid()||formId.length===0) return
  if(!position) position=''
  let formIdParams = {
    uid: app.getUid(),
    openId: app.globalData.openID ? app.globalData.openID : getYHStorageSync('openID', 'goodsDetail'),
    miniapp_type: app.globalData.miniapp_type,
    formId: formId,
    position,
    method: 'wechat.formId.add',
  }

  // console.log('formidParam:', formIdParams)
  GET(API_HOST, formIdParams)
    .then((data) => {
      // console.log('responsedata', data)
    })
    .catch(error => {
    })
}

export {
  postFormId,
}