restapi.js 2.63 KB
const restapi = require('../../../utils/restapi.js');

module.exports = {

  /** 获取绑定信息*/
  getBindingInfo: function (merchantId, success, fail) {
    restapi.req('/web-dj-weapp/home/getBindInfoByCondition', { merchantId: merchantId }, {}, 'GET', 'json', 'text', success, fail);
  },
  /**
  * 请求设备列表
  */
  getDeviceList: function (success, fail) {
    restapi.req('/web-dj-weapp/smartcar/listDevice', {}, { 'content-type': 'application/x-www-form-urlencoded' }, 'POST', 'json', 'text', success, fail);
  },

  /**
   * 切换设备
   */
  checkDevice: function (presentDevice, success, failed) {
    restapi.req('/web-dj-weapp/smartcar/checkDevice', presentDevice, {}, 'Get', 'json', 'text', success, failed);
  },

  /**
  * 检查设备状态
  */
  checkDeviceStatus: function (userId, success, fail) {
    restapi.req('/web-dj-weapp/smartcar/checkDeviceStatus', { userId: userId }, { 'content-type': 'application/x-www-form-urlencoded' }, 'POST', 'json', 'text', success, fail);
  },

  /**
   * 获取设备绑定信息
   */
  getDeviceBindInfo: function (sourcefrom, success, fail) {
    restapi.req('/web-dj-weapp/device/getBindInfo', { sourcefrom: sourcefrom }, { 'content-type': 'application/x-www-form-urlencoded' }, 'GET', 'json', 'text', success, fail)
  },


  /**
   * 绑定设备
   */
  bindDevice: function (obj, success, fail) {
    restapi.req('/web-dj-weapp/device/bindobd', JSON.stringify(obj), { 'content-type': 'application/json' }, 'POST', 'json', 'text', success, fail)
  },


  /**
  * 绑定设备--车辆未上牌
  */
  newCarBind: function (imei, validateCode, typeId, success, fail) {
    restapi.req('/web-dj-weapp/device/newCarBindOBD', { sn: imei, checkCode: validateCode, typeId: typeId }, { 'content-type': 'application/x-www-form-urlencoded' }, 'POST', 'json', 'text', success, fail)
  },

  /**
  * 绑定设备--账户下是否包含车辆
  */
  isNoVehicle: function (typeId, success, fail) {
    restapi.req('/web-dj-weapp/device/isNoVehicle', { typeId: typeId }, { 'content-type': 'application/x-www-form-urlencoded' }, 'GET', 'json', 'text', success, fail)
  },

  /**
  * 获取车智能助手数据
  */
  getSmartCarindexInfo: function (userId, success, fail) {
    restapi.req('/web-dj-weapp/smartcar/getIndexInfo', { userId: userId }, {}, 'GET', 'json', 'text', success, fail);
  },
  loadMoreActivities: function (activityRequestVO, success, fail) {
    restapi.req('/web-dj-weapp/popularActivity/loadMoreActivities', activityRequestVO, { 'content-type': 'application/x-www-form-urlencoded' }, 'POST', 'json', 'text', success, fail);
  },

}