Authored by 毕凯

Merge remote-tracking branch 'origin/feature/ctxCheck' into feature/contextMod

// 优惠券 by acgpiano
'use strict';
const api = global.yoho.API;
const helpers = global.yoho.helpers;
class couponsModel extends global.yoho.BaseModel {
... ... @@ -10,7 +9,7 @@ class couponsModel extends global.yoho.BaseModel {
}
couponData(params) {
return api.get('', params).then(result => {
return this.get({data: params}).then(result => {
if (result && result.data && result.data.couponList) {
let status0 = params.status === 0;
... ...
... ... @@ -7,9 +7,6 @@
'use strict';
const logger = global.yoho.logger;
const api = global.yoho.API;
// const serviceAPI = global.yoho.ServiceAPI;
const camelCase = global.yoho.camelCase;
const _ = require('lodash');
const config = global.yoho.config;
... ... @@ -22,12 +19,12 @@ class favoriteIndexModel extends global.yoho.BaseModel {
favProduct(uid, page, limit) {
return api.get('', {
return this.get({data: {
method: 'app.favorite.product',
uid: uid,
page: page,
limit: limit
}).then((result) => {
}}).then((result) => {
let resu = {
hasFavProduct: []
... ... @@ -123,12 +120,12 @@ class favoriteIndexModel extends global.yoho.BaseModel {
}
favfavBrand(uid, page, limit) {
return api.get('', {
return this.get({data: {
method: 'app.favorite.brand',
uid: uid,
page: page,
limit: limit
}).then((result) => {
}}).then((result) => {
let resu = {
hasFavBrand: []
... ... @@ -203,12 +200,12 @@ class favoriteIndexModel extends global.yoho.BaseModel {
favoriteDelete(uid, type, favId) {
return api.get('', {
return this.get({data: {
method: 'app.favorite.cancel',
uid: uid,
type: type,
fav_id: favId
});
}});
}
index(uid, page, limit, isbrand) {
... ...
'use strict';
const api = global.yoho.API;
const helpers = global.yoho.helpers;
const _ = require('lodash');
const moment = require('moment');
... ... @@ -90,7 +89,7 @@ module.exports = class extends global.yoho.BaseModel {
index(param) {
if (param.uid) {
return api.all([
return Promise.all([
this.getGradeGrade(param.uid, param.channel),
this.getGradeUser(param.uid, param.channel),
this.getGrowthVip(param.uid)
... ... @@ -200,7 +199,7 @@ module.exports = class extends global.yoho.BaseModel {
}
grow(param) {
return api.all([
return Promise.all([
this.getGrowthVip(param.uid),
this.getHis(param)
]).then((result) => {
... ... @@ -258,7 +257,7 @@ module.exports = class extends global.yoho.BaseModel {
}
getHisAjax(param) {
return api.all([
return Promise.all([
this.getHis(param)
]).then((result) => {
let resu = {
... ...
... ... @@ -2,7 +2,6 @@
'use strict';
const moment = require('moment');
const api = global.yoho.API;
const helpers = global.yoho.helpers;
// 格式化时间
... ... @@ -55,11 +54,11 @@ class messageModel extends global.yoho.BaseModel {
// 获取生日信息
_getBirthCouponById(uid) {
return api.get('', {
return this.get({data: {
method: 'app.promotion.queryBirthCoupon',
uid: uid,
couponType: 4,
}).then(result => {
}}).then(result => {
if (result && result.data) {
let final = {
ticket: []
... ... @@ -155,14 +154,13 @@ class messageModel extends global.yoho.BaseModel {
// 获取列表或详情
getList(params) {
return api.get('', {
return this.get({data: {
method: 'app.inbox.getlist',
page: params.page || 1,
size: params.size || 10,
uid: params.uid,
}).then(result => {
}}).then(result => {
if (params.msgid) {
// 绕的一比
return this._detail(result, params.msgid);
} else {
return this._list(result);
... ... @@ -172,11 +170,11 @@ class messageModel extends global.yoho.BaseModel {
// 删除消息
delMsg(params) {
return api.get('', {
return this.get({data: {
method: 'app.inbox.delmessage',
uid: params.uid,
id: params.msgid,
}).then(result => {
}}).then(result => {
if (result && result.code === 200) {
return {
code: 200
... ... @@ -192,11 +190,11 @@ class messageModel extends global.yoho.BaseModel {
// 领取优惠券
pickCoupon(params) {
return api.get('', {
return this.get({data: {
method: 'app.promotion.getCoupon',
uid: params.uid,
couponId: params.couponId,
}).then(result => {
}}).then(result => {
if (result && result.code === 200) {
return {
code: 200
... ...
'use strict';
const serviceAPI = global.yoho.ServiceAPI;
const api = global.yoho.API;
const _ = require('lodash');
const logger = global.yoho.logger;
... ... @@ -11,10 +9,10 @@ class myCurrencyModel extends global.yoho.BaseModel {
}
_yohoCoin(uid) {
return api.get('', {
return this.get({data: {
method: 'app.yoho.yohocoin',
uid: uid
}).then((result) => {
}}).then((result) => {
let data = [];
if (result && result.code === 200) {
... ... @@ -28,12 +26,18 @@ class myCurrencyModel extends global.yoho.BaseModel {
}
bannerData(contentCode) {
return serviceAPI.get('operations/api/v5/resource/get', {
content_code: contentCode
}, {
cache: true
}).then((result) => {
let options = {
url: 'operations/api/v5/resource/get',
data: {
content_code: contentCode
},
param: {
cache: true
},
api: global.yoho.ServiceAPI
};
return this.get(options).then((result) => {
if (result && result.code === 200) {
... ... @@ -60,12 +64,12 @@ class myCurrencyModel extends global.yoho.BaseModel {
}
currencyDetail(uid, page, limit) {
return api.get('', {
return this.get({data: {
method: 'app.yohocoin.lists',
uid: uid,
page: page,
limit: limit
}).then((result) => {
}}).then((result) => {
let data = [];
if (result && result.code === 200) {
... ...
'use strict';
const api = global.yoho.API;
const crypto = global.yoho.crypto;
const PASSWORD = 'yoho9646yoho9646';
... ... @@ -19,10 +18,10 @@ class qrcodeModel extends global.yoho.BaseModel {
uid = params.token;
}
return api.get('', {
return this.get({data: {
method: 'app.twoDimen.getCode',
uid: uid,
}).then(result => {
uid: uid
}}).then(result => {
return (result && result.data && result.data.code) || '';
});
}
... ...
... ... @@ -6,7 +6,6 @@
'use strict';
const logger = global.yoho.logger;
var api = global.yoho.API;
class qrcodeModel extends global.yoho.BaseModel {
constructor(ctx) {
... ... @@ -14,11 +13,12 @@ class qrcodeModel extends global.yoho.BaseModel {
}
getQRcodeData(id, uid) {
return api.get('', {
return this.get({data: {
method: 'app.SpaceOrders.getQrByOrderCode',
order_code: id,
uid: uid
}).then(result => {
}}).then(result => {
console.log(result);
if (result && result.code === 200) {
return result.data;
} else {
... ...