Authored by htoooth

fix api

... ... @@ -26,7 +26,7 @@ const check = (req, res, next) => {
});
}
res.cookie('__NEW_USER', (result.data.isNew ? 1 : 0), {domain: config.cookieDomain});
res.cookie('__NEW_USER', (result.isNew ? 1 : 0), {domain: config.cookieDomain});
return res.json({
code: 200,
... ...
'use strict';
const api = global.yoho.api;
const api = global.yoho.API;
exports.getUserOrders = (uid)=>{
exports.getUserSuccessfulOrders = (uid)=>{
return api.get('', {
method: 'app.SpaceOrders.get',
uid: uid,
... ...
... ... @@ -4,18 +4,18 @@ const _ = require('lodash');
const api = require('../models/new-user-api');
const check = (uid) => {
return api.getUserOrders(uid).then((result) => {
return api.getUserSuccessfulOrders(uid).then((result) => {
if (result.code !== 200) {
return {};
}
if (!_.isEmpty(_.get(result, 'data.order_list', []))) {
if (_.get(result, 'data.total', 0) !== 0) {
return {
isNew: true
isNew: false
};
} else {
return {
isNew: false
isNew: true
};
}
... ...