|
|
const MODULE = '/activity/zerobuy';
|
|
|
// const MODULE = '/activity/zerobuy';
|
|
|
const serviceAPI = global.yoho.ServiceAPI;
|
|
|
|
|
|
const yoLuckApi = new global.yoho.ApiBase(global.yoho.config.domains.yoLuck, {
|
|
|
name: 'yoLuck',
|
|
|
cache: global.yoho.cache,
|
|
|
useCache: false
|
|
|
});
|
|
|
/* 旧的api
|
|
|
const yoLuckApi = new global.yoho.ApiBase(global.yoho.config.domains.yoLuck, {
|
|
|
name: 'yoLuck',
|
|
|
cache: global.yoho.cache,
|
|
|
useCache: false
|
|
|
});
|
|
|
*/
|
|
|
|
|
|
function productTime(p) {
|
|
|
if (p.status === 1) {
|
...
|
...
|
@@ -68,27 +70,31 @@ class YoLuckApi extends global.yoho.BaseModel { |
|
|
* @returns {Promise}
|
|
|
*/
|
|
|
getList({page, type}) {
|
|
|
return yoLuckApi.get(MODULE + '/list', {
|
|
|
page,
|
|
|
type,
|
|
|
channel: 0
|
|
|
// 已改成java接口,数据结构改变,字段名改变
|
|
|
return this.get({
|
|
|
data: {
|
|
|
method: 'app.yoluck.activityList',
|
|
|
type,
|
|
|
page,
|
|
|
channel: 0,
|
|
|
size: 10
|
|
|
}
|
|
|
}).then(result => {
|
|
|
if (result.code === 200) {
|
|
|
const products = result.data;
|
|
|
const products = result.data.list;
|
|
|
const newProducts = products.map((p) => {
|
|
|
p = productTime(p);
|
|
|
p.countdown = formatCountDown(p.end_time);
|
|
|
p.countdown = formatCountDown(p.endTime);
|
|
|
|
|
|
return p;
|
|
|
});
|
|
|
|
|
|
result.data = newProducts;
|
|
|
result.data.list = newProducts;
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -97,13 +103,29 @@ class YoLuckApi extends global.yoho.BaseModel { |
|
|
* @returns {Promise}
|
|
|
*/
|
|
|
getDetail({actPrizeId, uid}) {
|
|
|
return yoLuckApi.get(MODULE + '/content', {actPrizeId, uid}).then(result => {
|
|
|
/* return yoLuckApi.get(MODULE + '/content', {actPrizeId, uid}).then(result => {
|
|
|
if (result.code === 200) {
|
|
|
productTime(result.data);
|
|
|
result.data.countdown = formatCountDown(result.data.end_time);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
});*/
|
|
|
|
|
|
return this.get({
|
|
|
data: {
|
|
|
method: 'app.yoluck.getContent',
|
|
|
uid,
|
|
|
actPrizeId
|
|
|
}
|
|
|
}).then(result => {
|
|
|
// console.log('detail:', result);
|
|
|
if (result.code === 200) {
|
|
|
productTime(result.data);
|
|
|
result.data.countdown = formatCountDown(result.data.endTime);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
});
|
|
|
}
|
|
|
|
...
|
...
|
@@ -113,7 +135,7 @@ class YoLuckApi extends global.yoho.BaseModel { |
|
|
* @returns {Promise}
|
|
|
*/
|
|
|
getRecommend({actPrizeId}) {
|
|
|
return yoLuckApi.get(MODULE + '/list/recommend', {
|
|
|
/* return yoLuckApi.get(MODULE + '/list/recommend', {
|
|
|
actPrizeId,
|
|
|
channel: 0
|
|
|
}).then(result => {
|
...
|
...
|
@@ -131,6 +153,30 @@ class YoLuckApi extends global.yoho.BaseModel { |
|
|
}
|
|
|
|
|
|
return result;
|
|
|
});*/
|
|
|
|
|
|
return this.get({
|
|
|
data: {
|
|
|
method: 'app.yoluck.recommendList',
|
|
|
actPrizeId,
|
|
|
channel: 0
|
|
|
}
|
|
|
}).then(result => {
|
|
|
if (result.code === 200) {
|
|
|
console.log('recomment=', result);
|
|
|
const products = result.data;
|
|
|
const newProducts = products.map((p) => {
|
|
|
p = productTime(p);
|
|
|
p.countdown = formatCountDown(p.end_time);
|
|
|
|
|
|
return p;
|
|
|
});
|
|
|
|
|
|
result.data = newProducts;
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
});
|
|
|
}
|
|
|
|
...
|
...
|
@@ -140,7 +186,13 @@ class YoLuckApi extends global.yoho.BaseModel { |
|
|
* @returns {Promise}
|
|
|
*/
|
|
|
getRecentAvatars({actPrizeId}) {
|
|
|
return yoLuckApi.get(MODULE + '/code/recent', {actPrizeId});
|
|
|
// return yoLuckApi.get(MODULE + '/code/recent', {actPrizeId});
|
|
|
return this.get({
|
|
|
data: {
|
|
|
method: 'app.yoluck.recent',
|
|
|
actPrizeId
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -150,7 +202,17 @@ class YoLuckApi extends global.yoho.BaseModel { |
|
|
* @returns {Promise}
|
|
|
*/
|
|
|
getMyList({page, type, limit, uid}) {
|
|
|
return yoLuckApi.get(MODULE + '/list/mine', {type, page, uid, limit, channel: 0});
|
|
|
// return yoLuckApi.get(MODULE + '/list/mine', {type, page, uid, limit, channel: 0});
|
|
|
return this.get({
|
|
|
data: {
|
|
|
method: 'app.yoluck.participationList',
|
|
|
type,
|
|
|
page,
|
|
|
uid,
|
|
|
size: limit,
|
|
|
channel: 0
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -160,7 +222,14 @@ class YoLuckApi extends global.yoho.BaseModel { |
|
|
* @returns {Promise}
|
|
|
*/
|
|
|
getMyListWithActid(uid, actPrizeId) {
|
|
|
return yoLuckApi.get(MODULE + '/code/mine', {uid, actPrizeId});
|
|
|
// return yoLuckApi.get(MODULE + '/code/mine', {uid, actPrizeId});
|
|
|
return this.get({
|
|
|
data: {
|
|
|
method: 'app.yoluck.userCode',
|
|
|
uid,
|
|
|
actPrizeId
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -173,12 +242,23 @@ class YoLuckApi extends global.yoho.BaseModel { |
|
|
* @returns {Promise}
|
|
|
*/
|
|
|
fetchCode({shareUid, uid, actPrizeId, userThumb, userName}) {
|
|
|
return yoLuckApi.post(MODULE + '/code/gain', {
|
|
|
/* return yoLuckApi.post(MODULE + '/code/gain', {
|
|
|
shareUid,
|
|
|
uid,
|
|
|
actPrizeId,
|
|
|
userThumb,
|
|
|
userName
|
|
|
});*/
|
|
|
|
|
|
return this.get({
|
|
|
data: {
|
|
|
method: 'app.yoluck.getCode',
|
|
|
actPrizeId,
|
|
|
uid,
|
|
|
shareUid,
|
|
|
userName,
|
|
|
userThumb
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
...
|
...
|
|