Authored by ccbikai(👎🏻🍜)

Merge branch 'master' into release/5.6

... ... @@ -148,6 +148,17 @@ app.use((req, res, next) => {
req.yoho = {}; // req和res绑定yoho对象,用于传递全局数据, 如req.yoho.channel等
req.app.locals.wap = app.locals.wap; // zookeper对象赋值
// 临时增加错误日志记录
let sendJson = res.json;
res.json = function(...args) {
try {
sendJson(...args);
} catch (e) {
logger.error(`res.json error data: ${JSON.stringify(args)}`);
}
};
next();
});
... ...
... ... @@ -373,7 +373,7 @@ const order = (params) => {
code: 200
}).then((result) => {
if (result.data) {
if (result && result.data) {
Object.assign(finalResult, {cancelReason: result.data});
}
return finalResult;
... ... @@ -385,7 +385,7 @@ const order = (params) => {
* @param params
*/
const getOrders = (params) => {
let finalResult = Promise.resolve([]);
let finalResult = [];
if (!params.uid) {
return Promise.resolve([]);
... ...
... ... @@ -182,7 +182,6 @@ exports.orderSub = (req, res, next) => {
let yohoCoin = req.body.yohoCoin || 0;
let skuList = req.body.skuList || '';
let orderInfo;
let isWechat = req.yoho.isWechat;
try {
orderInfo = JSON.parse(req.cookies['order-info']);
... ... @@ -254,7 +253,15 @@ exports.orderSub = (req, res, next) => {
return co(function* () {
let result;
let ip = req.ip || '';
// 接口需要的其他参数
let otherParams = {
unionKey: unionKey, // 友盟数据
userAgent: userAgent,
isWechat: req.yoho.isWechat,
ip: req.ip || '',
udid: req.cookies._yasvd || 'yoho'
};
/* tar modified 161206 套餐 */
if (req.body.cartType === 'bundle') {
... ... @@ -262,11 +269,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, ip, isWechat);
yohoCoin, null, times, activityInfo, otherParams);
} else {
result = yield cartModel.orderSub(uid, addressId, cartType, deliveryTimeId,
deliveryId, invoices, paymentTypeId, paymentType, msg, couponCode,
yohoCoin, skuList, unionKey, userAgent, null, null, ip, isWechat);
yohoCoin, skuList, null, null, otherParams);
}
// 提交成功清除Cookie
... ...
... ... @@ -180,23 +180,21 @@ exports.ticketsOrderCompute = (uid, productSku, buyNumber, yohoCoin) => {
* @param string $couponCode 优惠券码
* @param mixed $yohoCoin 使用的有货币数量或为空
* @param string $skuList 购买限购商品时需要传递的参数
* @param string $qhyUnio 友盟有关信息
* @param string|null $userAgent 联盟过来用户下单时需要的User-Agent信息
* @param int $times
* @param null $activityInfo 套餐数据
* @param isWechat 是否是微信商城
* @param otherParams 其他参数
* @return array 接口返回的数据
*/
exports.orderSub = (uid, addressId, cartType, deliveryTime,
deliveryWay, invoices, paymentId, paymentType, remark,
couponCode, yohoCoin, skuList, qhyUnio,
userAgent, times, activityInfo, ip, isWechat) => {
if (!qhyUnio) {
qhyUnio = '';
couponCode, yohoCoin, skuList, times, activityInfo, otherParams) => {
if (!otherParams.unionKey) {
otherParams.unionKey = '';
}
if (!userAgent) {
userAgent = null;
if (!otherParams.userAgent) {
otherParams.userAgent = null;
}
if (!times) {
... ... @@ -221,8 +219,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, ip, isWechat).then(orderSubRes => {
remark, couponCode, yohoCoin, skuList, times, activityInfo, otherParams).then(orderSubRes => {
let finalResult = {};
if (orderSubRes && orderSubRes.data && orderSubRes.data.is_hint === 'Y') {
... ...
... ... @@ -149,16 +149,15 @@ exports.checkTickets = (uid, productSku, buyNumber, useYohoCoin, yohoCoinMode) =
* @param string $couponCode 优惠券码
* @param mixed $yohoCoin 使用的有货币数量或为空
* @param string $skuList 购买限购商品时需要传递的参数
* @param string $qhyUnion 友盟有关信息
* @param string|null $userAgent 联盟过来用户下单时需要的User-Agent信息
* @param $times
* @param null $activityInfo 套餐信息
* @param isWechat 是否是微信商城
* @param @param otherParams 其他参数
* @return array 接口返回的数据
*/
exports.orderSub = (uid, addressId, cartType, deliveryTime,
deliveryWay, invoices, paymentId, paymentType, remark, couponCode,
yohoCoin, skuList, qhyUnion, userAgent, times, activityInfo, ip, isWechat) => {
yohoCoin, skuList, times, activityInfo, otherParams) => {
if (!activityInfo) {
activityInfo = null;
}
... ... @@ -173,7 +172,8 @@ exports.orderSub = (uid, addressId, cartType, deliveryTime,
payment_id: paymentId,
payment_type: paymentType,
remark: remark,
uid: uid
uid: uid,
udid: otherParams.udid
};
/* tar add 161130 结算优化 */
... ... @@ -223,19 +223,19 @@ exports.orderSub = (uid, addressId, cartType, deliveryTime,
}
// 友盟有关信息的传递
if (qhyUnion) {
params.qhy_union = qhyUnion;
if (otherParams.unionKey) {
params.qhy_union = otherParams.unionKey;
}
// 是否是微信商城
if (isWechat) {
if (otherParams.isWechat) {
params.client_type = 'wechat';
}
return api.post('', params, {
headers: {
'X-Forwarded-For': ip || '',
'User-Agent': userAgent
'X-Forwarded-For': otherParams.ip || '',
'User-Agent': otherParams.userAgent
}
});
};
... ...
... ... @@ -188,6 +188,7 @@ const addressModify = (req, res, next) => {
*/
const changeAddress = (req, res, next) => {
let uid = req.user.uid;
let udid = req.cookies._yasvd || 'yoho';
if (!uid) {
return res.json({
... ... @@ -202,7 +203,8 @@ const changeAddress = (req, res, next) => {
username: req.body.username,
areaCode: req.body.area_code,
address: req.body.address,
mobile: req.body.mobile
mobile: req.body.mobile,
udid: udid
}).then(result => {
res.json(result);
}).catch(next);
... ...
... ... @@ -395,7 +395,8 @@ const changeAddress = (params) => {
user_name: params.username,
area_code: params.areaCode,
address: params.address,
mobile: params.mobile
mobile: params.mobile,
udid: params.udid
};
if (params.addressId) {
... ...
... ... @@ -90,8 +90,8 @@ router.get('/helpDetail', help.helpDetail);
// 意见反馈
router.get('/suggest', suggest.suggestData);
router.post('/upAndDown', suggest.upAndDown);
router.get('/suggestSub', suggest.suggestSub);
router.post('/savesuggest', suggest.saveSuggest);
router.get('/suggestSub', auth, suggest.suggestSub);
router.post('/savesuggest', auth, suggest.saveSuggest);
// 消息
router.use('/message', auth, disableBFCache, message.index);
... ...