Explorar el Código

add api/apiUser.js

wudebin hace 6 meses
padre
commit
9d9ba47fa5
Se han modificado 2 ficheros con 160 adiciones y 0 borrados
  1. 91 0
      Strides-SPAPP/app/api/apiUser.js
  2. 69 0
      Strides-SPAPP/app/api/apiVoucher.js

+ 91 - 0
Strides-SPAPP/app/api/apiUser.js

@@ -0,0 +1,91 @@
+import { get, post } from "./http";
+
+const prefix = 'devicesApi/user/';
+
+export default user = {
+  login: (param) => {
+    return post(prefix + 'login', param);
+  },
+  register: (param) => {
+    return post(prefix + 'register', param);
+  },
+  registerDriver: (param) => {
+    return post(prefix + 'upgradeDriver', param);
+  },
+  getConmpany: () => {
+    return get(prefix + 'getFleetCompanyList');
+  },
+  getProfile: () => {
+    return get(prefix + 'getUserDetail', {});
+  },
+  setProfile: (params) => {
+    return post(prefix + 'update', params);
+  },
+  setNotifySwitch: (params) => {
+    return post(prefix + 'updateUserNotifySwitch', params);
+  },
+  setNotifyToken: (token) => {
+    return post(prefix + 'registerGoogleToken', token);
+  },
+  getCountryCode: () => {
+    return get(prefix + 'getCountryCode', {});
+  },
+  rateCharge: (params) => {
+    return post(prefix + 'rating', params);
+  },
+  feedback: (params) => {
+    return post(prefix + 'feedback', params);
+  },
+  getTypeOfFeedback: () => {
+    return get(prefix + 'getTypeOfFeedback', {});
+  },
+  getVehicles: () => {
+    return get(prefix + 'getVehicles', {});
+  },
+  getVehicleById: (params) => {
+    return get(prefix + 'getVehicleById', params);
+  },
+  addVehicle: (params) => {
+    return post(prefix + 'addVehicle', params);
+  },
+  updateVehicle: (params) => {
+    return post(prefix + 'updateVehicle', params);
+  },
+  deleteVehicle: (params) => {
+    return get(prefix + 'delVehicleById', params);
+  },
+  getConnectorType: () => {
+    return get(prefix + 'getConnectorType', {});
+  },
+  /**
+   * 重置密码时发送邮箱验证码接口
+   * @param {String} email 邮箱地址
+   * @returns Promise(Response)
+   */
+  sendVerificationCode: (email) => {
+    return get(prefix + 'sendVerificationCode', {email: email, type: "reset"});
+  },
+  /**
+   * 注册和重置密码时发送邮箱验证码接口
+   * @param {Object} params {email, type}
+   * @returns Promise(Response)
+   */
+  sendVerificationCodeV2: (params) => {
+    return get(prefix + 'sendVerificationCode', params);
+  },
+  updatePassword: (params) => {
+    return post(prefix + 'updatePassword', params);
+  },
+  getCountryList: () => {
+    return get('devicesApi/base/getCountries')
+  },
+  deleteAccount: (data) => {
+    return get(prefix + 'delUser', data)
+  },
+  getVehicleBrandList: () => {
+    return get(prefix + "brands")
+  },
+  getVehicleModelByBrand: (data) => {
+    return get(prefix + "models", data)
+  }
+}

+ 69 - 0
Strides-SPAPP/app/api/apiVoucher.js

@@ -0,0 +1,69 @@
+import { get, post } from "./http";
+
+const prefix = 'devicesApi/dawn/api/v1/';
+
+export default apiVoucher = {
+  /**
+   * 使用兑换码兑换优惠券
+   * @param {redemptionCode} data 
+   * @returns Promise
+   */
+  redeemVoucher(data) {
+    return post(prefix + "redeem-voucher-by-redemption-code", data)
+  },
+  /**
+   * 领券中心兑换优惠券
+   * @param {voucherId} data 
+   * @returns Promise
+   */
+  purchaseVoucher(data) {
+    return post(prefix + "redeem-voucher-by-voucher-id", data)
+  },
+  /**
+   * 分页查询我的优惠券列表
+   * @param {Object} data {lastVoucherId,voucherType}
+   * @returns Promise
+   */
+  getMyVouchers(data) {
+    return get(prefix + "user-vouchers", data)
+  },
+  /**
+   * 分页查询优惠券贩卖列表
+   * @param {Object} data {lastVoucherId,voucherType}
+   * @returns Promise
+   */
+  getDealVouchers(data) {
+    return get(prefix + "voucher-center", data)
+  },
+  /**
+   * 获取优惠券类型选项
+   * @returns Promise
+   */
+  getVoucherTypeOptions() {
+    return get(prefix + "voucher-type-select")
+  },
+  /**
+   * 获取充电桩可用的优惠券
+   * @param {Object} data {chargeBoxId,connectorId,voucherType}
+   * @returns Promise
+   */
+  getSelectionVoucher(data) {
+    return get(prefix + "charge-can-use-vouchers", data)
+  },
+  /**
+   * 获取优惠券详情
+   * @param {String|Number} voucherId 优惠券ID
+   * @returns Promise
+   */
+  getVoucherInfo(voucherId) {
+    return get(prefix + "vouchers/" + voucherId)
+  },
+  /**
+   * 分页获取积分历史列表
+   * @param {String} lastId 上一页最后一项的pointsHistoryId
+   * @returns Promise
+   */
+  getPointsHistory(lastId) {
+    return get(prefix + "points-history", {lastPointsHistoryId: lastId})
+  }
+}