Authored by ccbikai

移除 API 签名

var API = require('../../../library/api').API;
var api = new API();
const library = '../../../library';
const sign = require(`${library}/sign`);
/**
* 分享页面基础参数
... ... @@ -10,6 +8,7 @@ const sign = require(`${library}/sign`);
*/
const getPageInfo = (pageInfo) => {
var dest = {};
dest.shareTitle = pageInfo.data.shareTitle;
dest.shareDesc = pageInfo.data.shareContent;
dest.shareImg = pageInfo.data.shareImgUrl;
... ... @@ -73,13 +72,11 @@ const getUserStatus = (param) => {
*/
exports.getPageInfo = (data) => {
var defaultParam = {
method: 'app.activity.getInfoOfOrderShare'
},
infoData = Object.assign(defaultParam, data); // 处理完成后,发给后端
// 处理完成后,发给后端
infoData = Object.assign(defaultParam, data);
return api.get('', sign.apiSign(infoData)).then(result => {
return api.get('', infoData).then(result => {
return getPageInfo(result);
}); // 所有数据返回一个 Promise,方便 Promise.all 调用
};
... ... @@ -95,7 +92,7 @@ exports.getCoupon = (data) => {
// 处理完成后,发给后端
phoneData = Object.assign(defaultParam, data);
return api.get('', sign.apiSign(phoneData)).then(result => {
return api.get('', phoneData).then(result => {
return getUserStatus(result);
}); // 所有数据返回一个 Promise,方便 Promise.all 调用
};
... ... @@ -112,7 +109,7 @@ exports.registerAndSendCoupon = (data) => {
// 处理完成后,发给后端
verifyData = Object.assign(defaultParam, data);
return api.get('', sign.apiSign(verifyData)).then(result => {
return api.get('', verifyData).then(result => {
return getUserStatus(result);
}); // 所有数据返回一个 Promise,方便 Promise.all 调用
};
... ...
... ... @@ -10,7 +10,6 @@ const contentCodeConfig = require('../../../config/content-code');
const resourcesProcess = require(`${utils}/resources-process`);
const ServiceAPI = require(`${library}/api`).ServiceAPI;
const API = require(`${library}/api`).API;
const sign = require(`${library}/sign`);
const logger = require(`${library}/logger`);
const camelCase = require(`${library}/camel-case`);
const helpers = require(`${library}/helpers`);
... ... @@ -26,10 +25,10 @@ const contentCode = contentCodeConfig.guang;
* @return {[array]}
*/
const _getResources = (page) => {
return serviceAPI.get('operations/api/v5/resource/get', sign.apiSign({
return serviceAPI.get('operations/api/v5/resource/get', {
content_code: contentCode[page],
client_type: 'iphone'
})).then((result) => {
}).then((result) => {
if (result && result.code === 200) {
return resourcesProcess(result.data);
} else {
... ... @@ -164,11 +163,11 @@ const _processCollocationData = (list) => {
* 星潮首页
*/
const getIndexData = (uid) => {
return api.get('', sign.apiSign({
return api.get('', {
method: 'app.starClass.index',
code: '8adc27fcf5676f356602889afcfd2a8e',
client_type: 'iphone'
})).then((result) => {
}).then((result) => {
if (result && result.code === 200) {
return _processIndexData(result.data, uid);
} else {
... ... @@ -182,13 +181,13 @@ const getIndexData = (uid) => {
* 明星专题
*/
const getDetailData = (params) => {
return api.get('', sign.apiSign({
return api.get('', {
method: 'app.starClass.lastTagArticle',
tag: params.tag,
page: params.page || 1,
size: 10,
client_type: 'iphone'
})).then((result) => {
}).then((result) => {
if (result && result.code === 200) {
if (params.page > result.data.totalPage) {
return '';
... ... @@ -232,10 +231,10 @@ const getSpecialData = () => {
*/
const getCollocationListData = (params, uid) => {
return serviceAPI.get('guang/api/v5/article/getStarClassroomArticleList', sign.apiSign(Object.assign({
return serviceAPI.get('guang/api/v5/article/getStarClassroomArticleList', Object.assign({
limit: '20',
uid: uid
}, params))).then((result) => {
}, params)).then((result) => {
if (result && result.code === 200) {
return _processCollocationData(result.data.list.artList);
} else {
... ... @@ -253,12 +252,12 @@ const setFavorite = (params, uid) => {
});
}
return api.get('', sign.apiSign({
return api.get('', {
method: params.type === 'del' ? 'app.sns.cancelFavorBackCount' : 'app.sns.setFavorBackCount',
client_type: 'h5',
article_id: params.articleId,
uid: uid
}));
});
};
module.exports = {
... ...
... ... @@ -19,7 +19,7 @@ class Auth {
param.shopping_key = shoppingKey;
}
return api.post('', sign.apiSign(param));
return api.post('', param);
}
static signinByOpenID(nickname, openId, sourceType, shoppingKey) {
... ... @@ -35,7 +35,7 @@ class Auth {
param.shopping_key = shoppingKey;
}
return api.get('', sign.apiSign(param));
return api.get('', param);
}
static profile(uid) {
... ... @@ -44,7 +44,7 @@ class Auth {
method: 'app.passport.profile'
};
return api.get('', sign.apiSign(param));
return api.get('', param);
}
static syncUserSession(uid, req, res) {
... ...
... ... @@ -12,8 +12,6 @@ const contentCodeConfig = require('../../../config/content-code');
const _ = require('lodash');
const ServiceAPI = require(`${library}/api`).ServiceAPI;
const API = require(`${library}/api`).API;
const sign = require(`${library}/sign`);
const camelCase = require(`${library}/camel-case`);
const resourcesProcess = require(`${utils}/resources-process`);
const log = require(`${library}/logger`);
... ... @@ -61,7 +59,7 @@ const _getOutletResource = (channel, contentcode) => {
yh_channel: channel || ''
};
return serviceApi.get('operations/api/v5/resource/home', sign.apiSign(params)).then(result => {
return serviceApi.get('operations/api/v5/resource/home', params).then(result => {
if (result && result.code === 200) {
return resourcesProcess(result.data.list);
} else {
... ... @@ -102,7 +100,7 @@ const _getNavData = (categoryId) => {
parent_id: categoryId
};
return serviceApi.get('operations/api/v6/category/getCategory', sign.apiSign(params)).then(result => {
return serviceApi.get('operations/api/v6/category/getCategory', params).then(result => {
if (result && result.code === 200) {
let data = _convertNavData(result.data);
... ... @@ -170,7 +168,7 @@ const _getActivityDetail = (id) => {
};
return api.get('', sign.apiSign(params)).then(res => {
return api.get('', params).then(res => {
if (res.code === 200) {
return _convertActicityData(res.data);
} else {
... ... @@ -191,7 +189,7 @@ const _getHomeActivity = (data) => {
platform: 3 // h5平台代号
};
return api.get('', sign.apiSign(_.assign(params, data))).then(res => {
return api.get('', _.assign(params, data)).then(res => {
return _convertActicityData(res.data);
});
};
... ...
... ... @@ -10,7 +10,6 @@
const library = '../../../library';
const utils = '../../../utils';
const API = require(`${library}/api`).API;
const sign = require(`${library}/sign`);
const _ = require('lodash');
const productProcess = require(`${utils}/product-process`);
var api = new API();
... ... @@ -18,12 +17,12 @@ var api = new API();
module.exports = (data) => {
var finalResult;
return api.get('', sign.apiSign({
return api.get('', {
method: 'h5.preference.Search',
productskn: data.productskn,
yhchannel: data.yhchannel,
brandId: data.brandId
})).then(result => {
}).then(result => {
if (!_.isEmpty(result) && result.code === 200) {
// 为你优选数据处理,接口没有数据,待处理,待验证
finalResult = productProcess.processProductList(result.data);
... ...
... ... @@ -10,7 +10,6 @@ const contentCodeConfig = require('../../../config/content-code');
const API = require(`${library}/api`).API;
const ServiceAPI = require(`${library}/api`).ServiceAPI;
const sign = require(`${library}/sign`);
const logger = require(`${library}/logger`);
const camelCase = require(`${library}/camel-case`);
const resourcesProcess = require(`${utils}/resources-process`);
... ... @@ -87,11 +86,11 @@ const _processDiscount = (list, channel) => {
const _discount = (params) => {
params = params || {};
return api.get('', sign.apiSign(Object.assign({
return api.get('', Object.assign({
method: 'app.activity.get',
sort: 2,
plateform: 3
}, params)));
}, params));
};
/**
... ... @@ -160,9 +159,9 @@ const _searchSales = (params) => {
params.order = typeCont[params.type][params.order];
}
return api.get('', sign.apiSign(Object.assign({
return api.get('', Object.assign({
method: method
}, params)), true);
}, params), true);
};
/**
... ... @@ -177,10 +176,10 @@ const _getUserProfile = (uid) => {
data: {}
});
}
return api.get('', sign.apiSign({
return api.get('', {
method: 'app.passport.profile',
uid: uid
}), true);
}, true);
};
/**
... ... @@ -189,9 +188,9 @@ const _getUserProfile = (uid) => {
* @return {[array]}
*/
const _getResources = (page, channel) => {
return serviceAPI.get('operations/api/v5/resource/get', sign.apiSign({
return serviceAPI.get('operations/api/v5/resource/get', {
content_code: contentCode[channel][page]
})).then((result) => {
}).then((result) => {
if (result && result.code === 200) {
return resourcesProcess(result.data);
} else {
... ... @@ -207,10 +206,10 @@ const _getResources = (page, channel) => {
* @return {[object]}
*/
const _getBreakingSort = (yhChannel) => {
return api.get('', sign.apiSign({
return api.get('', {
method: 'app.sale.getBreakingSort',
yh_channel: channelType[yhChannel] || '1'
})).then((result) => {
}).then((result) => {
if (result && result.code === 200) {
return _processBreakingSort(result.data);
} else {
... ...