restapi.js 8.15 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);
  },

  /**
   * 分页获取车辆启动信息
   */
  startCarMessgaePage: function (accountId, pageNum, pageSize, success, fail) {
    restapi.req('/web-dj-weapp/smartcar/startCarMessgaePage', { accountId: accountId, pageNum: pageNum, pageSize: pageSize }, { 'content-type': 'application/x-www-form-urlencoded' }, 'POST', 'json', 'text', success, fail);
  },

  /**
   * 爱车追踪-获取爱车位置
   */
  getVehiclePosition: function (userId, success, fail) {
    restapi.req('/web-dj-weapp/smartcar/getVehiclePosition', { userId: userId }, { 'content-type': 'application/x-www-form-urlencoded' }, 'POST', 'json', 'text', success, fail)
  },
  /**
   * 我的里程-分页获取日里程列表
   */
  getDayWheelPathList: function (obj, success, fail) {
    restapi.req('/web-dj-weapp/mileage/getDailyWheelPathList', obj, { 'content-type': 'application/x-www-form-urlencoded' }, 'POST', 'json', 'text', success, fail)
  },

  /**
   * 我的里程-分页获取月里程列表
   */
  getMonthWheelPathList: function (obj, success, fail) {
    restapi.req('/web-dj-weapp/mileage/getMonthWheelPathList', obj, { 'content-type': 'application/x-www-form-urlencoded' }, 'POST', 'json', 'text', success, fail)
  },

  /**
   * 我的里程-获取日里程卡片信息
   */
  getDailyJourneyCardInfo: function (userId, date, success, fail) {
    restapi.req('/web-dj-weapp/mileage/getDailyJourneyCardInfo', { userId: userId, time: date }, { 'content-type': 'application/x-www-form-urlencoded' }, 'POST', 'json', 'text', success, fail)
  },

  /**
   * 我的里程-获取月里程卡片信息
   */
  getMonthJourneyCardInfo: function (userId, date, success, fail) {
    restapi.req('/web-dj-weapp/mileage/getMonthJourneyCardInfo', { userId: userId, time: date }, { 'content-type': 'application/x-www-form-urlencoded' }, 'POST', 'json', 'text', success, fail)
  },
  /**
  * 检查设备状态
  */
  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)
  },



  /**
 * 关闭引导图
 */
  closeBindImg: function (success, fail) {
    restapi.req('/web-dj-weapp/device/closeBindImg', {}, { 'content-type': 'application/x-www-form-urlencoded' }, 'POST', '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)
  },
  /**
   * 获取近四个月有轨迹的日期
   */
  getJouneyDays: function (userId, success, fail) {
    restapi.req('/web-dj-weapp/mileage/getJouneyDays', { userId: userId }, { 'content-type': 'application/x-www-form-urlencoded' }, 'POST', 'json', 'text', success, fail);
  },
  /**
  * 获取车智能助手数据
  */
  getSmartCarindexInfo: function (userId, success, fail) {
    restapi.req('/web-dj-weapp/smartcar/getIndexInfo', { userId: userId }, {}, 'GET', 'json', 'text', success, fail);
  },
  /**
 * 获取车智能助手应用
 */
  getSmartCarApp: function (userId, success, fail) {
    restapi.req('/web-dj-weapp/smartcar/getSmartCarApp', { userId: userId }, {}, 'GET', 'json', 'text', success, fail);
  },
  /**
   * 获取轨迹详情
   */
  // getJourneyById: function (userId, journeyId, startDate, endDate, success, fail) {
  //   restapi.req('/web-dj-weapp/smartcar/getJourneyById', { userId: userId, journeyId: journeyId, startDate: startDate, endDate: endDate }, { 'content-type': 'application/x-www-form-urlencoded' }, 'POST', 'json', 'text', success, fail);
  // },
  getJourneyById: function (journeyId, success, fail) {
    restapi.req('/web-dj-weapp/smartcar/getJourneyById', { journeyId: journeyId }, { 'content-type': 'application/x-www-form-urlencoded' }, 'POST', 'json', 'text', success, fail);
  },
  /**
   * 获取账户下的所有车辆
   */
  getVehicles: function (success) {
    restapi.req('/web-dj-weapp/home/getVehiclesForVerify', {}, {}, 'GET', 'json', 'text', success);
  },

  /**
   * 添加车辆
   */
  addOrUpdateVehicle: function (vehicle, success, fail) {
    restapi.req('/web-dj-weapp/home/addOrUpdateVehicle', vehicle, { 'content-type': 'application/x-www-form-urlencoded' }, 'Post', 'json', 'text', success, fail);
  },

  /**
   * 获得一级品牌(车牌1、2级)
   */
  getParentBrands: function (success) {
    restapi.req('/web-dj-weapp/home/getParentBrands', {}, {}, 'GET', 'json', 'text', success);
  },

  /**
   * 获得品牌车系
   */
  getSecondBrands: function (parentId, success) {
    restapi.req('/web-dj-weapp/home/getSecondBrands', { parentId: parentId }, {}, 'GET', 'json', 'text', success);
  },

  /**
   * 删除车辆
   */
  deleteVehicle(id, success, fail) {
    restapi.req('/web-dj-weapp/home/deleteVehicle', { id: id }, { 'content-type': 'application/x-www-form-urlencoded' }, 'POST', 'json', 'text', success, fail)
  },
  /**
   * 获取门店信息
   */
  getMerchantById(merchantId, success) {
    restapi.req('/web-dj-weapp/personal/merchant', { merchantId: merchantId }, {}, 'GET', 'json', 'text', success);
  },

  /**
   * 获取显示违章的开关
   */
  getIllegalFlag(appId, success, fail) {
    restapi.req('/web-dj-weapp/home/getIllegalFlag', { appId: appId }, {}, 'Get', 'json', 'text', success, fail);
  },

  //获取云防盗列表
  getCloudSecurity: function (userId, success, fail) {
    restapi.req('/web-dj-weapp/cloudSecurity/getCloudSecurityList', { protocolId: userId }, { 'content-type': 'application/x-www-form-urlencoded' }, 'POST', 'json', 'text', success, fail)
  },

  //修改云防盗数据
  updateCloudSecurity: function (obj, success, fail) {
    restapi.req('/web-dj-weapp/cloudSecurity/updateCloudSecurity', obj, { 'content-type': 'application/x-www-form-urlencoded' }, 'POST', 'json', 'text', success, fail)
  },

  //删除云防盗设置
  deleteCloudSecurity: function (userId, group, success, fail) {
    restapi.req('/web-dj-weapp/cloudSecurity/deleteCloudSecurity', { userId: userId, group: group }, { 'content-type': 'application/x-www-form-urlencoded' }, 'POST', 'json', 'text', success, fail)
  },

  //更新云防盗开关
  updateCloudSecurityEnable: function (obj, success, fail) {
    restapi.req('/web-dj-weapp/cloudSecurity/updateCloudSecurityEnable', obj, { 'content-type': 'application/x-www-form-urlencoded' }, 'POST', 'json', 'text', success, fail)
  }

}