Authored by 郝肖肖

下单接口添加IP

... ... @@ -46,6 +46,8 @@ app.set('subdomain offset', 3);
app.set('etag', false);
app.enable('trust proxy');
// 全局注册library
yohoLib.global(config);
... ...
... ... @@ -236,6 +236,7 @@ exports.orderSub = (req, res, next) => {
return co(function* () {
let result;
let ip = req.ip || '';
/* tar modified 161206 套餐 */
if (req.body.cartType === 'bundle') {
... ... @@ -243,11 +244,11 @@ exports.orderSub = (req, res, next) => {
result = yield cartModel.orderSub(uid, addressId, 'bundle', deliveryTimeId,
deliveryId, invoices, paymentTypeId, paymentType, msg, couponCode,
yohoCoin, null, unionKey, userAgent, times, activityInfo);
yohoCoin, null, unionKey, userAgent, times, activityInfo, ip);
} else {
result = yield cartModel.orderSub(uid, addressId, cartType, deliveryTimeId,
deliveryId, invoices, paymentTypeId, paymentType, msg, couponCode,
yohoCoin, skuList, unionKey, userAgent);
yohoCoin, skuList, unionKey, userAgent, null, null, ip);
}
if (unionInfo && result.data) {
... ...
... ... @@ -203,7 +203,8 @@ exports.submit = (req, res, next) => {
payment_type: paymentType,
product_sku: sku,
activity_id: activityId,
uid
uid,
ip: req.ip || ''
};
return seckillModel.submit(options)
... ...
... ... @@ -38,5 +38,7 @@ exports.submit = options => {
method: 'app.Buynow.submit'
}, options);
return API.post(url, queryData);
return API.post(url, queryData, {
headers: {'X-Forwarded-For': options.ip || ''}
});
};
... ...
... ... @@ -183,7 +183,7 @@ exports.ticketsOrderCompute = (uid, productSku, buyNumber, yohoCoin) => {
exports.orderSub = (uid, addressId, cartType, deliveryTime,
deliveryWay, invoices, paymentId, paymentType, remark,
couponCode, yohoCoin, skuList, qhyUnio,
userAgent, times, activityInfo) => {
userAgent, times, activityInfo, ip) => {
if (!qhyUnio) {
qhyUnio = '';
}
... ... @@ -215,7 +215,7 @@ exports.orderSub = (uid, addressId, cartType, deliveryTime,
return shoppingAPI.orderSub(uid, addressId, cartType, deliveryTime,
deliveryWay, invoices, paymentId, paymentType,
remark, couponCode, yohoCoin, skuList, qhyUnio,
userAgent, times, activityInfo).then(orderSubRes => {
userAgent, times, activityInfo, ip).then(orderSubRes => {
let finalResult = {};
if (orderSubRes && orderSubRes.data && orderSubRes.data.is_hint === 'Y') {
... ...
... ... @@ -55,5 +55,7 @@ exports.submit = options => {
method: 'app.Seckill.submit'
}, options);
return API.post(url, queryData);
return API.post(url, queryData, {
headers: {'X-Forwarded-For': options.ip || ''}
});
};
... ...
... ... @@ -324,8 +324,7 @@ const sendVerifyCode = (uid, mobile) => {
*/
const activateService = (params) => {
return api.get('', Object.assign({
method: 'user.instalment.activate',
debug: 'XYZ' // TODO: remove this
method: 'user.instalment.activate'
}, params), {
timeout: 30000
});
... ... @@ -367,8 +366,7 @@ const getInstallmentOrders = (params) => {
uid: params.uid,
type: params.type || 1,
page: params.page || 1,
limit: params.limit || 10,
debug: 'XYZ'
limit: params.limit || 10
}, {
timeout: API_TIMEOUT
}).then((result) => {
... ... @@ -427,8 +425,7 @@ const getInstallmentOrderDetail = (params) => {
return api.get('', {
method: method,
uid: params.uid,
order_code: params.orderCode,
debug: 'XYZ'
order_code: params.orderCode
}, {
timeout: API_TIMEOUT
}).then((result)=> {
... ... @@ -448,8 +445,7 @@ const totalAmount = (params) => {
return api.get('', {
method: method,
prices: params,
debug: 'XYZ'
prices: params
}, {
timeout: API_TIMEOUT
}).then((result)=> {
... ... @@ -466,8 +462,7 @@ const checkVerifyCode = (uid, mobile, code) => {
method: method,
mobile: mobile,
snsCheckCode: code,
codeType: 1, // 授信
debug: 'XYZ'
codeType: 1 // 授信
}, {
timeout: API_TIMEOUT
}).then((result)=> {
... ... @@ -478,8 +473,7 @@ const checkVerifyCode = (uid, mobile, code) => {
// 添加银行卡请求
const postAccount = (params) => {
return api.get('', _.assign({
method: 'user.instalment.bindingCards',
debug: 'XYZ'
method: 'user.instalment.bindingCards'
}, params), {
timeout: 6000
});
... ...
... ... @@ -157,13 +157,12 @@ exports.checkTickets = (uid, productSku, buyNumber, useYohoCoin, yohoCoinMode) =
*/
exports.orderSub = (uid, addressId, cartType, deliveryTime,
deliveryWay, invoices, paymentId, paymentType, remark, couponCode,
yohoCoin, skuList, qhyUnion, userAgent, times, activityInfo) => {
yohoCoin, skuList, qhyUnion, userAgent, times, activityInfo, ip) => {
if (!activityInfo) {
activityInfo = null;
}
let params = {
debug: 'Y',
private_key: privateKeyList.h5,
method: activityInfo ? 'app.Shopping.easySubmit' : 'app.Shopping.submit',
address_id: addressId,
... ... @@ -227,7 +226,9 @@ exports.orderSub = (uid, addressId, cartType, deliveryTime,
params.qhy_union = qhyUnion;
}
return api.get('', params);
return api.get('', params, {
headers: {'X-Forwarded-For': ip || ''}
});
};
... ...
... ... @@ -47,7 +47,7 @@
"uuid": "^2.0.3",
"xml2js": "^0.4.17",
"yoho-express-session": "^2.0.0",
"yoho-node-lib": "^0.2.7",
"yoho-node-lib": "^0.2.8",
"yoho-zookeeper": "^1.0.6"
},
"devDependencies": {
... ...