...
|
...
|
@@ -5,6 +5,8 @@ const co = Promise.coroutine; |
|
|
const userData = require('./user-data');
|
|
|
const moment = require('moment');
|
|
|
const helpers = global.yoho.helpers;
|
|
|
const _ = require('lodash');
|
|
|
const setPager = require(`${global.utils}/pager`).setPager;
|
|
|
|
|
|
const vipIndex = (uid)=>{
|
|
|
|
...
|
...
|
@@ -62,8 +64,35 @@ const vipIndex = (uid)=>{ |
|
|
})();
|
|
|
};
|
|
|
|
|
|
const getVipRecord = (params) => {
|
|
|
return userData.getVipRecord(params);
|
|
|
const getVipRecord = (uid, params) => {
|
|
|
let page = parseInt(params.page, 10) || 1;
|
|
|
let size = parseInt(params.size, 10) || 1;
|
|
|
let type = parseInt(params.type, 10) || 1;
|
|
|
|
|
|
type = type > 0 && type < 3 ? type : 1;//1 or 2
|
|
|
|
|
|
return userData.getVipRecordDemo({
|
|
|
uid: uid,
|
|
|
page: page,
|
|
|
size: size || 10
|
|
|
}).then(d => {
|
|
|
var resData = {type: type};
|
|
|
|
|
|
if (d.code !== 200) {
|
|
|
return resData;
|
|
|
}
|
|
|
|
|
|
let pagerList = setPager(_.get(d.data, 'page_total', 1), Object.assign(params, {page: page}));
|
|
|
|
|
|
resData.data = d.data.list;
|
|
|
resData.pager = Object.assign({
|
|
|
count: _.get(d.data, 'total', 0),
|
|
|
curPage: page,
|
|
|
totalPages: _.get(d.data, 'page_total', 0)
|
|
|
}, pagerList);
|
|
|
|
|
|
return resData;
|
|
|
});
|
|
|
};
|
|
|
|
|
|
module.exports = {
|
...
|
...
|
|