|
|
const api = global.yoho.API;
|
|
|
const _ = require('lodash');
|
|
|
const helpers = global.yoho.helpers;
|
|
|
const utils = '../../../utils';
|
|
|
const productProcess = require(`${utils}/product-process`);
|
|
|
const service = global.yoho.ServiceAPI;
|
|
|
const serviceAPI = global.yoho.ServiceAPI;
|
|
|
const co = require('bluebird').coroutine;
|
|
|
|
|
|
module.exports = class extends global.yoho.BaseModel {
|
...
|
...
|
@@ -15,11 +14,14 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
* 我的邀请码页
|
|
|
*/
|
|
|
_getPromotionData(uid, isApp) {
|
|
|
return api.get('', {
|
|
|
method: 'app.invitecode.my',
|
|
|
uid: uid
|
|
|
}, {
|
|
|
code: 200
|
|
|
return this.get({
|
|
|
data: {
|
|
|
method: 'app.invitecode.my',
|
|
|
uid: uid
|
|
|
},
|
|
|
param: {
|
|
|
code: 200
|
|
|
}
|
|
|
}).then((result) => {
|
|
|
|
|
|
if (result && result.code === 200 && result.data) {
|
...
|
...
|
@@ -39,11 +41,16 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
* 资源位
|
|
|
*/
|
|
|
_getTrendPop(contentCode) {
|
|
|
return service.get('operations/api/v5/resource/get', {
|
|
|
content_code: contentCode,
|
|
|
}, {
|
|
|
code: 200,
|
|
|
cache: true
|
|
|
return this.get({
|
|
|
api: serviceAPI,
|
|
|
url: 'operations/api/v5/resource/get',
|
|
|
data: {
|
|
|
content_code: contentCode,
|
|
|
},
|
|
|
param: {
|
|
|
code: 200,
|
|
|
cache: true
|
|
|
}
|
|
|
}).then(result => {
|
|
|
if (result && result.code === 200 && result.data) {
|
|
|
return result.data[0];
|
...
|
...
|
@@ -54,7 +61,7 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
}
|
|
|
|
|
|
promotionData(uid, isApp, contentCode) {
|
|
|
return api.all([this._getPromotionData(uid, isApp), this._getTrendPop(contentCode)]).then(result => {
|
|
|
return Promise.all([this._getPromotionData(uid, isApp), this._getTrendPop(contentCode)]).then(result => {
|
|
|
let friendPromotionData = {};
|
|
|
|
|
|
friendPromotionData = Object.assign(friendPromotionData, result[0]);
|
...
|
...
|
@@ -68,11 +75,13 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
* 奖励列表页
|
|
|
*/
|
|
|
rewardList(uid, page, limit, isApp) {
|
|
|
return api.get('', {
|
|
|
method: 'app.invitecode.history',
|
|
|
uid: uid,
|
|
|
page: page,
|
|
|
limit: limit
|
|
|
return this.get({
|
|
|
data: {
|
|
|
method: 'app.invitecode.history',
|
|
|
uid: uid,
|
|
|
page: page,
|
|
|
limit: limit
|
|
|
}
|
|
|
}).then((result) => {
|
|
|
|
|
|
if (result && result.code === 200 && result.data) {
|
...
|
...
|
@@ -110,10 +119,12 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
* 奖励详情页
|
|
|
*/
|
|
|
rewardDeatil(uid, firstOrderUid) {
|
|
|
return api.get('', {
|
|
|
method: 'app.invitecode.detail',
|
|
|
uid: uid,
|
|
|
firstOrderUid: firstOrderUid
|
|
|
return this.get({
|
|
|
data: {
|
|
|
method: 'app.invitecode.detail',
|
|
|
uid: uid,
|
|
|
firstOrderUid: firstOrderUid
|
|
|
}
|
|
|
}).then((result) => {
|
|
|
|
|
|
if (result && result.code === 200) {
|
...
|
...
|
@@ -130,13 +141,12 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
* 设置我的潮流口令
|
|
|
*/
|
|
|
setTrendWord(uid, trendWord) {
|
|
|
return api.get('', {
|
|
|
method: 'app.trendword.update',
|
|
|
uid: uid,
|
|
|
trendWord: trendWord
|
|
|
}).then((result) => {
|
|
|
|
|
|
return result;
|
|
|
return this.get({
|
|
|
data: {
|
|
|
method: 'app.trendword.update',
|
|
|
uid: uid,
|
|
|
trendWord: trendWord
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
...
|
...
|
@@ -144,11 +154,13 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
* 好友邀请商品
|
|
|
*/
|
|
|
_hotGoods(yhChannel, limit, page) {
|
|
|
return api.get('', {
|
|
|
method: 'app.search.top',
|
|
|
yh_channel: yhChannel,
|
|
|
page: page,
|
|
|
limit: limit
|
|
|
return this.get({
|
|
|
data: {
|
|
|
method: 'app.search.top',
|
|
|
yh_channel: yhChannel,
|
|
|
page: page,
|
|
|
limit: limit
|
|
|
}
|
|
|
}).then((result) => {
|
|
|
if (result && result.code === 200) {
|
|
|
|
...
|
...
|
@@ -163,19 +175,20 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
* 好友邀请信息
|
|
|
*/
|
|
|
inviteUserInfo(inviteCode) {
|
|
|
return api.get('', {
|
|
|
method: 'app.invitecode.userinfo',
|
|
|
inviteCode: inviteCode
|
|
|
}).then((result) => {
|
|
|
|
|
|
return result;
|
|
|
return this.get({
|
|
|
data: {
|
|
|
method: 'app.invitecode.userinfo',
|
|
|
inviteCode: inviteCode
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
_getProductList(skns) {
|
|
|
return api.get('', {
|
|
|
method: 'app.search.li',
|
|
|
query: skns
|
|
|
return this.get({
|
|
|
data: {
|
|
|
method: 'app.search.li',
|
|
|
query: skns
|
|
|
}
|
|
|
}).then((result) => {
|
|
|
if (result && result.code === 200) {
|
|
|
return result.data;
|
...
|
...
|
@@ -199,9 +212,12 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
if (!token) {
|
|
|
return Promise.resolve({});
|
|
|
}
|
|
|
return api.get('', {
|
|
|
method: 'app.SpaceOrders.getProductList',
|
|
|
order_token: token
|
|
|
|
|
|
return this.get({
|
|
|
data: {
|
|
|
method: 'app.SpaceOrders.getProductList',
|
|
|
order_token: token
|
|
|
}
|
|
|
}).then((result) => {
|
|
|
let self = this;
|
|
|
|
...
|
...
|
@@ -247,7 +263,7 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
* 好友邀请页
|
|
|
*/
|
|
|
friendInvite(inciteCode, yhChannel, limit, page, contentCode, token) {
|
|
|
return api.all([
|
|
|
return Promise.all([
|
|
|
this.inviteUserInfo(inciteCode),
|
|
|
this._hotGoods(yhChannel, limit, page),
|
|
|
this._getTrendPop(contentCode),
|
...
|
...
|
@@ -272,11 +288,14 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
}
|
|
|
|
|
|
reloadQrcode(uid) {
|
|
|
return api.get('', {
|
|
|
method: 'app.invitecode.my',
|
|
|
uid: uid
|
|
|
}, {
|
|
|
code: 200
|
|
|
return this.get({
|
|
|
data: {
|
|
|
method: 'app.invitecode.my',
|
|
|
uid: uid
|
|
|
},
|
|
|
param: {
|
|
|
code: 200
|
|
|
}
|
|
|
}).then((result) => {
|
|
|
|
|
|
if (result && result.code === 200 && result.data) {
|
...
|
...
|
|