...
|
...
|
@@ -5,8 +5,6 @@ |
|
|
*/
|
|
|
'use strict';
|
|
|
|
|
|
const api = global.yoho.API;
|
|
|
|
|
|
const _ = require('lodash');
|
|
|
const Promise = require('bluebird');
|
|
|
|
...
|
...
|
@@ -20,7 +18,13 @@ const complaintType = { |
|
|
2: '物流相关'
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
|
|
|
module.exports = class extends global.yoho.BaseModel {
|
|
|
constructor(ctx) {
|
|
|
super(ctx);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取投诉列表
|
|
|
* @function getComplaintsList
|
|
|
* @param { Number } uid 用户uid
|
...
|
...
|
@@ -28,18 +32,23 @@ const complaintType = { |
|
|
* @param { Number } limit 每页数目
|
|
|
* @return { Object } 投诉列表数据
|
|
|
*/
|
|
|
const getComplaintsList = (uid, page, limit) => {
|
|
|
getComplaintsList(uid, page, limit) {
|
|
|
page = page || 1;
|
|
|
limit = limit || 10;
|
|
|
|
|
|
const process = function*() {
|
|
|
let resData = {};
|
|
|
let result = yield api.get('', {
|
|
|
let result = yield this.get({
|
|
|
data: {
|
|
|
method: 'web.complaints.getList',
|
|
|
uid: uid,
|
|
|
page: page,
|
|
|
limit: limit
|
|
|
}, {code: 200});
|
|
|
},
|
|
|
param: {
|
|
|
cache: 200
|
|
|
}
|
|
|
});
|
|
|
|
|
|
if (!_.isEmpty(result.data)) {
|
|
|
let list = [];
|
...
|
...
|
@@ -82,17 +91,18 @@ const getComplaintsList = (uid, page, limit) => { |
|
|
};
|
|
|
|
|
|
return co(process)();
|
|
|
};
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
/**
|
|
|
* 添加投诉
|
|
|
* @function addComplaints
|
|
|
* @param { Number } uid 用户uid
|
|
|
* @param { Object } params 投诉内容信息
|
|
|
* @return { Object } 添加投诉结果
|
|
|
*/
|
|
|
const addComplaints = (uid, params) => {
|
|
|
return api.post('', {
|
|
|
addComplaints(uid, params) {
|
|
|
return this.post({
|
|
|
data: {
|
|
|
method: 'web.complaints.add',
|
|
|
uid: uid,
|
|
|
title: _.trim(params.title),
|
...
|
...
|
@@ -100,26 +110,24 @@ const addComplaints = (uid, params) => { |
|
|
complaintsType: _.trim(params.complaintsType),
|
|
|
orderCode: _.trim(params.orderCode),
|
|
|
content: _.trim(params.content)
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
/**
|
|
|
* 撤销投诉
|
|
|
* @function addComplaints
|
|
|
* @param { Number } uid 用户uid
|
|
|
* @param { Number } id 投诉id
|
|
|
* @return { Object } 撤销投诉结果
|
|
|
*/
|
|
|
const cancelComplaints = (uid, id) => {
|
|
|
return api.post('', {
|
|
|
cancelComplaints(uid, id) {
|
|
|
return this.post({
|
|
|
data: {
|
|
|
method: 'web.complaints.cancel',
|
|
|
uid: uid,
|
|
|
id: id
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
|
|
|
module.exports = {
|
|
|
getComplaintsList,
|
|
|
addComplaints,
|
|
|
cancelComplaints
|
|
|
}
|
|
|
}; |
...
|
...
|
|