restapi.js 12.8 KB
// const restapi = require('../utils/util.js');
const restapi = require('../utils/restapi.js');
module.exports = {

  /** 获取主页数据*/
  getIndexModules: function (merchantId, success, fail) {
    restapi.req('/web-dj-weapp/home/getIndexModules', { merchantId: merchantId}, {}, 'GET', 'json', 'text', success, fail);
  },

  /** 领取活动优惠券*/
  receiveActivityCoupon: function (activityCouponId,activityId, success, fail) {
    restapi.req('/web-dj-weapp/coupon/receive', { activityCouponId: activityCouponId, activityId: activityId }, { 'content-type': 'application/x-www-form-urlencoded'}, 'POST', 'json', 'text', success, fail);
  },
  /** 获取智能提醒列表*/
  pageIntelligentRminders: function(reminderVo, success, fail) {
    restapi.req('/web-dj-weapp/home/pageIntelligentRminders', reminderVo, { 'content-type': 'application/x-www-form-urlencoded' }, 'POST', '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);
  },
  /** 查看活动详情*/
  getActivityDetail: function (data, success, fail) {
    restapi.req('/web-dj-weapp/popularActivity/detail', JSON.stringify(data), { 'content-type': 'application/json' }, 'POST', 'json', 'text', success, fail);
  },
  generateActivityOrder: function (activityOrderRequestVO, success, fail) {
    // restapi.req('/web-dj-weapp/popularActivity/generateActivityOrder', activityOrderRequestVO, { 'content-type': 'application/x-www-form-urlencoded' }, 'POST', 'json', 'text', success, fail);
    restapi.req('/web-dj-weapp/popularActivity/generateActivityOrder', JSON.stringify(activityOrderRequestVO), { 'content-type': 'application/json' }, 'POST', 'json', 'text', success, fail);
  
  },
  /** 获取绑定信息*/
  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);
  },

/**
 * 获得门店公共内容
 */
  
  getNotice: function (merchantId,success) {
    restapi.req('/web-dj-weapp/home/getNotice', { merchantId: merchantId}, {}, '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);
  },
  /**
   * 车智能跳转H5
   */
  smartCarJumpToH5(redirectUrl, success, fail) {
    restapi.req('/web-dj-weapp/smartcar/route', { redirectUrl: redirectUrl }, {}, '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)
  },

   /**
    * 获取小程序应用信息
    * merchantId:商户号
    */
  getAppInfo: function (merchantId, success, fail) {
    restapi.req('/web-dj-weapp/appinfo/get', { merchantId: merchantId }, {}, 'GET', 'json', 'text', success, fail);
  },
  /**
   * 创建记录
  */
  createLogRecord: function (obj, success, fail) {
    restapi.req('/web-dj-weapp/myactivity/createLogRecord', JSON.stringify(obj), { 'content-type': 'application/json' }, 'POST', 'json', 'text', success, fail);
  },

  /**
   * 查询是否此活动已报过价
   */
  getQuoteRecord: function (activityId, success, fail){
    restapi.req('/web-dj-weapp/quote/getQuoteRecord', {activityId:activityId},{},'GET', 'json', 'text', success, fail);
  },
  /**
   * 根据车型年款和购车时间匹配报价价格
   */
  getQuoteInfo: function (quote, success,fail){
    restapi.req('/web-dj-weapp/quote/getQuoteInfo', quote, { 'content-type': 'application/json' }, 'POST','json','text',success,fail);
  },
  /**
   * 获取商户主营品牌下车系列表
   */
  getMerchantCarSeriesList: function(success, fail){
    restapi.req('/web-dj-weapp/quote/getMerchantCarSeriesList', {}, {}, 'GET', 'json', 'text', success, fail);
  },
  /**
   * 获取车系下的车型年款
   */
  getCarTypeList: function (carSeriesId, success, fail){
    restapi.req('/web-dj-weapp/quote/getCarTypeList', { carSeriesId: carSeriesId}, {}, 'GET', 'json', 'text', success, fail);
  },
  /**
   * 生产报价单
   */
  generateQuoteRecord: function (record, success, fail){
    restapi.req('/web-dj-weapp/quote/generateQuoteRecord', record, { 'content-type': 'application/json'}, 'POST', 'json', 'text', success, fail);
  },
  /**
   * 获取直播间详情
   */
  getLiveDetail: function (roomId, success, fail){
    restapi.req('/web-dj-weapp/home/liveplayer/detail', roomId, { }, 'GET', 'json', 'text', success, fail);
  },

  /**
   * 获取活动优惠券详情
   * */
  getActivityCouponById: function(activityCouponId, success, fail) {
    restapi.req('/web-dj-weapp/coupon/detail', {
      activityCouponId: activityCouponId
    }, {}, 'GET', 'json', 'text', success, fail);
  },

  /**
   * 获取优惠券类名
   */
  getQuoteCoupon: function (activityId, success, fail) {
    restapi.req('/web-dj-weapp/quote/getQuoteCoupon', { activityId: activityId }, {}, 'GET', 'json', 'text', success, fail);
  }
  
}