|
|
'use strict';
|
|
|
|
|
|
|
|
|
const api = global.yoho.API;
|
|
|
const _ = require('lodash');
|
|
|
const camelCase = global.yoho.camelCase;
|
|
|
const logger = global.yoho.logger;
|
|
|
|
|
|
const myCurrency = (uid) => {
|
|
|
return api.get('', {
|
|
|
method: 'app.yoho.yohocoin',
|
|
|
uid: uid
|
|
|
}).then((result) => {
|
|
|
|
|
|
if (result && result.code === 200) {
|
|
|
return camelCase(result.data);
|
|
|
} else {
|
|
|
logger.error('youho币总数 cood 不是 200');
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
|
|
|
// const banner = (CODE_YOHOCOIN_BANNER) => {
|
|
|
// return api.get('', {
|
|
|
// content_code: 'CODE_YOHOCOIN_BANNER',
|
|
|
// }).then((result) => {
|
|
|
// console.log(content_code)
|
|
|
// if(result && result.code === 200) {
|
|
|
// return camelCase(result.data);
|
|
|
// } else {
|
|
|
// logger.error('youho币总数 cood 不是 200');
|
|
|
// }
|
|
|
// })
|
|
|
// };
|
|
|
|
|
|
const currencyDetail = (uid, page, limit) => {
|
|
|
return api.get('', {
|
|
|
method: 'app.yohocoin.lists',
|
|
|
uid: uid,
|
|
|
page: page,
|
|
|
limit: limit
|
|
|
}).then((result) => {
|
|
|
// console.log(result)
|
|
|
if (result && result.code === 200) {
|
|
|
let total = parseInt(result.data.page_total, 10) + 1;
|
|
|
|
|
|
if (page && page < total) {
|
|
|
return myCurrency(uid).then(list => {
|
|
|
|
|
|
if (list.yohocoinNum && list.yohocoinNum === 0) {
|
|
|
result.data = _.assign(result.data, {
|
|
|
money: false
|
|
|
});
|
|
|
} else {
|
|
|
result.data = _.assign(result.data, {
|
|
|
money: true
|
|
|
});
|
|
|
}
|
|
|
|
|
|
return result.data;
|
|
|
});
|
|
|
} else {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
logger.error('youho币列表 cood 不是 200');
|
|
|
}
|
|
|
|
|
|
});
|
|
|
};
|
|
|
|
|
|
module.exports = {
|
|
|
myCurrency,
|
|
|
currencyDetail
|
|
|
}; |
...
|
...
|
|